@qvac/sdk 0.21.1 → 0.23.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (249) hide show
  1. package/NOTICE +131 -62
  2. package/README.md +31 -326
  3. package/dist/examples/abot-world.js +1 -1
  4. package/dist/examples/advisory-model-fit.d.ts +0 -58
  5. package/dist/examples/advisory-model-fit.js +23 -150
  6. package/dist/examples/asr/moss-transcribe-filesystem.d.ts +2 -0
  7. package/dist/examples/asr/moss-transcribe-filesystem.js +84 -0
  8. package/dist/examples/asr/moss-transcribe-fit.d.ts +2 -0
  9. package/dist/examples/asr/moss-transcribe-fit.js +40 -0
  10. package/dist/examples/asr/nemotron-diarization-filesystem.d.ts +2 -0
  11. package/dist/examples/asr/nemotron-diarization-filesystem.js +64 -0
  12. package/dist/examples/asr/parakeet-ctc-filesystem.js +2 -2
  13. package/dist/examples/asr/parakeet-indic-conformer-filesystem.js +2 -2
  14. package/dist/examples/asr/parakeet-microphone-record.js +1 -1
  15. package/dist/examples/asr/parakeet-microphone-stream.js +1 -1
  16. package/dist/examples/asr/parakeet-nemotron-filesystem.js +3 -3
  17. package/dist/examples/asr/parakeet-sortformer-streaming.js +2 -2
  18. package/dist/examples/asr/parakeet-sortformer.js +1 -1
  19. package/dist/examples/asr/parakeet-tdt-filesystem-chunked.js +2 -2
  20. package/dist/examples/asr/parakeet-tdt-filesystem.js +2 -2
  21. package/dist/examples/asr/parakeet-transcribepsy-filesystem.d.ts +2 -0
  22. package/dist/examples/asr/parakeet-transcribepsy-filesystem.js +76 -0
  23. package/dist/examples/asr/parakeet-unified-coreml.js +2 -2
  24. package/dist/examples/asr/parakeet-unified-filesystem.js +2 -2
  25. package/dist/examples/asr/whispercpp-filesystem-streaming.js +1 -1
  26. package/dist/examples/asr/whispercpp-filesystem.js +1 -1
  27. package/dist/examples/asr/whispercpp-microphone-record.js +1 -1
  28. package/dist/examples/asr/whispercpp-prompt.js +1 -1
  29. package/dist/examples/assess-model-fit.js +3 -6
  30. package/dist/examples/audiogen/edit-music.js +2 -2
  31. package/dist/examples/audiogen/generate-cover.js +2 -2
  32. package/dist/examples/audiogen/generate-music-minimax.js +1 -1
  33. package/dist/examples/audiogen/generate-music.js +1 -1
  34. package/dist/examples/audiogen/understand-music.js +2 -2
  35. package/dist/examples/batch-completion.d.ts +1 -1
  36. package/dist/examples/batch-completion.js +1 -1
  37. package/dist/examples/bci/bci-filesystem-streaming.js +2 -2
  38. package/dist/examples/bci/bci-filesystem.js +2 -2
  39. package/dist/examples/concurrent-completion-collision.js +1 -1
  40. package/dist/examples/config-reload.js +1 -1
  41. package/dist/examples/decisions.d.ts +2 -0
  42. package/dist/examples/decisions.js +38 -0
  43. package/dist/examples/diffusion-esrgan-upscale.js +1 -1
  44. package/dist/examples/diffusion-flux2-klein-img2img.js +1 -1
  45. package/dist/examples/diffusion-img2img.js +1 -1
  46. package/dist/examples/diffusion-img2vid-ltx.js +8 -15
  47. package/dist/examples/diffusion-img2vid-minimax-h3.d.ts +2 -0
  48. package/dist/examples/diffusion-img2vid-minimax-h3.js +72 -0
  49. package/dist/examples/diffusion-img2vid.js +1 -1
  50. package/dist/examples/diffusion-qwen-image-21.d.ts +2 -0
  51. package/dist/examples/diffusion-qwen-image-21.js +104 -0
  52. package/dist/examples/diffusion-txt2vid-ltx.js +7 -14
  53. package/dist/examples/finetune/llamacpp-finetune.js +9 -4
  54. package/dist/examples/llamacpp-filesystem.js +1 -1
  55. package/dist/examples/llamacpp-multi-gpu.js +2 -2
  56. package/dist/examples/llamacpp-multimodal.js +3 -1
  57. package/dist/examples/llamacpp-structured-output.js +1 -1
  58. package/dist/examples/mcp-websearch.d.ts +2 -2
  59. package/dist/examples/mcp-websearch.js +4 -4
  60. package/dist/examples/model-fit-ui/server.d.ts +1 -1
  61. package/dist/examples/model-fit-ui/server.js +1 -1
  62. package/dist/examples/multi-job-completion.d.ts +1 -1
  63. package/dist/examples/multi-job-completion.js +1 -1
  64. package/dist/examples/ocr-fasttext.js +1 -1
  65. package/dist/examples/plugins.js +1 -1
  66. package/dist/examples/rerank.d.ts +2 -0
  67. package/dist/examples/rerank.js +33 -0
  68. package/dist/examples/tools/llamacpp-deferred-tools.js +5 -5
  69. package/dist/examples/tools/llamacpp-tools-auto-dialect.js +5 -4
  70. package/dist/examples/tools/llamacpp-tools-gemma4.js +4 -4
  71. package/dist/examples/tools/llamacpp-tools-qwen35.js +5 -4
  72. package/dist/examples/tts/llm-to-tts-streaming.d.ts +2 -2
  73. package/dist/examples/tts/llm-to-tts-streaming.js +2 -2
  74. package/dist/examples/tts/moss-sound-effect-controls.d.ts +2 -0
  75. package/dist/examples/tts/moss-sound-effect-controls.js +88 -0
  76. package/dist/examples/tts/moss-sound-effect.d.ts +2 -0
  77. package/dist/examples/tts/moss-sound-effect.js +86 -0
  78. package/dist/examples/tts/moss-speech-audio.d.ts +2 -0
  79. package/dist/examples/tts/moss-speech-audio.js +159 -0
  80. package/dist/examples/tts/moss-speech.d.ts +2 -0
  81. package/dist/examples/tts/moss-speech.js +70 -0
  82. package/dist/examples/vla-groot.js +2 -2
  83. package/dist/examples/vla-pi05.js +2 -2
  84. package/dist/examples/vla-smolvla.js +2 -2
  85. package/dist/examples/voice-assistant/voice-assistant.js +1 -1
  86. package/dist/scripts/contract/build-contract.d.ts +3 -1
  87. package/dist/scripts/contract/build-contract.js +40 -2
  88. package/dist/scripts/contract/build-model-type-maps.d.ts +6 -1
  89. package/dist/scripts/contract/build-model-type-maps.js +3 -2
  90. package/dist/scripts/contract/constants-registry.d.ts +6 -0
  91. package/dist/scripts/contract/constants-registry.js +4 -1
  92. package/dist/scripts/contract/method-shapes.d.ts +2 -0
  93. package/dist/scripts/contract/method-shapes.js +2 -0
  94. package/dist/scripts/export-contract.js +20 -7
  95. package/dist/scripts/run-unit-tests.js +10 -5
  96. package/dist/src/client/api/assess-model-fit.d.ts +5 -5
  97. package/dist/src/client/api/assess-model-fit.js +6 -7
  98. package/dist/src/client/api/audio-edit.d.ts +14 -2
  99. package/dist/src/client/api/audio-edit.js +16 -4
  100. package/dist/src/client/api/audio-gen-result.js +2 -2
  101. package/dist/src/client/api/audio-gen.d.ts +10 -2
  102. package/dist/src/client/api/audio-gen.js +12 -4
  103. package/dist/src/client/api/audio-understand.d.ts +1 -1
  104. package/dist/src/client/api/audio-understand.js +3 -3
  105. package/dist/src/client/api/batch-completion.js +3 -3
  106. package/dist/src/client/api/bci-transcribe.js +3 -3
  107. package/dist/src/client/api/cancel.js +1 -1
  108. package/dist/src/client/api/classify.js +1 -1
  109. package/dist/src/client/api/completion-stream.d.ts +2 -1
  110. package/dist/src/client/api/completion-stream.js +6 -4
  111. package/dist/src/client/api/decide.d.ts +31 -0
  112. package/dist/src/client/api/decide.js +29 -0
  113. package/dist/src/client/api/delete-cache.js +1 -1
  114. package/dist/src/client/api/diffusion.d.ts +18 -1
  115. package/dist/src/client/api/diffusion.js +19 -2
  116. package/dist/src/client/api/download-asset.js +3 -3
  117. package/dist/src/client/api/embed.js +2 -2
  118. package/dist/src/client/api/finetune.js +3 -3
  119. package/dist/src/client/api/get-loaded-model-info.js +1 -1
  120. package/dist/src/client/api/get-model-info.js +1 -1
  121. package/dist/src/client/api/get-system-resources.js +1 -1
  122. package/dist/src/client/api/heartbeat.js +1 -1
  123. package/dist/src/client/api/index.d.ts +5 -3
  124. package/dist/src/client/api/index.js +5 -3
  125. package/dist/src/client/api/invoke-plugin.js +1 -1
  126. package/dist/src/client/api/load-model.d.ts +1 -0
  127. package/dist/src/client/api/load-model.js +4 -4
  128. package/dist/src/client/api/logging-stream.d.ts +11 -2
  129. package/dist/src/client/api/logging-stream.js +12 -3
  130. package/dist/src/client/api/ocr.js +1 -1
  131. package/dist/src/client/api/rag.js +2 -2
  132. package/dist/src/client/api/registry.d.ts +2 -1
  133. package/dist/src/client/api/registry.js +6 -5
  134. package/dist/src/client/api/rerank.d.ts +22 -0
  135. package/dist/src/client/api/rerank.js +39 -0
  136. package/dist/src/client/api/resume.js +1 -1
  137. package/dist/src/client/api/rpc-server.js +2 -2
  138. package/dist/src/client/api/state.js +1 -1
  139. package/dist/src/client/api/subscribe-logs.js +3 -2
  140. package/dist/src/client/api/suspend.js +1 -1
  141. package/dist/src/client/api/text-to-speech.d.ts +1 -0
  142. package/dist/src/client/api/text-to-speech.js +18 -25
  143. package/dist/src/client/api/transcribe.d.ts +1 -1
  144. package/dist/src/client/api/transcribe.js +7 -4
  145. package/dist/src/client/api/translate.js +2 -2
  146. package/dist/src/client/api/unload-model.js +2 -2
  147. package/dist/src/client/api/upscale.js +1 -1
  148. package/dist/src/client/api/vector-index.d.ts +1 -1
  149. package/dist/src/client/api/vector-index.js +1 -1
  150. package/dist/src/client/api/video-request.d.ts +5 -5
  151. package/dist/src/client/api/video.d.ts +23 -3
  152. package/dist/src/client/api/video.js +26 -6
  153. package/dist/src/client/api/world-result.js +2 -2
  154. package/dist/src/client/api/world.d.ts +1 -1
  155. package/dist/src/client/api/world.js +2 -2
  156. package/dist/src/client/logging-stream-registry.js +9 -6
  157. package/dist/src/client/plugins-factory.d.ts +1 -1
  158. package/dist/src/client/plugins-factory.js +1 -1
  159. package/dist/src/client/rpc/expo-rpc-client.js +3 -3
  160. package/dist/src/client/rpc/ipc-socket-path.d.ts +11 -0
  161. package/dist/src/client/rpc/ipc-socket-path.js +30 -0
  162. package/dist/src/client/rpc/node-rpc-client.js +14 -25
  163. package/dist/src/client/rpc/rpc-client.d.ts +3 -2
  164. package/dist/src/client/rpc/rpc-client.js +46 -12
  165. package/dist/src/client/rpc/rpc-error.js +4 -1
  166. package/dist/src/commands/bundle/bare-pack.d.ts +8 -0
  167. package/dist/src/commands/bundle/bare-pack.js +28 -5
  168. package/dist/src/commands/bundle/constants.js +3 -0
  169. package/dist/src/commands/bundle/entry-gen.js +1 -1
  170. package/dist/src/commands/bundle/index.d.ts +8 -7
  171. package/dist/src/commands/bundle/index.js +135 -52
  172. package/dist/src/commands/bundle/manifest.d.ts +2 -0
  173. package/dist/src/commands/bundle/manifest.js +3 -2
  174. package/dist/src/commands/bundle/plugins.js +1 -1
  175. package/dist/src/commands/host-prebuilds/index.d.ts +18 -10
  176. package/dist/src/commands/host-prebuilds/index.js +39 -20
  177. package/dist/src/commands/index.d.ts +13 -13
  178. package/dist/src/commands/index.js +8 -8
  179. package/dist/src/commands/verify/abi.d.ts +1 -1
  180. package/dist/src/commands/verify/abi.js +1 -1
  181. package/dist/src/commands/verify/addon-source.d.ts +12 -0
  182. package/dist/src/commands/verify/addon-source.js +36 -3
  183. package/dist/src/commands/verify/bare-kit-runtime.d.ts +1 -1
  184. package/dist/src/commands/verify/bare-kit-runtime.js +1 -1
  185. package/dist/src/commands/verify/bare-kit-runtimes.js +2 -1
  186. package/dist/src/commands/verify/bundle-source.d.ts +1 -1
  187. package/dist/src/commands/verify/bundle-source.js +3 -3
  188. package/dist/src/commands/verify/engines-advice.d.ts +4 -4
  189. package/dist/src/commands/verify/engines-advice.js +4 -4
  190. package/dist/src/commands/verify/index.d.ts +5 -5
  191. package/dist/src/commands/verify/index.js +7 -7
  192. package/dist/src/commands/verify/node-modules-source.d.ts +1 -1
  193. package/dist/src/commands/verify/node-modules-source.js +11 -2
  194. package/dist/src/{expo/plugins/patches/qvac-platform-addons.d.ts → commands/verify/platform-addons.d.ts} +6 -10
  195. package/dist/src/{expo/plugins/patches/qvac-platform-addons.js → commands/verify/platform-addons.js} +2 -45
  196. package/dist/src/commands/verify/prebuilds.d.ts +8 -11
  197. package/dist/src/commands/verify/prebuilds.js +44 -35
  198. package/dist/src/commands/verify/resource-collectors.js +2 -2
  199. package/dist/src/expo/plugins/link-addons.d.ts +18 -0
  200. package/dist/src/expo/plugins/link-addons.js +65 -0
  201. package/dist/src/expo/plugins/withAndroidNdkVersion.js +16 -10
  202. package/dist/src/expo/plugins/withDeviceInfo.js +19 -5
  203. package/dist/src/expo/plugins/withMobileBundle.d.ts +13 -23
  204. package/dist/src/expo/plugins/withMobileBundle.js +27 -117
  205. package/dist/src/index.d.ts +4 -4
  206. package/dist/src/index.js +3 -3
  207. package/dist/src/logging/addon.d.ts +1 -1
  208. package/dist/src/pear/pre.js +4 -0
  209. package/dist/src/plugin-ids.d.ts +4 -1
  210. package/dist/src/plugin-ids.js +6 -0
  211. package/dist/src/schemas/public.d.ts +2 -1
  212. package/dist/src/schemas/public.js +2 -1
  213. package/dist/src/schemas/sdk-errors-client.d.ts +3 -0
  214. package/dist/src/schemas/sdk-errors-client.js +16 -0
  215. package/dist/src/schemas/sdk-errors-server.d.ts +2 -0
  216. package/dist/src/schemas/sdk-errors-server.js +11 -1
  217. package/dist/src/server/rpc/rpc-utils.d.ts +5 -0
  218. package/dist/src/server/rpc/rpc-utils.js +7 -0
  219. package/dist/src/server/utils/qvac-paths.js +1 -1
  220. package/dist/src/server/utils/worker-lock.js +1 -1
  221. package/dist/src/utils/aggregate-events.d.ts +1 -1
  222. package/dist/src/utils/aggregate-events.js +2 -2
  223. package/dist/src/utils/errors-client.d.ts +10 -0
  224. package/dist/src/utils/errors-client.js +18 -0
  225. package/dist/src/utils/errors-server.d.ts +6 -0
  226. package/dist/src/utils/errors-server.js +12 -0
  227. package/dist/src/utils/mcp-adapter.d.ts +1 -1
  228. package/dist/src/utils/mcp-adapter.js +13 -9
  229. package/dist/src/utils/tool-helpers.d.ts +1 -1
  230. package/dist/src/utils/tool-helpers.js +21 -53
  231. package/dist/src/worker/create-server.d.ts +1 -0
  232. package/dist/src/worker/create-server.js +5 -0
  233. package/dist/src/worker/handle-request.js +4 -2
  234. package/dist/src/worker/handler-utils.js +1 -1
  235. package/dist/src/worker/index.js +7 -1
  236. package/dist/src/worker/lifecycle.js +10 -2
  237. package/dist/src/worker/plugins/llamacpp-decision.d.ts +2 -0
  238. package/dist/src/worker/plugins/llamacpp-decision.js +1 -0
  239. package/dist/src/worker/plugins/llamacpp-rerank.d.ts +2 -0
  240. package/dist/src/worker/plugins/llamacpp-rerank.js +1 -0
  241. package/dist/src/worker/plugins/moss-transcribe.d.ts +2 -0
  242. package/dist/src/worker/plugins/moss-transcribe.js +1 -0
  243. package/package.json +63 -53
  244. package/src/electron-forge/index.cjs +12 -71
  245. package/dist/scripts/link-workspace-inference.d.ts +0 -2
  246. package/dist/scripts/link-workspace-inference.js +0 -31
  247. package/src/expo/plugins/patches/android-link.mjs +0 -67
  248. package/src/expo/plugins/patches/ios-link.mjs +0 -67
  249. package/src/expo/plugins/patches/qvac-platform-addons.ts +0 -124
@@ -1,4 +1,4 @@
1
- import { requestSchema, responseSchema, PROFILING_TRAILER_KEY, nowMs, shouldProfile, shouldIncludeServerBreakdown, shouldIncludeResourceGauges, generateId as createProfileId, createProfilingMeta, createProfilingDisabledMeta, injectProfilingMetaIntoObject, extractProfilingMeta, stripProfilingMeta, recordFailure } from '@qvac/inference/surface';
1
+ import { requestSchema, responseSchema, PROFILING_TRAILER_KEY, nowMs, shouldProfile, shouldIncludeServerBreakdown, shouldIncludeResourceGauges, generateId as createProfileId, createProfilingMeta, createProfilingDisabledMeta, injectProfilingMetaIntoObject, extractProfilingMeta, stripProfilingMeta, recordFailure, untilAborted } from '@qvac/inference/surface';
2
2
  import { reconstructError } from './rpc-error.js';
3
3
  import { withTimeout, withTimeoutStream, OperationTimeoutError } from '../../utils/withTimeout.js';
4
4
  import { getClientLogger, summarizeRequest } from '../../logging/index.js';
@@ -157,6 +157,20 @@ async function* iterateWithLifeSignal(source) {
157
157
  void source.return?.(undefined).catch(() => { });
158
158
  }
159
159
  }
160
+ // Destroying the response stream makes the worker abort the engine stream.
161
+ // Registered before `untilAborted`, so the destroyed stream's late rejection is
162
+ // dropped there instead of reaching `iterateWithLifeSignal` as a worker crash.
163
+ function destroyOnAbort(responseStream, signal) {
164
+ if (!signal)
165
+ return () => { };
166
+ const onAbort = () => responseStream.destroy();
167
+ if (signal.aborted) {
168
+ onAbort();
169
+ return () => { };
170
+ }
171
+ signal.addEventListener('abort', onAbort, { once: true });
172
+ return () => signal.removeEventListener('abort', onAbort);
173
+ }
160
174
  function checkAndThrowError(response) {
161
175
  if (response.type === 'error') {
162
176
  // Use the typed-error reconstructor map in `rpc-error.ts` so the
@@ -277,8 +291,13 @@ async function sendProfiled(request, rpc, options) {
277
291
  throw error;
278
292
  }
279
293
  }
294
+ /** `options.signal` ends the stream; only `endsOnAbort` handlers stop on the worker. */
280
295
  export async function* stream(request, options = {}, rpc) {
296
+ if (options.signal?.aborted)
297
+ return;
281
298
  const ctx = await prepareRPCContext(request.type, options?.profiling, rpc);
299
+ if (options.signal?.aborted)
300
+ return;
282
301
  if (!ctx.profilingEnabled) {
283
302
  yield* streamBase(request, ctx.rpc, options, ctx.signalDisable);
284
303
  return;
@@ -294,6 +313,7 @@ async function* streamBase(request, rpc, options = {}, signalDisable = false) {
294
313
  : parsedRequest;
295
314
  req.send(JSON.stringify(payloadObj), 'utf-8');
296
315
  const responseStream = req.createResponseStream({ encoding: 'utf-8' });
316
+ const stopDestroyOnAbort = destroyOnAbort(responseStream, options.signal);
297
317
  let buffer = '';
298
318
  async function* processStream() {
299
319
  for await (const chunk of responseStream) {
@@ -301,19 +321,27 @@ async function* streamBase(request, rpc, options = {}, signalDisable = false) {
301
321
  }
302
322
  }
303
323
  const streamWithTimeout = withTimeoutStream(processStream(), options?.timeout);
304
- for await (const chunk of iterateWithLifeSignal(streamWithTimeout)) {
305
- buffer += chunk.toString();
306
- // Process complete lines (newline-delimited JSON)
307
- const lines = buffer.split('\n');
308
- buffer = lines.pop() || ''; // Keep incomplete line in buffer
309
- for (const line of lines) {
310
- if (line.trim()) {
311
- const response = responseSchema.parse(JSON.parse(line));
312
- checkAndThrowError(response);
313
- yield response;
324
+ try {
325
+ for await (const chunk of iterateWithLifeSignal(untilAborted(streamWithTimeout, options.signal))) {
326
+ buffer += chunk.toString();
327
+ // Process complete lines (newline-delimited JSON)
328
+ const lines = buffer.split('\n');
329
+ buffer = lines.pop() || ''; // Keep incomplete line in buffer
330
+ for (const line of lines) {
331
+ // Aborted mid-chunk.
332
+ if (options.signal?.aborted)
333
+ return;
334
+ if (line.trim()) {
335
+ const response = responseSchema.parse(JSON.parse(line));
336
+ checkAndThrowError(response);
337
+ yield response;
338
+ }
314
339
  }
315
340
  }
316
341
  }
342
+ finally {
343
+ stopDestroyOnAbort();
344
+ }
317
345
  }
318
346
  async function* streamProfiled(request, rpc, options = {}) {
319
347
  const requestType = request.type;
@@ -322,6 +350,7 @@ async function* streamProfiled(request, rpc, options = {}) {
322
350
  const includeResources = shouldIncludeResourceGauges(options?.profiling);
323
351
  const timings = createClientStreamTimings(profileId, requestType);
324
352
  let profilingMeta = undefined;
353
+ let stopDestroyOnAbort = () => { };
325
354
  try {
326
355
  const zodStart = nowMs();
327
356
  const parsedRequest = parseRequest(request);
@@ -336,6 +365,7 @@ async function* streamProfiled(request, rpc, options = {}) {
336
365
  timings.sendStart = nowMs();
337
366
  req.send(payload, 'utf-8');
338
367
  const responseStream = req.createResponseStream({ encoding: 'utf-8' });
368
+ stopDestroyOnAbort = destroyOnAbort(responseStream, options.signal);
339
369
  let buffer = '';
340
370
  async function* processStream() {
341
371
  for await (const chunk of responseStream) {
@@ -343,7 +373,7 @@ async function* streamProfiled(request, rpc, options = {}) {
343
373
  }
344
374
  }
345
375
  const streamWithTimeout = withTimeoutStream(processStream(), options?.timeout);
346
- for await (const chunk of iterateWithLifeSignal(streamWithTimeout)) {
376
+ for await (const chunk of iterateWithLifeSignal(untilAborted(streamWithTimeout, options.signal))) {
347
377
  const chunkTime = nowMs();
348
378
  if (timings.firstChunkAt === undefined) {
349
379
  timings.firstChunkAt = chunkTime;
@@ -353,6 +383,9 @@ async function* streamProfiled(request, rpc, options = {}) {
353
383
  const lines = buffer.split('\n');
354
384
  buffer = lines.pop() || '';
355
385
  for (const line of lines) {
386
+ // Aborted mid-chunk.
387
+ if (options.signal?.aborted)
388
+ return;
356
389
  if (line.trim()) {
357
390
  const rawParsed = JSON.parse(line);
358
391
  const chunkMeta = extractProfilingMeta(rawParsed);
@@ -383,6 +416,7 @@ async function* streamProfiled(request, rpc, options = {}) {
383
416
  throw error;
384
417
  }
385
418
  finally {
419
+ stopDestroyOnAbort();
386
420
  if (timings.chunkCount > 0) {
387
421
  timings.requestEnd = nowMs();
388
422
  recordClientStreamEvents(timings, profilingMeta);
@@ -1,4 +1,4 @@
1
- import { RpcServerOperationError, InferenceCancelledError, ContextOverflowError, RequestIdConflictError, RequestNotFoundError, RequestRejectedByPolicyError, TranslationFailedError } from '../../utils/errors-server.js';
1
+ import { RpcServerOperationError, InferenceCancelledError, ContextOverflowError, ModelRegistryModelNotFoundError, RequestIdConflictError, RequestNotFoundError, RequestRejectedByPolicyError, TranslationFailedError } from '../../utils/errors-server.js';
2
2
  export class RPCError extends Error {
3
3
  timestamp;
4
4
  remoteStack;
@@ -108,6 +108,9 @@ const RECONSTRUCTORS = {
108
108
  REQUEST_ID_CONFLICT: (response) => {
109
109
  return new RequestIdConflictError(readStringField(response.typedFields, 'requestId', ''), response.cause);
110
110
  },
111
+ QVAC_MODEL_REGISTRY_MODEL_NOT_FOUND: (response) => {
112
+ return new ModelRegistryModelNotFoundError(readStringField(response.typedFields, 'registrySource', ''), readStringField(response.typedFields, 'registryPath', ''), response.cause);
113
+ },
111
114
  REQUEST_NOT_FOUND: (response) => {
112
115
  return new RequestNotFoundError(readStringField(response.typedFields, 'requestId', ''), response.cause);
113
116
  },
@@ -1,4 +1,10 @@
1
1
  import type { Logger } from '../../logging/types.js';
2
+ export declare const BARE_PACK_NODE_ENGINES = "^22.21.0 || >=24.9.0";
3
+ export declare function isBarePackNodeSupported(version: string): boolean;
4
+ interface NodeVersions {
5
+ node: string;
6
+ bun?: string | undefined;
7
+ }
2
8
  interface RunBarePackOptions {
3
9
  entryPath: string;
4
10
  outputPath: string;
@@ -7,6 +13,8 @@ interface RunBarePackOptions {
7
13
  deferModules: string[];
8
14
  quiet: boolean;
9
15
  logger: Logger;
16
+ /** The runtime running bare-pack; defaults to this process. Tests inject an older Node. */
17
+ nodeVersions?: NodeVersions | undefined;
10
18
  }
11
19
  export declare function runBarePack(options: RunBarePackOptions): Promise<void>;
12
20
  export {};
@@ -2,9 +2,29 @@ import fs from 'node:fs';
2
2
  import path from 'node:path';
3
3
  import { createRequire } from 'node:module';
4
4
  import { spawn } from 'node:child_process';
5
- import { platform, execPath } from 'node:process';
6
- import { BarePackNotInstalledError, BarePackError } from '../../utils/errors-client.js';
5
+ import { platform, execPath, versions } from 'node:process';
6
+ import semver from 'semver';
7
+ import { BarePackNotInstalledError, BarePackNodeUnsupportedError, BarePackError } from '../../utils/errors-client.js';
7
8
  const require = createRequire(import.meta.url);
9
+ // bare-module-lexer (loaded by bare-pack through bare-module-traverse) calls
10
+ // js_is_sharedarraybuffer from its native addon, which Node outside this range
11
+ // lacks; the bare-pack child process crashes instead of throwing. Same range as
12
+ // engines.node in @qvac/cli.
13
+ export const BARE_PACK_NODE_ENGINES = '^22.21.0 || >=24.9.0';
14
+ export function isBarePackNodeSupported(version) {
15
+ return semver.satisfies(version, BARE_PACK_NODE_ENGINES, { includePrerelease: true });
16
+ }
17
+ // On Node, bare-pack is spawned with this process's execPath, so checking
18
+ // process.versions.node checks the Node that will load the lexer. Under Bun,
19
+ // process.versions.node is Bun's emulated value and, except on Windows, bare-pack
20
+ // runs through its shebang in the `node` from PATH, which cannot be checked here.
21
+ function assertNodeCanRunBarePack(nodeVersions) {
22
+ if (nodeVersions.bun !== undefined)
23
+ return;
24
+ if (isBarePackNodeSupported(nodeVersions.node))
25
+ return;
26
+ throw new BarePackNodeUnsupportedError(nodeVersions.node, BARE_PACK_NODE_ENGINES);
27
+ }
8
28
  function resolveBarePackBin() {
9
29
  try {
10
30
  const barePackPkgPath = require.resolve('bare-pack/package');
@@ -17,10 +37,12 @@ function resolveBarePackBin() {
17
37
  }
18
38
  export async function runBarePack(options) {
19
39
  const { entryPath, outputPath, hosts, importsMapPath, deferModules, quiet, logger } = options;
40
+ const nodeVersions = options.nodeVersions ?? versions;
20
41
  const barePackBin = resolveBarePackBin();
21
42
  if (!barePackBin || !fs.existsSync(barePackBin)) {
22
43
  throw new BarePackNotInstalledError();
23
44
  }
45
+ assertNodeCanRunBarePack(nodeVersions);
24
46
  return new Promise((resolve, reject) => {
25
47
  const hostArgs = hosts.flatMap((h) => ['--host', h]);
26
48
  const deferArgs = deferModules.flatMap((m) => ['--defer', m]);
@@ -34,9 +56,10 @@ export async function runBarePack(options) {
34
56
  outputPath,
35
57
  entryPath
36
58
  ];
37
- const isWindows = platform === 'win32';
38
- const command = isWindows ? execPath : barePackBin;
39
- const spawnArgs = isWindows ? [barePackBin, ...args] : args;
59
+ // Windows cannot exec a .js file directly, so it always goes through execPath.
60
+ const viaShebang = nodeVersions.bun !== undefined && platform !== 'win32';
61
+ const command = viaShebang ? barePackBin : execPath;
62
+ const spawnArgs = viaShebang ? args : [barePackBin, ...args];
40
63
  logger.debug(`\nšŸ“¦ Running: ${command} ${spawnArgs.join(' ')}`);
41
64
  const proc = spawn(command, spawnArgs, {
42
65
  stdio: quiet ? 'ignore' : 'inherit'
@@ -1,9 +1,12 @@
1
1
  export const BUILTIN_PLUGINS = {
2
2
  'llamacpp-completion': { exportName: 'llmPlugin' },
3
3
  'llamacpp-embedding': { exportName: 'embeddingsPlugin' },
4
+ 'llamacpp-decision': { exportName: 'decisionPlugin' },
5
+ 'llamacpp-rerank': { exportName: 'rerankPlugin' },
4
6
  'whispercpp-transcription': { exportName: 'whisperPlugin' },
5
7
  'bci-whispercpp-transcription': { exportName: 'bciPlugin' },
6
8
  'parakeet-transcription': { exportName: 'parakeetPlugin' },
9
+ 'moss-transcribe': { exportName: 'mossTranscribePlugin' },
7
10
  'nmtcpp-translation': { exportName: 'nmtPlugin' },
8
11
  'tts-ggml': { exportName: 'ttsPlugin' },
9
12
  'ggml-ocr': { exportName: 'ocrPlugin' },
@@ -1,4 +1,4 @@
1
- import { parseBuiltinSpecifier } from './plugins.js';
1
+ import { parseBuiltinSpecifier } from '../../commands/bundle/plugins.js';
2
2
  export function generateWorkerEntry(pluginSpecifiers, sdkName, resolveImport = (specifier) => specifier, rpcServerProvider) {
3
3
  const imports = [];
4
4
  const registrations = [];
@@ -1,4 +1,4 @@
1
- import { type HostPrebuildPackage } from '../host-prebuilds/index.js';
1
+ import { type HostPrebuildPackage } from '../../commands/host-prebuilds/index.js';
2
2
  export interface BundleSdkOptions {
3
3
  projectRoot?: string | undefined;
4
4
  configPath?: string | undefined;
@@ -8,12 +8,13 @@ export interface BundleSdkOptions {
8
8
  quiet?: boolean | undefined;
9
9
  verbose?: boolean | undefined;
10
10
  /**
11
- * Install the addon platform packages the bundle needs for its mobile hosts
12
- * with the project's package manager (see `ensureHostPrebuilds`), then
13
- * bundle again. Off by default: without it, bundling never changes
14
- * package.json or node_modules. When the install is refused, the bundle and
15
- * its manifest are still written before `HostPrebuildsInstallRefusedError`
16
- * is thrown.
11
+ * Install the addon platform packages that the split addons the bundle
12
+ * reaches need for its mobile hosts, with the project's package manager
13
+ * (see `ensureHostPrebuilds`), before bundling. Off by default: without it,
14
+ * bundling never changes package.json or node_modules, and a mobile host
15
+ * whose platform package is missing fails with `HostPrebuildsMissingError`,
16
+ * naming the exact pins. A refused install
17
+ * throws `HostPrebuildsInstallRefusedError` before anything is written.
17
18
  */
18
19
  installMissingPrebuilds?: boolean | undefined;
19
20
  /**
@@ -1,20 +1,19 @@
1
1
  import fs, { promises as fsp } from 'node:fs';
2
2
  import path from 'node:path';
3
3
  import { createRequire } from 'node:module';
4
- import { DEFAULT_HOSTS, DEFAULT_SDK_NAME } from './constants.js';
4
+ import { DEFAULT_HOSTS, DEFAULT_SDK_NAME } from '../../commands/bundle/constants.js';
5
5
  import { CONFIG_CANDIDATES, resolveConfigForProject } from '../../client/config-loader/resolve-config.node.js';
6
- import { createCommandLogger } from '../command-logger.js';
7
- import { BareImportsMapNotFoundError, HostPrebuildsInstallRefusedError } from '../../utils/errors-client.js';
8
- import { resolvePluginSpecifiers, parseBuiltinSpecifier } from './plugins.js';
9
- import { generateWorkerEntries } from './entry-gen.js';
10
- import { runBarePack } from './bare-pack.js';
11
- import { generateAddonsManifest } from './manifest.js';
12
- import { createSdkImportResolver } from './resolve-sdk-import.js';
13
- import { installMissingHostPrebuilds } from '../host-prebuilds/index.js';
14
- import { collectAddonsFromBundle } from '../verify/bundle-source.js';
15
- import { verifyBundle } from '../verify/index.js';
16
- import { formatRuntimeSource } from '../verify/abi.js';
17
- import { formatEnginesAdvice } from '../verify/engines-advice.js';
6
+ import { createCommandLogger } from '../../commands/command-logger.js';
7
+ import { BareImportsMapNotFoundError, HostPrebuildsMissingError } from '../../utils/errors-client.js';
8
+ import { resolvePluginSpecifiers, parseBuiltinSpecifier } from '../../commands/bundle/plugins.js';
9
+ import { generateWorkerEntries } from '../../commands/bundle/entry-gen.js';
10
+ import { runBarePack } from '../../commands/bundle/bare-pack.js';
11
+ import { AUDIO_DECODER_ADDON, extractBarePackHeader, extractPackedString, generateAddonsManifest } from '../../commands/bundle/manifest.js';
12
+ import { createSdkImportResolver } from '../../commands/bundle/resolve-sdk-import.js';
13
+ import { findMissingHostPrebuilds, installMissingHostPrebuilds, resolveAddons } from '../../commands/host-prebuilds/index.js';
14
+ import { verifyBundle } from '../../commands/verify/index.js';
15
+ import { formatRuntimeSource } from '../../commands/verify/abi.js';
16
+ import { formatEnginesAdvice } from '../../commands/verify/engines-advice.js';
18
17
  const require = createRequire(import.meta.url);
19
18
  function resolveSdkPath(projectRoot, explicitSdkPath) {
20
19
  if (explicitSdkPath) {
@@ -55,6 +54,19 @@ function resolveImportsMapPath(sdkPath, sdkName) {
55
54
  throw new BareImportsMapNotFoundError(sdkName, importsMapPath);
56
55
  }
57
56
  const ENGINES_ISSUE_CODES = new Set(['abi-mismatch', 'engines-mismatch']);
57
+ const AUDIO_PLUGINS = new Set([
58
+ 'whispercpp-transcription',
59
+ 'bci-whispercpp-transcription',
60
+ 'parakeet-transcription',
61
+ 'moss-transcribe',
62
+ 'audiogen-ggml'
63
+ ]);
64
+ function audioPluginsIn(pluginSpecifiers, sdkName) {
65
+ return pluginSpecifiers.filter((specifier) => {
66
+ const builtin = parseBuiltinSpecifier(specifier, sdkName);
67
+ return builtin !== null && AUDIO_PLUGINS.has(builtin.suffix);
68
+ });
69
+ }
58
70
  async function checkBundleEngines(options) {
59
71
  const { projectRoot, bundlePath, hosts, configPath, network, logger } = options;
60
72
  logger.info('\nšŸ”Ž Checking engines.bare against the Bare runtime of each host...');
@@ -124,7 +136,17 @@ export async function bundleSdk(options = {}) {
124
136
  logger.info(` ${label}: ${spec}`);
125
137
  }
126
138
  const hosts = options.hosts && options.hosts.length > 0 ? options.hosts : DEFAULT_HOSTS;
127
- const deferModules = options.defer ?? [];
139
+ const explicitDefer = options.defer ?? [];
140
+ const includeAudioDecoder = config.includeAudioDecoder !== false && !explicitDefer.includes(AUDIO_DECODER_ADDON);
141
+ const deferModules = includeAudioDecoder
142
+ ? explicitDefer
143
+ : [...new Set([...explicitDefer, AUDIO_DECODER_ADDON])];
144
+ if (!includeAudioDecoder) {
145
+ const affected = audioPluginsIn(pluginSpecifiers, sdkName);
146
+ if (affected.length > 0) {
147
+ logger.warn(`${AUDIO_DECODER_ADDON} is not bundled: ${affected.join(', ')} cannot decode compressed audio files; compressed audiogen output formats also require FFmpeg.`);
148
+ }
149
+ }
128
150
  await fsp.mkdir(outputDir, { recursive: true });
129
151
  logger.info('\nšŸ“ Generating worker entry...');
130
152
  const resolveSdkImport = createSdkImportResolver(sdkPath, sdkName);
@@ -137,46 +159,44 @@ export async function bundleSdk(options = {}) {
137
159
  if (deferModules.length > 0) {
138
160
  logger.debug(` Deferred: ${deferModules.join(', ')}`);
139
161
  }
162
+ // Missing mobile platform packages are installed, or reported, before bundling.
140
163
  let installedPrebuilds = [];
141
- let installRefused;
164
+ const barePackOptions = {
165
+ entryPath: bundleEntryPath,
166
+ hosts,
167
+ importsMapPath,
168
+ quiet: options.quiet === true,
169
+ logger
170
+ };
171
+ const addonsMissingPlatformPackages = () => reachedAddonsMissingPlatformPackages({
172
+ addons: async () => (await resolveAddons(projectRoot, undefined, logger)).filter((addon) => !deferModules.includes(addon.name)),
173
+ hosts,
174
+ scan: (extraDefer, outputPath) => runBarePack({
175
+ ...barePackOptions,
176
+ outputPath,
177
+ deferModules: [...deferModules, ...extraDefer],
178
+ quiet: true
179
+ }),
180
+ scanPath: path.join(outputDir, 'worker.scan.bundle.js'),
181
+ logger
182
+ });
142
183
  try {
143
184
  await fsp.writeFile(bundleEntryPath, bundleEntry, 'utf8');
144
- const barePackOptions = {
145
- entryPath: bundleEntryPath,
146
- outputPath: bundlePath,
147
- hosts,
148
- importsMapPath,
149
- deferModules,
150
- quiet: options.quiet === true,
151
- logger
152
- };
153
- await runBarePack(barePackOptions);
185
+ const addons = await addonsMissingPlatformPackages();
154
186
  if (options.installMissingPrebuilds === true) {
155
- try {
156
- const { installed } = await installMissingHostPrebuilds({
157
- projectRoot,
158
- hosts,
159
- addons: await collectAddonsFromBundle({ bundlePath, projectRoot, hosts }),
160
- quiet: options.quiet === true,
161
- logger
162
- });
163
- installedPrebuilds = installed;
164
- // Where a platform package was missing, bare-pack resolved the addon's
165
- // `#host-addon` import to its fallback module; bundle again to pick up
166
- // the installed package.
167
- if (installed.length > 0) {
168
- logger.info('\nšŸ”Ø Bundling again with the installed platform packages...');
169
- await runBarePack(barePackOptions);
170
- }
171
- }
172
- catch (error) {
173
- if (!(error instanceof HostPrebuildsInstallRefusedError))
174
- throw error;
175
- // A refusal happens before anything is installed, so the bundle
176
- // already written is final and only its manifest is left to write.
177
- installRefused = error;
178
- }
187
+ const { installed } = await installMissingHostPrebuilds({
188
+ projectRoot,
189
+ hosts,
190
+ addons,
191
+ quiet: options.quiet === true,
192
+ logger
193
+ });
194
+ installedPrebuilds = installed;
179
195
  }
196
+ else {
197
+ await throwIfPlatformPackagesMissing(addons, hosts);
198
+ }
199
+ await runBarePack({ ...barePackOptions, outputPath: bundlePath, deferModules });
180
200
  }
181
201
  finally {
182
202
  await fsp.rm(bundleEntryPath, { force: true });
@@ -189,7 +209,8 @@ export async function bundleSdk(options = {}) {
189
209
  bundlePath,
190
210
  outputDir,
191
211
  projectRoot,
192
- logger
212
+ logger,
213
+ includeAudioDecoder
193
214
  });
194
215
  if (options.checkEngines !== false) {
195
216
  await checkBundleEngines({
@@ -201,8 +222,6 @@ export async function bundleSdk(options = {}) {
201
222
  logger
202
223
  });
203
224
  }
204
- if (installRefused !== undefined)
205
- throw installRefused;
206
225
  const elapsed = ((Date.now() - startTime) / 1000).toFixed(2);
207
226
  logger.info(`\nšŸŽ‰ Done in ${elapsed}s!\n`);
208
227
  logger.info('Generated files:');
@@ -222,3 +241,67 @@ export async function bundleSdk(options = {}) {
222
241
  installedPrebuilds
223
242
  };
224
243
  }
244
+ /**
245
+ * The installed split addons that the bundle reaches and that are missing a
246
+ * mobile platform package. Every installed addon is a candidate (`@qvac/sdk`
247
+ * depends on all of them), so a first bare-pack pass defers each missing
248
+ * platform package: bare-pack then records the reached ones as
249
+ * `deferred:<package>` and never visits the rest. Empty when nothing is
250
+ * missing, or when that pass fails, which leaves the real bundle to report
251
+ * the failure.
252
+ */
253
+ async function reachedAddonsMissingPlatformPackages(options) {
254
+ const { hosts, scan, scanPath, logger } = options;
255
+ const addons = await options.addons();
256
+ const missing = await findMissingHostPrebuilds(addons, hosts);
257
+ if (missing.length === 0)
258
+ return [];
259
+ logger.debug(`\nšŸ”Ž Checking which of ${missing.length} missing platform packages the bundle reaches...`);
260
+ try {
261
+ await scan(missing.map((pkg) => pkg.name), scanPath);
262
+ const reached = deferredSpecifiers(await fsp.readFile(scanPath, 'utf8'));
263
+ const owners = new Set(missing.filter((pkg) => reached.has(pkg.name)).map((pkg) => pkg.addon));
264
+ return addons.filter((addon) => owners.has(addon.name));
265
+ }
266
+ catch (error) {
267
+ logger.debug(` Scan failed: ${error instanceof Error ? error.message : String(error)}`);
268
+ return [];
269
+ }
270
+ finally {
271
+ await fsp.rm(scanPath, { force: true });
272
+ }
273
+ }
274
+ const DEFERRED_PROTOCOL = 'deferred:';
275
+ /** Every specifier a bare-pack bundle leaves as `deferred:<specifier>`. */
276
+ function deferredSpecifiers(bundleText) {
277
+ const { resolutions = {} } = extractBarePackHeader(extractPackedString(bundleText));
278
+ const found = new Set();
279
+ const visit = (value) => {
280
+ if (typeof value === 'string') {
281
+ if (value.startsWith(DEFERRED_PROTOCOL))
282
+ found.add(value.slice(DEFERRED_PROTOCOL.length));
283
+ }
284
+ else if (value !== null && typeof value === 'object') {
285
+ for (const nested of Object.values(value))
286
+ visit(nested);
287
+ }
288
+ };
289
+ visit(resolutions);
290
+ return found;
291
+ }
292
+ /**
293
+ * Throws `HostPrebuildsMissingError` when split addons are missing mobile
294
+ * platform packages, naming the exact pins.
295
+ */
296
+ async function throwIfPlatformPackagesMissing(addons, hosts) {
297
+ let missing;
298
+ try {
299
+ missing = await findMissingHostPrebuilds(addons, hosts);
300
+ }
301
+ catch {
302
+ return;
303
+ }
304
+ if (missing.length === 0)
305
+ return;
306
+ throw new HostPrebuildsMissingError(Object.fromEntries(missing.map((pkg) => [pkg.name, pkg.version])));
307
+ }
@@ -10,7 +10,9 @@ interface GenerateAddonsManifestOptions {
10
10
  outputDir: string;
11
11
  projectRoot: string;
12
12
  logger: Logger;
13
+ includeAudioDecoder?: boolean;
13
14
  }
15
+ export declare const AUDIO_DECODER_ADDON = "bare-ffmpeg";
14
16
  interface GenerateAddonsManifestResult {
15
17
  manifestPath: string;
16
18
  addons: string[];
@@ -1,5 +1,6 @@
1
1
  import fs, { promises as fsp } from 'node:fs';
2
2
  import path from 'node:path';
3
+ export const AUDIO_DECODER_ADDON = 'bare-ffmpeg';
3
4
  export function extractPackedString(bundleJsText) {
4
5
  const idx = bundleJsText.indexOf('module.exports');
5
6
  if (idx === -1) {
@@ -150,7 +151,7 @@ export function buildNestedPathIndex(resolutions, projectRoot) {
150
151
  return index;
151
152
  }
152
153
  export async function generateAddonsManifest(options) {
153
- const { bundlePath, outputDir, projectRoot, logger } = options;
154
+ const { bundlePath, outputDir, projectRoot, logger, includeAudioDecoder = true } = options;
154
155
  logger.info('\nšŸ“¦ Generating addons manifest...');
155
156
  const bundleJsText = await fsp.readFile(bundlePath, 'utf8');
156
157
  const packed = extractPackedString(bundleJsText);
@@ -171,7 +172,7 @@ export async function generateAddonsManifest(options) {
171
172
  logger.warn(` Could not read ${candidate}: ${err.message}`);
172
173
  }
173
174
  }
174
- if (pkgJson?.addon === true) {
175
+ if (pkgJson?.addon === true && (includeAudioDecoder || pkgName !== AUDIO_DECODER_ADDON)) {
175
176
  addons.push(pkgName);
176
177
  }
177
178
  }
@@ -1,4 +1,4 @@
1
- import { BUILTIN_PLUGINS, BUILTIN_SUFFIXES } from './constants.js';
1
+ import { BUILTIN_PLUGINS, BUILTIN_SUFFIXES } from '../../commands/bundle/constants.js';
2
2
  import { InvalidPluginSpecifierError } from '../../utils/errors-client.js';
3
3
  export function buildBuiltinSpecifier(sdkName, suffix) {
4
4
  return `${sdkName}/${suffix}/plugin`;
@@ -1,7 +1,7 @@
1
1
  import type { Logger } from '../../logging/types.js';
2
- import { type NativeAddon } from '../verify/addon-source.js';
3
- import { type PackageManagerName } from './package-manager.js';
4
- export type { PackageManagerName } from './package-manager.js';
2
+ import { type NativeAddon } from '../../commands/verify/addon-source.js';
3
+ import { type PackageManagerName } from '../../commands/host-prebuilds/package-manager.js';
4
+ export type { PackageManagerName } from '../../commands/host-prebuilds/package-manager.js';
5
5
  export interface EnsureHostPrebuildsOptions {
6
6
  /** The package whose package.json receives the pins; its package manager installs them. */
7
7
  projectRoot: string;
@@ -9,7 +9,8 @@ export interface EnsureHostPrebuildsOptions {
9
9
  hosts: string[];
10
10
  /**
11
11
  * Addon package names to cover. Defaults to every addon installed for the
12
- * project: in its own node_modules or in that of a workspace root listing it.
12
+ * project, split addon metas included: in its own node_modules or in that
13
+ * of a workspace root listing it.
13
14
  */
14
15
  addons?: string[] | undefined;
15
16
  /** Install with this package manager instead of detecting the project's own. */
@@ -38,15 +39,15 @@ export interface EnsureHostPrebuildsResult {
38
39
  * hosts and that the project does not have yet.
39
40
  *
40
41
  * A split addon names one platform package per host in the `#host-addon` map
41
- * of its package.json (`<addon>-ios` covers every iOS host). Desktop platform
42
- * packages install as the addon's os/cpu-filtered optionalDependencies, but a
43
- * build host never reports a mobile os, so mobile ones have to be declared.
42
+ * of its package.json (`<addon>-ios` covers every iOS host) and loads its
43
+ * native code from that package alone. Desktop platform packages install as
44
+ * os/cpu-filtered optionalDependencies, but a build host never reports a
45
+ * mobile os, so mobile ones have to be declared.
44
46
  * This declares the missing ones in package.json, pinned to each addon's
45
47
  * exact version, using the project's own package manager.
46
48
  *
47
- * A host whose prebuild already resolves is skipped: a local
48
- * `prebuilds/<host>` in the addon (source builds) or its platform package at
49
- * the addon's version. Throws `HostPrebuildsInstallRefusedError` when no
49
+ * A host whose platform package is already installed at the addon's version
50
+ * is skipped. Throws `HostPrebuildsInstallRefusedError` when no
50
51
  * supported package manager (npm 7+, pnpm, bun, Yarn Berry) is found, and
51
52
  * `HostPrebuildsInstallFailedError` when the install does not produce the
52
53
  * packages.
@@ -68,4 +69,11 @@ export declare function installMissingHostPrebuilds(options: InstallMissingHostP
68
69
  * the same platform package, since only one version of it can be installed.
69
70
  */
70
71
  export declare function findMissingHostPrebuilds(addons: NativeAddon[], hosts: string[]): Promise<HostPrebuildPackage[]>;
72
+ /**
73
+ * The installed addons named in `names`, or every installed addon when
74
+ * `names` is omitted, split addon metas included. For each name the copy in
75
+ * the nearest modules directory wins, as it does for Node's resolver. Without
76
+ * `names`, the packages nested in each package's own node_modules count too.
77
+ */
78
+ export declare function resolveAddons(projectRoot: string, names: string[] | undefined, logger: Logger): Promise<NativeAddon[]>;
71
79
  //# sourceMappingURL=index.d.ts.map