@qvac/sdk 0.23.0 → 0.24.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (239) hide show
  1. package/NOTICE +115 -58
  2. package/README.md +10 -13
  3. package/dist/examples/asr/parakeet-sortformer.js +24 -14
  4. package/dist/examples/asr/parakeet-transcribepsy-filesystem.js +40 -11
  5. package/dist/examples/asr/parakeet-unified-coreml.js +14 -9
  6. package/dist/examples/asr/whispercpp-prompt.js +9 -5
  7. package/dist/examples/assess-model-fit.d.ts +7 -9
  8. package/dist/examples/assess-model-fit.js +22 -43
  9. package/dist/examples/calc-tokens.d.ts +2 -0
  10. package/dist/examples/calc-tokens.js +21 -0
  11. package/dist/examples/classification/classify-image.js +11 -5
  12. package/dist/examples/completion-stop-reason.d.ts +3 -3
  13. package/dist/examples/completion-stop-reason.js +4 -4
  14. package/dist/examples/diffusion-flux3-klein.d.ts +2 -0
  15. package/dist/examples/diffusion-flux3-klein.js +102 -0
  16. package/dist/examples/diffusion-moss-image.d.ts +2 -0
  17. package/dist/examples/diffusion-moss-image.js +126 -0
  18. package/dist/examples/diffusion-qwen-image-21.js +15 -4
  19. package/dist/examples/embed-multimodal.d.ts +2 -0
  20. package/dist/examples/embed-multimodal.js +80 -0
  21. package/dist/examples/embed-p2p.js +2 -2
  22. package/dist/examples/image/megaloc.d.ts +2 -0
  23. package/dist/examples/image/megaloc.js +37 -0
  24. package/dist/examples/llamacpp-multimodal.js +18 -0
  25. package/dist/examples/rag/rag-hyperdb/pipeline.js +2 -2
  26. package/dist/examples/rag/rag-turbovec.js +2 -2
  27. package/dist/examples/sessions.d.ts +17 -0
  28. package/dist/examples/sessions.js +63 -0
  29. package/dist/examples/tools/llamacpp-deferred-tools.js +8 -4
  30. package/dist/scripts/check-resource-collectors-packaging.js +7 -6
  31. package/dist/scripts/contract/build-contract.d.ts +2 -1
  32. package/dist/scripts/contract/build-contract.js +13 -1
  33. package/dist/scripts/contract/constants-registry.d.ts +17 -0
  34. package/dist/scripts/contract/constants-registry.js +8 -2
  35. package/dist/scripts/contract/method-shapes.d.ts +4 -0
  36. package/dist/scripts/contract/method-shapes.js +4 -0
  37. package/dist/scripts/enforce-inference-versions.d.ts +1 -1
  38. package/dist/scripts/enforce-inference-versions.js +28 -18
  39. package/dist/scripts/generate-bare-kit-runtimes.js +101 -69
  40. package/dist/src/client/api/assess-model-fit.d.ts +17 -17
  41. package/dist/src/client/api/assess-model-fit.js +18 -31
  42. package/dist/src/client/api/audio-edit.d.ts +5 -3
  43. package/dist/src/client/api/audio-edit.js +5 -3
  44. package/dist/src/client/api/audio-gen-result.js +134 -45
  45. package/dist/src/client/api/audio-gen.d.ts +40 -3
  46. package/dist/src/client/api/audio-gen.js +40 -3
  47. package/dist/src/client/api/audio-understand.d.ts +2 -2
  48. package/dist/src/client/api/audio-understand.js +2 -2
  49. package/dist/src/client/api/batch-completion.js +2 -1
  50. package/dist/src/client/api/calc-tokens.d.ts +33 -0
  51. package/dist/src/client/api/calc-tokens.js +44 -0
  52. package/dist/src/client/api/cancel.d.ts +2 -2
  53. package/dist/src/client/api/cancel.js +2 -2
  54. package/dist/src/client/api/classify.d.ts +12 -5
  55. package/dist/src/client/api/classify.js +17 -5
  56. package/dist/src/client/api/client-request-id.d.ts +0 -15
  57. package/dist/src/client/api/client-request-id.js +15 -12
  58. package/dist/src/client/api/completion-stream.d.ts +8 -1
  59. package/dist/src/client/api/completion-stream.js +10 -1
  60. package/dist/src/client/api/delete-cache.d.ts +9 -2
  61. package/dist/src/client/api/delete-cache.js +13 -3
  62. package/dist/src/client/api/diffusion.d.ts +20 -4
  63. package/dist/src/client/api/diffusion.js +23 -5
  64. package/dist/src/client/api/embed.d.ts +82 -29
  65. package/dist/src/client/api/embed.js +64 -19
  66. package/dist/src/client/api/get-model-info.d.ts +2 -2
  67. package/dist/src/client/api/get-model-info.js +2 -2
  68. package/dist/src/client/api/get-system-resources.d.ts +2 -2
  69. package/dist/src/client/api/get-system-resources.js +2 -2
  70. package/dist/src/client/api/heartbeat.d.ts +3 -2
  71. package/dist/src/client/api/heartbeat.js +3 -2
  72. package/dist/src/client/api/index.d.ts +4 -3
  73. package/dist/src/client/api/index.js +2 -1
  74. package/dist/src/client/api/invoke-plugin.d.ts +8 -2
  75. package/dist/src/client/api/invoke-plugin.js +17 -2
  76. package/dist/src/client/api/load-model.js +5 -2
  77. package/dist/src/client/api/ocr.d.ts +5 -3
  78. package/dist/src/client/api/ocr.js +44 -21
  79. package/dist/src/client/api/rag.d.ts +1 -1
  80. package/dist/src/client/api/rag.js +1 -1
  81. package/dist/src/client/api/registry.d.ts +17 -7
  82. package/dist/src/client/api/registry.js +37 -12
  83. package/dist/src/client/api/resume.d.ts +2 -1
  84. package/dist/src/client/api/resume.js +2 -2
  85. package/dist/src/client/api/rpc-server.d.ts +4 -4
  86. package/dist/src/client/api/rpc-server.js +10 -10
  87. package/dist/src/client/api/state.d.ts +2 -2
  88. package/dist/src/client/api/state.js +2 -2
  89. package/dist/src/client/api/subscribe-logs.d.ts +2 -2
  90. package/dist/src/client/api/subscribe-logs.js +2 -2
  91. package/dist/src/client/api/suspend.d.ts +4 -2
  92. package/dist/src/client/api/suspend.js +4 -3
  93. package/dist/src/client/api/text-to-speech.d.ts +14 -5
  94. package/dist/src/client/api/text-to-speech.js +83 -29
  95. package/dist/src/client/api/transcribe.d.ts +6 -2
  96. package/dist/src/client/api/transcribe.js +7 -1
  97. package/dist/src/client/api/unload-model.d.ts +19 -7
  98. package/dist/src/client/api/unload-model.js +29 -11
  99. package/dist/src/client/api/upscale.d.ts +6 -3
  100. package/dist/src/client/api/upscale.js +9 -4
  101. package/dist/src/client/api/vector-index.d.ts +50 -16
  102. package/dist/src/client/api/vector-index.js +100 -48
  103. package/dist/src/client/api/video-request.d.ts +5 -5
  104. package/dist/src/client/api/video.d.ts +3 -2
  105. package/dist/src/client/api/video.js +3 -2
  106. package/dist/src/client/api/vla.d.ts +9 -5
  107. package/dist/src/client/api/vla.js +17 -8
  108. package/dist/src/client/api/world.d.ts +5 -5
  109. package/dist/src/client/api/world.js +4 -4
  110. package/dist/src/client/init-hooks.d.ts +6 -4
  111. package/dist/src/client/init-hooks.js +12 -15
  112. package/dist/src/client/logging-stream-registry.d.ts +6 -3
  113. package/dist/src/client/logging-stream-registry.js +31 -12
  114. package/dist/src/client/rpc/bundle-stamp.d.ts +29 -0
  115. package/dist/src/client/rpc/bundle-stamp.js +75 -0
  116. package/dist/src/client/rpc/expo-home-dir.d.ts +2 -0
  117. package/dist/src/client/rpc/expo-home-dir.js +4 -0
  118. package/dist/src/client/rpc/expo-rpc-client.js +189 -135
  119. package/dist/src/client/rpc/node-rpc-client.js +322 -413
  120. package/dist/src/client/rpc/pear-runtime.d.ts +12 -0
  121. package/dist/src/client/rpc/pear-runtime.js +12 -0
  122. package/dist/src/client/rpc/rpc-client.d.ts +5 -4
  123. package/dist/src/client/rpc/rpc-client.js +126 -23
  124. package/dist/src/client/rpc/rpc-error.js +21 -2
  125. package/dist/src/client/rpc/unbundled-harness.d.ts +16 -0
  126. package/dist/src/client/rpc/unbundled-harness.js +27 -0
  127. package/dist/src/client/rpc/worker-failure.d.ts +27 -0
  128. package/dist/src/client/rpc/worker-failure.js +61 -0
  129. package/dist/src/client/session-registry.d.ts +75 -0
  130. package/dist/src/client/session-registry.js +149 -0
  131. package/dist/src/client/session.d.ts +125 -0
  132. package/dist/src/client/session.js +148 -0
  133. package/dist/src/commands/bundle/addons.d.ts +14 -0
  134. package/dist/src/commands/bundle/addons.js +65 -0
  135. package/dist/src/commands/bundle/constants.js +1 -0
  136. package/dist/src/commands/bundle/entry-gen.d.ts +1 -5
  137. package/dist/src/commands/bundle/entry-gen.js +17 -50
  138. package/dist/src/commands/bundle/index.d.ts +59 -13
  139. package/dist/src/commands/bundle/index.js +345 -121
  140. package/dist/src/commands/bundle/link.d.ts +58 -0
  141. package/dist/src/commands/bundle/link.js +135 -0
  142. package/dist/src/commands/bundle/node-support.d.ts +13 -0
  143. package/dist/src/commands/bundle/node-support.js +23 -0
  144. package/dist/src/commands/bundle/read-bundle.d.ts +9 -0
  145. package/dist/src/commands/bundle/read-bundle.js +27 -0
  146. package/dist/src/commands/bundle/resolve-sdk-import.d.ts +6 -0
  147. package/dist/src/commands/bundle/resolve-sdk-import.js +24 -28
  148. package/dist/src/commands/bundle/scratch.d.ts +35 -0
  149. package/dist/src/commands/bundle/scratch.js +178 -0
  150. package/dist/src/commands/bundle/targets.d.ts +14 -0
  151. package/dist/src/commands/bundle/targets.js +37 -0
  152. package/dist/src/commands/host-prebuilds/index.d.ts +5 -4
  153. package/dist/src/commands/host-prebuilds/index.js +9 -7
  154. package/dist/src/commands/index.d.ts +4 -3
  155. package/dist/src/commands/verify/abi.d.ts +20 -14
  156. package/dist/src/commands/verify/abi.js +11 -79
  157. package/dist/src/commands/verify/bare-kit-runtime.d.ts +20 -22
  158. package/dist/src/commands/verify/bare-kit-runtime.js +102 -150
  159. package/dist/src/commands/verify/bare-kit-runtimes.d.ts +10 -9
  160. package/dist/src/commands/verify/bare-kit-runtimes.js +21 -21
  161. package/dist/src/commands/verify/bundle-source.js +25 -21
  162. package/dist/src/commands/verify/engines-advice.d.ts +2 -8
  163. package/dist/src/commands/verify/engines-advice.js +7 -54
  164. package/dist/src/commands/verify/index.d.ts +30 -29
  165. package/dist/src/commands/verify/index.js +92 -200
  166. package/dist/src/commands/verify/prebuilds.d.ts +3 -5
  167. package/dist/src/commands/verify/prebuilds.js +1 -2
  168. package/dist/src/commands/verify/resource-collectors.d.ts +0 -6
  169. package/dist/src/commands/verify/resource-collectors.js +1 -50
  170. package/dist/src/commands/verify/sidecar-runtime.d.ts +6 -0
  171. package/dist/src/commands/verify/sidecar-runtime.js +51 -0
  172. package/dist/src/expo/plugins/withBareKit.d.ts +59 -0
  173. package/dist/src/expo/plugins/withBareKit.js +204 -0
  174. package/dist/src/expo/plugins/withMobileBundle.d.ts +4 -11
  175. package/dist/src/expo/plugins/withMobileBundle.js +36 -57
  176. package/dist/src/expo/plugins/withQvacSDK.d.ts +1 -0
  177. package/dist/src/expo/plugins/withQvacSDK.js +3 -0
  178. package/dist/src/index.d.ts +6 -5
  179. package/dist/src/index.js +10 -14
  180. package/dist/src/logging/utils.js +10 -2
  181. package/dist/src/plugin-ids.d.ts +2 -1
  182. package/dist/src/plugin-ids.js +2 -0
  183. package/dist/src/schemas/public.d.ts +1 -1
  184. package/dist/src/schemas/public.js +1 -1
  185. package/dist/src/schemas/sdk-errors-client.d.ts +5 -6
  186. package/dist/src/schemas/sdk-errors-client.js +30 -36
  187. package/dist/src/schemas/sdk-errors-server.d.ts +11 -1
  188. package/dist/src/schemas/sdk-errors-server.js +60 -2
  189. package/dist/src/server/rpc/rpc-utils.d.ts +25 -4
  190. package/dist/src/server/rpc/rpc-utils.js +39 -5
  191. package/dist/src/utils/errors-client.d.ts +37 -29
  192. package/dist/src/utils/errors-client.js +50 -41
  193. package/dist/src/utils/errors-server.d.ts +59 -1
  194. package/dist/src/utils/errors-server.js +110 -1
  195. package/dist/src/utils/withTimeout.js +34 -17
  196. package/dist/src/worker/handle-request.js +25 -22
  197. package/dist/src/worker/handler-utils.d.ts +2 -6
  198. package/dist/src/worker/handler-utils.js +2 -20
  199. package/dist/src/worker/index.d.ts +2 -4
  200. package/dist/src/worker/index.js +23 -35
  201. package/dist/src/worker/plugins/ggml-image-embedding.d.ts +2 -0
  202. package/dist/src/worker/plugins/ggml-image-embedding.js +1 -0
  203. package/dist/src/worker/shim.d.ts +4 -0
  204. package/dist/src/worker/shim.js +7 -0
  205. package/dist/src/worker/start.d.ts +9 -0
  206. package/dist/src/worker/start.js +16 -0
  207. package/dist/src/worker/unbundled-shim.d.ts +2 -0
  208. package/dist/src/worker/unbundled-shim.js +4 -0
  209. package/docs/system-resources-support-matrix.md +27 -19
  210. package/package.json +62 -51
  211. package/src/electron-forge/index.cjs +65 -91
  212. package/dist/examples/model-fit-ui/server.d.ts +0 -24
  213. package/dist/examples/model-fit-ui/server.js +0 -221
  214. package/dist/src/client/rpc/ensure-worker-ready.d.ts +0 -9
  215. package/dist/src/client/rpc/ensure-worker-ready.js +0 -17
  216. package/dist/src/client/rpc/init-timeout.d.ts +0 -26
  217. package/dist/src/client/rpc/init-timeout.js +0 -25
  218. package/dist/src/client/rpc/ipc-socket-path.d.ts +0 -11
  219. package/dist/src/client/rpc/ipc-socket-path.js +0 -30
  220. package/dist/src/client/rpc/worker-startup-error.d.ts +0 -12
  221. package/dist/src/client/rpc/worker-startup-error.js +0 -13
  222. package/dist/src/commands/bundle/bare-pack.d.ts +0 -21
  223. package/dist/src/commands/bundle/bare-pack.js +0 -77
  224. package/dist/src/commands/bundle/manifest.d.ts +0 -25
  225. package/dist/src/commands/bundle/manifest.js +0 -192
  226. package/dist/src/expo/plugins/link-addons.d.ts +0 -18
  227. package/dist/src/expo/plugins/link-addons.js +0 -65
  228. package/dist/src/pear/pre.d.ts +0 -21
  229. package/dist/src/pear/pre.js +0 -450
  230. package/dist/src/server/env.d.ts +0 -22
  231. package/dist/src/server/env.js +0 -59
  232. package/dist/src/server/utils/qvac-paths.d.ts +0 -2
  233. package/dist/src/server/utils/qvac-paths.js +0 -5
  234. package/dist/src/server/utils/worker-lock.d.ts +0 -3
  235. package/dist/src/server/utils/worker-lock.js +0 -67
  236. package/dist/src/worker/create-server.d.ts +0 -8
  237. package/dist/src/worker/create-server.js +0 -51
  238. package/dist/src/worker/lifecycle.d.ts +0 -23
  239. package/dist/src/worker/lifecycle.js +0 -149
@@ -1,4 +1,4 @@
1
- import type { AudioGenClientParams, AudioGenResult } from '@qvac/inference/surface';
1
+ import type { AudioGenClientParams, AudioGenResult, RPCOptions } from '@qvac/inference/surface';
2
2
  /**
3
3
  * Generates PCM audio using a loaded AudioGen model.
4
4
  *
@@ -34,7 +34,11 @@ import type { AudioGenClientParams, AudioGenResult } from '@qvac/inference/surfa
34
34
  * @param params.taskType - `"text2music"` (default), `"cover-nofsq"`, or `"lego"`.
35
35
  * @param params.audioCoverStrength - Source-context strength for cover tasks (0..1).
36
36
  * @param params.coverNoiseStrength - Initial source/noise blend for cover tasks (0..1).
37
- * @returns A run with a synchronous request ID, generation progress stream, PCM audio promise, stats promise, and diagnostics promise describing the backend the run resolved to. An ACE-Step run's stats carry `metadata`: the caption, lyrics and musical metadata it rendered and the seed it used. A MiniMax run's stats carry its stage timings and `emittedFrames`.
37
+ * @param params.outputFormat - Also deliver the finished audio as a file in this container
38
+ * (`AUDIOGEN_OUTPUT_FORMATS`), through `run.encoded`. `"wav"` is always available; the
39
+ * compressed formats need the matching FFmpeg encoder on the inference host, and the request
40
+ * fails with `AUDIO_ENCODE_FAILED` before generation starts when it is missing.
41
+ * @returns A run with a synchronous request ID, generation progress stream, PCM audio promise, `chunkStream` (the same PCM as one `Int16Array` per engine chunk), `encoded` (the file for `outputFormat`, or `undefined`), stats promise, and diagnostics promise describing the backend the run resolved to. The engines emit the whole track as one chunk when generation finishes, so `chunkStream` is not incremental synthesis. The stats carry the primary backend the engine used (`backendDevice`, `backendId`) and `gpuFallbackReason`, the engine's code for a GPU request that landed on the CPU, which `diagnostics.fallback.reason` names. An ACE-Step run's stats carry `metadata`: the caption, lyrics and musical metadata it rendered and the seed it used. A MiniMax run's stats carry its stage timings and `emittedFrames`.
38
42
  *
39
43
  * @example
40
44
  * ```typescript
@@ -55,6 +59,14 @@ import type { AudioGenClientParams, AudioGenResult } from '@qvac/inference/surfa
55
59
  * const { pcm, sampleRate, channels, bitsPerSample } = await run.audio;
56
60
  * const stats = await run.stats;
57
61
  *
62
+ * // Ask for a file next to the PCM, and read the samples as Int16Array chunks:
63
+ * const flacRun = audioGen({ modelId, caption: "ambient electronic music", outputFormat: "flac" });
64
+ * for await (const samples of flacRun.chunkStream) {
65
+ * console.log(samples.length, "interleaved int16 samples");
66
+ * }
67
+ * const file = await flacRun.encoded;
68
+ * if (file) await fs.writeFile(`track.${file.extension}`, file.data);
69
+ *
58
70
  * // MiniMax-Music3 uses a local LM and synthesis GGUF pair:
59
71
  * const minimaxId = await loadModel({
60
72
  * modelType: "audiogen",
@@ -65,6 +77,31 @@ import type { AudioGenClientParams, AudioGenResult } from '@qvac/inference/surfa
65
77
  * device: "gpu", // fail the load instead of falling back to the CPU
66
78
  * },
67
79
  * });
80
+ *
81
+ * // On macOS 15+, run MiniMax through a compiled full Core ML profile instead:
82
+ * const coremlId = await loadModel({
83
+ * modelType: "audiogen",
84
+ * modelConfig: {
85
+ * engine: "minimax",
86
+ * lmModelSrc: "/models/mm3-lm-f16.gguf",
87
+ * synthModelSrc: "/models/mm3-synth-f16.gguf",
88
+ * coremlProfileDir: "/models/minimax-coreml",
89
+ * coremlComputeUnits: "CPU_AND_NE",
90
+ * },
91
+ * });
92
+ *
93
+ * // ACE-Step can name the backend of its pipeline and of its LM independently:
94
+ * const placedId = await loadModel({
95
+ * modelType: "audiogen",
96
+ * modelConfig: {
97
+ * textEncModelSrc,
98
+ * lmModelSrc,
99
+ * ditModelSrc,
100
+ * vaeModelSrc,
101
+ * backend: "CUDA0", // the load fails when the host cannot provide it
102
+ * lmBackend: "cpu",
103
+ * },
104
+ * });
68
105
  * const minimaxRun = audioGen({
69
106
  * modelId: minimaxId,
70
107
  * caption: "warm cinematic piano",
@@ -107,5 +144,5 @@ import type { AudioGenClientParams, AudioGenResult } from '@qvac/inference/surfa
107
144
  * });
108
145
  * ```
109
146
  */
110
- export declare function audioGen(params: AudioGenClientParams): AudioGenResult;
147
+ export declare function audioGen(params: AudioGenClientParams, options?: RPCOptions): AudioGenResult;
111
148
  //# sourceMappingURL=audio-gen.d.ts.map
@@ -35,7 +35,11 @@ import { createAudioGenResult } from '../../client/api/audio-gen-result.js';
35
35
  * @param params.taskType - `"text2music"` (default), `"cover-nofsq"`, or `"lego"`.
36
36
  * @param params.audioCoverStrength - Source-context strength for cover tasks (0..1).
37
37
  * @param params.coverNoiseStrength - Initial source/noise blend for cover tasks (0..1).
38
- * @returns A run with a synchronous request ID, generation progress stream, PCM audio promise, stats promise, and diagnostics promise describing the backend the run resolved to. An ACE-Step run's stats carry `metadata`: the caption, lyrics and musical metadata it rendered and the seed it used. A MiniMax run's stats carry its stage timings and `emittedFrames`.
38
+ * @param params.outputFormat - Also deliver the finished audio as a file in this container
39
+ * (`AUDIOGEN_OUTPUT_FORMATS`), through `run.encoded`. `"wav"` is always available; the
40
+ * compressed formats need the matching FFmpeg encoder on the inference host, and the request
41
+ * fails with `AUDIO_ENCODE_FAILED` before generation starts when it is missing.
42
+ * @returns A run with a synchronous request ID, generation progress stream, PCM audio promise, `chunkStream` (the same PCM as one `Int16Array` per engine chunk), `encoded` (the file for `outputFormat`, or `undefined`), stats promise, and diagnostics promise describing the backend the run resolved to. The engines emit the whole track as one chunk when generation finishes, so `chunkStream` is not incremental synthesis. The stats carry the primary backend the engine used (`backendDevice`, `backendId`) and `gpuFallbackReason`, the engine's code for a GPU request that landed on the CPU, which `diagnostics.fallback.reason` names. An ACE-Step run's stats carry `metadata`: the caption, lyrics and musical metadata it rendered and the seed it used. A MiniMax run's stats carry its stage timings and `emittedFrames`.
39
43
  *
40
44
  * @example
41
45
  * ```typescript
@@ -56,6 +60,14 @@ import { createAudioGenResult } from '../../client/api/audio-gen-result.js';
56
60
  * const { pcm, sampleRate, channels, bitsPerSample } = await run.audio;
57
61
  * const stats = await run.stats;
58
62
  *
63
+ * // Ask for a file next to the PCM, and read the samples as Int16Array chunks:
64
+ * const flacRun = audioGen({ modelId, caption: "ambient electronic music", outputFormat: "flac" });
65
+ * for await (const samples of flacRun.chunkStream) {
66
+ * console.log(samples.length, "interleaved int16 samples");
67
+ * }
68
+ * const file = await flacRun.encoded;
69
+ * if (file) await fs.writeFile(`track.${file.extension}`, file.data);
70
+ *
59
71
  * // MiniMax-Music3 uses a local LM and synthesis GGUF pair:
60
72
  * const minimaxId = await loadModel({
61
73
  * modelType: "audiogen",
@@ -66,6 +78,31 @@ import { createAudioGenResult } from '../../client/api/audio-gen-result.js';
66
78
  * device: "gpu", // fail the load instead of falling back to the CPU
67
79
  * },
68
80
  * });
81
+ *
82
+ * // On macOS 15+, run MiniMax through a compiled full Core ML profile instead:
83
+ * const coremlId = await loadModel({
84
+ * modelType: "audiogen",
85
+ * modelConfig: {
86
+ * engine: "minimax",
87
+ * lmModelSrc: "/models/mm3-lm-f16.gguf",
88
+ * synthModelSrc: "/models/mm3-synth-f16.gguf",
89
+ * coremlProfileDir: "/models/minimax-coreml",
90
+ * coremlComputeUnits: "CPU_AND_NE",
91
+ * },
92
+ * });
93
+ *
94
+ * // ACE-Step can name the backend of its pipeline and of its LM independently:
95
+ * const placedId = await loadModel({
96
+ * modelType: "audiogen",
97
+ * modelConfig: {
98
+ * textEncModelSrc,
99
+ * lmModelSrc,
100
+ * ditModelSrc,
101
+ * vaeModelSrc,
102
+ * backend: "CUDA0", // the load fails when the host cannot provide it
103
+ * lmBackend: "cpu",
104
+ * },
105
+ * });
69
106
  * const minimaxRun = audioGen({
70
107
  * modelId: minimaxId,
71
108
  * caption: "warm cinematic piano",
@@ -108,6 +145,6 @@ import { createAudioGenResult } from '../../client/api/audio-gen-result.js';
108
145
  * });
109
146
  * ```
110
147
  */
111
- export function audioGen(params) {
112
- return createAudioGenResult(params, streamRpc);
148
+ export function audioGen(params, options) {
149
+ return createAudioGenResult(params, (request) => streamRpc(request, options));
113
150
  }
@@ -1,4 +1,4 @@
1
- import type { AudioUnderstandClientParams, AudioUnderstandResult } from '@qvac/inference/surface';
1
+ import type { AudioUnderstandClientParams, AudioUnderstandResult, RPCOptions } from '@qvac/inference/surface';
2
2
  /**
3
3
  * Describes a recording with a loaded ACE-Step AudioGen model, running the
4
4
  * engine's reverse pipeline: the PCM is encoded, its FSQ semantic codes are
@@ -21,5 +21,5 @@ import type { AudioUnderstandClientParams, AudioUnderstandResult } from '@qvac/i
21
21
  * const remake = audioGen({ modelId, caption: "the same song, brighter mix", audioCodes });
22
22
  * ```
23
23
  */
24
- export declare function audioUnderstand(params: AudioUnderstandClientParams): AudioUnderstandResult;
24
+ export declare function audioUnderstand(params: AudioUnderstandClientParams, options?: RPCOptions): AudioUnderstandResult;
25
25
  //# sourceMappingURL=audio-understand.d.ts.map
@@ -22,6 +22,6 @@ import { createAudioUnderstandResult } from '../../client/api/audio-gen-result.j
22
22
  * const remake = audioGen({ modelId, caption: "the same song, brighter mix", audioCodes });
23
23
  * ```
24
24
  */
25
- export function audioUnderstand(params) {
26
- return createAudioUnderstandResult(params, streamRpc);
25
+ export function audioUnderstand(params, options) {
26
+ return createAudioUnderstandResult(params, (request) => streamRpc(request, options));
27
27
  }
@@ -56,7 +56,8 @@ async function resolveBatchPrompts(prompts) {
56
56
  generationParams: prompt.generationParams
57
57
  }),
58
58
  ...(prompt.responseFormat && { responseFormat: prompt.responseFormat }),
59
- ...(allTools.length > 0 && { tools: allTools })
59
+ ...(allTools.length > 0 && { tools: allTools }),
60
+ ...(prompt.toolSearch && { toolSearch: prompt.toolSearch })
60
61
  });
61
62
  }
62
63
  return { prompts: resolvedPrompts, handlers: resolvedHandlers };
@@ -0,0 +1,33 @@
1
+ import { send } from '../../client/rpc/rpc-client.js';
2
+ import { type CalcTokensParams, type RPCOptions, type Tool } from '@qvac/inference/surface';
3
+ import { type ToolInput } from '../../utils/tool-helpers.js';
4
+ type OmitTools<T> = T extends unknown ? Omit<T, 'tools'> : never;
5
+ export type CalcTokensClientParams = OmitTools<CalcTokensParams> & {
6
+ tools?: Tool[] | ToolInput[];
7
+ };
8
+ /**
9
+ * Counts tokens with a loaded language model without running generation.
10
+ *
11
+ * When neither `history` nor enabled tools are supplied, `text` is counted raw.
12
+ * Otherwise, the conversation is rendered with the model's chat template and
13
+ * `text`, when present, becomes its final user turn. Tools are counted only when
14
+ * the model was loaded with `modelConfig.tools: true`.
15
+ * `toolSearch` controls the limits rendered for deferred-tool search, matching
16
+ * `completion()`.
17
+ * Media content and attachments are not supported.
18
+ * The count uses every supplied tool and the load-time reasoning setting. A named
19
+ * `generationParams.tool_choice` or `generationParams.reasoning_budget` override on
20
+ * `completion()` can render a different prompt.
21
+ *
22
+ * @param params - Loaded model ID and at least one prompt source: `text` or non-empty `history`.
23
+ * @param options - RPC transport options.
24
+ * @returns The number of tokens in the prompt under the model's load-time settings.
25
+ * @throws {RequestValidationFailedError} If the request is invalid.
26
+ * @throws {ModelNotFoundError} If `modelId` is not loaded.
27
+ * @throws {ModelOperationNotSupportedError} If the loaded model is not a language model.
28
+ * @throws {InvalidResponseError} If the worker returns a malformed result.
29
+ */
30
+ export declare function calcTokens(params: CalcTokensClientParams, options?: RPCOptions): Promise<number>;
31
+ export declare function createCalcTokensCall(params: CalcTokensClientParams, options?: RPCOptions, sendRequest?: typeof send): Promise<number>;
32
+ export {};
33
+ //# sourceMappingURL=calc-tokens.d.ts.map
@@ -0,0 +1,44 @@
1
+ import { parseClientInput } from '../../client/parse-input.js';
2
+ import { send } from '../../client/rpc/rpc-client.js';
3
+ import { calcTokensParamsSchema, calcTokensResponseSchema } from '@qvac/inference/surface';
4
+ import { InvalidResponseError } from '../../utils/errors-client.js';
5
+ import { validateTools } from '../../utils/tool-helpers.js';
6
+ /**
7
+ * Counts tokens with a loaded language model without running generation.
8
+ *
9
+ * When neither `history` nor enabled tools are supplied, `text` is counted raw.
10
+ * Otherwise, the conversation is rendered with the model's chat template and
11
+ * `text`, when present, becomes its final user turn. Tools are counted only when
12
+ * the model was loaded with `modelConfig.tools: true`.
13
+ * `toolSearch` controls the limits rendered for deferred-tool search, matching
14
+ * `completion()`.
15
+ * Media content and attachments are not supported.
16
+ * The count uses every supplied tool and the load-time reasoning setting. A named
17
+ * `generationParams.tool_choice` or `generationParams.reasoning_budget` override on
18
+ * `completion()` can render a different prompt.
19
+ *
20
+ * @param params - Loaded model ID and at least one prompt source: `text` or non-empty `history`.
21
+ * @param options - RPC transport options.
22
+ * @returns The number of tokens in the prompt under the model's load-time settings.
23
+ * @throws {RequestValidationFailedError} If the request is invalid.
24
+ * @throws {ModelNotFoundError} If `modelId` is not loaded.
25
+ * @throws {ModelOperationNotSupportedError} If the loaded model is not a language model.
26
+ * @throws {InvalidResponseError} If the worker returns a malformed result.
27
+ */
28
+ export async function calcTokens(params, options) {
29
+ return createCalcTokensCall(params, options);
30
+ }
31
+ export async function createCalcTokensCall(params, options, sendRequest = send) {
32
+ const tools = params.tools ? validateTools(params.tools).tools : undefined;
33
+ const input = parseClientInput(calcTokensParamsSchema, {
34
+ ...params,
35
+ ...(tools !== undefined && { tools })
36
+ });
37
+ const response = await sendRequest({ ...input, type: 'calcTokens' }, options);
38
+ if (response.type !== 'calcTokens')
39
+ throw new InvalidResponseError('calcTokens');
40
+ const parsed = calcTokensResponseSchema.safeParse(response);
41
+ if (!parsed.success)
42
+ throw new InvalidResponseError('calcTokens', parsed.error);
43
+ return parsed.data.tokens;
44
+ }
@@ -1,4 +1,4 @@
1
- import { type CancelClientInput } from '@qvac/inference/surface';
1
+ import { type CancelClientInput, type RPCOptions } from '@qvac/inference/surface';
2
2
  /**
3
3
  * Cancels an ongoing operation.
4
4
  *
@@ -31,5 +31,5 @@ import { type CancelClientInput } from '@qvac/inference/surface';
31
31
  * // Broad-cancel every inference running on a model
32
32
  * await cancel({ modelId: "model-123", kind: "completion" });
33
33
  */
34
- export declare function cancel(params: CancelClientInput): Promise<void>;
34
+ export declare function cancel(params: CancelClientInput, options?: RPCOptions): Promise<void>;
35
35
  //# sourceMappingURL=cancel.d.ts.map
@@ -33,13 +33,13 @@ import { InvalidResponseError, CancelFailedError } from '../../utils/errors-clie
33
33
  * // Broad-cancel every inference running on a model
34
34
  * await cancel({ modelId: "model-123", kind: "completion" });
35
35
  */
36
- export async function cancel(params) {
36
+ export async function cancel(params, options) {
37
37
  const wireParams = normalizeCancelParams(params);
38
38
  const request = {
39
39
  type: 'cancel',
40
40
  ...wireParams
41
41
  };
42
- const response = await send(request);
42
+ const response = await send(request, options);
43
43
  if (response.type !== 'cancel') {
44
44
  throw new InvalidResponseError('cancel');
45
45
  }
@@ -1,8 +1,8 @@
1
- import { type ClassifyClientParams, type ClassificationResult } from '@qvac/inference/surface';
1
+ import { type ClassifyClientParams, type ClassificationResult, type RPCOptions } from '@qvac/inference/surface';
2
2
  /**
3
3
  * Classifies an image using a loaded classification model.
4
4
  *
5
- * The bundled MobileNetV3-Small model produces 3 labels: `"food"`, `"report"`, `"other"`.
5
+ * The `MOBILENETV3_3CLASS_V3_FP16` model produces 3 labels: `"food"`, `"report"`, `"other"`.
6
6
  * Custom models may emit different labels sourced from the GGUF metadata.
7
7
  *
8
8
  * @param params - The loaded model ID, image data, optional raw-image
@@ -10,16 +10,23 @@ import { type ClassifyClientParams, type ClassificationResult } from '@qvac/infe
10
10
  * @param params.modelId - The identifier of the loaded classification model
11
11
  * @param params.image - JPEG or PNG buffer; raw RGB bytes also accepted with `width`, `height`, `channels`
12
12
  * @param params.topK - Limit results to top-K classes (default: all)
13
- * @returns Sorted classification results, highest confidence first
13
+ * @param options - Optional RPC options (timeout, profiling, force new connection).
14
+ * @returns Sorted classification results, highest confidence first. The promise
15
+ * carries `requestId` synchronously for `cancel({ requestId })`.
14
16
  *
15
17
  * @example
16
18
  * ```typescript
17
- * const modelId = await loadModel({ modelType: "ggml-classification" });
19
+ * const modelId = await loadModel({
20
+ * modelSrc: MOBILENETV3_3CLASS_V3_FP16,
21
+ * modelType: "ggml-classification",
22
+ * });
18
23
  * const jpeg = fs.readFileSync("photo.jpg");
19
24
  * const results = await classify({ modelId, image: jpeg });
20
25
  * // [ { label: "food", confidence: 0.93 }, { label: "other", confidence: 0.05 }, ... ]
21
26
  * await unloadModel({ modelId });
22
27
  * ```
23
28
  */
24
- export declare function classify(params: ClassifyClientParams): Promise<ClassificationResult[]>;
29
+ export declare function classify(params: ClassifyClientParams, options?: RPCOptions): Promise<ClassificationResult[]> & {
30
+ requestId: string;
31
+ };
25
32
  //# sourceMappingURL=classify.d.ts.map
@@ -1,10 +1,12 @@
1
1
  import { classifyResponseSchema } from '@qvac/inference/surface';
2
2
  import { stream as streamRpc } from '../../client/rpc/rpc-client.js';
3
+ import { generateClientRequestId } from '../../client/api/client-request-id.js';
4
+ import { decoratePromise } from '../../utils/decorate-promise.js';
3
5
  import { encodeBase64 } from '../../utils/encoding.js';
4
6
  /**
5
7
  * Classifies an image using a loaded classification model.
6
8
  *
7
- * The bundled MobileNetV3-Small model produces 3 labels: `"food"`, `"report"`, `"other"`.
9
+ * The `MOBILENETV3_3CLASS_V3_FP16` model produces 3 labels: `"food"`, `"report"`, `"other"`.
8
10
  * Custom models may emit different labels sourced from the GGUF metadata.
9
11
  *
10
12
  * @param params - The loaded model ID, image data, optional raw-image
@@ -12,20 +14,30 @@ import { encodeBase64 } from '../../utils/encoding.js';
12
14
  * @param params.modelId - The identifier of the loaded classification model
13
15
  * @param params.image - JPEG or PNG buffer; raw RGB bytes also accepted with `width`, `height`, `channels`
14
16
  * @param params.topK - Limit results to top-K classes (default: all)
15
- * @returns Sorted classification results, highest confidence first
17
+ * @param options - Optional RPC options (timeout, profiling, force new connection).
18
+ * @returns Sorted classification results, highest confidence first. The promise
19
+ * carries `requestId` synchronously for `cancel({ requestId })`.
16
20
  *
17
21
  * @example
18
22
  * ```typescript
19
- * const modelId = await loadModel({ modelType: "ggml-classification" });
23
+ * const modelId = await loadModel({
24
+ * modelSrc: MOBILENETV3_3CLASS_V3_FP16,
25
+ * modelType: "ggml-classification",
26
+ * });
20
27
  * const jpeg = fs.readFileSync("photo.jpg");
21
28
  * const results = await classify({ modelId, image: jpeg });
22
29
  * // [ { label: "food", confidence: 0.93 }, { label: "other", confidence: 0.05 }, ... ]
23
30
  * await unloadModel({ modelId });
24
31
  * ```
25
32
  */
26
- export async function classify(params) {
33
+ export function classify(params, options) {
34
+ const requestId = generateClientRequestId();
35
+ return decoratePromise(runClassify(params, requestId, options), { requestId });
36
+ }
37
+ async function runClassify(params, requestId, options) {
27
38
  const request = {
28
39
  type: 'classify',
40
+ requestId,
29
41
  modelId: params.modelId,
30
42
  image: encodeBase64(params.image),
31
43
  ...(params.topK !== undefined && { topK: params.topK }),
@@ -33,7 +45,7 @@ export async function classify(params) {
33
45
  ...(params.height !== undefined && { height: params.height }),
34
46
  ...(params.channels !== undefined && { channels: params.channels })
35
47
  };
36
- for await (const response of streamRpc(request)) {
48
+ for await (const response of streamRpc(request, options)) {
37
49
  if (response &&
38
50
  typeof response === 'object' &&
39
51
  'type' in response &&
@@ -1,17 +1,2 @@
1
- /**
2
- * UUIDv4 generator for client-side request ids. The Web Crypto API
3
- * ships `crypto.randomUUID` everywhere we run today (Bun, modern Node,
4
- * modern browsers, React Native via the polyfill that the workbench-
5
- * desktop / RN runtime config injects). The fallback exists so the SDK
6
- * never crashes in an exotic JS environment without
7
- * `crypto.randomUUID` — `requestId` semantics still hold (uniqueness,
8
- * opaque to the caller), just without the UUIDv4 wire shape.
9
- *
10
- * Shared with the long-running call sites that decorate their promises
11
- * with `requestId`: `completion(...)`, `loadModel(...)`,
12
- * `downloadAsset(...)`. The decorated promise's `op.requestId` and the
13
- * server's registry entry's `requestId` must match — generating once
14
- * here keeps that invariant.
15
- */
16
1
  export declare function generateClientRequestId(): string;
17
2
  //# sourceMappingURL=client-request-id.d.ts.map
@@ -1,11 +1,11 @@
1
1
  /**
2
- * UUIDv4 generator for client-side request ids. The Web Crypto API
3
- * ships `crypto.randomUUID` everywhere we run today (Bun, modern Node,
2
+ * UUIDv4 generator for client-side request and session ids. The Web Crypto
3
+ * API ships `crypto.randomUUID` everywhere we run today (Bun, modern Node,
4
4
  * modern browsers, React Native via the polyfill that the workbench-
5
- * desktop / RN runtime config injects). The fallback exists so the SDK
6
- * never crashes in an exotic JS environment without
7
- * `crypto.randomUUID` — `requestId` semantics still hold (uniqueness,
8
- * opaque to the caller), just without the UUIDv4 wire shape.
5
+ * desktop / RN runtime config injects). The fallbacks exist so the SDK
6
+ * never crashes in an exotic JS environment without it: the id stays
7
+ * unique within the process and opaque to the caller, without the UUIDv4
8
+ * wire shape.
9
9
  *
10
10
  * Shared with the long-running call sites that decorate their promises
11
11
  * with `requestId`: `completion(...)`, `loadModel(...)`,
@@ -13,15 +13,18 @@
13
13
  * server's registry entry's `requestId` must match — generating once
14
14
  * here keeps that invariant.
15
15
  */
16
+ let fallbackCounter = 0;
16
17
  export function generateClientRequestId() {
17
18
  const c = globalThis.crypto;
18
19
  if (c?.randomUUID)
19
20
  return c.randomUUID();
20
- // Fallback: 128 random bits encoded as a hex string. Distinct enough
21
- // for in-flight cancel targeting; not a wire-spec UUID.
22
- const bytes = new Uint8Array(16);
23
- for (let i = 0; i < bytes.length; i++) {
24
- bytes[i] = Math.floor(Math.random() * 256);
21
+ if (c?.getRandomValues) {
22
+ const bytes = c.getRandomValues(new Uint8Array(16));
23
+ return Array.from(bytes, (b) => b.toString(16).padStart(2, '0')).join('');
25
24
  }
26
- return Array.from(bytes, (b) => b.toString(16).padStart(2, '0')).join('');
25
+ // No random source at all: a per-process counter keeps ids unique for
26
+ // cancel targeting and session keys, which only have to be unique
27
+ // within this process and its runtime.
28
+ fallbackCounter += 1;
29
+ return `${Date.now().toString(16)}-${fallbackCounter.toString(16)}`;
27
30
  }
@@ -26,6 +26,7 @@ type CompletionParams = Omit<CompletionClientParams, 'tools'> & {
26
26
  * @param params.stream - Whether to stream tokens (true) or return complete response (false). Defaults to true
27
27
  * @param params.tools - Optional array of tools (can be simple ToolInput with Zod schemas or full Tool objects)
28
28
  * @param params.mcp - Optional array of MCP client inputs for tool integration
29
+ * @param params.toolSearch - Limits on what the built-in `tool_search` loads per call, used when a tool sets `deferLoading`: `defaultLimit` (default 3) is how many tool definitions one call loads when the model does not ask for a number with the call's `limit` argument; `maxLimit` (default 8) is the most one call can load, and a larger `limit` is lowered to it. The model is told these limits in the tool definitions at the front of the prompt, so set them once per conversation; changing them re-prefills from there. When you run the search yourself, pass these same params to `executeToolSearch`.
29
30
  * @param params.captureThinking - Best-effort parsing of `<think>` blocks into `thinkingDelta` events; `final.raw.fullText` always preserves the original output
30
31
  * @param params.emitRawDeltas - When true, every raw model token is also emitted as a `rawDelta` event
31
32
  * @param params.toolDialect - Override the SDK's dialect detection, which uses the model name, then the GGUF `general.architecture`, then `"hermes"`. Supported values: `"hermes"`, `"pythonic"`, `"json"`, `"harmony"`, `"qwen35"` (Qwen3.5/3.6/3.8), `"gemma4"`, `"dsml"` (DeepSeek V3.2/V4). Use when detection picks the wrong dialect for your model. Drives both streaming frame detection and finalization parsing.
@@ -45,7 +46,13 @@ type CompletionParams = Omit<CompletionClientParams, 'tools'> & {
45
46
  * validation must encode it explicitly in `schema`.
46
47
  *
47
48
  * Cannot be combined with `tools` (tools already constrain output via their parameter schema).
48
- * @param params.prefill - Evaluate the prompt and tools without generating an answer. Requires an enabled kvCache; cannot force tool_choice. Await final before sending the question with the same prefix.
49
+ * @param params.prefill - Evaluate the prompt and tools without generating an answer. Requires an enabled kvCache and at least one message (from history or `modelConfig.system_prompt`); cannot force tool_choice. Await final before sending the question with the same prefix.
50
+ * @param params.seedFrom - Optional name of another caller-managed cache to start this chat from, such as a
51
+ * system prompt and tools primed with `prefill`. On the first turn of a chat whose `kvCache` key has no
52
+ * cache yet, the model reads that cache and reuses the prefix it shares with the prompt, so only the rest is
53
+ * processed; the source is never written. Ignored once the chat has a cache. Requires a string `kvCache`
54
+ * other than `seedFrom`. Refused when no cache of that name exists for this model and system prompt, or
55
+ * when the model was not loaded with `cache_share_across_keys: true`, which is off by default.
49
56
  * @param params.kvCache - Optional KV cache configuration. Cache files are organized hierarchically:
50
57
  * - Structure: `{kvCacheKey}/{modelId}/{configHash}.bin`
51
58
  * - The configHash includes model config + system prompt to ensure cache isolation
@@ -26,6 +26,7 @@ const logger = getClientLogger();
26
26
  * @param params.stream - Whether to stream tokens (true) or return complete response (false). Defaults to true
27
27
  * @param params.tools - Optional array of tools (can be simple ToolInput with Zod schemas or full Tool objects)
28
28
  * @param params.mcp - Optional array of MCP client inputs for tool integration
29
+ * @param params.toolSearch - Limits on what the built-in `tool_search` loads per call, used when a tool sets `deferLoading`: `defaultLimit` (default 3) is how many tool definitions one call loads when the model does not ask for a number with the call's `limit` argument; `maxLimit` (default 8) is the most one call can load, and a larger `limit` is lowered to it. The model is told these limits in the tool definitions at the front of the prompt, so set them once per conversation; changing them re-prefills from there. When you run the search yourself, pass these same params to `executeToolSearch`.
29
30
  * @param params.captureThinking - Best-effort parsing of `<think>` blocks into `thinkingDelta` events; `final.raw.fullText` always preserves the original output
30
31
  * @param params.emitRawDeltas - When true, every raw model token is also emitted as a `rawDelta` event
31
32
  * @param params.toolDialect - Override the SDK's dialect detection, which uses the model name, then the GGUF `general.architecture`, then `"hermes"`. Supported values: `"hermes"`, `"pythonic"`, `"json"`, `"harmony"`, `"qwen35"` (Qwen3.5/3.6/3.8), `"gemma4"`, `"dsml"` (DeepSeek V3.2/V4). Use when detection picks the wrong dialect for your model. Drives both streaming frame detection and finalization parsing.
@@ -45,7 +46,13 @@ const logger = getClientLogger();
45
46
  * validation must encode it explicitly in `schema`.
46
47
  *
47
48
  * Cannot be combined with `tools` (tools already constrain output via their parameter schema).
48
- * @param params.prefill - Evaluate the prompt and tools without generating an answer. Requires an enabled kvCache; cannot force tool_choice. Await final before sending the question with the same prefix.
49
+ * @param params.prefill - Evaluate the prompt and tools without generating an answer. Requires an enabled kvCache and at least one message (from history or `modelConfig.system_prompt`); cannot force tool_choice. Await final before sending the question with the same prefix.
50
+ * @param params.seedFrom - Optional name of another caller-managed cache to start this chat from, such as a
51
+ * system prompt and tools primed with `prefill`. On the first turn of a chat whose `kvCache` key has no
52
+ * cache yet, the model reads that cache and reuses the prefix it shares with the prompt, so only the rest is
53
+ * processed; the source is never written. Ignored once the chat has a cache. Requires a string `kvCache`
54
+ * other than `seedFrom`. Refused when no cache of that name exists for this model and system prompt, or
55
+ * when the model was not loaded with `cache_share_across_keys: true`, which is off by default.
49
56
  * @param params.kvCache - Optional KV cache configuration. Cache files are organized hierarchically:
50
57
  * - Structure: `{kvCacheKey}/{modelId}/{configHash}.bin`
51
58
  * - The configHash includes model config + system prompt to ensure cache isolation
@@ -185,7 +192,9 @@ export function completion(params) {
185
192
  history: params.history.map((message) => ({ ...message, content: message.content ?? '' })),
186
193
  kvCache: params.kvCache,
187
194
  prefill: params.prefill,
195
+ seedFrom: params.seedFrom,
188
196
  tools: allTools.length > 0 ? allTools : undefined,
197
+ toolSearch: params.toolSearch,
189
198
  stream: params.stream ?? true,
190
199
  generationParams: params.generationParams,
191
200
  captureThinking: params.captureThinking,
@@ -1,11 +1,13 @@
1
+ import type { RPCOptions } from '@qvac/inference/surface';
1
2
  /**
2
- * Deletes KV cache files.
3
+ * Deletes KV cache files, or a registry model's cached download.
3
4
  *
4
5
  * @param params - The delete cache parameters
5
6
  * @param params.all - If true, deletes all cache files, including caller-owned named caches
6
7
  * @param params.auto - If true, reclaims only automatic caches (`completion({ kvCache: true })`) that no request is using. Named caches are untouched. Covers the whole cache directory, which is shared by every QVAC process using the same home directory
7
8
  * @param params.kvCacheKey - The cache key to delete
8
9
  * @param params.modelId - Optional: specific model ID to delete within the cache key. If not provided, deletes entire cache key.
10
+ * @param params.modelSrc - A `registry://` model source. Deletes its cached files and the registry blocks a cancelled or failed download kept for resume. Fails while the model is downloading or loaded
9
11
  * @returns Promise resolving to success status
10
12
  * @throws {QvacErrorBase} When the cache parameters are invalid (`InvalidDeleteCacheParamsError`) or the server reports a delete failure (`DeleteCacheFailedError`).
11
13
  * @example
@@ -21,6 +23,9 @@
21
23
  *
22
24
  * // Delete only specific model within cache key
23
25
  * await deleteCache({ kvCacheKey: "my-session", modelId: "model-abc123" });
26
+ *
27
+ * // Discard a paused registry download, or a cached registry model
28
+ * await deleteCache({ modelSrc: QWEN3_600M_INST_Q4.src });
24
29
  * ```
25
30
  */
26
31
  export declare function deleteCache(params: {
@@ -30,7 +35,9 @@ export declare function deleteCache(params: {
30
35
  } | {
31
36
  kvCacheKey: string;
32
37
  modelId?: string;
33
- }): Promise<{
38
+ } | {
39
+ modelSrc: string;
40
+ }, options?: RPCOptions): Promise<{
34
41
  success: boolean;
35
42
  }>;
36
43
  //# sourceMappingURL=delete-cache.d.ts.map
@@ -1,13 +1,14 @@
1
1
  import { send } from '../../client/rpc/rpc-client.js';
2
2
  import { InvalidDeleteCacheParamsError, DeleteCacheFailedError } from '../../utils/errors-client.js';
3
3
  /**
4
- * Deletes KV cache files.
4
+ * Deletes KV cache files, or a registry model's cached download.
5
5
  *
6
6
  * @param params - The delete cache parameters
7
7
  * @param params.all - If true, deletes all cache files, including caller-owned named caches
8
8
  * @param params.auto - If true, reclaims only automatic caches (`completion({ kvCache: true })`) that no request is using. Named caches are untouched. Covers the whole cache directory, which is shared by every QVAC process using the same home directory
9
9
  * @param params.kvCacheKey - The cache key to delete
10
10
  * @param params.modelId - Optional: specific model ID to delete within the cache key. If not provided, deletes entire cache key.
11
+ * @param params.modelSrc - A `registry://` model source. Deletes its cached files and the registry blocks a cancelled or failed download kept for resume. Fails while the model is downloading or loaded
11
12
  * @returns Promise resolving to success status
12
13
  * @throws {QvacErrorBase} When the cache parameters are invalid (`InvalidDeleteCacheParamsError`) or the server reports a delete failure (`DeleteCacheFailedError`).
13
14
  * @example
@@ -23,9 +24,12 @@ import { InvalidDeleteCacheParamsError, DeleteCacheFailedError } from '../../uti
23
24
  *
24
25
  * // Delete only specific model within cache key
25
26
  * await deleteCache({ kvCacheKey: "my-session", modelId: "model-abc123" });
27
+ *
28
+ * // Discard a paused registry download, or a cached registry model
29
+ * await deleteCache({ modelSrc: QWEN3_600M_INST_Q4.src });
26
30
  * ```
27
31
  */
28
- export async function deleteCache(params) {
32
+ export async function deleteCache(params, options) {
29
33
  let req;
30
34
  if ('all' in params && params.all) {
31
35
  req = {
@@ -39,6 +43,12 @@ export async function deleteCache(params) {
39
43
  auto: true
40
44
  };
41
45
  }
46
+ else if ('modelSrc' in params) {
47
+ req = {
48
+ type: 'deleteCache',
49
+ modelSrc: params.modelSrc
50
+ };
51
+ }
42
52
  else if ('kvCacheKey' in params) {
43
53
  req = {
44
54
  type: 'deleteCache',
@@ -49,7 +59,7 @@ export async function deleteCache(params) {
49
59
  else {
50
60
  throw new InvalidDeleteCacheParamsError();
51
61
  }
52
- const response = (await send(req));
62
+ const response = (await send(req, options));
53
63
  if (!response.success && response.error) {
54
64
  throw new DeleteCacheFailedError(response.error);
55
65
  }