@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,9 +1,9 @@
1
1
  import { textToSpeechStreamResponseSchema, textToSpeechStreamRequestSchema, ttsClientParamsSchema } from '@qvac/inference/surface';
2
- import { stream as streamRpc, duplex } from '../rpc/rpc-client.js';
2
+ import { stream as streamRpc, duplex } from '../../client/rpc/rpc-client.js';
3
3
  import { getClientLogger } from '../../logging/index.js';
4
4
  import { TextToSpeechStreamFailedError } from '../../utils/errors-client.js';
5
- import { parseClientInput } from '../parse-input.js';
6
- import { generateClientRequestId } from './client-request-id.js';
5
+ import { parseClientInput } from '../../client/parse-input.js';
6
+ import { generateClientRequestId } from '../../client/api/client-request-id.js';
7
7
  const logger = getClientLogger();
8
8
  /**
9
9
  * Fan-out queue that lets multiple consumers iterate the same TTS response
@@ -132,29 +132,9 @@ export class TtsMulticast {
132
132
  }
133
133
  function buildTtsRequest(params, requestId) {
134
134
  return {
135
+ ...params,
135
136
  type: 'textToSpeech',
136
- modelId: params.modelId,
137
- requestId,
138
- inputType: params.inputType,
139
- text: params.text,
140
- stream: params.stream,
141
- sentenceStream: params.sentenceStream,
142
- ...(params.sentenceStreamLocale !== undefined && {
143
- sentenceStreamLocale: params.sentenceStreamLocale
144
- }),
145
- ...(params.sentenceStreamMaxChunkScalars !== undefined && {
146
- sentenceStreamMaxChunkScalars: params.sentenceStreamMaxChunkScalars
147
- }),
148
- ...(params.description !== undefined && { description: params.description }),
149
- ...(params.voiceDescription !== undefined && { voiceDescription: params.voiceDescription }),
150
- ...(params.voice !== undefined && { voice: params.voice }),
151
- ...(params.emotion !== undefined && { emotion: params.emotion }),
152
- ...(params.pitch !== undefined && { pitch: params.pitch }),
153
- ...(params.pace !== undefined && { pace: params.pace }),
154
- ...(params.expressivity !== undefined && { expressivity: params.expressivity }),
155
- ...(params.noise !== undefined && { noise: params.noise }),
156
- ...(params.reverb !== undefined && { reverb: params.reverb }),
157
- ...(params.quality !== undefined && { quality: params.quality })
137
+ requestId
158
138
  };
159
139
  }
160
140
  function buildTextToSpeechStreamRequest(params, requestId) {
@@ -271,6 +251,11 @@ async function* ttsResponseSource(request, options, side) {
271
251
  }
272
252
  /** Exported for test use; not part of the public SDK surface. */
273
253
  export function createTtsSideChannel() {
254
+ let resolveText;
255
+ const text = new Promise((resolve) => {
256
+ resolveText = resolve;
257
+ });
258
+ let seenText;
274
259
  let resolveSampleRate;
275
260
  let resolveStats;
276
261
  let resolveStopReason;
@@ -288,10 +273,13 @@ export function createTtsSideChannel() {
288
273
  let seenStopReason;
289
274
  let settled = false;
290
275
  return {
276
+ text,
291
277
  sampleRate,
292
278
  stats,
293
279
  stopReason,
294
280
  observe(response) {
281
+ if (response.text !== undefined)
282
+ seenText = response.text;
295
283
  // Resolve on the FIRST frame that carries a rate, not at end of stream:
296
284
  // a caller opening an audio device wants it before draining the audio.
297
285
  // Promise resolution is idempotent, so settle() can still resolve the
@@ -309,6 +297,7 @@ export function createTtsSideChannel() {
309
297
  if (settled)
310
298
  return;
311
299
  settled = true;
300
+ resolveText(seenText);
312
301
  resolveSampleRate(seenSampleRate);
313
302
  resolveStats(latestStats);
314
303
  resolveStopReason(seenStopReason);
@@ -331,6 +320,7 @@ function sentenceStreamTts(request, options) {
331
320
  buffer: Promise.resolve([]),
332
321
  done: multicast.done,
333
322
  requestId: request.requestId,
323
+ text: side.text,
334
324
  sampleRate: side.sampleRate,
335
325
  stats: side.stats,
336
326
  stopReason: side.stopReason
@@ -379,6 +369,7 @@ function plainStreamTts(request, options) {
379
369
  buffer: Promise.resolve([]),
380
370
  done,
381
371
  requestId: request.requestId,
372
+ text: side.text,
382
373
  sampleRate: side.sampleRate,
383
374
  stats: side.stats,
384
375
  stopReason: side.stopReason
@@ -431,6 +422,7 @@ function collectTts(request, options) {
431
422
  buffer: collectTtsBuffer(request, options, resolveDone, rejectDone, side),
432
423
  done,
433
424
  requestId: request.requestId,
425
+ text: side.text,
434
426
  sampleRate: side.sampleRate,
435
427
  stats: side.stats,
436
428
  stopReason: side.stopReason
@@ -449,6 +441,7 @@ async function collectTtsBuffer(request, options, resolveDone, rejectDone, side)
449
441
  buffer = buffer.concat(response.buffer);
450
442
  if (response.done) {
451
443
  resolveDone(true);
444
+ break;
452
445
  }
453
446
  }
454
447
  return buffer;
@@ -1,5 +1,5 @@
1
1
  import { type TranscribeClientParams, type RPCOptions, type TranscribeSegment, type TranscribeStreamRequest, type TranscribeStreamClientParams, type TranscribeStreamSession, type TranscribeStreamMetadataSession, type TranscribeStreamConversationSession, type TranscribeStreamEvent, type TranscribeStats, type InferenceBackendDiagnostics } from '@qvac/inference/surface';
2
- import { stream, duplex } from '../rpc/rpc-client.js';
2
+ import { stream, duplex } from '../../client/rpc/rpc-client.js';
3
3
  type TranscribeDuplexFactory = (request: TranscribeStreamRequest, options?: RPCOptions) => ReturnType<typeof duplex>;
4
4
  /**
5
5
  * Transcribe audio and return the complete text. Accepts either a file
@@ -1,9 +1,9 @@
1
1
  import { transcribeResponseSchema, transcribeStreamResponseSchema } from '@qvac/inference/surface';
2
- import { stream, duplex } from '../rpc/rpc-client.js';
2
+ import { stream, duplex } from '../../client/rpc/rpc-client.js';
3
3
  import { getClientLogger } from '../../logging/index.js';
4
4
  import { TranscriptionFailedError } from '../../utils/errors-client.js';
5
5
  import { decoratePromise } from '../../utils/decorate-promise.js';
6
- import { generateClientRequestId } from './client-request-id.js';
6
+ import { generateClientRequestId } from '../../client/api/client-request-id.js';
7
7
  const logger = getClientLogger();
8
8
  function buildTranscribeRequest(params, requestId) {
9
9
  return {
@@ -12,7 +12,9 @@ function buildTranscribeRequest(params, requestId) {
12
12
  audioChunk: typeof params.audioChunk === 'string'
13
13
  ? { type: 'filePath', value: params.audioChunk }
14
14
  : { type: 'base64', value: params.audioChunk.toString('base64') },
15
- ...(params.prompt && { prompt: params.prompt }),
15
+ ...(params.prompt !== undefined && params.prompt !== null && { prompt: params.prompt }),
16
+ ...(params.hotwords !== undefined && { hotwords: params.hotwords }),
17
+ ...(params.maxNewTokens !== undefined && { maxNewTokens: params.maxNewTokens }),
16
18
  ...(params.metadata === true && { metadata: true }),
17
19
  requestId
18
20
  };
@@ -310,7 +312,8 @@ export function processLineConversation(line, wantsMetadata, onTerminal) {
310
312
  type: 'vad',
311
313
  speaking: response.vad.speaking,
312
314
  probability: response.vad.probability,
313
- ...(response.vad.source && { source: response.vad.source })
315
+ ...(response.vad.source && { source: response.vad.source }),
316
+ ...(response.vad.speakerId !== undefined && { speakerId: response.vad.speakerId })
314
317
  };
315
318
  }
316
319
  if (response.endOfTurn) {
@@ -1,5 +1,5 @@
1
- import { stream as streamRpc } from '../rpc/rpc-client.js';
2
- import { generateClientRequestId } from './client-request-id.js';
1
+ import { stream as streamRpc } from '../../client/rpc/rpc-client.js';
2
+ import { generateClientRequestId } from '../../client/api/client-request-id.js';
3
3
  import { translateResponseSchema } from '@qvac/inference/surface';
4
4
  /**
5
5
  * Translates text from one language to another using a specified translation model.
@@ -1,7 +1,7 @@
1
1
  import { isBare } from 'which-runtime';
2
2
  import {} from '@qvac/inference/surface';
3
- import { send, close } from '../rpc/rpc-client.js';
4
- import { stopLoggingStreamForModel } from '../logging-stream-registry.js';
3
+ import { send, close } from '../../client/rpc/rpc-client.js';
4
+ import { stopLoggingStreamForModel } from '../../client/logging-stream-registry.js';
5
5
  import { InvalidResponseError, ModelUnloadFailedError } from '../../utils/errors-client.js';
6
6
  import { getClientLogger } from '../../logging/index.js';
7
7
  const logger = getClientLogger();
@@ -1,5 +1,5 @@
1
1
  import { upscaleStreamResponseSchema } from '@qvac/inference/surface';
2
- import { stream as streamRpc } from '../rpc/rpc-client.js';
2
+ import { stream as streamRpc } from '../../client/rpc/rpc-client.js';
3
3
  import { decodeBase64, encodeBase64 } from '../../utils/encoding.js';
4
4
  import { StreamEndedError } from '../../utils/errors-client.js';
5
5
  /**
@@ -1,4 +1,4 @@
1
- import { send } from '../rpc/rpc-client.js';
1
+ import { send } from '../../client/rpc/rpc-client.js';
2
2
  import { type CreateVectorIndexParams, type LoadVectorIndexParams, type RPCOptions, type VectorIndexAddParams, type VectorIndexHit, type VectorIndexIdsParams, type VectorIndexStorage, type VectorIndexWriteParams } from '@qvac/inference/surface';
3
3
  /**
4
4
  * A handle to a vector index that lives in worker memory.
@@ -1,4 +1,4 @@
1
- import { send } from '../rpc/rpc-client.js';
1
+ import { send } from '../../client/rpc/rpc-client.js';
2
2
  import { DEFAULT_VECTOR_INDEX_STORAGE, findVectorRowLengthMismatch, toWireVectorIds } from '@qvac/inference/surface';
3
3
  import { InvalidOperationError, InvalidResponseError, RequestValidationFailedError } from '../../utils/errors-client.js';
4
4
  /**
@@ -9,10 +9,10 @@ export declare function createVideoStreamRequest(params: VideoClientParams, requ
9
9
  modelId: string;
10
10
  seed?: number | undefined;
11
11
  vae_tiling?: boolean | undefined;
12
+ steps?: number | undefined;
12
13
  negative_prompt?: string | undefined;
13
14
  width?: number | undefined;
14
15
  height?: number | undefined;
15
- steps?: number | undefined;
16
16
  cfg_scale?: number | undefined;
17
17
  sampling_method?: "euler" | "euler_a" | "heun" | "dpm2" | "dpm++2m" | "dpm++2mv2" | "dpm++2s_a" | "lcm" | "ipndm" | "ipndm_v" | "ddim_trailing" | "tcd" | "res_multistep" | "res_2s" | undefined;
18
18
  scheduler?: "lcm" | "discrete" | "karras" | "exponential" | "ays" | "gits" | "sgm_uniform" | "simple" | "smoothstep" | "kl_optimal" | "bong_tangent" | "ltx2" | undefined;
@@ -50,10 +50,10 @@ export declare function createVideoStreamRequest(params: VideoClientParams, requ
50
50
  modelId: string;
51
51
  seed?: number | undefined;
52
52
  vae_tiling?: boolean | undefined;
53
+ steps?: number | undefined;
53
54
  negative_prompt?: string | undefined;
54
55
  width?: number | undefined;
55
56
  height?: number | undefined;
56
- steps?: number | undefined;
57
57
  cfg_scale?: number | undefined;
58
58
  sampling_method?: "euler" | "euler_a" | "heun" | "dpm2" | "dpm++2m" | "dpm++2mv2" | "dpm++2s_a" | "lcm" | "ipndm" | "ipndm_v" | "ddim_trailing" | "tcd" | "res_multistep" | "res_2s" | undefined;
59
59
  scheduler?: "lcm" | "discrete" | "karras" | "exponential" | "ays" | "gits" | "sgm_uniform" | "simple" | "smoothstep" | "kl_optimal" | "bong_tangent" | "ltx2" | undefined;
@@ -91,10 +91,10 @@ export declare function createVideoStreamRequest(params: VideoClientParams, requ
91
91
  modelId: string;
92
92
  seed?: number | undefined;
93
93
  vae_tiling?: boolean | undefined;
94
+ steps?: number | undefined;
94
95
  negative_prompt?: string | undefined;
95
96
  width?: number | undefined;
96
97
  height?: number | undefined;
97
- steps?: number | undefined;
98
98
  cfg_scale?: number | undefined;
99
99
  sampling_method?: "euler" | "euler_a" | "heun" | "dpm2" | "dpm++2m" | "dpm++2mv2" | "dpm++2s_a" | "lcm" | "ipndm" | "ipndm_v" | "ddim_trailing" | "tcd" | "res_multistep" | "res_2s" | undefined;
100
100
  scheduler?: "lcm" | "discrete" | "karras" | "exponential" | "ays" | "gits" | "sgm_uniform" | "simple" | "smoothstep" | "kl_optimal" | "bong_tangent" | "ltx2" | undefined;
@@ -132,10 +132,10 @@ export declare function createVideoStreamRequest(params: VideoClientParams, requ
132
132
  modelId: string;
133
133
  seed?: number | undefined;
134
134
  vae_tiling?: boolean | undefined;
135
+ steps?: number | undefined;
135
136
  negative_prompt?: string | undefined;
136
137
  width?: number | undefined;
137
138
  height?: number | undefined;
138
- steps?: number | undefined;
139
139
  cfg_scale?: number | undefined;
140
140
  sampling_method?: "euler" | "euler_a" | "heun" | "dpm2" | "dpm++2m" | "dpm++2mv2" | "dpm++2s_a" | "lcm" | "ipndm" | "ipndm_v" | "ddim_trailing" | "tcd" | "res_multistep" | "res_2s" | undefined;
141
141
  scheduler?: "lcm" | "discrete" | "karras" | "exponential" | "ays" | "gits" | "sgm_uniform" | "simple" | "smoothstep" | "kl_optimal" | "bong_tangent" | "ltx2" | undefined;
@@ -173,10 +173,10 @@ export declare function createVideoStreamRequest(params: VideoClientParams, requ
173
173
  modelId: string;
174
174
  seed?: number | undefined;
175
175
  vae_tiling?: boolean | undefined;
176
+ steps?: number | undefined;
176
177
  negative_prompt?: string | undefined;
177
178
  width?: number | undefined;
178
179
  height?: number | undefined;
179
- steps?: number | undefined;
180
180
  cfg_scale?: number | undefined;
181
181
  sampling_method?: "euler" | "euler_a" | "heun" | "dpm2" | "dpm++2m" | "dpm++2mv2" | "dpm++2s_a" | "lcm" | "ipndm" | "ipndm_v" | "ddim_trailing" | "tcd" | "res_multistep" | "res_2s" | undefined;
182
182
  scheduler?: "lcm" | "discrete" | "karras" | "exponential" | "ays" | "gits" | "sgm_uniform" | "simple" | "smoothstep" | "kl_optimal" | "bong_tangent" | "ltx2" | undefined;
@@ -16,12 +16,15 @@ export interface VideoResult {
16
16
  * @param params - Video request parameters (model, prompt, dimensions, frame count, fps, sampler, seed, etc.).
17
17
  * @returns A result object exposing `requestId` (stable identifier for this in-flight generation), `progressStream` (async iterator of `{ step, totalSteps, elapsedMs }`), `outputs` (promise of the generated video buffers, typically a single AVI file), and `stats` (promise of generation statistics).
18
18
  *
19
- * Supports `txt2vid` (text-to-video) and `img2vid` (image-to-video) for both the
20
- * Wan and LTX-2 layouts. For Wan `img2vid`, load the pipeline with
19
+ * Supports `txt2vid` (text-to-video) and `img2vid` (image-to-video) for Wan,
20
+ * LTX-2, and MiniMax H3. For Wan `img2vid`, load the pipeline with
21
21
  * `modelConfig.clipVisionModelSrc` set to `clip_vision_h.safetensors`; LTX-2
22
22
  * `img2vid` conditions on the first frame through its video VAE and needs no
23
23
  * CLIP vision weights (the same LTX-2 model loaded for txt2vid also does
24
- * img2vid). On React Native, the bundled video diffusion models are too large
24
+ * img2vid). MiniMax H3 also conditions through its video VAE; load its text
25
+ * encoder companion and optionally its audio VAE for synchronized audio. H3
26
+ * frames must satisfy `17*k + 5`, and its native frame rate is 24 FPS. On
27
+ * React Native, the bundled video diffusion models are too large
25
28
  * for typical mobile devices.
26
29
  *
27
30
  * @example Basic txt2vid generation
@@ -64,6 +67,23 @@ export interface VideoResult {
64
67
  * });
65
68
  * ```
66
69
  *
70
+ * @example MiniMax H3 image-to-video
71
+ * ```typescript
72
+ * const firstFrame = fs.readFileSync("first-frame.png");
73
+ * const { outputs } = video({
74
+ * modelId,
75
+ * mode: "img2vid",
76
+ * prompt: "A sailboat glides across a calm bay as the camera follows it.",
77
+ * init_image: firstFrame,
78
+ * width: 864,
79
+ * height: 480,
80
+ * video_frames: 22,
81
+ * fps: 24,
82
+ * cfg_scale: 1,
83
+ * });
84
+ * fs.writeFileSync("h3-output.avi", (await outputs)[0]);
85
+ * ```
86
+ *
67
87
  * @example With control frames (e.g. for guided generation)
68
88
  * ```typescript
69
89
  * const frameA = fs.readFileSync("frame-a.png");
@@ -1,7 +1,7 @@
1
1
  import { videoStreamResponseSchema } from '@qvac/inference/surface';
2
- import { stream as streamRpc } from '../rpc/rpc-client.js';
3
- import { generateClientRequestId } from './client-request-id.js';
4
- import { createVideoStreamRequest } from './video-request.js';
2
+ import { stream as streamRpc } from '../../client/rpc/rpc-client.js';
3
+ import { generateClientRequestId } from '../../client/api/client-request-id.js';
4
+ import { createVideoStreamRequest } from '../../client/api/video-request.js';
5
5
  import { decodeBase64 } from '../../utils/encoding.js';
6
6
  /**
7
7
  * Generates a video using a loaded video diffusion model.
@@ -9,12 +9,15 @@ import { decodeBase64 } from '../../utils/encoding.js';
9
9
  * @param params - Video request parameters (model, prompt, dimensions, frame count, fps, sampler, seed, etc.).
10
10
  * @returns A result object exposing `requestId` (stable identifier for this in-flight generation), `progressStream` (async iterator of `{ step, totalSteps, elapsedMs }`), `outputs` (promise of the generated video buffers, typically a single AVI file), and `stats` (promise of generation statistics).
11
11
  *
12
- * Supports `txt2vid` (text-to-video) and `img2vid` (image-to-video) for both the
13
- * Wan and LTX-2 layouts. For Wan `img2vid`, load the pipeline with
12
+ * Supports `txt2vid` (text-to-video) and `img2vid` (image-to-video) for Wan,
13
+ * LTX-2, and MiniMax H3. For Wan `img2vid`, load the pipeline with
14
14
  * `modelConfig.clipVisionModelSrc` set to `clip_vision_h.safetensors`; LTX-2
15
15
  * `img2vid` conditions on the first frame through its video VAE and needs no
16
16
  * CLIP vision weights (the same LTX-2 model loaded for txt2vid also does
17
- * img2vid). On React Native, the bundled video diffusion models are too large
17
+ * img2vid). MiniMax H3 also conditions through its video VAE; load its text
18
+ * encoder companion and optionally its audio VAE for synchronized audio. H3
19
+ * frames must satisfy `17*k + 5`, and its native frame rate is 24 FPS. On
20
+ * React Native, the bundled video diffusion models are too large
18
21
  * for typical mobile devices.
19
22
  *
20
23
  * @example Basic txt2vid generation
@@ -57,6 +60,23 @@ import { decodeBase64 } from '../../utils/encoding.js';
57
60
  * });
58
61
  * ```
59
62
  *
63
+ * @example MiniMax H3 image-to-video
64
+ * ```typescript
65
+ * const firstFrame = fs.readFileSync("first-frame.png");
66
+ * const { outputs } = video({
67
+ * modelId,
68
+ * mode: "img2vid",
69
+ * prompt: "A sailboat glides across a calm bay as the camera follows it.",
70
+ * init_image: firstFrame,
71
+ * width: 864,
72
+ * height: 480,
73
+ * video_frames: 22,
74
+ * fps: 24,
75
+ * cfg_scale: 1,
76
+ * });
77
+ * fs.writeFileSync("h3-output.avi", (await outputs)[0]);
78
+ * ```
79
+ *
60
80
  * @example With control frames (e.g. for guided generation)
61
81
  * ```typescript
62
82
  * const frameA = fs.readFileSync("frame-a.png");
@@ -1,6 +1,6 @@
1
1
  import { MAX_SCENE_IMAGE_BYTES, walkKeySchema, worldSceneStreamRequestSchema, worldSceneStreamResponseSchema, worldStepStreamRequestSchema, worldStepStreamResponseSchema } from '@qvac/inference/surface';
2
- import { parseClientInput } from '../parse-input.js';
3
- import { generateClientRequestId } from './client-request-id.js';
2
+ import { parseClientInput } from '../../client/parse-input.js';
3
+ import { generateClientRequestId } from '../../client/api/client-request-id.js';
4
4
  import { decodeBase64, encodeBase64 } from '../../utils/encoding.js';
5
5
  import { InvalidResponseError, RequestValidationFailedError, StreamEndedError } from '../../utils/errors-client.js';
6
6
  import { InferenceCancelledError } from '../../utils/errors-server.js';
@@ -1,5 +1,5 @@
1
1
  import type { WorldSceneClientParams, WorldStepClientParams } from '@qvac/inference/surface';
2
- import { type WorldSceneResult, type WorldSceneResultWithPack, type WorldStepResult } from './world-result.js';
2
+ import { type WorldSceneResult, type WorldSceneResultWithPack, type WorldStepResult } from '../../client/api/world-result.js';
3
3
  /**
4
4
  * Builds a world for an ABot-World session: the prompt and first frame are
5
5
  * encoded into a scene pack the walk then runs on.
@@ -1,5 +1,5 @@
1
- import { stream as streamRpc } from '../rpc/rpc-client.js';
2
- import { createWorldSceneResult, createWorldStepResult } from './world-result.js';
1
+ import { stream as streamRpc } from '../../client/rpc/rpc-client.js';
2
+ import { createWorldSceneResult, createWorldStepResult } from '../../client/api/world-result.js';
3
3
  export function worldCreateScene(params) {
4
4
  return createWorldSceneResult(params, streamRpc);
5
5
  }
@@ -7,8 +7,10 @@ export function startLoggingStreamForModel(modelId, modelLogger) {
7
7
  logger.warn(`Logging stream already active for model ${modelId}`);
8
8
  return;
9
9
  }
10
- const streamIterator = loggingStream({ id: modelId });
11
- activeStreams.set(modelId, { logger: modelLogger, streamIterator });
10
+ const controller = new AbortController();
11
+ const streamIterator = loggingStream({ id: modelId }, { signal: controller.signal });
12
+ const entry = { logger: modelLogger, controller };
13
+ activeStreams.set(modelId, entry);
12
14
  try {
13
15
  void (async () => {
14
16
  try {
@@ -36,7 +38,9 @@ export function startLoggingStreamForModel(modelId, modelLogger) {
36
38
  logger.error(`Logging stream error for model ${modelId}:`, error);
37
39
  }
38
40
  finally {
39
- activeStreams.delete(modelId);
41
+ // A reload may have replaced this entry.
42
+ if (activeStreams.get(modelId) === entry)
43
+ activeStreams.delete(modelId);
40
44
  }
41
45
  })();
42
46
  }
@@ -50,9 +54,8 @@ export function stopLoggingStreamForModel(modelId) {
50
54
  const stream = activeStreams.get(modelId);
51
55
  if (stream) {
52
56
  activeStreams.delete(modelId);
53
- // Terminate the stream iterator - this will close the RPC connection
54
- // and the server-side async generator will automatically terminate
55
- void stream.streamIterator.return(undefined);
57
+ // `return()` would wait for a log an unloaded model never sends.
58
+ stream.controller.abort();
56
59
  logger.debug(`Stopped logging stream for model ${modelId}`);
57
60
  }
58
61
  }
@@ -1,4 +1,4 @@
1
- import * as hostApi from './api/index.js';
1
+ import * as hostApi from '../client/api/index.js';
2
2
  import type { QvacPlugin } from '@qvac/inference/surface';
3
3
  /**
4
4
  * Register plugins and return the client host API.
@@ -1,5 +1,5 @@
1
1
  import { registerPlugins } from '../server/plugins/index.js';
2
- import * as hostApi from './api/index.js';
2
+ import * as hostApi from '../client/api/index.js';
3
3
  /**
4
4
  * Register plugins and return the client host API.
5
5
  */
@@ -1,9 +1,9 @@
1
1
  import RPC from 'bare-rpc';
2
2
  import { RPCConnectionFailedError } from '../../utils/errors-client.js';
3
- import { initializeConfig } from '../init-hooks.js';
4
- import { resolveConfig } from '../config-loader/resolve-config.expo.js';
3
+ import { initializeConfig } from '../../client/init-hooks.js';
4
+ import { resolveConfig } from '../../client/config-loader/resolve-config.expo.js';
5
5
  import { getClientLogger } from '../../logging/index.js';
6
- import { getDeviceInfo } from './expo-device-info.js';
6
+ import { getDeviceInfo } from '../../client/rpc/expo-device-info.js';
7
7
  const logger = getClientLogger();
8
8
  let rpcInstance = null;
9
9
  let rpcPromise = null;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Create the endpoint the worker dials.
3
+ *
4
+ * On Unix the socket sits in a fresh directory that only the current user can
5
+ * enter, so other local users cannot reach it whatever the process umask. On
6
+ * Windows it is a named pipe, whose default access already denies other users.
7
+ */
8
+ export declare function createIPCSocketPath(): string;
9
+ /** Remove the socket file and its directory. Named pipes have nothing to remove. */
10
+ export declare function removeIPCSocketPath(socketPath: string): void;
11
+ //# sourceMappingURL=ipc-socket-path.d.ts.map
@@ -0,0 +1,30 @@
1
+ import { randomBytes } from 'node:crypto';
2
+ import fs from 'node:fs';
3
+ import os from 'node:os';
4
+ import path from 'node:path';
5
+ const SOCKET_FILE_NAME = 'worker.sock';
6
+ /**
7
+ * Create the endpoint the worker dials.
8
+ *
9
+ * On Unix the socket sits in a fresh directory that only the current user can
10
+ * enter, so other local users cannot reach it whatever the process umask. On
11
+ * Windows it is a named pipe, whose default access already denies other users.
12
+ */
13
+ export function createIPCSocketPath() {
14
+ if (process.platform === 'win32') {
15
+ const timestamp = Date.now().toString(36);
16
+ const randomSuffix = randomBytes(2).toString('hex');
17
+ return `\\\\.\\pipe\\qvac-worker-${process.pid}-${timestamp}-${randomSuffix}`;
18
+ }
19
+ const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'qvac-worker-'));
20
+ return path.join(dir, SOCKET_FILE_NAME);
21
+ }
22
+ /** Remove the socket file and its directory. Named pipes have nothing to remove. */
23
+ export function removeIPCSocketPath(socketPath) {
24
+ if (process.platform === 'win32')
25
+ return;
26
+ const dir = path.dirname(socketPath);
27
+ fs.rmSync(socketPath, { force: true });
28
+ if (fs.existsSync(dir))
29
+ fs.rmdirSync(dir);
30
+ }
@@ -1,16 +1,16 @@
1
1
  import RPC from 'bare-rpc';
2
2
  import spawn, {} from 'bare-runtime/spawn';
3
- import { randomBytes } from 'node:crypto';
4
- import fs, { existsSync, unlinkSync } from 'node:fs';
3
+ import fs from 'node:fs';
5
4
  import { createServer } from 'node:net';
6
5
  import os from 'node:os';
7
6
  import path from 'node:path';
8
7
  import { fileURLToPath } from 'node:url';
9
- import { initializeConfig } from '../init-hooks.js';
10
- import { resolveConfig } from '../config-loader/resolve-config.node.js';
8
+ import { initializeConfig } from '../../client/init-hooks.js';
9
+ import { resolveConfig } from '../../client/config-loader/resolve-config.node.js';
11
10
  import { getClientLogger, getLogger, SDK_SERVER_NAMESPACE } from '../../logging/index.js';
12
11
  import { BareRuntimeBinaryNotFoundError, RPCInitTimeoutError, WorkerCrashedError, WorkerShutdownError } from '../../utils/errors-client.js';
13
12
  import { createRPCInitTimeoutCause } from './worker-startup-error.js';
13
+ import { createIPCSocketPath, removeIPCSocketPath } from './ipc-socket-path.js';
14
14
  import { RPC_INIT_TIMEOUT_ENV_VAR, resolveRPCInitTimeoutMs } from './init-timeout.js';
15
15
  const WORKER_STDERR_TAIL_CHARS = 16_384;
16
16
  const logger = getClientLogger();
@@ -125,25 +125,14 @@ function resolveWorkerPath() {
125
125
  return defaultPath;
126
126
  }
127
127
  const WORKER_PATH = resolveWorkerPath();
128
- function createSocketPath() {
129
- const timestamp = Date.now().toString(36);
130
- const randomSuffix = randomBytes(2).toString('hex');
131
- const socketName = `qvac-worker-${process.pid}-${timestamp}-${randomSuffix}`;
132
- return process.platform === 'win32'
133
- ? `\\\\.\\pipe\\${socketName}`
134
- : path.join(os.tmpdir(), `${socketName}.sock`);
135
- }
136
- function bestEffortUnlinkSocket(socketPath) {
137
- // Windows named pipes are not filesystem paths, so unlink is Unix-only.
138
- if (!socketPath || process.platform === 'win32')
128
+ function bestEffortRemoveSocket(socketPath) {
129
+ if (!socketPath)
139
130
  return;
140
131
  try {
141
- if (existsSync(socketPath)) {
142
- unlinkSync(socketPath);
143
- }
132
+ removeIPCSocketPath(socketPath);
144
133
  }
145
134
  catch (error) {
146
- logger.debug('Failed to unlink IPC socket path', { socketPath, error });
135
+ logger.debug('Failed to remove IPC socket path', { socketPath, error });
147
136
  }
148
137
  }
149
138
  function appendWorkerStderrTail(current, chunk) {
@@ -188,7 +177,7 @@ function teardownFailedInit() {
188
177
  logger.debug('Failed to close IPC server after init failure', { error });
189
178
  }
190
179
  }
191
- bestEffortUnlinkSocket(socketPathToClose);
180
+ bestEffortRemoveSocket(socketPathToClose);
192
181
  }
193
182
  export function getWorkerLifeSignal() {
194
183
  return workerLifeController?.signal ?? null;
@@ -220,7 +209,7 @@ export function notifyChannelClosed() {
220
209
  logger.debug('Failed to close IPC server after channel close', { error });
221
210
  }
222
211
  }
223
- bestEffortUnlinkSocket(socketPathToClose);
212
+ bestEffortRemoveSocket(socketPathToClose);
224
213
  controller.abort(new WorkerCrashedError(null, null));
225
214
  }
226
215
  function getWorkerStderr(proc) {
@@ -258,7 +247,7 @@ function handlePostHandshakeExit(code, exitSignal, spawn) {
258
247
  logger.debug('Failed to close IPC server after worker crash', { err });
259
248
  }
260
249
  spawn.controller.abort(new WorkerCrashedError(code, exitSignal));
261
- bestEffortUnlinkSocket(spawn.socketPath);
250
+ bestEffortRemoveSocket(spawn.socketPath);
262
251
  }
263
252
  function closeSyncForExit() {
264
253
  // Abort before kill so the exit handler sees planned intent.
@@ -280,7 +269,7 @@ function closeSyncForExit() {
280
269
  logger.debug('Failed to close IPC server during process exit', { error });
281
270
  }
282
271
  }
283
- bestEffortUnlinkSocket(socketPathToClose);
272
+ bestEffortRemoveSocket(socketPathToClose);
284
273
  }
285
274
  /** Distinguishes "config file failed to load" from "no config file present". */
286
275
  const CONFIG_UNRESOLVED = Symbol('config-unresolved');
@@ -316,7 +305,7 @@ async function ensureRPC() {
316
305
  configValue: preresolved === CONFIG_UNRESOLVED ? undefined : (preresolved?.rpcInitTimeoutMs ?? undefined),
317
306
  onInvalidEnvValue: (value) => logger.warn(`Ignoring invalid ${RPC_INIT_TIMEOUT_ENV_VAR}=${value}; expected a positive integer of milliseconds`)
318
307
  });
319
- const socketPath = createSocketPath();
308
+ const socketPath = createIPCSocketPath();
320
309
  currentSocketPath = socketPath;
321
310
  // Allocated here so the init race and exit handler share one controller.
322
311
  const spawnController = new AbortController();
@@ -505,7 +494,7 @@ export async function close() {
505
494
  }
506
495
  });
507
496
  }
508
- bestEffortUnlinkSocket(socketPathToClose);
497
+ bestEffortRemoveSocket(socketPathToClose);
509
498
  })();
510
499
  try {
511
500
  await closePromise;
@@ -1,7 +1,8 @@
1
1
  import type RPC from 'bare-rpc';
2
- import { type Request, type Response, type RPCOptions } from '@qvac/inference/surface';
2
+ import { type AbortableRPCOptions, type Request, type Response, type RPCOptions } from '@qvac/inference/surface';
3
3
  export declare function send<T extends Request>(request: T, options?: RPCOptions, rpc?: RPC): Promise<Response>;
4
- export declare function stream<T extends Request>(request: T, options?: RPCOptions, rpc?: RPC): AsyncGenerator<Response>;
4
+ /** `options.signal` ends the stream; only `endsOnAbort` handlers stop on the worker. */
5
+ export declare function stream<T extends Request>(request: T, options?: AbortableRPCOptions, rpc?: RPC): AsyncGenerator<Response>;
5
6
  export interface DuplexWritable {
6
7
  write(chunk: Uint8Array): void;
7
8
  end(): void;