@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.
- package/NOTICE +131 -62
- package/README.md +31 -326
- package/dist/examples/abot-world.js +1 -1
- package/dist/examples/advisory-model-fit.d.ts +0 -58
- package/dist/examples/advisory-model-fit.js +23 -150
- package/dist/examples/asr/moss-transcribe-filesystem.d.ts +2 -0
- package/dist/examples/asr/moss-transcribe-filesystem.js +84 -0
- package/dist/examples/asr/moss-transcribe-fit.d.ts +2 -0
- package/dist/examples/asr/moss-transcribe-fit.js +40 -0
- package/dist/examples/asr/nemotron-diarization-filesystem.d.ts +2 -0
- package/dist/examples/asr/nemotron-diarization-filesystem.js +64 -0
- package/dist/examples/asr/parakeet-ctc-filesystem.js +2 -2
- package/dist/examples/asr/parakeet-indic-conformer-filesystem.js +2 -2
- package/dist/examples/asr/parakeet-microphone-record.js +1 -1
- package/dist/examples/asr/parakeet-microphone-stream.js +1 -1
- package/dist/examples/asr/parakeet-nemotron-filesystem.js +3 -3
- package/dist/examples/asr/parakeet-sortformer-streaming.js +2 -2
- package/dist/examples/asr/parakeet-sortformer.js +1 -1
- package/dist/examples/asr/parakeet-tdt-filesystem-chunked.js +2 -2
- package/dist/examples/asr/parakeet-tdt-filesystem.js +2 -2
- package/dist/examples/asr/parakeet-transcribepsy-filesystem.d.ts +2 -0
- package/dist/examples/asr/parakeet-transcribepsy-filesystem.js +76 -0
- package/dist/examples/asr/parakeet-unified-coreml.js +2 -2
- package/dist/examples/asr/parakeet-unified-filesystem.js +2 -2
- package/dist/examples/asr/whispercpp-filesystem-streaming.js +1 -1
- package/dist/examples/asr/whispercpp-filesystem.js +1 -1
- package/dist/examples/asr/whispercpp-microphone-record.js +1 -1
- package/dist/examples/asr/whispercpp-prompt.js +1 -1
- package/dist/examples/assess-model-fit.js +3 -6
- package/dist/examples/audiogen/edit-music.js +2 -2
- package/dist/examples/audiogen/generate-cover.js +2 -2
- package/dist/examples/audiogen/generate-music-minimax.js +1 -1
- package/dist/examples/audiogen/generate-music.js +1 -1
- package/dist/examples/audiogen/understand-music.js +2 -2
- package/dist/examples/batch-completion.d.ts +1 -1
- package/dist/examples/batch-completion.js +1 -1
- package/dist/examples/bci/bci-filesystem-streaming.js +2 -2
- package/dist/examples/bci/bci-filesystem.js +2 -2
- package/dist/examples/concurrent-completion-collision.js +1 -1
- package/dist/examples/config-reload.js +1 -1
- package/dist/examples/decisions.d.ts +2 -0
- package/dist/examples/decisions.js +38 -0
- package/dist/examples/diffusion-esrgan-upscale.js +1 -1
- package/dist/examples/diffusion-flux2-klein-img2img.js +1 -1
- package/dist/examples/diffusion-img2img.js +1 -1
- package/dist/examples/diffusion-img2vid-ltx.js +8 -15
- package/dist/examples/diffusion-img2vid-minimax-h3.d.ts +2 -0
- package/dist/examples/diffusion-img2vid-minimax-h3.js +72 -0
- package/dist/examples/diffusion-img2vid.js +1 -1
- package/dist/examples/diffusion-qwen-image-21.d.ts +2 -0
- package/dist/examples/diffusion-qwen-image-21.js +104 -0
- package/dist/examples/diffusion-txt2vid-ltx.js +7 -14
- package/dist/examples/finetune/llamacpp-finetune.js +9 -4
- package/dist/examples/llamacpp-filesystem.js +1 -1
- package/dist/examples/llamacpp-multi-gpu.js +2 -2
- package/dist/examples/llamacpp-multimodal.js +3 -1
- package/dist/examples/llamacpp-structured-output.js +1 -1
- package/dist/examples/mcp-websearch.d.ts +2 -2
- package/dist/examples/mcp-websearch.js +4 -4
- package/dist/examples/model-fit-ui/server.d.ts +1 -1
- package/dist/examples/model-fit-ui/server.js +1 -1
- package/dist/examples/multi-job-completion.d.ts +1 -1
- package/dist/examples/multi-job-completion.js +1 -1
- package/dist/examples/ocr-fasttext.js +1 -1
- package/dist/examples/plugins.js +1 -1
- package/dist/examples/rerank.d.ts +2 -0
- package/dist/examples/rerank.js +33 -0
- package/dist/examples/tools/llamacpp-deferred-tools.js +5 -5
- package/dist/examples/tools/llamacpp-tools-auto-dialect.js +5 -4
- package/dist/examples/tools/llamacpp-tools-gemma4.js +4 -4
- package/dist/examples/tools/llamacpp-tools-qwen35.js +5 -4
- package/dist/examples/tts/llm-to-tts-streaming.d.ts +2 -2
- package/dist/examples/tts/llm-to-tts-streaming.js +2 -2
- package/dist/examples/tts/moss-sound-effect-controls.d.ts +2 -0
- package/dist/examples/tts/moss-sound-effect-controls.js +88 -0
- package/dist/examples/tts/moss-sound-effect.d.ts +2 -0
- package/dist/examples/tts/moss-sound-effect.js +86 -0
- package/dist/examples/tts/moss-speech-audio.d.ts +2 -0
- package/dist/examples/tts/moss-speech-audio.js +159 -0
- package/dist/examples/tts/moss-speech.d.ts +2 -0
- package/dist/examples/tts/moss-speech.js +70 -0
- package/dist/examples/vla-groot.js +2 -2
- package/dist/examples/vla-pi05.js +2 -2
- package/dist/examples/vla-smolvla.js +2 -2
- package/dist/examples/voice-assistant/voice-assistant.js +1 -1
- package/dist/scripts/contract/build-contract.d.ts +3 -1
- package/dist/scripts/contract/build-contract.js +40 -2
- package/dist/scripts/contract/build-model-type-maps.d.ts +6 -1
- package/dist/scripts/contract/build-model-type-maps.js +3 -2
- package/dist/scripts/contract/constants-registry.d.ts +6 -0
- package/dist/scripts/contract/constants-registry.js +4 -1
- package/dist/scripts/contract/method-shapes.d.ts +2 -0
- package/dist/scripts/contract/method-shapes.js +2 -0
- package/dist/scripts/export-contract.js +20 -7
- package/dist/scripts/run-unit-tests.js +10 -5
- package/dist/src/client/api/assess-model-fit.d.ts +5 -5
- package/dist/src/client/api/assess-model-fit.js +6 -7
- package/dist/src/client/api/audio-edit.d.ts +14 -2
- package/dist/src/client/api/audio-edit.js +16 -4
- package/dist/src/client/api/audio-gen-result.js +2 -2
- package/dist/src/client/api/audio-gen.d.ts +10 -2
- package/dist/src/client/api/audio-gen.js +12 -4
- package/dist/src/client/api/audio-understand.d.ts +1 -1
- package/dist/src/client/api/audio-understand.js +3 -3
- package/dist/src/client/api/batch-completion.js +3 -3
- package/dist/src/client/api/bci-transcribe.js +3 -3
- package/dist/src/client/api/cancel.js +1 -1
- package/dist/src/client/api/classify.js +1 -1
- package/dist/src/client/api/completion-stream.d.ts +2 -1
- package/dist/src/client/api/completion-stream.js +6 -4
- package/dist/src/client/api/decide.d.ts +31 -0
- package/dist/src/client/api/decide.js +29 -0
- package/dist/src/client/api/delete-cache.js +1 -1
- package/dist/src/client/api/diffusion.d.ts +18 -1
- package/dist/src/client/api/diffusion.js +19 -2
- package/dist/src/client/api/download-asset.js +3 -3
- package/dist/src/client/api/embed.js +2 -2
- package/dist/src/client/api/finetune.js +3 -3
- package/dist/src/client/api/get-loaded-model-info.js +1 -1
- package/dist/src/client/api/get-model-info.js +1 -1
- package/dist/src/client/api/get-system-resources.js +1 -1
- package/dist/src/client/api/heartbeat.js +1 -1
- package/dist/src/client/api/index.d.ts +5 -3
- package/dist/src/client/api/index.js +5 -3
- package/dist/src/client/api/invoke-plugin.js +1 -1
- package/dist/src/client/api/load-model.d.ts +1 -0
- package/dist/src/client/api/load-model.js +4 -4
- package/dist/src/client/api/logging-stream.d.ts +11 -2
- package/dist/src/client/api/logging-stream.js +12 -3
- package/dist/src/client/api/ocr.js +1 -1
- package/dist/src/client/api/rag.js +2 -2
- package/dist/src/client/api/registry.d.ts +2 -1
- package/dist/src/client/api/registry.js +6 -5
- package/dist/src/client/api/rerank.d.ts +22 -0
- package/dist/src/client/api/rerank.js +39 -0
- package/dist/src/client/api/resume.js +1 -1
- package/dist/src/client/api/rpc-server.js +2 -2
- package/dist/src/client/api/state.js +1 -1
- package/dist/src/client/api/subscribe-logs.js +3 -2
- package/dist/src/client/api/suspend.js +1 -1
- package/dist/src/client/api/text-to-speech.d.ts +1 -0
- package/dist/src/client/api/text-to-speech.js +18 -25
- package/dist/src/client/api/transcribe.d.ts +1 -1
- package/dist/src/client/api/transcribe.js +7 -4
- package/dist/src/client/api/translate.js +2 -2
- package/dist/src/client/api/unload-model.js +2 -2
- package/dist/src/client/api/upscale.js +1 -1
- package/dist/src/client/api/vector-index.d.ts +1 -1
- package/dist/src/client/api/vector-index.js +1 -1
- package/dist/src/client/api/video-request.d.ts +5 -5
- package/dist/src/client/api/video.d.ts +23 -3
- package/dist/src/client/api/video.js +26 -6
- package/dist/src/client/api/world-result.js +2 -2
- package/dist/src/client/api/world.d.ts +1 -1
- package/dist/src/client/api/world.js +2 -2
- package/dist/src/client/logging-stream-registry.js +9 -6
- package/dist/src/client/plugins-factory.d.ts +1 -1
- package/dist/src/client/plugins-factory.js +1 -1
- package/dist/src/client/rpc/expo-rpc-client.js +3 -3
- package/dist/src/client/rpc/ipc-socket-path.d.ts +11 -0
- package/dist/src/client/rpc/ipc-socket-path.js +30 -0
- package/dist/src/client/rpc/node-rpc-client.js +14 -25
- package/dist/src/client/rpc/rpc-client.d.ts +3 -2
- package/dist/src/client/rpc/rpc-client.js +46 -12
- package/dist/src/client/rpc/rpc-error.js +4 -1
- package/dist/src/commands/bundle/bare-pack.d.ts +8 -0
- package/dist/src/commands/bundle/bare-pack.js +28 -5
- package/dist/src/commands/bundle/constants.js +3 -0
- package/dist/src/commands/bundle/entry-gen.js +1 -1
- package/dist/src/commands/bundle/index.d.ts +8 -7
- package/dist/src/commands/bundle/index.js +135 -52
- package/dist/src/commands/bundle/manifest.d.ts +2 -0
- package/dist/src/commands/bundle/manifest.js +3 -2
- package/dist/src/commands/bundle/plugins.js +1 -1
- package/dist/src/commands/host-prebuilds/index.d.ts +18 -10
- package/dist/src/commands/host-prebuilds/index.js +39 -20
- package/dist/src/commands/index.d.ts +13 -13
- package/dist/src/commands/index.js +8 -8
- package/dist/src/commands/verify/abi.d.ts +1 -1
- package/dist/src/commands/verify/abi.js +1 -1
- package/dist/src/commands/verify/addon-source.d.ts +12 -0
- package/dist/src/commands/verify/addon-source.js +36 -3
- package/dist/src/commands/verify/bare-kit-runtime.d.ts +1 -1
- package/dist/src/commands/verify/bare-kit-runtime.js +1 -1
- package/dist/src/commands/verify/bare-kit-runtimes.js +2 -1
- package/dist/src/commands/verify/bundle-source.d.ts +1 -1
- package/dist/src/commands/verify/bundle-source.js +3 -3
- package/dist/src/commands/verify/engines-advice.d.ts +4 -4
- package/dist/src/commands/verify/engines-advice.js +4 -4
- package/dist/src/commands/verify/index.d.ts +5 -5
- package/dist/src/commands/verify/index.js +7 -7
- package/dist/src/commands/verify/node-modules-source.d.ts +1 -1
- package/dist/src/commands/verify/node-modules-source.js +11 -2
- package/dist/src/{expo/plugins/patches/qvac-platform-addons.d.ts → commands/verify/platform-addons.d.ts} +6 -10
- package/dist/src/{expo/plugins/patches/qvac-platform-addons.js → commands/verify/platform-addons.js} +2 -45
- package/dist/src/commands/verify/prebuilds.d.ts +8 -11
- package/dist/src/commands/verify/prebuilds.js +44 -35
- package/dist/src/commands/verify/resource-collectors.js +2 -2
- package/dist/src/expo/plugins/link-addons.d.ts +18 -0
- package/dist/src/expo/plugins/link-addons.js +65 -0
- package/dist/src/expo/plugins/withAndroidNdkVersion.js +16 -10
- package/dist/src/expo/plugins/withDeviceInfo.js +19 -5
- package/dist/src/expo/plugins/withMobileBundle.d.ts +13 -23
- package/dist/src/expo/plugins/withMobileBundle.js +27 -117
- package/dist/src/index.d.ts +4 -4
- package/dist/src/index.js +3 -3
- package/dist/src/logging/addon.d.ts +1 -1
- package/dist/src/pear/pre.js +4 -0
- package/dist/src/plugin-ids.d.ts +4 -1
- package/dist/src/plugin-ids.js +6 -0
- package/dist/src/schemas/public.d.ts +2 -1
- package/dist/src/schemas/public.js +2 -1
- package/dist/src/schemas/sdk-errors-client.d.ts +3 -0
- package/dist/src/schemas/sdk-errors-client.js +16 -0
- package/dist/src/schemas/sdk-errors-server.d.ts +2 -0
- package/dist/src/schemas/sdk-errors-server.js +11 -1
- package/dist/src/server/rpc/rpc-utils.d.ts +5 -0
- package/dist/src/server/rpc/rpc-utils.js +7 -0
- package/dist/src/server/utils/qvac-paths.js +1 -1
- package/dist/src/server/utils/worker-lock.js +1 -1
- package/dist/src/utils/aggregate-events.d.ts +1 -1
- package/dist/src/utils/aggregate-events.js +2 -2
- package/dist/src/utils/errors-client.d.ts +10 -0
- package/dist/src/utils/errors-client.js +18 -0
- package/dist/src/utils/errors-server.d.ts +6 -0
- package/dist/src/utils/errors-server.js +12 -0
- package/dist/src/utils/mcp-adapter.d.ts +1 -1
- package/dist/src/utils/mcp-adapter.js +13 -9
- package/dist/src/utils/tool-helpers.d.ts +1 -1
- package/dist/src/utils/tool-helpers.js +21 -53
- package/dist/src/worker/create-server.d.ts +1 -0
- package/dist/src/worker/create-server.js +5 -0
- package/dist/src/worker/handle-request.js +4 -2
- package/dist/src/worker/handler-utils.js +1 -1
- package/dist/src/worker/index.js +7 -1
- package/dist/src/worker/lifecycle.js +10 -2
- package/dist/src/worker/plugins/llamacpp-decision.d.ts +2 -0
- package/dist/src/worker/plugins/llamacpp-decision.js +1 -0
- package/dist/src/worker/plugins/llamacpp-rerank.d.ts +2 -0
- package/dist/src/worker/plugins/llamacpp-rerank.js +1 -0
- package/dist/src/worker/plugins/moss-transcribe.d.ts +2 -0
- package/dist/src/worker/plugins/moss-transcribe.js +1 -0
- package/package.json +63 -53
- package/src/electron-forge/index.cjs +12 -71
- package/dist/scripts/link-workspace-inference.d.ts +0 -2
- package/dist/scripts/link-workspace-inference.js +0 -31
- package/src/expo/plugins/patches/android-link.mjs +0 -67
- package/src/expo/plugins/patches/ios-link.mjs +0 -67
- 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
|
|
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 `
|
|
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,
|
|
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";
|
|
@@ -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
|
-
|
|
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
|
|
9
|
-
const filePath = fileURLToPath(
|
|
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(
|
|
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
|
|
34
|
+
console.log(`wrote ${label}`);
|
|
22
35
|
}
|
|
23
36
|
}
|
|
24
37
|
if (stale) {
|
|
25
|
-
console.error("
|
|
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
|
-
//
|
|
8
|
-
|
|
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)
|
|
33
|
-
|
|
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
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
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 '
|
|
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
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
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
|
|
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 '
|
|
2
|
-
import { createAudioEditResult } from '
|
|
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
|
|
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 '
|
|
3
|
-
import { generateClientRequestId } from '
|
|
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 -
|
|
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 '
|
|
2
|
-
import { createAudioGenResult } from '
|
|
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 -
|
|
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 '
|
|
2
|
-
import { createAudioUnderstandResult } from '
|
|
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 '
|
|
2
|
-
import { generateClientRequestId } from '
|
|
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 '
|
|
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 '
|
|
7
|
-
import { generateClientRequestId } from '
|
|
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,5 +1,5 @@
|
|
|
1
1
|
import { classifyResponseSchema } from '@qvac/inference/surface';
|
|
2
|
-
import { stream as streamRpc } from '
|
|
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
|
|
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 '
|
|
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 '
|
|
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
|
|
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,
|