@qvac/sdk 0.21.0 ā 0.22.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 +35 -1
- package/README.md +167 -24
- 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-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 +1 -1
- 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/llamacpp-filesystem.js +1 -1
- package/dist/examples/llamacpp-multi-gpu.js +2 -2
- package/dist/examples/llamacpp-structured-output.js +1 -1
- package/dist/examples/mcp-websearch.d.ts +2 -2
- package/dist/examples/mcp-websearch.js +3 -3
- 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/tools/llamacpp-tools-auto-dialect.js +1 -1
- package/dist/examples/tools/llamacpp-tools-gemma4.js +1 -1
- package/dist/examples/tools/llamacpp-tools-qwen35.js +1 -1
- 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 +4 -0
- package/dist/scripts/contract/constants-registry.js +3 -1
- package/dist/scripts/contract/method-shapes.d.ts +1 -0
- package/dist/scripts/contract/method-shapes.js +1 -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 +5 -6
- package/dist/src/client/api/audio-edit.d.ts +14 -2
- package/dist/src/client/api/audio-edit.js +14 -2
- package/dist/src/client/api/audio-gen.d.ts +10 -2
- package/dist/src/client/api/audio-gen.js +10 -2
- package/dist/src/client/api/audio-understand.d.ts +1 -1
- package/dist/src/client/api/audio-understand.js +1 -1
- package/dist/src/client/api/batch-completion.js +1 -1
- package/dist/src/client/api/completion-stream.js +1 -1
- package/dist/src/client/api/decide.d.ts +31 -0
- package/dist/src/client/api/decide.js +29 -0
- package/dist/src/client/api/index.d.ts +1 -0
- package/dist/src/client/api/index.js +1 -0
- package/dist/src/client/api/load-model.d.ts +1 -0
- package/dist/src/client/api/text-to-speech.d.ts +1 -0
- package/dist/src/client/api/text-to-speech.js +15 -22
- package/dist/src/client/api/transcribe.js +5 -2
- 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 +23 -3
- 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 +2 -0
- package/dist/src/commands/bundle/index.d.ts +7 -6
- package/dist/src/commands/bundle/index.js +126 -43
- package/dist/src/commands/bundle/manifest.d.ts +2 -0
- package/dist/src/commands/bundle/manifest.js +3 -2
- package/dist/src/commands/host-prebuilds/index.d.ts +15 -7
- package/dist/src/commands/host-prebuilds/index.js +35 -16
- package/dist/src/commands/index.d.ts +1 -1
- package/dist/src/commands/index.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-runtimes.js +2 -1
- package/dist/src/commands/verify/node-modules-source.js +10 -1
- 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 +7 -10
- package/dist/src/commands/verify/prebuilds.js +43 -34
- package/dist/src/expo/plugins/get-project-root.d.ts +1 -1
- 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/withAndroidArchitecture.d.ts +1 -1
- package/dist/src/expo/plugins/withAndroidNdkVersion.d.ts +1 -1
- package/dist/src/expo/plugins/withDeviceInfo.d.ts +1 -1
- package/dist/src/expo/plugins/withMobileBundle.d.ts +11 -21
- package/dist/src/expo/plugins/withMobileBundle.js +22 -112
- package/dist/src/expo/plugins/withOpenCL.d.ts +1 -1
- package/dist/src/expo/plugins/withQvacSDK.d.ts +1 -1
- package/dist/src/index.d.ts +3 -3
- package/dist/src/index.js +2 -2
- package/dist/src/logging/base-logger.js +1 -1
- package/dist/src/logging/utils.js +1 -1
- package/dist/src/pear/pre.js +2 -0
- package/dist/src/plugin-ids.d.ts +3 -1
- package/dist/src/plugin-ids.js +4 -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 +1 -0
- package/dist/src/schemas/sdk-errors-server.js +5 -0
- package/dist/src/utils/errors-client.d.ts +10 -0
- package/dist/src/utils/errors-client.js +18 -0
- package/dist/src/utils/mcp-adapter.js +12 -8
- package/dist/src/utils/tool-helpers.d.ts +1 -1
- package/dist/src/utils/tool-helpers.js +20 -52
- package/dist/src/worker/create-server.d.ts +1 -0
- package/dist/src/worker/create-server.js +5 -0
- package/dist/src/worker/index.js +4 -0
- package/dist/src/worker/lifecycle.js +9 -1
- 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/moss-transcribe.d.ts +2 -0
- package/dist/src/worker/plugins/moss-transcribe.js +1 -0
- package/package.json +39 -35
- 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
|
@@ -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
|
}),
|
|
@@ -181,7 +181,7 @@ export function completion(params) {
|
|
|
181
181
|
const request = {
|
|
182
182
|
type: 'completionStream',
|
|
183
183
|
modelId: params.modelId,
|
|
184
|
-
history: params.history,
|
|
184
|
+
history: params.history.map((message) => ({ ...message, content: message.content ?? '' })),
|
|
185
185
|
kvCache: params.kvCache,
|
|
186
186
|
tools: allTools.length > 0 ? allTools : undefined,
|
|
187
187
|
stream: params.stream ?? true,
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { send } from '../rpc/rpc-client.js';
|
|
2
|
+
import { type DecideParams, type DecisionResult, type DecisionResponse, type RPCOptions } from '@qvac/inference/surface';
|
|
3
|
+
/**
|
|
4
|
+
* Answers typed decision questions about one state or a batch of states.
|
|
5
|
+
*
|
|
6
|
+
* @param params - Model ID, states, questions, and optional token budgets.
|
|
7
|
+
* @param options - RPC transport options.
|
|
8
|
+
* @returns A promise with a synchronous requestId for cancel(). One state
|
|
9
|
+
* resolves to one result; a batch resolves to results in input order.
|
|
10
|
+
* @throws {RequestValidationFailedError} If the request is invalid.
|
|
11
|
+
* @throws {InferenceCancelledError} If the request is cancelled.
|
|
12
|
+
* @throws {RequestRejectedByPolicyError} If this model's decision queue is full.
|
|
13
|
+
* @throws {InvalidResponseError} If the worker returns a malformed result.
|
|
14
|
+
*/
|
|
15
|
+
export declare function decide(params: Extract<DecideParams, {
|
|
16
|
+
state: unknown;
|
|
17
|
+
}>, options?: RPCOptions): Promise<DecisionResult> & {
|
|
18
|
+
requestId: string;
|
|
19
|
+
};
|
|
20
|
+
export declare function decide(params: Extract<DecideParams, {
|
|
21
|
+
states: unknown;
|
|
22
|
+
}>, options?: RPCOptions): Promise<DecisionResult[]> & {
|
|
23
|
+
requestId: string;
|
|
24
|
+
};
|
|
25
|
+
export declare function decide(params: DecideParams, options?: RPCOptions): Promise<DecisionResponse> & {
|
|
26
|
+
requestId: string;
|
|
27
|
+
};
|
|
28
|
+
export declare function createDecisionCall(params: DecideParams, options?: RPCOptions, sendRequest?: typeof send): Promise<DecisionResponse> & {
|
|
29
|
+
requestId: string;
|
|
30
|
+
};
|
|
31
|
+
//# sourceMappingURL=decide.d.ts.map
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { parseClientInput } from '../parse-input.js';
|
|
2
|
+
import { send } from '../rpc/rpc-client.js';
|
|
3
|
+
import { decideParamsSchema, decideResponseSchema } from '@qvac/inference/surface';
|
|
4
|
+
import { InvalidResponseError } from '../../utils/errors-client.js';
|
|
5
|
+
import { decoratePromise } from '../../utils/decorate-promise.js';
|
|
6
|
+
import { generateClientRequestId } from './client-request-id.js';
|
|
7
|
+
export function decide(params, options) {
|
|
8
|
+
return createDecisionCall(params, options);
|
|
9
|
+
}
|
|
10
|
+
export function createDecisionCall(params, options, sendRequest = send) {
|
|
11
|
+
const requestId = generateClientRequestId();
|
|
12
|
+
return decoratePromise(runDecide(params, requestId, options, sendRequest), { requestId });
|
|
13
|
+
}
|
|
14
|
+
async function runDecide(params, requestId, options, sendRequest) {
|
|
15
|
+
const input = parseClientInput(decideParamsSchema, params);
|
|
16
|
+
const response = await sendRequest({ ...input, type: 'decide', requestId }, options);
|
|
17
|
+
if (response.type !== 'decide')
|
|
18
|
+
throw new InvalidResponseError('decide');
|
|
19
|
+
const parsed = decideResponseSchema.safeParse(response);
|
|
20
|
+
if (!parsed.success)
|
|
21
|
+
throw new InvalidResponseError('decide', parsed.error);
|
|
22
|
+
const { result } = parsed.data;
|
|
23
|
+
if ('states' in input
|
|
24
|
+
? !Array.isArray(result) || result.length !== input.states.length
|
|
25
|
+
: Array.isArray(result)) {
|
|
26
|
+
throw new InvalidResponseError('decide');
|
|
27
|
+
}
|
|
28
|
+
return result;
|
|
29
|
+
}
|
|
@@ -38,4 +38,5 @@ export { audioGen } from './audio-gen.js';
|
|
|
38
38
|
export { audioEdit } from './audio-edit.js';
|
|
39
39
|
export { audioUnderstand } from './audio-understand.js';
|
|
40
40
|
export { startRpcServer, stopRpcServer, discoverRpcServers } from './rpc-server.js';
|
|
41
|
+
export { decide } from './decide.js';
|
|
41
42
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -38,3 +38,4 @@ export { audioGen } from './audio-gen.js';
|
|
|
38
38
|
export { audioEdit } from './audio-edit.js';
|
|
39
39
|
export { audioUnderstand } from './audio-understand.js';
|
|
40
40
|
export { startRpcServer, stopRpcServer, discoverRpcServers } from './rpc-server.js';
|
|
41
|
+
export { decide } from './decide.js';
|
|
@@ -44,6 +44,7 @@ export declare function loadModel<S extends ModelDescriptor>(options: LoadModelD
|
|
|
44
44
|
* - fallbackSrc: For a built-in catalog model, an HTTP URL or local file path to load from when the registry is unreachable (validated against the model checksum)
|
|
45
45
|
* - requireHttpChecksum: Per-call override ā reject a Hugging Face HTTP download that exposes no usable SHA-256 instead of downloading it unverified. Defaults to the engine config (false).
|
|
46
46
|
* - requireSecureTransport: Per-call override ā reject plaintext http:// and HTTPSāHTTP downgrades for every HTTP source (loopback exempt); when unset, only Hugging Face transport is hardened. Defaults to the engine config (false).
|
|
47
|
+
* - modelFitPolicy: Per-call override ā "log" reports the engine fitter's verdict and loads anyway, "refuse" rejects a load it projects will not fit, "off" skips the check. Defaults to the engine config ("log").
|
|
47
48
|
* - onProgress: Callback for download progress updates
|
|
48
49
|
* - logger: Logger instance for model operation logs
|
|
49
50
|
* @param rpcOptions - Optional RPC options including per-call profiling configuration
|
|
@@ -83,6 +83,7 @@ export declare function textToSpeech(params: TtsClientParamsInput, options?: RPC
|
|
|
83
83
|
* so `await result.sampleRate` can never hang or reject on its own.
|
|
84
84
|
*/
|
|
85
85
|
export type TtsSideChannel = {
|
|
86
|
+
text: Promise<string | undefined>;
|
|
86
87
|
sampleRate: Promise<number | undefined>;
|
|
87
88
|
stats: Promise<TtsStats | undefined>;
|
|
88
89
|
stopReason: Promise<'completed' | 'cancelled' | undefined>;
|
|
@@ -132,29 +132,9 @@ export class TtsMulticast {
|
|
|
132
132
|
}
|
|
133
133
|
function buildTtsRequest(params, requestId) {
|
|
134
134
|
return {
|
|
135
|
+
...params,
|
|
135
136
|
type: 'textToSpeech',
|
|
136
|
-
|
|
137
|
-
requestId,
|
|
138
|
-
inputType: params.inputType,
|
|
139
|
-
text: params.text,
|
|
140
|
-
stream: params.stream,
|
|
141
|
-
sentenceStream: params.sentenceStream,
|
|
142
|
-
...(params.sentenceStreamLocale !== undefined && {
|
|
143
|
-
sentenceStreamLocale: params.sentenceStreamLocale
|
|
144
|
-
}),
|
|
145
|
-
...(params.sentenceStreamMaxChunkScalars !== undefined && {
|
|
146
|
-
sentenceStreamMaxChunkScalars: params.sentenceStreamMaxChunkScalars
|
|
147
|
-
}),
|
|
148
|
-
...(params.description !== undefined && { description: params.description }),
|
|
149
|
-
...(params.voiceDescription !== undefined && { voiceDescription: params.voiceDescription }),
|
|
150
|
-
...(params.voice !== undefined && { voice: params.voice }),
|
|
151
|
-
...(params.emotion !== undefined && { emotion: params.emotion }),
|
|
152
|
-
...(params.pitch !== undefined && { pitch: params.pitch }),
|
|
153
|
-
...(params.pace !== undefined && { pace: params.pace }),
|
|
154
|
-
...(params.expressivity !== undefined && { expressivity: params.expressivity }),
|
|
155
|
-
...(params.noise !== undefined && { noise: params.noise }),
|
|
156
|
-
...(params.reverb !== undefined && { reverb: params.reverb }),
|
|
157
|
-
...(params.quality !== undefined && { quality: params.quality })
|
|
137
|
+
requestId
|
|
158
138
|
};
|
|
159
139
|
}
|
|
160
140
|
function buildTextToSpeechStreamRequest(params, requestId) {
|
|
@@ -271,6 +251,11 @@ async function* ttsResponseSource(request, options, side) {
|
|
|
271
251
|
}
|
|
272
252
|
/** Exported for test use; not part of the public SDK surface. */
|
|
273
253
|
export function createTtsSideChannel() {
|
|
254
|
+
let resolveText;
|
|
255
|
+
const text = new Promise((resolve) => {
|
|
256
|
+
resolveText = resolve;
|
|
257
|
+
});
|
|
258
|
+
let seenText;
|
|
274
259
|
let resolveSampleRate;
|
|
275
260
|
let resolveStats;
|
|
276
261
|
let resolveStopReason;
|
|
@@ -288,10 +273,13 @@ export function createTtsSideChannel() {
|
|
|
288
273
|
let seenStopReason;
|
|
289
274
|
let settled = false;
|
|
290
275
|
return {
|
|
276
|
+
text,
|
|
291
277
|
sampleRate,
|
|
292
278
|
stats,
|
|
293
279
|
stopReason,
|
|
294
280
|
observe(response) {
|
|
281
|
+
if (response.text !== undefined)
|
|
282
|
+
seenText = response.text;
|
|
295
283
|
// Resolve on the FIRST frame that carries a rate, not at end of stream:
|
|
296
284
|
// a caller opening an audio device wants it before draining the audio.
|
|
297
285
|
// Promise resolution is idempotent, so settle() can still resolve the
|
|
@@ -309,6 +297,7 @@ export function createTtsSideChannel() {
|
|
|
309
297
|
if (settled)
|
|
310
298
|
return;
|
|
311
299
|
settled = true;
|
|
300
|
+
resolveText(seenText);
|
|
312
301
|
resolveSampleRate(seenSampleRate);
|
|
313
302
|
resolveStats(latestStats);
|
|
314
303
|
resolveStopReason(seenStopReason);
|
|
@@ -331,6 +320,7 @@ function sentenceStreamTts(request, options) {
|
|
|
331
320
|
buffer: Promise.resolve([]),
|
|
332
321
|
done: multicast.done,
|
|
333
322
|
requestId: request.requestId,
|
|
323
|
+
text: side.text,
|
|
334
324
|
sampleRate: side.sampleRate,
|
|
335
325
|
stats: side.stats,
|
|
336
326
|
stopReason: side.stopReason
|
|
@@ -379,6 +369,7 @@ function plainStreamTts(request, options) {
|
|
|
379
369
|
buffer: Promise.resolve([]),
|
|
380
370
|
done,
|
|
381
371
|
requestId: request.requestId,
|
|
372
|
+
text: side.text,
|
|
382
373
|
sampleRate: side.sampleRate,
|
|
383
374
|
stats: side.stats,
|
|
384
375
|
stopReason: side.stopReason
|
|
@@ -431,6 +422,7 @@ function collectTts(request, options) {
|
|
|
431
422
|
buffer: collectTtsBuffer(request, options, resolveDone, rejectDone, side),
|
|
432
423
|
done,
|
|
433
424
|
requestId: request.requestId,
|
|
425
|
+
text: side.text,
|
|
434
426
|
sampleRate: side.sampleRate,
|
|
435
427
|
stats: side.stats,
|
|
436
428
|
stopReason: side.stopReason
|
|
@@ -449,6 +441,7 @@ async function collectTtsBuffer(request, options, resolveDone, rejectDone, side)
|
|
|
449
441
|
buffer = buffer.concat(response.buffer);
|
|
450
442
|
if (response.done) {
|
|
451
443
|
resolveDone(true);
|
|
444
|
+
break;
|
|
452
445
|
}
|
|
453
446
|
}
|
|
454
447
|
return buffer;
|
|
@@ -12,7 +12,9 @@ function buildTranscribeRequest(params, requestId) {
|
|
|
12
12
|
audioChunk: typeof params.audioChunk === 'string'
|
|
13
13
|
? { type: 'filePath', value: params.audioChunk }
|
|
14
14
|
: { type: 'base64', value: params.audioChunk.toString('base64') },
|
|
15
|
-
...(params.prompt && { prompt: params.prompt }),
|
|
15
|
+
...(params.prompt !== undefined && params.prompt !== null && { prompt: params.prompt }),
|
|
16
|
+
...(params.hotwords !== undefined && { hotwords: params.hotwords }),
|
|
17
|
+
...(params.maxNewTokens !== undefined && { maxNewTokens: params.maxNewTokens }),
|
|
16
18
|
...(params.metadata === true && { metadata: true }),
|
|
17
19
|
requestId
|
|
18
20
|
};
|
|
@@ -310,7 +312,8 @@ export function processLineConversation(line, wantsMetadata, onTerminal) {
|
|
|
310
312
|
type: 'vad',
|
|
311
313
|
speaking: response.vad.speaking,
|
|
312
314
|
probability: response.vad.probability,
|
|
313
|
-
...(response.vad.source && { source: response.vad.source })
|
|
315
|
+
...(response.vad.source && { source: response.vad.source }),
|
|
316
|
+
...(response.vad.speakerId !== undefined && { speakerId: response.vad.speakerId })
|
|
314
317
|
};
|
|
315
318
|
}
|
|
316
319
|
if (response.endOfTurn) {
|
|
@@ -9,10 +9,10 @@ export declare function createVideoStreamRequest(params: VideoClientParams, requ
|
|
|
9
9
|
modelId: string;
|
|
10
10
|
seed?: number | undefined;
|
|
11
11
|
vae_tiling?: boolean | undefined;
|
|
12
|
+
steps?: number | undefined;
|
|
12
13
|
negative_prompt?: string | undefined;
|
|
13
14
|
width?: number | undefined;
|
|
14
15
|
height?: number | undefined;
|
|
15
|
-
steps?: number | undefined;
|
|
16
16
|
cfg_scale?: number | undefined;
|
|
17
17
|
sampling_method?: "euler" | "euler_a" | "heun" | "dpm2" | "dpm++2m" | "dpm++2mv2" | "dpm++2s_a" | "lcm" | "ipndm" | "ipndm_v" | "ddim_trailing" | "tcd" | "res_multistep" | "res_2s" | undefined;
|
|
18
18
|
scheduler?: "lcm" | "discrete" | "karras" | "exponential" | "ays" | "gits" | "sgm_uniform" | "simple" | "smoothstep" | "kl_optimal" | "bong_tangent" | "ltx2" | undefined;
|
|
@@ -50,10 +50,10 @@ export declare function createVideoStreamRequest(params: VideoClientParams, requ
|
|
|
50
50
|
modelId: string;
|
|
51
51
|
seed?: number | undefined;
|
|
52
52
|
vae_tiling?: boolean | undefined;
|
|
53
|
+
steps?: number | undefined;
|
|
53
54
|
negative_prompt?: string | undefined;
|
|
54
55
|
width?: number | undefined;
|
|
55
56
|
height?: number | undefined;
|
|
56
|
-
steps?: number | undefined;
|
|
57
57
|
cfg_scale?: number | undefined;
|
|
58
58
|
sampling_method?: "euler" | "euler_a" | "heun" | "dpm2" | "dpm++2m" | "dpm++2mv2" | "dpm++2s_a" | "lcm" | "ipndm" | "ipndm_v" | "ddim_trailing" | "tcd" | "res_multistep" | "res_2s" | undefined;
|
|
59
59
|
scheduler?: "lcm" | "discrete" | "karras" | "exponential" | "ays" | "gits" | "sgm_uniform" | "simple" | "smoothstep" | "kl_optimal" | "bong_tangent" | "ltx2" | undefined;
|
|
@@ -91,10 +91,10 @@ export declare function createVideoStreamRequest(params: VideoClientParams, requ
|
|
|
91
91
|
modelId: string;
|
|
92
92
|
seed?: number | undefined;
|
|
93
93
|
vae_tiling?: boolean | undefined;
|
|
94
|
+
steps?: number | undefined;
|
|
94
95
|
negative_prompt?: string | undefined;
|
|
95
96
|
width?: number | undefined;
|
|
96
97
|
height?: number | undefined;
|
|
97
|
-
steps?: number | undefined;
|
|
98
98
|
cfg_scale?: number | undefined;
|
|
99
99
|
sampling_method?: "euler" | "euler_a" | "heun" | "dpm2" | "dpm++2m" | "dpm++2mv2" | "dpm++2s_a" | "lcm" | "ipndm" | "ipndm_v" | "ddim_trailing" | "tcd" | "res_multistep" | "res_2s" | undefined;
|
|
100
100
|
scheduler?: "lcm" | "discrete" | "karras" | "exponential" | "ays" | "gits" | "sgm_uniform" | "simple" | "smoothstep" | "kl_optimal" | "bong_tangent" | "ltx2" | undefined;
|
|
@@ -132,10 +132,10 @@ export declare function createVideoStreamRequest(params: VideoClientParams, requ
|
|
|
132
132
|
modelId: string;
|
|
133
133
|
seed?: number | undefined;
|
|
134
134
|
vae_tiling?: boolean | undefined;
|
|
135
|
+
steps?: number | undefined;
|
|
135
136
|
negative_prompt?: string | undefined;
|
|
136
137
|
width?: number | undefined;
|
|
137
138
|
height?: number | undefined;
|
|
138
|
-
steps?: number | undefined;
|
|
139
139
|
cfg_scale?: number | undefined;
|
|
140
140
|
sampling_method?: "euler" | "euler_a" | "heun" | "dpm2" | "dpm++2m" | "dpm++2mv2" | "dpm++2s_a" | "lcm" | "ipndm" | "ipndm_v" | "ddim_trailing" | "tcd" | "res_multistep" | "res_2s" | undefined;
|
|
141
141
|
scheduler?: "lcm" | "discrete" | "karras" | "exponential" | "ays" | "gits" | "sgm_uniform" | "simple" | "smoothstep" | "kl_optimal" | "bong_tangent" | "ltx2" | undefined;
|
|
@@ -173,10 +173,10 @@ export declare function createVideoStreamRequest(params: VideoClientParams, requ
|
|
|
173
173
|
modelId: string;
|
|
174
174
|
seed?: number | undefined;
|
|
175
175
|
vae_tiling?: boolean | undefined;
|
|
176
|
+
steps?: number | undefined;
|
|
176
177
|
negative_prompt?: string | undefined;
|
|
177
178
|
width?: number | undefined;
|
|
178
179
|
height?: number | undefined;
|
|
179
|
-
steps?: number | undefined;
|
|
180
180
|
cfg_scale?: number | undefined;
|
|
181
181
|
sampling_method?: "euler" | "euler_a" | "heun" | "dpm2" | "dpm++2m" | "dpm++2mv2" | "dpm++2s_a" | "lcm" | "ipndm" | "ipndm_v" | "ddim_trailing" | "tcd" | "res_multistep" | "res_2s" | undefined;
|
|
182
182
|
scheduler?: "lcm" | "discrete" | "karras" | "exponential" | "ays" | "gits" | "sgm_uniform" | "simple" | "smoothstep" | "kl_optimal" | "bong_tangent" | "ltx2" | undefined;
|
|
@@ -16,12 +16,15 @@ export interface VideoResult {
|
|
|
16
16
|
* @param params - Video request parameters (model, prompt, dimensions, frame count, fps, sampler, seed, etc.).
|
|
17
17
|
* @returns A result object exposing `requestId` (stable identifier for this in-flight generation), `progressStream` (async iterator of `{ step, totalSteps, elapsedMs }`), `outputs` (promise of the generated video buffers, typically a single AVI file), and `stats` (promise of generation statistics).
|
|
18
18
|
*
|
|
19
|
-
* Supports `txt2vid` (text-to-video) and `img2vid` (image-to-video) for
|
|
20
|
-
*
|
|
19
|
+
* Supports `txt2vid` (text-to-video) and `img2vid` (image-to-video) for Wan,
|
|
20
|
+
* LTX-2, and MiniMax H3. For Wan `img2vid`, load the pipeline with
|
|
21
21
|
* `modelConfig.clipVisionModelSrc` set to `clip_vision_h.safetensors`; LTX-2
|
|
22
22
|
* `img2vid` conditions on the first frame through its video VAE and needs no
|
|
23
23
|
* CLIP vision weights (the same LTX-2 model loaded for txt2vid also does
|
|
24
|
-
* img2vid).
|
|
24
|
+
* img2vid). MiniMax H3 also conditions through its video VAE; load its text
|
|
25
|
+
* encoder companion and optionally its audio VAE for synchronized audio. H3
|
|
26
|
+
* frames must satisfy `17*k + 5`, and its native frame rate is 24 FPS. On
|
|
27
|
+
* React Native, the bundled video diffusion models are too large
|
|
25
28
|
* for typical mobile devices.
|
|
26
29
|
*
|
|
27
30
|
* @example Basic txt2vid generation
|
|
@@ -64,6 +67,23 @@ export interface VideoResult {
|
|
|
64
67
|
* });
|
|
65
68
|
* ```
|
|
66
69
|
*
|
|
70
|
+
* @example MiniMax H3 image-to-video
|
|
71
|
+
* ```typescript
|
|
72
|
+
* const firstFrame = fs.readFileSync("first-frame.png");
|
|
73
|
+
* const { outputs } = video({
|
|
74
|
+
* modelId,
|
|
75
|
+
* mode: "img2vid",
|
|
76
|
+
* prompt: "A sailboat glides across a calm bay as the camera follows it.",
|
|
77
|
+
* init_image: firstFrame,
|
|
78
|
+
* width: 864,
|
|
79
|
+
* height: 480,
|
|
80
|
+
* video_frames: 22,
|
|
81
|
+
* fps: 24,
|
|
82
|
+
* cfg_scale: 1,
|
|
83
|
+
* });
|
|
84
|
+
* fs.writeFileSync("h3-output.avi", (await outputs)[0]);
|
|
85
|
+
* ```
|
|
86
|
+
*
|
|
67
87
|
* @example With control frames (e.g. for guided generation)
|
|
68
88
|
* ```typescript
|
|
69
89
|
* const frameA = fs.readFileSync("frame-a.png");
|
|
@@ -9,12 +9,15 @@ import { decodeBase64 } from '../../utils/encoding.js';
|
|
|
9
9
|
* @param params - Video request parameters (model, prompt, dimensions, frame count, fps, sampler, seed, etc.).
|
|
10
10
|
* @returns A result object exposing `requestId` (stable identifier for this in-flight generation), `progressStream` (async iterator of `{ step, totalSteps, elapsedMs }`), `outputs` (promise of the generated video buffers, typically a single AVI file), and `stats` (promise of generation statistics).
|
|
11
11
|
*
|
|
12
|
-
* Supports `txt2vid` (text-to-video) and `img2vid` (image-to-video) for
|
|
13
|
-
*
|
|
12
|
+
* Supports `txt2vid` (text-to-video) and `img2vid` (image-to-video) for Wan,
|
|
13
|
+
* LTX-2, and MiniMax H3. For Wan `img2vid`, load the pipeline with
|
|
14
14
|
* `modelConfig.clipVisionModelSrc` set to `clip_vision_h.safetensors`; LTX-2
|
|
15
15
|
* `img2vid` conditions on the first frame through its video VAE and needs no
|
|
16
16
|
* CLIP vision weights (the same LTX-2 model loaded for txt2vid also does
|
|
17
|
-
* img2vid).
|
|
17
|
+
* img2vid). MiniMax H3 also conditions through its video VAE; load its text
|
|
18
|
+
* encoder companion and optionally its audio VAE for synchronized audio. H3
|
|
19
|
+
* frames must satisfy `17*k + 5`, and its native frame rate is 24 FPS. On
|
|
20
|
+
* React Native, the bundled video diffusion models are too large
|
|
18
21
|
* for typical mobile devices.
|
|
19
22
|
*
|
|
20
23
|
* @example Basic txt2vid generation
|
|
@@ -57,6 +60,23 @@ import { decodeBase64 } from '../../utils/encoding.js';
|
|
|
57
60
|
* });
|
|
58
61
|
* ```
|
|
59
62
|
*
|
|
63
|
+
* @example MiniMax H3 image-to-video
|
|
64
|
+
* ```typescript
|
|
65
|
+
* const firstFrame = fs.readFileSync("first-frame.png");
|
|
66
|
+
* const { outputs } = video({
|
|
67
|
+
* modelId,
|
|
68
|
+
* mode: "img2vid",
|
|
69
|
+
* prompt: "A sailboat glides across a calm bay as the camera follows it.",
|
|
70
|
+
* init_image: firstFrame,
|
|
71
|
+
* width: 864,
|
|
72
|
+
* height: 480,
|
|
73
|
+
* video_frames: 22,
|
|
74
|
+
* fps: 24,
|
|
75
|
+
* cfg_scale: 1,
|
|
76
|
+
* });
|
|
77
|
+
* fs.writeFileSync("h3-output.avi", (await outputs)[0]);
|
|
78
|
+
* ```
|
|
79
|
+
*
|
|
60
80
|
* @example With control frames (e.g. for guided generation)
|
|
61
81
|
* ```typescript
|
|
62
82
|
* const frameA = fs.readFileSync("frame-a.png");
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import type { Logger } from '../../logging/types.js';
|
|
2
|
+
export declare const BARE_PACK_NODE_ENGINES = "^22.21.0 || >=24.9.0";
|
|
3
|
+
export declare function isBarePackNodeSupported(version: string): boolean;
|
|
4
|
+
interface NodeVersions {
|
|
5
|
+
node: string;
|
|
6
|
+
bun?: string | undefined;
|
|
7
|
+
}
|
|
2
8
|
interface RunBarePackOptions {
|
|
3
9
|
entryPath: string;
|
|
4
10
|
outputPath: string;
|
|
@@ -7,6 +13,8 @@ interface RunBarePackOptions {
|
|
|
7
13
|
deferModules: string[];
|
|
8
14
|
quiet: boolean;
|
|
9
15
|
logger: Logger;
|
|
16
|
+
/** The runtime running bare-pack; defaults to this process. Tests inject an older Node. */
|
|
17
|
+
nodeVersions?: NodeVersions | undefined;
|
|
10
18
|
}
|
|
11
19
|
export declare function runBarePack(options: RunBarePackOptions): Promise<void>;
|
|
12
20
|
export {};
|
|
@@ -2,9 +2,29 @@ import fs from 'node:fs';
|
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
import { createRequire } from 'node:module';
|
|
4
4
|
import { spawn } from 'node:child_process';
|
|
5
|
-
import { platform, execPath } from 'node:process';
|
|
6
|
-
import
|
|
5
|
+
import { platform, execPath, versions } from 'node:process';
|
|
6
|
+
import semver from 'semver';
|
|
7
|
+
import { BarePackNotInstalledError, BarePackNodeUnsupportedError, BarePackError } from '../../utils/errors-client.js';
|
|
7
8
|
const require = createRequire(import.meta.url);
|
|
9
|
+
// bare-module-lexer (loaded by bare-pack through bare-module-traverse) calls
|
|
10
|
+
// js_is_sharedarraybuffer from its native addon, which Node outside this range
|
|
11
|
+
// lacks; the bare-pack child process crashes instead of throwing. Same range as
|
|
12
|
+
// engines.node in @qvac/cli.
|
|
13
|
+
export const BARE_PACK_NODE_ENGINES = '^22.21.0 || >=24.9.0';
|
|
14
|
+
export function isBarePackNodeSupported(version) {
|
|
15
|
+
return semver.satisfies(version, BARE_PACK_NODE_ENGINES, { includePrerelease: true });
|
|
16
|
+
}
|
|
17
|
+
// On Node, bare-pack is spawned with this process's execPath, so checking
|
|
18
|
+
// process.versions.node checks the Node that will load the lexer. Under Bun,
|
|
19
|
+
// process.versions.node is Bun's emulated value and, except on Windows, bare-pack
|
|
20
|
+
// runs through its shebang in the `node` from PATH, which cannot be checked here.
|
|
21
|
+
function assertNodeCanRunBarePack(nodeVersions) {
|
|
22
|
+
if (nodeVersions.bun !== undefined)
|
|
23
|
+
return;
|
|
24
|
+
if (isBarePackNodeSupported(nodeVersions.node))
|
|
25
|
+
return;
|
|
26
|
+
throw new BarePackNodeUnsupportedError(nodeVersions.node, BARE_PACK_NODE_ENGINES);
|
|
27
|
+
}
|
|
8
28
|
function resolveBarePackBin() {
|
|
9
29
|
try {
|
|
10
30
|
const barePackPkgPath = require.resolve('bare-pack/package');
|
|
@@ -17,10 +37,12 @@ function resolveBarePackBin() {
|
|
|
17
37
|
}
|
|
18
38
|
export async function runBarePack(options) {
|
|
19
39
|
const { entryPath, outputPath, hosts, importsMapPath, deferModules, quiet, logger } = options;
|
|
40
|
+
const nodeVersions = options.nodeVersions ?? versions;
|
|
20
41
|
const barePackBin = resolveBarePackBin();
|
|
21
42
|
if (!barePackBin || !fs.existsSync(barePackBin)) {
|
|
22
43
|
throw new BarePackNotInstalledError();
|
|
23
44
|
}
|
|
45
|
+
assertNodeCanRunBarePack(nodeVersions);
|
|
24
46
|
return new Promise((resolve, reject) => {
|
|
25
47
|
const hostArgs = hosts.flatMap((h) => ['--host', h]);
|
|
26
48
|
const deferArgs = deferModules.flatMap((m) => ['--defer', m]);
|
|
@@ -34,9 +56,10 @@ export async function runBarePack(options) {
|
|
|
34
56
|
outputPath,
|
|
35
57
|
entryPath
|
|
36
58
|
];
|
|
37
|
-
|
|
38
|
-
const
|
|
39
|
-
const
|
|
59
|
+
// Windows cannot exec a .js file directly, so it always goes through execPath.
|
|
60
|
+
const viaShebang = nodeVersions.bun !== undefined && platform !== 'win32';
|
|
61
|
+
const command = viaShebang ? barePackBin : execPath;
|
|
62
|
+
const spawnArgs = viaShebang ? args : [barePackBin, ...args];
|
|
40
63
|
logger.debug(`\nš¦ Running: ${command} ${spawnArgs.join(' ')}`);
|
|
41
64
|
const proc = spawn(command, spawnArgs, {
|
|
42
65
|
stdio: quiet ? 'ignore' : 'inherit'
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
export const BUILTIN_PLUGINS = {
|
|
2
2
|
'llamacpp-completion': { exportName: 'llmPlugin' },
|
|
3
3
|
'llamacpp-embedding': { exportName: 'embeddingsPlugin' },
|
|
4
|
+
'llamacpp-decision': { exportName: 'decisionPlugin' },
|
|
4
5
|
'whispercpp-transcription': { exportName: 'whisperPlugin' },
|
|
5
6
|
'bci-whispercpp-transcription': { exportName: 'bciPlugin' },
|
|
6
7
|
'parakeet-transcription': { exportName: 'parakeetPlugin' },
|
|
8
|
+
'moss-transcribe': { exportName: 'mossTranscribePlugin' },
|
|
7
9
|
'nmtcpp-translation': { exportName: 'nmtPlugin' },
|
|
8
10
|
'tts-ggml': { exportName: 'ttsPlugin' },
|
|
9
11
|
'ggml-ocr': { exportName: 'ocrPlugin' },
|
|
@@ -8,12 +8,13 @@ export interface BundleSdkOptions {
|
|
|
8
8
|
quiet?: boolean | undefined;
|
|
9
9
|
verbose?: boolean | undefined;
|
|
10
10
|
/**
|
|
11
|
-
* Install the addon platform packages the
|
|
12
|
-
* with the project's package manager
|
|
13
|
-
*
|
|
14
|
-
* package.json or node_modules
|
|
15
|
-
*
|
|
16
|
-
*
|
|
11
|
+
* Install the addon platform packages that the split addons the bundle
|
|
12
|
+
* reaches need for its mobile hosts, with the project's package manager
|
|
13
|
+
* (see `ensureHostPrebuilds`), before bundling. Off by default: without it,
|
|
14
|
+
* bundling never changes package.json or node_modules, and a mobile host
|
|
15
|
+
* whose platform package is missing fails with `HostPrebuildsMissingError`,
|
|
16
|
+
* naming the exact pins. A refused install
|
|
17
|
+
* throws `HostPrebuildsInstallRefusedError` before anything is written.
|
|
17
18
|
*/
|
|
18
19
|
installMissingPrebuilds?: boolean | undefined;
|
|
19
20
|
/**
|