@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
@@ -9,6 +9,7 @@ import { buildModelTypeMaps } from './build-model-type-maps.js';
9
9
  import { buildErrorCodes } from './build-error-codes.js';
10
10
  import { buildNumericConstants } from './build-numeric-constants.js';
11
11
  export const contractDir = new URL('../../contract/', import.meta.url);
12
+ export const registryEngineManifestFile = new URL('../../../registry-server/lib/generated/engine-manifest.json', import.meta.url);
12
13
  export const callShapeByHandlerType = {
13
14
  reply: 'request-reply',
14
15
  stream: 'server-stream',
@@ -139,6 +140,37 @@ function flattenAllOfWithUnion(json, defName) {
139
140
  function isSchemaObject(node) {
140
141
  return node !== null && typeof node === 'object' && !Array.isArray(node);
141
142
  }
143
+ /**
144
+ * Zod 4.6 emits primitive unions as `type: [...]`. That is valid JSON Schema,
145
+ * but the Kotlin generator represents that form as an untyped JsonElement.
146
+ * Keep the equivalent `anyOf` form used by earlier Zod releases so generated
147
+ * clients retain their typed union wrappers.
148
+ */
149
+ function expandPrimitiveTypeArrays(node) {
150
+ if (Array.isArray(node))
151
+ return node.map(expandPrimitiveTypeArrays);
152
+ if (!isSchemaObject(node))
153
+ return node;
154
+ const expanded = Object.fromEntries(Object.entries(node).map(function ([key, value]) {
155
+ return [key, expandPrimitiveTypeArrays(value)];
156
+ }));
157
+ const types = expanded['type'];
158
+ if (!Array.isArray(types))
159
+ return expanded;
160
+ if (!types.every(function (type) {
161
+ return typeof type === 'string';
162
+ })) {
163
+ throw new Error('JSON Schema type arrays must contain only strings');
164
+ }
165
+ if (expanded['anyOf'] !== undefined || expanded['oneOf'] !== undefined) {
166
+ throw new Error('Cannot expand a JSON Schema type array beside an existing union');
167
+ }
168
+ delete expanded['type'];
169
+ expanded['anyOf'] = types.map(function (type) {
170
+ return { type };
171
+ });
172
+ return expanded;
173
+ }
142
174
  function unionArmsOf(node) {
143
175
  if (Array.isArray(node['oneOf']))
144
176
  return node['oneOf'];
@@ -429,7 +461,8 @@ export function toWireJsonSchema(schema, io, defName) {
429
461
  unrepresentable: 'any'
430
462
  });
431
463
  delete json['$schema'];
432
- const flattened = flattenAllOfWithUnion(json, defName);
464
+ const expanded = expandPrimitiveTypeArrays(json);
465
+ const flattened = flattenAllOfWithUnion(expanded, defName);
433
466
  const collapsed = collapseSingleMemberUnions(flattened);
434
467
  assertNoRefs(collapsed, defName);
435
468
  return collapsed;
@@ -591,7 +624,7 @@ export function buildContract() {
591
624
  const schemaDocument = {
592
625
  $schema: 'https://json-schema.org/draft/2020-12/schema',
593
626
  title: '@qvac/sdk wire contract',
594
- description: 'Generated from the SDK Zod schemas by `bun run contract:export`. Do not edit by hand. ' +
627
+ description: 'Generated from the SDK Zod schemas by `npm run contract:export`. Do not edit by hand. ' +
595
628
  'Requests use the schema input shape, responses the output shape; runtime-only ' +
596
629
  'refinements and transforms stay server-side.',
597
630
  $defs: defs
@@ -621,3 +654,8 @@ export async function renderContractFiles() {
621
654
  'numeric-constants.json': await formatJson(numericConstants, 'numeric-constants.json')
622
655
  };
623
656
  }
657
+ // Build-time export only: registry validation reads its own packaged artifact.
658
+ export async function renderRegistryEngineManifest() {
659
+ const { engineToAddon, legacyEngineToCanonical, legacyRegistryEngineRules } = buildModelTypeMaps();
660
+ return formatJson({ engineToAddon, legacyEngineToCanonical, legacyRegistryEngineRules }, 'engine-manifest.json');
661
+ }
@@ -1,7 +1,8 @@
1
1
  /**
2
2
  * JSON export of the model-type resolution maps that `loadModel`'s
3
3
  * client-side type-inference reads: alias → canonical model type, canonical
4
- * engine → addon, and legacy engine string → canonical engine.
4
+ * engine → addon, legacy engine string → canonical engine, and tagged rules
5
+ * for shared legacy registry packages.
5
6
  *
6
7
  * Inference itself stays in each client (a plain string `modelSrc` carries no
7
8
  * engine to infer from, so it can't move server-side), but the *data* it reads
@@ -17,6 +18,10 @@ export interface ModelTypeMaps {
17
18
  aliasToCanonical: Record<string, string>;
18
19
  engineToAddon: Record<string, string>;
19
20
  legacyEngineToCanonical: Record<string, string>;
21
+ legacyRegistryEngineRules: Record<string, readonly {
22
+ tag: string;
23
+ engine: string;
24
+ }[]>;
20
25
  }
21
26
  export declare function buildModelTypeMaps(): ModelTypeMaps;
22
27
  //# sourceMappingURL=build-model-type-maps.d.ts.map
@@ -1,4 +1,4 @@
1
- import { ModelTypeAliases, ENGINE_TO_ADDON, LEGACY_ENGINE_TO_CANONICAL } from '@qvac/inference/surface';
1
+ import { ModelTypeAliases, ENGINE_TO_ADDON, LEGACY_ENGINE_TO_CANONICAL, LEGACY_REGISTRY_ENGINE_RULES } from '@qvac/inference/surface';
2
2
  function sortedEntries(record) {
3
3
  const entries = Object.entries(record);
4
4
  entries.sort(function (a, b) {
@@ -10,6 +10,7 @@ export function buildModelTypeMaps() {
10
10
  return {
11
11
  aliasToCanonical: sortedEntries(ModelTypeAliases),
12
12
  engineToAddon: sortedEntries(ENGINE_TO_ADDON),
13
- legacyEngineToCanonical: sortedEntries(LEGACY_ENGINE_TO_CANONICAL)
13
+ legacyEngineToCanonical: sortedEntries(LEGACY_ENGINE_TO_CANONICAL),
14
+ legacyRegistryEngineRules: sortedEntries(LEGACY_REGISTRY_ENGINE_RULES)
14
15
  };
15
16
  }
@@ -29,10 +29,13 @@ export declare const constantsRegistry: {
29
29
  readonly whispercppTranscription: "whispercpp-transcription";
30
30
  readonly bciWhispercppTranscription: "bci-whispercpp-transcription";
31
31
  readonly llamacppEmbedding: "llamacpp-embedding";
32
+ readonly llamacppDecision: "llamacpp-decision";
33
+ readonly llamacppRerank: "llamacpp-rerank";
32
34
  readonly nmtcppTranslation: "nmtcpp-translation";
33
35
  readonly onnxTts: "onnx-tts";
34
36
  readonly ttsGgml: "tts-ggml";
35
37
  readonly parakeetTranscription: "parakeet-transcription";
38
+ readonly mossTranscribe: "moss-transcribe";
36
39
  readonly ggmlOcr: "ggml-ocr";
37
40
  readonly sdcppGeneration: "sdcpp-generation";
38
41
  readonly audiogenGgml: "audiogen-ggml";
@@ -48,8 +51,11 @@ export declare const constantsRegistry: {
48
51
  readonly PluginId: z.ZodEnum<{
49
52
  readonly LLM: "@qvac/sdk/llamacpp-completion/plugin";
50
53
  readonly EMBEDDING: "@qvac/sdk/llamacpp-embedding/plugin";
54
+ readonly DECISION: "@qvac/sdk/llamacpp-decision/plugin";
55
+ readonly RERANK: "@qvac/sdk/llamacpp-rerank/plugin";
51
56
  readonly WHISPER: "@qvac/sdk/whispercpp-transcription/plugin";
52
57
  readonly BCI: "@qvac/sdk/bci-whispercpp-transcription/plugin";
58
+ readonly MOSS_TRANSCRIBE: "@qvac/sdk/moss-transcribe/plugin";
53
59
  readonly NMT: "@qvac/sdk/nmtcpp-translation/plugin";
54
60
  readonly TTS: "@qvac/sdk/tts-ggml/plugin";
55
61
  readonly OCR: "@qvac/sdk/ggml-ocr/plugin";
@@ -1,6 +1,6 @@
1
1
  import { z } from 'zod';
2
2
  import { ModelType, VERBOSITY, SUPPORTED_AUDIO_FORMATS, AUDIOGEN_ENGINES, AUDIOGEN_TASK_TYPES, AUDIOGEN_EDIT_OPERATIONS, AUDIOGEN_REPAINT_MODES, AUDIOGEN_TRACKS, TTS_ENGINES, TTS_PACES, TTS_PARLER_EMOTIONS, TTS_SENTENCE_DELIMITER_PRESETS, TTS_CHATTERBOX_LANGUAGES, TTS_SUPERTONIC_LANGUAGES, TTS_COSYVOICE3_EMOTIONS, TTS_COSYVOICE3_INSTRUCT_DIALECTS, TTS_COSYVOICE3_INSTRUCT_VOLUMES, TTS_COSYVOICE3_INSTRUCT_STYLES, VectorIndexStorage } from '@qvac/inference/surface';
3
- import { PLUGIN_LLM, PLUGIN_EMBEDDING, PLUGIN_WHISPER, PLUGIN_BCI, PLUGIN_NMT, PLUGIN_TTS, PLUGIN_OCR, PLUGIN_DIFFUSION, PLUGIN_AUDIOGEN, PLUGIN_VLA, PLUGIN_CLASSIFICATION } from '../../src/plugin-ids.js';
3
+ import { PLUGIN_LLM, PLUGIN_EMBEDDING, PLUGIN_DECISION, PLUGIN_RERANK, PLUGIN_WHISPER, PLUGIN_BCI, PLUGIN_MOSS_TRANSCRIBE, PLUGIN_NMT, PLUGIN_TTS, PLUGIN_OCR, PLUGIN_DIFFUSION, PLUGIN_AUDIOGEN, PLUGIN_VLA, PLUGIN_CLASSIFICATION } from '../../src/plugin-ids.js';
4
4
  // Uppercases each vocabulary value into an identifier-safe varname (e.g.
5
5
  // 'slow' -> 'SLOW', 'cover-nofsq' -> 'COVER_NOFSQ'), mirroring the
6
6
  // SupportedAudioFormat derivation so names can't drift from the single
@@ -38,8 +38,11 @@ export const constantsRegistry = {
38
38
  PluginId: z.enum({
39
39
  LLM: PLUGIN_LLM,
40
40
  EMBEDDING: PLUGIN_EMBEDDING,
41
+ DECISION: PLUGIN_DECISION,
42
+ RERANK: PLUGIN_RERANK,
41
43
  WHISPER: PLUGIN_WHISPER,
42
44
  BCI: PLUGIN_BCI,
45
+ MOSS_TRANSCRIBE: PLUGIN_MOSS_TRANSCRIBE,
43
46
  NMT: PLUGIN_NMT,
44
47
  TTS: PLUGIN_TTS,
45
48
  OCR: PLUGIN_OCR,
@@ -25,6 +25,8 @@ export declare const methodShapes: {
25
25
  readonly diffusionStream: "stream";
26
26
  readonly downloadAsset: "reply";
27
27
  readonly embed: "reply";
28
+ readonly decide: "reply";
29
+ readonly rerank: "reply";
28
30
  readonly finetune: "reply";
29
31
  readonly getLoadedModelInfo: "reply";
30
32
  readonly getModelInfo: "reply";
@@ -25,6 +25,8 @@ export const methodShapes = {
25
25
  diffusionStream: 'stream',
26
26
  downloadAsset: 'reply',
27
27
  embed: 'reply',
28
+ decide: 'reply',
29
+ rerank: 'reply',
28
30
  finetune: 'reply',
29
31
  getLoadedModelInfo: 'reply',
30
32
  getModelInfo: 'reply',
@@ -1,27 +1,40 @@
1
1
  import { mkdir, readFile, writeFile } from 'node:fs/promises';
2
+ import { dirname } from 'node:path';
2
3
  import { fileURLToPath } from 'node:url';
3
- import { contractDir, renderContractFiles } from './contract/build-contract.js';
4
+ import { contractDir, registryEngineManifestFile, renderContractFiles, renderRegistryEngineManifest } from './contract/build-contract.js';
4
5
  const checkOnly = process.argv.includes('--check');
5
6
  const files = await renderContractFiles();
6
- await mkdir(contractDir, { recursive: true });
7
+ const artifacts = [
8
+ ...Object.entries(files).map(([name, content]) => ({
9
+ label: `contract/${name}`,
10
+ file: new URL(name, contractDir),
11
+ content
12
+ })),
13
+ {
14
+ label: 'registry-server/lib/generated/engine-manifest.json',
15
+ file: registryEngineManifestFile,
16
+ content: await renderRegistryEngineManifest()
17
+ }
18
+ ];
7
19
  let stale = false;
8
- for (const [name, content] of Object.entries(files)) {
9
- const filePath = fileURLToPath(new URL(name, contractDir));
20
+ for (const { label, file, content } of artifacts) {
21
+ const filePath = fileURLToPath(file);
10
22
  if (checkOnly) {
11
23
  const existing = await readFile(filePath, 'utf8').catch(function () {
12
24
  return null;
13
25
  });
14
26
  if (existing !== content) {
15
- console.error(`contract/${name} is ${existing === null ? 'missing' : 'out of date'}`);
27
+ console.error(`${label} is ${existing === null ? 'missing' : 'out of date'}`);
16
28
  stale = true;
17
29
  }
18
30
  }
19
31
  else {
32
+ await mkdir(dirname(filePath), { recursive: true });
20
33
  await writeFile(filePath, content);
21
- console.log(`wrote contract/${name}`);
34
+ console.log(`wrote ${label}`);
22
35
  }
23
36
  }
24
37
  if (stale) {
25
- console.error("Contract artifacts are stale. Run 'bun run contract:export' and commit the result.");
38
+ console.error("Generated contract artifacts are stale. Run 'npm run contract:export' and commit the result.");
26
39
  process.exit(1);
27
40
  }
@@ -4,9 +4,8 @@ import { spawnSync } from 'child_process';
4
4
  import { fileURLToPath } from 'url';
5
5
  const __dirname = dirname(fileURLToPath(import.meta.url));
6
6
  const testDir = join(__dirname, '..', 'test');
7
- // The Bare suite (test/bare) and its build output (test/dist) run via
8
- // `test:bare`, so the Bun/Node unit runner skips them.
9
- const SKIP_DIRS = new Set(['bare', 'dist']);
7
+ // test/dist is a build output, not a test source tree.
8
+ const SKIP_DIRS = new Set(['dist']);
10
9
  function collectTestFiles(dir) {
11
10
  const files = [];
12
11
  for (const entry of readdirSync(dir, { withFileTypes: true })) {
@@ -28,9 +27,15 @@ function usesNodeTestRunner(filePath) {
28
27
  const source = readFileSync(filePath, 'utf8');
29
28
  return source.includes("from 'node:test'") || source.includes('from "node:test"');
30
29
  }
30
+ // Each file runs in its own Node process with tsx loaded, so TypeScript sources
31
+ // and the tsconfig path aliases resolve without a build step. brittle files run
32
+ // as plain scripts; node:test files go through Node's test runner, with
33
+ // `mock.module` enabled for tests that replace a module before importing it.
31
34
  for (const file of testFiles) {
32
- const args = usesNodeTestRunner(file) ? ['test', file] : ['run', file];
33
- const result = spawnSync('bun', args, {
35
+ const args = usesNodeTestRunner(file)
36
+ ? ['--experimental-test-module-mocks', '--import', 'tsx', '--test', file]
37
+ : ['--import', 'tsx', file];
38
+ const result = spawnSync(process.execPath, args, {
34
39
  stdio: 'inherit'
35
40
  });
36
41
  if (result.status !== 0) {
@@ -8,11 +8,11 @@ import { type AssessModelFitInput, type AssessModelFitResult } from '@qvac/infer
8
8
  * the available evidence does not support a verdict either way, and callers
9
9
  * should treat it as "cannot say", not "no".
10
10
  *
11
- * For a single candidate it fetches the registry's weightless description of
12
- * every source that load names — tens of KB each, never the weights — and runs
13
- * the engine's own fitter against them, reported as `native-fit` evidence.
14
- * Where that is unavailable, and for a set of candidates, the calibrated
15
- * estimate stands.
11
+ * For each candidate it fetches the registry's weightless description of every
12
+ * source that load names — tens of KB each, never the weights — and runs the
13
+ * engine's own fitter against them, reported as `native-fit` evidence. Where
14
+ * that is unavailable the computed floor stands, which can refuse a model but
15
+ * never confirm one.
16
16
  *
17
17
  * @param input - Loads to assess in `loadModel`'s own parameters, the declared
18
18
  * execution mode, and the headroom policy.
@@ -1,5 +1,5 @@
1
1
  import { assessModelFitInputSchema, inferModelTypeFromModelSrc } from '@qvac/inference/surface';
2
- import { send } from '../rpc/rpc-client.js';
2
+ import { send } from '../../client/rpc/rpc-client.js';
3
3
  import { InvalidResponseError, ModelTypeRequiredError } from '../../utils/errors-client.js';
4
4
  /**
5
5
  * Names the engine a candidate omitted, from the source it carries.
@@ -23,11 +23,11 @@ function withModelType(candidate) {
23
23
  * the available evidence does not support a verdict either way, and callers
24
24
  * should treat it as "cannot say", not "no".
25
25
  *
26
- * For a single candidate it fetches the registry's weightless description of
27
- * every source that load names — tens of KB each, never the weights — and runs
28
- * the engine's own fitter against them, reported as `native-fit` evidence.
29
- * Where that is unavailable, and for a set of candidates, the calibrated
30
- * estimate stands.
26
+ * For each candidate it fetches the registry's weightless description of every
27
+ * source that load names — tens of KB each, never the weights — and runs the
28
+ * engine's own fitter against them, reported as `native-fit` evidence. Where
29
+ * that is unavailable the computed floor stands, which can refuse a model but
30
+ * never confirm one.
31
31
  *
32
32
  * @param input - Loads to assess in `loadModel`'s own parameters, the declared
33
33
  * execution mode, and the headroom policy.
@@ -53,7 +53,6 @@ export async function assessModelFit(input) {
53
53
  execution: response.execution,
54
54
  ...(response.evidence && { evidence: response.evidence }),
55
55
  ...(response.budget && { budget: response.budget }),
56
- ...(response.estimate && { estimate: response.estimate }),
57
56
  ...(response.floorBytes !== undefined && { floorBytes: response.floorBytes }),
58
57
  models: response.models,
59
58
  reasons: response.reasons,
@@ -3,15 +3,24 @@ import type { AudioEditClientParams, AudioGenResult } from '@qvac/inference/surf
3
3
  * Edits a source recording with a loaded ACE-Step AudioGen model: an ordered
4
4
  * pipeline of `flow-edit` and `repaint` operations, executed in array order.
5
5
  *
6
- * @param params - Loaded model ID, the source audio, the ordered `operations`, and an optional `seed`.
6
+ * @param params - Loaded model ID, the source audio, the ordered `operations`, and optional
7
+ * run controls that apply to every operation.
7
8
  * @param params.sourceAudio - The recording to edit: a file path (decoded server-side) or raw
8
9
  * interleaved stereo 48 kHz Float32 LE PCM bytes in `[-1, 1]`.
10
+ * @param params.referenceAudio - Optional timbre reference for every operation, in the same forms
11
+ * as `sourceAudio` (samples need only be finite).
12
+ * @param params.vocalLanguage - Prompt metadata for every operation, as on a generation; so are
13
+ * `bpm`, `keyscale`, `timesignature` and `augmentCaptionWithMetadata`.
14
+ * @param params.dcwEnabled - Repaint only: the Haar DCW sampler correction, tuned by `dcwScaler` and
15
+ * `dcwHighScaler`.
16
+ * @param params.inferenceSteps - DiT steps for every operation (0..1000); omit to keep the load-time
17
+ * value. `shift` overrides the load-time timestep shift the same way.
9
18
  * @param params.operations - `flow-edit` re-conditions the whole clip from a `from` prompt to a
10
19
  * `to` prompt over an optional `nMin`/`nMax` diffusion window (turbo DiT variants only);
11
20
  * `repaint` regenerates the `start`..`end` range (seconds) against a new `caption`, keeping the
12
21
  * rest of the clip. Operations may repeat or mix.
13
22
  * @param params.seed - Seeds the first operation; each following operation uses `seed + index`.
14
- * @returns The same run shape as `audioGen()`: a synchronous request ID, generation progress stream, PCM audio promise, stats promise, and diagnostics promise.
23
+ * @returns The same run shape as `audioGen()`: a synchronous request ID, generation progress stream, PCM audio promise, stats promise, and diagnostics promise. `stats.metadata.seed` reports the base seed the edit used.
15
24
  *
16
25
  * @example
17
26
  * ```typescript
@@ -27,6 +36,9 @@ import type { AudioEditClientParams, AudioGenResult } from '@qvac/inference/surf
27
36
  * { type: "repaint", caption: "analog synth solo", start: 10, end: 20, mode: "balanced" },
28
37
  * ],
29
38
  * seed: 22883,
39
+ * referenceAudio: "/path/to/reference.wav",
40
+ * bpm: 120,
41
+ * keyscale: "C minor",
30
42
  * });
31
43
  * stopButton.onclick = () => cancel({ requestId: run.requestId });
32
44
  * const { pcm, sampleRate, channels, bitsPerSample } = await run.audio;
@@ -1,18 +1,27 @@
1
- import { stream as streamRpc } from '../rpc/rpc-client.js';
2
- import { createAudioEditResult } from './audio-gen-result.js';
1
+ import { stream as streamRpc } from '../../client/rpc/rpc-client.js';
2
+ import { createAudioEditResult } from '../../client/api/audio-gen-result.js';
3
3
  /**
4
4
  * Edits a source recording with a loaded ACE-Step AudioGen model: an ordered
5
5
  * pipeline of `flow-edit` and `repaint` operations, executed in array order.
6
6
  *
7
- * @param params - Loaded model ID, the source audio, the ordered `operations`, and an optional `seed`.
7
+ * @param params - Loaded model ID, the source audio, the ordered `operations`, and optional
8
+ * run controls that apply to every operation.
8
9
  * @param params.sourceAudio - The recording to edit: a file path (decoded server-side) or raw
9
10
  * interleaved stereo 48 kHz Float32 LE PCM bytes in `[-1, 1]`.
11
+ * @param params.referenceAudio - Optional timbre reference for every operation, in the same forms
12
+ * as `sourceAudio` (samples need only be finite).
13
+ * @param params.vocalLanguage - Prompt metadata for every operation, as on a generation; so are
14
+ * `bpm`, `keyscale`, `timesignature` and `augmentCaptionWithMetadata`.
15
+ * @param params.dcwEnabled - Repaint only: the Haar DCW sampler correction, tuned by `dcwScaler` and
16
+ * `dcwHighScaler`.
17
+ * @param params.inferenceSteps - DiT steps for every operation (0..1000); omit to keep the load-time
18
+ * value. `shift` overrides the load-time timestep shift the same way.
10
19
  * @param params.operations - `flow-edit` re-conditions the whole clip from a `from` prompt to a
11
20
  * `to` prompt over an optional `nMin`/`nMax` diffusion window (turbo DiT variants only);
12
21
  * `repaint` regenerates the `start`..`end` range (seconds) against a new `caption`, keeping the
13
22
  * rest of the clip. Operations may repeat or mix.
14
23
  * @param params.seed - Seeds the first operation; each following operation uses `seed + index`.
15
- * @returns The same run shape as `audioGen()`: a synchronous request ID, generation progress stream, PCM audio promise, stats promise, and diagnostics promise.
24
+ * @returns The same run shape as `audioGen()`: a synchronous request ID, generation progress stream, PCM audio promise, stats promise, and diagnostics promise. `stats.metadata.seed` reports the base seed the edit used.
16
25
  *
17
26
  * @example
18
27
  * ```typescript
@@ -28,6 +37,9 @@ import { createAudioEditResult } from './audio-gen-result.js';
28
37
  * { type: "repaint", caption: "analog synth solo", start: 10, end: 20, mode: "balanced" },
29
38
  * ],
30
39
  * seed: 22883,
40
+ * referenceAudio: "/path/to/reference.wav",
41
+ * bpm: 120,
42
+ * keyscale: "C minor",
31
43
  * });
32
44
  * stopButton.onclick = () => cancel({ requestId: run.requestId });
33
45
  * const { pcm, sampleRate, channels, bitsPerSample } = await run.audio;
@@ -1,6 +1,6 @@
1
1
  import { audioEditClientParamsSchema, audioEditStreamResponseSchema, audioGenClientParamsSchema, audioGenStreamResponseSchema, audioUnderstandClientParamsSchema, audioUnderstandResponseSchema } 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 } from '../../utils/encoding.js';
5
5
  import { InvalidResponseError } from '../../utils/errors-client.js';
6
6
  import { InferenceCancelledError } from '../../utils/errors-server.js';
@@ -22,7 +22,10 @@ import type { AudioGenClientParams, AudioGenResult } from '@qvac/inference/surfa
22
22
  * @param params.track - ACE-Step only: the instrument layer the `"lego"` task regenerates.
23
23
  * Required when `taskType` is `"lego"` and rejected otherwise.
24
24
  * @param params.maxFrames - MiniMax semantic-frame cap; mutually exclusive with `duration`.
25
- * @param params.inferenceSteps - MiniMax flow steps for this run.
25
+ * @param params.inferenceSteps - Diffusion steps for this run (0..1000), on either engine; omit to
26
+ * keep the load-time value.
27
+ * @param params.shift - ACE-Step only: DiT timestep shift for this run; omit to keep the load-time
28
+ * value.
26
29
  * @param params.cfgScale - MiniMax flow classifier-free guidance scale for this run.
27
30
  * @param params.referenceAudio - Optional timbre reference: a file path (decoded server-side)
28
31
  * or raw interleaved stereo 48 kHz Float32 LE PCM bytes.
@@ -31,7 +34,7 @@ import type { AudioGenClientParams, AudioGenResult } from '@qvac/inference/surfa
31
34
  * @param params.taskType - `"text2music"` (default), `"cover-nofsq"`, or `"lego"`.
32
35
  * @param params.audioCoverStrength - Source-context strength for cover tasks (0..1).
33
36
  * @param params.coverNoiseStrength - Initial source/noise blend for cover tasks (0..1).
34
- * @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.
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`.
35
38
  *
36
39
  * @example
37
40
  * ```typescript
@@ -59,6 +62,7 @@ import type { AudioGenClientParams, AudioGenResult } from '@qvac/inference/surfa
59
62
  * engine: "minimax",
60
63
  * lmModelSrc: "/models/mm3-lm-q8.gguf",
61
64
  * synthModelSrc: "/models/mm3-synth-q8.gguf",
65
+ * device: "gpu", // fail the load instead of falling back to the CPU
62
66
  * },
63
67
  * });
64
68
  * const minimaxRun = audioGen({
@@ -89,6 +93,10 @@ import type { AudioGenClientParams, AudioGenResult } from '@qvac/inference/surfa
89
93
  * });
90
94
  * const { lrc, lyricsScore, qualityScore } = (await assisted.stats) ?? {};
91
95
  *
96
+ * // What the LM composed, and the seed that replays the take:
97
+ * const rendered = (await assisted.stats)?.metadata;
98
+ * console.log(rendered?.caption, rendered?.lyrics, rendered?.bpm, rendered?.seed);
99
+ *
92
100
  * // Rebuild one layer of an existing song:
93
101
  * const newDrums = audioGen({
94
102
  * modelId,
@@ -1,5 +1,5 @@
1
- import { stream as streamRpc } from '../rpc/rpc-client.js';
2
- import { createAudioGenResult } from './audio-gen-result.js';
1
+ import { stream as streamRpc } from '../../client/rpc/rpc-client.js';
2
+ import { createAudioGenResult } from '../../client/api/audio-gen-result.js';
3
3
  /**
4
4
  * Generates PCM audio using a loaded AudioGen model.
5
5
  *
@@ -23,7 +23,10 @@ import { createAudioGenResult } from './audio-gen-result.js';
23
23
  * @param params.track - ACE-Step only: the instrument layer the `"lego"` task regenerates.
24
24
  * Required when `taskType` is `"lego"` and rejected otherwise.
25
25
  * @param params.maxFrames - MiniMax semantic-frame cap; mutually exclusive with `duration`.
26
- * @param params.inferenceSteps - MiniMax flow steps for this run.
26
+ * @param params.inferenceSteps - Diffusion steps for this run (0..1000), on either engine; omit to
27
+ * keep the load-time value.
28
+ * @param params.shift - ACE-Step only: DiT timestep shift for this run; omit to keep the load-time
29
+ * value.
27
30
  * @param params.cfgScale - MiniMax flow classifier-free guidance scale for this run.
28
31
  * @param params.referenceAudio - Optional timbre reference: a file path (decoded server-side)
29
32
  * or raw interleaved stereo 48 kHz Float32 LE PCM bytes.
@@ -32,7 +35,7 @@ import { createAudioGenResult } from './audio-gen-result.js';
32
35
  * @param params.taskType - `"text2music"` (default), `"cover-nofsq"`, or `"lego"`.
33
36
  * @param params.audioCoverStrength - Source-context strength for cover tasks (0..1).
34
37
  * @param params.coverNoiseStrength - Initial source/noise blend for cover tasks (0..1).
35
- * @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.
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`.
36
39
  *
37
40
  * @example
38
41
  * ```typescript
@@ -60,6 +63,7 @@ import { createAudioGenResult } from './audio-gen-result.js';
60
63
  * engine: "minimax",
61
64
  * lmModelSrc: "/models/mm3-lm-q8.gguf",
62
65
  * synthModelSrc: "/models/mm3-synth-q8.gguf",
66
+ * device: "gpu", // fail the load instead of falling back to the CPU
63
67
  * },
64
68
  * });
65
69
  * const minimaxRun = audioGen({
@@ -90,6 +94,10 @@ import { createAudioGenResult } from './audio-gen-result.js';
90
94
  * });
91
95
  * const { lrc, lyricsScore, qualityScore } = (await assisted.stats) ?? {};
92
96
  *
97
+ * // What the LM composed, and the seed that replays the take:
98
+ * const rendered = (await assisted.stats)?.metadata;
99
+ * console.log(rendered?.caption, rendered?.lyrics, rendered?.bpm, rendered?.seed);
100
+ *
93
101
  * // Rebuild one layer of an existing song:
94
102
  * const newDrums = audioGen({
95
103
  * modelId,
@@ -9,7 +9,7 @@ import type { AudioUnderstandClientParams, AudioUnderstandResult } from '@qvac/i
9
9
  * interleaved stereo 48 kHz Float32 LE PCM bytes in `[-1, 1]`.
10
10
  * @param params.vocalLanguage - Language hint forced into the result instead of the LM's guess.
11
11
  * @param params.seed - Seeds the LM decode; omit for a random seed.
12
- * @returns A synchronous request ID, a progress stream, the `description` promise, and the stats and diagnostics promises.
12
+ * @returns A synchronous request ID, a progress stream, the `description` promise, and the stats and diagnostics promises. `description.seed` is the seed the decode used, so an unseeded description can be reproduced.
13
13
  *
14
14
  * @example
15
15
  * ```typescript
@@ -1,5 +1,5 @@
1
- import { stream as streamRpc } from '../rpc/rpc-client.js';
2
- import { createAudioUnderstandResult } from './audio-gen-result.js';
1
+ import { stream as streamRpc } from '../../client/rpc/rpc-client.js';
2
+ import { createAudioUnderstandResult } from '../../client/api/audio-gen-result.js';
3
3
  /**
4
4
  * Describes a recording with a loaded ACE-Step AudioGen model, running the
5
5
  * engine's reverse pipeline: the PCM is encoded, its FSQ semantic codes are
@@ -10,7 +10,7 @@ import { createAudioUnderstandResult } from './audio-gen-result.js';
10
10
  * interleaved stereo 48 kHz Float32 LE PCM bytes in `[-1, 1]`.
11
11
  * @param params.vocalLanguage - Language hint forced into the result instead of the LM's guess.
12
12
  * @param params.seed - Seeds the LM decode; omit for a random seed.
13
- * @returns A synchronous request ID, a progress stream, the `description` promise, and the stats and diagnostics promises.
13
+ * @returns A synchronous request ID, a progress stream, the `description` promise, and the stats and diagnostics promises. `description.seed` is the seed the decode used, so an unseeded description can be reproduced.
14
14
  *
15
15
  * @example
16
16
  * ```typescript
@@ -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 { getClientLogger } from '../../logging/index.js';
4
4
  import { batchCompletionStreamResponseSchema } from '@qvac/inference/surface';
5
5
  import { buildFinalFromEvents } from '../../utils/aggregate-events.js';
@@ -51,7 +51,7 @@ async function resolveBatchPrompts(prompts) {
51
51
  resolvedHandlers.push(handlers);
52
52
  resolvedPrompts.push({
53
53
  ...(prompt.id !== undefined && { id: prompt.id }),
54
- history: prompt.history,
54
+ history: prompt.history.map((message) => ({ ...message, content: message.content ?? '' })),
55
55
  ...(prompt.generationParams && {
56
56
  generationParams: prompt.generationParams
57
57
  }),
@@ -1,10 +1,10 @@
1
1
  import { bciTranscribeResponseSchema, bciTranscribeClientParamsSchema, bciTranscribeStreamResponseSchema } 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 { parseClientInput } from '../parse-input.js';
7
- import { generateClientRequestId } from './client-request-id.js';
6
+ import { parseClientInput } from '../../client/parse-input.js';
7
+ import { generateClientRequestId } from '../../client/api/client-request-id.js';
8
8
  const logger = getClientLogger();
9
9
  function buildBciTranscribeRequest(params, requestId) {
10
10
  return {
@@ -1,4 +1,4 @@
1
- import { send } from '../rpc/rpc-client.js';
1
+ import { send } from '../../client/rpc/rpc-client.js';
2
2
  import {} from '@qvac/inference/surface';
3
3
  import { InvalidResponseError, CancelFailedError } from '../../utils/errors-client.js';
4
4
  /**
@@ -1,5 +1,5 @@
1
1
  import { classifyResponseSchema } 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 { encodeBase64 } from '../../utils/encoding.js';
4
4
  /**
5
5
  * Classifies an image using a loaded classification model.
@@ -28,7 +28,7 @@ type CompletionParams = Omit<CompletionClientParams, 'tools'> & {
28
28
  * @param params.mcp - Optional array of MCP client inputs for tool integration
29
29
  * @param params.captureThinking - Best-effort parsing of `<think>` blocks into `thinkingDelta` events; `final.raw.fullText` always preserves the original output
30
30
  * @param params.emitRawDeltas - When true, every raw model token is also emitted as a `rawDelta` event
31
- * @param params.toolDialect - Override the SDK's name-based dialect detection. Supported values: `"hermes"`, `"pythonic"`, `"json"`, `"harmony"`, `"qwen35"` (Qwen3.5/3.6/3.8), `"gemma4"`, `"dsml"` (DeepSeek V3.2/V4). Use when the auto-router doesn't recognise your model name. Drives both streaming frame detection and finalization parsing.
31
+ * @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.
32
32
  * Common override case: Llama 3.x tool-calling fine-tunes that emit the native pythonic header (`<|start_header_id|>tool_call<|end_header_id|>...<|eot_id|>`).
33
33
  * @param params.responseFormat - Optional structured-output constraint applied to the model's output:
34
34
  * - `{ type: "text" }` — no constraint (default behavior)
@@ -45,6 +45,7 @@ type CompletionParams = Omit<CompletionClientParams, 'tools'> & {
45
45
  * validation must encode it explicitly in `schema`.
46
46
  *
47
47
  * 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.
48
49
  * @param params.kvCache - Optional KV cache configuration. Cache files are organized hierarchically:
49
50
  * - Structure: `{kvCacheKey}/{modelId}/{configHash}.bin`
50
51
  * - The configHash includes model config + system prompt to ensure cache isolation
@@ -1,11 +1,11 @@
1
- import { stream as streamRpc } from '../rpc/rpc-client.js';
1
+ import { stream as streamRpc } from '../../client/rpc/rpc-client.js';
2
2
  import { getClientLogger } from '../../logging/index.js';
3
3
  import { completionStreamResponseSchema } from '@qvac/inference/surface';
4
4
  import { CompletionFailedError, InferenceCancelledError } from '../../utils/errors-server.js';
5
5
  import { getMcpToolsWithHandlers } from '../../utils/mcp-adapter.js';
6
6
  import { validateTools } from '../../utils/tool-helpers.js';
7
7
  import { buildFinalFromEvents } from '../../utils/aggregate-events.js';
8
- import { generateClientRequestId } from './client-request-id.js';
8
+ import { generateClientRequestId } from '../../client/api/client-request-id.js';
9
9
  const logger = getClientLogger();
10
10
  /**
11
11
  * Generates completion from a language model based on conversation history.
@@ -28,7 +28,7 @@ const logger = getClientLogger();
28
28
  * @param params.mcp - Optional array of MCP client inputs for tool integration
29
29
  * @param params.captureThinking - Best-effort parsing of `<think>` blocks into `thinkingDelta` events; `final.raw.fullText` always preserves the original output
30
30
  * @param params.emitRawDeltas - When true, every raw model token is also emitted as a `rawDelta` event
31
- * @param params.toolDialect - Override the SDK's name-based dialect detection. Supported values: `"hermes"`, `"pythonic"`, `"json"`, `"harmony"`, `"qwen35"` (Qwen3.5/3.6/3.8), `"gemma4"`, `"dsml"` (DeepSeek V3.2/V4). Use when the auto-router doesn't recognise your model name. Drives both streaming frame detection and finalization parsing.
31
+ * @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.
32
32
  * Common override case: Llama 3.x tool-calling fine-tunes that emit the native pythonic header (`<|start_header_id|>tool_call<|end_header_id|>...<|eot_id|>`).
33
33
  * @param params.responseFormat - Optional structured-output constraint applied to the model's output:
34
34
  * - `{ type: "text" }` — no constraint (default behavior)
@@ -45,6 +45,7 @@ const logger = getClientLogger();
45
45
  * validation must encode it explicitly in `schema`.
46
46
  *
47
47
  * 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.
48
49
  * @param params.kvCache - Optional KV cache configuration. Cache files are organized hierarchically:
49
50
  * - Structure: `{kvCacheKey}/{modelId}/{configHash}.bin`
50
51
  * - The configHash includes model config + system prompt to ensure cache isolation
@@ -181,8 +182,9 @@ export function completion(params) {
181
182
  const request = {
182
183
  type: 'completionStream',
183
184
  modelId: params.modelId,
184
- history: params.history,
185
+ history: params.history.map((message) => ({ ...message, content: message.content ?? '' })),
185
186
  kvCache: params.kvCache,
187
+ prefill: params.prefill,
186
188
  tools: allTools.length > 0 ? allTools : undefined,
187
189
  stream: params.stream ?? true,
188
190
  generationParams: params.generationParams,