@qvac/sdk 0.12.1 → 0.13.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 +55 -1225
- package/README.md +12 -0
- package/dist/client/api/bci-transcribe.d.ts +57 -0
- package/dist/client/api/bci-transcribe.js +172 -0
- package/dist/client/api/get-model-info.d.ts +1 -1
- package/dist/client/api/index.d.ts +1 -0
- package/dist/client/api/index.js +1 -0
- package/dist/client/api/video.d.ts +26 -6
- package/dist/client/api/video.js +30 -7
- package/dist/client/api/vla.d.ts +11 -7
- package/dist/client/api/vla.js +11 -7
- package/dist/client/config-loader/resolve-config.bare.d.ts +1 -1
- package/dist/client/config-loader/resolve-config.bare.js +21 -35
- package/dist/client/rpc/bare-client.js +2 -2
- package/dist/commands/bundle/constants.js +2 -0
- package/dist/examples/bci/bci-filesystem-streaming.d.ts +2 -0
- package/dist/examples/bci/bci-filesystem-streaming.js +77 -0
- package/dist/examples/bci/bci-filesystem.d.ts +2 -0
- package/dist/examples/bci/bci-filesystem.js +63 -0
- package/dist/examples/cache-management.js +0 -1
- package/dist/examples/cancel-by-request-id.js +0 -1
- package/dist/examples/classification/classify-image.js +1 -1
- package/dist/examples/completion-events.js +6 -2
- package/dist/examples/completion-stop-reason.d.ts +25 -0
- package/dist/examples/completion-stop-reason.js +65 -0
- package/dist/examples/concurrent-completion-collision.d.ts +2 -0
- package/dist/examples/concurrent-completion-collision.js +98 -0
- package/dist/examples/config-reload.js +1 -2
- package/dist/examples/default-config-usage.js +0 -1
- package/dist/examples/delegated-inference/composite.js +0 -1
- package/dist/examples/delegated-inference/consumer-profiled.js +0 -1
- package/dist/examples/delegated-inference/consumer.js +0 -1
- package/dist/examples/diffusion-esrgan-upscale.js +1 -3
- package/dist/examples/diffusion-flux2-klein-img2img.js +1 -1
- package/dist/examples/diffusion-flux2-klein.js +2 -2
- package/dist/examples/diffusion-img2img.js +1 -1
- package/dist/examples/diffusion-img2vid.d.ts +2 -0
- package/dist/examples/diffusion-img2vid.js +78 -0
- package/dist/examples/diffusion-simple.js +1 -1
- package/dist/examples/diffusion-txt2img.js +8 -3
- package/dist/examples/diffusion-txt2vid.js +2 -3
- package/dist/examples/download-with-blind-relays.js +0 -1
- package/dist/examples/embed-multi-gpu.js +1 -2
- package/dist/examples/embed-p2p.js +4 -2
- package/dist/examples/finetune/llamacpp-finetune.js +5 -3
- package/dist/examples/kv-cache-cleanup.js +0 -1
- package/dist/examples/kv-cache-custom-key.js +0 -1
- package/dist/examples/kv-cache-example.js +4 -2
- package/dist/examples/llamacpp-cache.js +0 -1
- package/dist/examples/llamacpp-dynamic-tools.js +4 -2
- package/dist/examples/llamacpp-filesystem.js +1 -1
- package/dist/examples/llamacpp-http.js +1 -1
- package/dist/examples/llamacpp-multi-gpu.js +2 -2
- package/dist/examples/llamacpp-multimodal.js +0 -1
- package/dist/examples/llamacpp-p2p.js +0 -1
- package/dist/examples/llamacpp-sharded.js +1 -1
- package/dist/examples/llamacpp-structured-output.js +0 -1
- package/dist/examples/logging-file-transport.js +0 -1
- package/dist/examples/logging-streaming.js +0 -2
- package/dist/examples/mcp-websearch.js +0 -1
- package/dist/examples/multi-model-demo.js +0 -2
- package/dist/examples/ocr-fasttext.js +0 -1
- package/dist/examples/plugins.js +1 -4
- package/dist/examples/profiling/basic.js +3 -2
- package/dist/examples/profiling/per-call.js +0 -1
- package/dist/examples/quickstart.js +0 -1
- package/dist/examples/rag/rag-chromadb.js +0 -1
- package/dist/examples/rag/rag-hyperdb/cancellation.js +0 -1
- package/dist/examples/rag/rag-hyperdb/ingest.js +0 -1
- package/dist/examples/rag/rag-hyperdb/pipeline.js +0 -1
- package/dist/examples/rag/rag-hyperdb/workspaces.js +0 -1
- package/dist/examples/rag/rag-lancedb.js +0 -1
- package/dist/examples/rag/rag-sqlite.js +0 -1
- package/dist/examples/suspend-resume.js +0 -1
- package/dist/examples/tools/llamacpp-native-tools.js +0 -1
- package/dist/examples/tools/llamacpp-tools-gemma4.js +1 -1
- package/dist/examples/tools/llamacpp-tools-pythonic.js +2 -2
- package/dist/examples/tools/llamacpp-tools-qwen35.js +1 -1
- package/dist/examples/transcription/parakeet-ctc-filesystem.js +1 -1
- package/dist/examples/transcription/parakeet-microphone-record.js +0 -1
- package/dist/examples/transcription/parakeet-microphone-stream.js +0 -1
- package/dist/examples/transcription/parakeet-sortformer.js +1 -2
- package/dist/examples/transcription/parakeet-tdt-filesystem.js +1 -1
- package/dist/examples/transcription/whispercpp-filesystem-streaming.js +10 -6
- package/dist/examples/transcription/whispercpp-filesystem.js +4 -2
- package/dist/examples/transcription/whispercpp-microphone-conversation.js +0 -1
- package/dist/examples/transcription/whispercpp-microphone-record.js +0 -1
- package/dist/examples/transcription/whispercpp-prompt.js +0 -1
- package/dist/examples/translation/translation-bergamot-batch.js +1 -2
- package/dist/examples/translation/translation-bergamot-pivot.js +3 -4
- package/dist/examples/translation/translation-bergamot.js +1 -2
- package/dist/examples/translation/translation-indic.js +1 -2
- package/dist/examples/translation/translation-llm-afriquegemma.js +3 -4
- package/dist/examples/translation/translation-llm-context.js +1 -2
- package/dist/examples/translation/translation-llm.js +2 -3
- package/dist/examples/translation/translation-stream.js +2 -3
- package/dist/examples/tts/chatterbox.js +1 -2
- package/dist/examples/tts/llm-to-tts-streaming.js +2 -4
- package/dist/examples/tts/supertonic-multilingual.js +1 -2
- package/dist/examples/tts/supertonic.js +1 -2
- package/dist/examples/vla-pi05.d.ts +2 -0
- package/dist/examples/vla-pi05.js +84 -0
- package/dist/examples/vla-smolvla.js +1 -1
- package/dist/examples/voice-assistant/voice-assistant.js +1 -4
- package/dist/index.d.ts +2 -2
- package/dist/index.js +9 -7
- package/dist/models/registry/models.d.ts +869 -186
- package/dist/models/registry/models.js +3160 -2453
- package/dist/models/update-models/companions.d.ts +7 -0
- package/dist/models/update-models/companions.js +56 -0
- package/dist/models/update-models/naming.js +10 -0
- package/dist/pear/pre.js +2 -0
- package/dist/schemas/bci-config.d.ts +36 -0
- package/dist/schemas/bci-config.js +56 -0
- package/dist/schemas/bci.d.ts +177 -0
- package/dist/schemas/bci.js +95 -0
- package/dist/schemas/common.d.ts +395 -51
- package/dist/schemas/common.js +5 -0
- package/dist/schemas/completion-event.d.ts +1 -0
- package/dist/schemas/download-asset.d.ts +7 -3
- package/dist/schemas/embed.d.ts +2 -0
- package/dist/schemas/embed.js +1 -0
- package/dist/schemas/engine-addon-map.d.ts +1 -0
- package/dist/schemas/engine-addon-map.js +4 -1
- package/dist/schemas/get-model-info.d.ts +2 -0
- package/dist/schemas/get-model-info.js +1 -0
- package/dist/schemas/index.d.ts +2 -0
- package/dist/schemas/index.js +2 -0
- package/dist/schemas/llamacpp-config.d.ts +6 -2
- package/dist/schemas/load-model.d.ts +1841 -267
- package/dist/schemas/load-model.js +34 -1
- package/dist/schemas/model-src-utils.d.ts +10 -2
- package/dist/schemas/model-types.d.ts +19 -1
- package/dist/schemas/model-types.js +11 -0
- package/dist/schemas/ocr.d.ts +2 -0
- package/dist/schemas/plugin.d.ts +13 -5
- package/dist/schemas/plugin.js +13 -4
- package/dist/schemas/registry.d.ts +18 -0
- package/dist/schemas/registry.js +2 -0
- package/dist/schemas/reload-config.d.ts +10 -2
- package/dist/schemas/sdcpp-config.d.ts +75 -8
- package/dist/schemas/sdcpp-config.js +56 -10
- package/dist/schemas/sdk-config.d.ts +342 -0
- package/dist/schemas/text-to-speech.d.ts +8 -0
- package/dist/schemas/transcription-config.d.ts +2 -0
- package/dist/schemas/transcription.d.ts +12 -0
- package/dist/schemas/transcription.js +8 -0
- package/dist/schemas/translation-config.d.ts +44 -16
- package/dist/schemas/translation-config.js +2 -0
- package/dist/schemas/vla.d.ts +14 -0
- package/dist/schemas/vla.js +26 -3
- package/dist/server/bare/delegate-connect-diagnostics.d.ts +9 -0
- package/dist/server/bare/delegate-connect-diagnostics.js +44 -0
- package/dist/server/bare/delegate-rpc-client.js +10 -12
- package/dist/server/bare/hyperswarm.js +1 -0
- package/dist/server/bare/ops/bci-transcribe.d.ts +13 -0
- package/dist/server/bare/ops/bci-transcribe.js +248 -0
- package/dist/server/bare/ops/embed.js +2 -1
- package/dist/server/bare/ops/kv-cache-utils.js +4 -3
- package/dist/server/bare/ops/transcribe.js +6 -2
- package/dist/server/bare/ops/translate.js +1 -1
- package/dist/server/bare/plugins/bci-whispercpp-transcription/plugin.d.ts +130 -0
- package/dist/server/bare/plugins/bci-whispercpp-transcription/plugin.js +116 -0
- package/dist/server/bare/plugins/ggml-vla/ops/vla-run.js +4 -0
- package/dist/server/bare/plugins/ggml-vla/plugin.d.ts +7 -0
- package/dist/server/bare/plugins/ggml-vla/plugin.js +1 -1
- package/dist/server/bare/plugins/index.d.ts +1 -0
- package/dist/server/bare/plugins/index.js +1 -0
- package/dist/server/bare/plugins/llamacpp-completion/ops/finetune.js +22 -29
- package/dist/server/bare/plugins/llamacpp-completion/plugin.d.ts +2 -0
- package/dist/server/bare/plugins/llamacpp-completion/plugin.js +38 -7
- package/dist/server/bare/plugins/llamacpp-embedding/plugin.d.ts +1 -0
- package/dist/server/bare/plugins/llamacpp-embedding/plugin.js +9 -1
- package/dist/server/bare/plugins/nmtcpp-translation/plugin.d.ts +14 -0
- package/dist/server/bare/plugins/onnx-ocr/plugin.d.ts +2 -0
- package/dist/server/bare/plugins/parakeet-transcription/plugin.d.ts +8 -0
- package/dist/server/bare/plugins/sdcpp-generation/ops/video.js +7 -1
- package/dist/server/bare/plugins/sdcpp-generation/plugin.d.ts +58 -4
- package/dist/server/bare/plugins/sdcpp-generation/plugin.js +9 -4
- package/dist/server/bare/plugins/whispercpp-transcription/plugin.d.ts +10 -0
- package/dist/server/bare/registry/model-config-utils.js +3 -0
- package/dist/server/bare/runtime/request-registry-singleton.js +11 -4
- package/dist/server/bare/runtime/request-registry.d.ts +60 -16
- package/dist/server/bare/runtime/request-registry.js +258 -15
- package/dist/server/bare/runtime/with-request-context.d.ts +1 -1
- package/dist/server/bare/runtime/with-request-context.js +1 -1
- package/dist/server/bare/types/addon-responses.d.ts +5 -0
- package/dist/server/rpc/handler-registry.js +4 -0
- package/dist/server/rpc/handlers/bci-transcribe-stream.d.ts +3 -0
- package/dist/server/rpc/handlers/bci-transcribe-stream.js +4 -0
- package/dist/server/rpc/handlers/bci-transcribe.d.ts +3 -0
- package/dist/server/rpc/handlers/bci-transcribe.js +4 -0
- package/dist/server/rpc/handlers/download-asset.js +1 -1
- package/dist/server/rpc/handlers/get-model-info.js +3 -3
- package/dist/server/rpc/handlers/index.d.ts +4 -0
- package/dist/server/rpc/handlers/index.js +4 -0
- package/dist/server/rpc/handlers/load-model/download-manager.d.ts +1 -1
- package/dist/server/rpc/handlers/load-model/handler.js +1 -1
- package/dist/server/rpc/handlers/load-model/http.js +6 -6
- package/dist/server/rpc/handlers/load-model/hyperdrive.js +1 -0
- package/dist/server/rpc/handlers/load-model/registry-companion-set.d.ts +1 -0
- package/dist/server/rpc/handlers/load-model/registry-companion-set.js +2 -2
- package/dist/server/rpc/handlers/load-model/registry.js +1 -0
- package/dist/server/rpc/handlers/load-model/resolve-session.d.ts +1 -1
- package/dist/server/rpc/handlers/rag.js +5 -5
- package/dist/server/utils/checksum.js +2 -1
- package/dist/server/utils/formatting.js +2 -1
- package/dist/server/utils/multi-gpu-mobile.d.ts +5 -0
- package/dist/server/utils/multi-gpu-mobile.js +10 -0
- package/dist/server/worker.js +2 -1
- package/dist/utils/aggregate-events.d.ts +2 -1
- package/dist/utils/aggregate-events.js +11 -3
- package/dist/utils/errors-server.d.ts +6 -4
- package/dist/utils/errors-server.js +6 -4
- package/electron-forge/index.cjs +820 -0
- package/package.json +73 -35
- package/dist/scripts/run-security-tests-bare.d.ts +0 -2
- package/dist/scripts/run-security-tests-bare.js +0 -78
|
@@ -13,6 +13,13 @@ import type { ProcessedModel } from "./types";
|
|
|
13
13
|
* Bergamot NMT sets (directory-based):
|
|
14
14
|
* Primary: `model.<langPair>.intgemm.alphas.bin`
|
|
15
15
|
* Companions in same directory: lex, vocab/srcvocab+trgvocab, metadata
|
|
16
|
+
*
|
|
17
|
+
* BCI whisper.cpp sets (directory-based):
|
|
18
|
+
* Primary: `ggml-bci-windowed.bin`
|
|
19
|
+
* Companion in same directory: `bci-embedder.bin`
|
|
20
|
+
* The addon resolves the embedder by exact filename next to the model
|
|
21
|
+
* (`dirname(model)/bci-embedder.bin`), so the two files must be
|
|
22
|
+
* physically co-located — which the companion-set cache layout guarantees.
|
|
16
23
|
*/
|
|
17
24
|
export declare function groupCompanionSets(models: ProcessedModel[]): ProcessedModel[];
|
|
18
25
|
//# sourceMappingURL=companions.d.ts.map
|
|
@@ -14,6 +14,13 @@ import { BERGAMOT_MODEL_RE } from "../../schemas/index.js";
|
|
|
14
14
|
* Bergamot NMT sets (directory-based):
|
|
15
15
|
* Primary: `model.<langPair>.intgemm.alphas.bin`
|
|
16
16
|
* Companions in same directory: lex, vocab/srcvocab+trgvocab, metadata
|
|
17
|
+
*
|
|
18
|
+
* BCI whisper.cpp sets (directory-based):
|
|
19
|
+
* Primary: `ggml-bci-windowed.bin`
|
|
20
|
+
* Companion in same directory: `bci-embedder.bin`
|
|
21
|
+
* The addon resolves the embedder by exact filename next to the model
|
|
22
|
+
* (`dirname(model)/bci-embedder.bin`), so the two files must be
|
|
23
|
+
* physically co-located — which the companion-set cache layout guarantees.
|
|
17
24
|
*/
|
|
18
25
|
export function groupCompanionSets(models) {
|
|
19
26
|
const bySourcePath = new Map();
|
|
@@ -23,6 +30,7 @@ export function groupCompanionSets(models) {
|
|
|
23
30
|
const companionKeys = new Set();
|
|
24
31
|
groupOnnxCompanions(models, bySourcePath, companionKeys);
|
|
25
32
|
groupBergamotCompanions(models, bySourcePath, companionKeys);
|
|
33
|
+
groupBciCompanions(models, bySourcePath, companionKeys);
|
|
26
34
|
return models.map((model) => {
|
|
27
35
|
const key = sourceKey(model.registrySource, model.registryPath);
|
|
28
36
|
if (companionKeys.has(key)) {
|
|
@@ -126,6 +134,54 @@ function groupBergamotCompanions(models, bySourcePath, companionKeys) {
|
|
|
126
134
|
};
|
|
127
135
|
}
|
|
128
136
|
}
|
|
137
|
+
const BCI_PRIMARY_FILENAME = "ggml-bci-windowed.bin";
|
|
138
|
+
const BCI_EMBEDDER_FILENAME = "bci-embedder.bin";
|
|
139
|
+
function groupBciCompanions(models, bySourcePath, companionKeys) {
|
|
140
|
+
for (const model of models) {
|
|
141
|
+
const filename = model.registryPath.split("/").pop();
|
|
142
|
+
if (filename !== BCI_PRIMARY_FILENAME)
|
|
143
|
+
continue;
|
|
144
|
+
const lastSep = model.registryPath.lastIndexOf("/");
|
|
145
|
+
const dirPrefix = lastSep >= 0 ? model.registryPath.slice(0, lastSep + 1) : "";
|
|
146
|
+
const source = model.registrySource;
|
|
147
|
+
const embedderPath = `${dirPrefix}${BCI_EMBEDDER_FILENAME}`;
|
|
148
|
+
const embedder = bySourcePath.get(sourceKey(source, embedderPath));
|
|
149
|
+
if (!embedder)
|
|
150
|
+
continue;
|
|
151
|
+
const setKey = shortHash(`${source}:${model.registryPath}`);
|
|
152
|
+
const primaryEntry = {
|
|
153
|
+
key: "modelPath",
|
|
154
|
+
registryPath: model.registryPath,
|
|
155
|
+
registrySource: source,
|
|
156
|
+
targetName: BCI_PRIMARY_FILENAME,
|
|
157
|
+
expectedSize: model.expectedSize,
|
|
158
|
+
sha256Checksum: model.sha256Checksum,
|
|
159
|
+
blobCoreKey: model.blobCoreKey,
|
|
160
|
+
blobBlockOffset: model.blobBlockOffset,
|
|
161
|
+
blobBlockLength: model.blobBlockLength,
|
|
162
|
+
blobByteOffset: model.blobByteOffset,
|
|
163
|
+
primary: true,
|
|
164
|
+
};
|
|
165
|
+
const embedderEntry = {
|
|
166
|
+
key: "embedderPath",
|
|
167
|
+
registryPath: embedder.registryPath,
|
|
168
|
+
registrySource: embedder.registrySource,
|
|
169
|
+
targetName: BCI_EMBEDDER_FILENAME,
|
|
170
|
+
expectedSize: embedder.expectedSize,
|
|
171
|
+
sha256Checksum: embedder.sha256Checksum,
|
|
172
|
+
blobCoreKey: embedder.blobCoreKey,
|
|
173
|
+
blobBlockOffset: embedder.blobBlockOffset,
|
|
174
|
+
blobBlockLength: embedder.blobBlockLength,
|
|
175
|
+
blobByteOffset: embedder.blobByteOffset,
|
|
176
|
+
};
|
|
177
|
+
model.companionSet = {
|
|
178
|
+
setKey,
|
|
179
|
+
primaryKey: "modelPath",
|
|
180
|
+
files: [primaryEntry, embedderEntry],
|
|
181
|
+
};
|
|
182
|
+
companionKeys.add(sourceKey(embedder.registrySource, embedder.registryPath));
|
|
183
|
+
}
|
|
184
|
+
}
|
|
129
185
|
function findBergamotCompanions(source, dirPrefix, langPair, bySourcePath) {
|
|
130
186
|
const found = [];
|
|
131
187
|
const lexPath = `${dirPrefix}lex.50.50.${langPair}.s2t.bin`;
|
|
@@ -87,6 +87,8 @@ function generateBaseName(input) {
|
|
|
87
87
|
switch (addon) {
|
|
88
88
|
case "whisper":
|
|
89
89
|
return generateWhisperName(input);
|
|
90
|
+
case "bci":
|
|
91
|
+
return generateBciName(input);
|
|
90
92
|
case "vad":
|
|
91
93
|
return generateVadName(input);
|
|
92
94
|
case "nmt":
|
|
@@ -150,6 +152,14 @@ function generateWhisperName({ filename, lowerFilename, quantization, }) {
|
|
|
150
152
|
nameParts.push(fileQuant);
|
|
151
153
|
return `WHISPER_${nameParts.map(cleanPart).join("_")}`;
|
|
152
154
|
}
|
|
155
|
+
function generateBciName({ filename, quantization }) {
|
|
156
|
+
// Strip the engine/format prefix and a leading "BCI" token so role names
|
|
157
|
+
// like "bci-embedder.bin" / "ggml-bci-windowed.bin" become EMBEDDER /
|
|
158
|
+
// WINDOWED before we re-prefix with BCI_.
|
|
159
|
+
const role = cleanPart(filename.replace(/\.\w+$/, "")).replace(/^BCI_?/, "");
|
|
160
|
+
const nameParts = [role, quantization].filter((p) => p && p !== "");
|
|
161
|
+
return `BCI_${nameParts.map(cleanPart).join("_")}`;
|
|
162
|
+
}
|
|
153
163
|
function generateVadName({ filename, tagType, tagName, }) {
|
|
154
164
|
const versionMatch = filename.match(/v(\d+\.\d+\.\d+)/i);
|
|
155
165
|
const version = versionMatch ? versionMatch[1] : "";
|
package/dist/pear/pre.js
CHANGED
|
@@ -31,6 +31,7 @@ const BUILTIN_PLUGINS = [
|
|
|
31
31
|
"@qvac/sdk/llamacpp-completion/plugin",
|
|
32
32
|
"@qvac/sdk/llamacpp-embedding/plugin",
|
|
33
33
|
"@qvac/sdk/whispercpp-transcription/plugin",
|
|
34
|
+
"@qvac/sdk/bci-whispercpp-transcription/plugin",
|
|
34
35
|
"@qvac/sdk/nmtcpp-translation/plugin",
|
|
35
36
|
"@qvac/sdk/tts-ggml/plugin",
|
|
36
37
|
"@qvac/sdk/onnx-ocr/plugin",
|
|
@@ -42,6 +43,7 @@ const BUILTIN_PLUGIN_EXPORTS = {
|
|
|
42
43
|
"llamacpp-completion": "llmPlugin",
|
|
43
44
|
"llamacpp-embedding": "embeddingsPlugin",
|
|
44
45
|
"whispercpp-transcription": "whisperPlugin",
|
|
46
|
+
"bci-whispercpp-transcription": "bciPlugin",
|
|
45
47
|
"nmtcpp-translation": "nmtPlugin",
|
|
46
48
|
"tts-ggml": "ttsPlugin",
|
|
47
49
|
"onnx-ocr": "ocrPlugin",
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const bciConfigSchema: z.ZodObject<{
|
|
3
|
+
whisperConfig: z.ZodOptional<z.ZodObject<{
|
|
4
|
+
language: z.ZodOptional<z.ZodString>;
|
|
5
|
+
n_threads: z.ZodOptional<z.ZodNumber>;
|
|
6
|
+
temperature: z.ZodOptional<z.ZodNumber>;
|
|
7
|
+
suppress_nst: z.ZodOptional<z.ZodBoolean>;
|
|
8
|
+
suppress_blank: z.ZodOptional<z.ZodBoolean>;
|
|
9
|
+
duration_ms: z.ZodOptional<z.ZodNumber>;
|
|
10
|
+
translate: z.ZodOptional<z.ZodBoolean>;
|
|
11
|
+
no_timestamps: z.ZodOptional<z.ZodBoolean>;
|
|
12
|
+
single_segment: z.ZodOptional<z.ZodBoolean>;
|
|
13
|
+
print_special: z.ZodOptional<z.ZodBoolean>;
|
|
14
|
+
print_progress: z.ZodOptional<z.ZodBoolean>;
|
|
15
|
+
print_realtime: z.ZodOptional<z.ZodBoolean>;
|
|
16
|
+
print_timestamps: z.ZodOptional<z.ZodBoolean>;
|
|
17
|
+
detect_language: z.ZodOptional<z.ZodBoolean>;
|
|
18
|
+
greedy_best_of: z.ZodOptional<z.ZodNumber>;
|
|
19
|
+
beam_search_beam_size: z.ZodOptional<z.ZodNumber>;
|
|
20
|
+
}, z.core.$strip>>;
|
|
21
|
+
bciConfig: z.ZodOptional<z.ZodObject<{
|
|
22
|
+
day_idx: z.ZodOptional<z.ZodNumber>;
|
|
23
|
+
}, z.core.$strip>>;
|
|
24
|
+
contextParams: z.ZodOptional<z.ZodObject<{
|
|
25
|
+
model: z.ZodOptional<z.ZodString>;
|
|
26
|
+
use_gpu: z.ZodOptional<z.ZodBoolean>;
|
|
27
|
+
flash_attn: z.ZodOptional<z.ZodBoolean>;
|
|
28
|
+
gpu_device: z.ZodOptional<z.ZodNumber>;
|
|
29
|
+
}, z.core.$strip>>;
|
|
30
|
+
miscConfig: z.ZodOptional<z.ZodObject<{
|
|
31
|
+
caption_enabled: z.ZodOptional<z.ZodBoolean>;
|
|
32
|
+
}, z.core.$strip>>;
|
|
33
|
+
backendsDir: z.ZodOptional<z.ZodString>;
|
|
34
|
+
}, z.core.$strip>;
|
|
35
|
+
export type BciConfig = z.infer<typeof bciConfigSchema>;
|
|
36
|
+
//# sourceMappingURL=bci-config.d.ts.map
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
// === BCI (whisper.cpp) engine config ===
|
|
3
|
+
//
|
|
4
|
+
// Mirrors `BCIWhispercppConfig` from `@qvac/bci-whispercpp`. Unlike the
|
|
5
|
+
// flat `whisperConfigSchema`, the BCI addon nests its inference knobs
|
|
6
|
+
// under `whisperConfig` and exposes a separate `bciConfig` for
|
|
7
|
+
// session-level (neural-signal) parameters.
|
|
8
|
+
// Reduced whisper inference field set exposed by the BCI addon (see the
|
|
9
|
+
// `WhisperConfig` interface in `@qvac/bci-whispercpp`).
|
|
10
|
+
const bciWhisperConfigSchema = z
|
|
11
|
+
.object({
|
|
12
|
+
language: z.string().optional(),
|
|
13
|
+
n_threads: z.number().int().optional(),
|
|
14
|
+
temperature: z.number().optional(),
|
|
15
|
+
suppress_nst: z.boolean().optional(),
|
|
16
|
+
suppress_blank: z.boolean().optional(),
|
|
17
|
+
duration_ms: z.number().int().optional(),
|
|
18
|
+
translate: z.boolean().optional(),
|
|
19
|
+
no_timestamps: z.boolean().optional(),
|
|
20
|
+
single_segment: z.boolean().optional(),
|
|
21
|
+
print_special: z.boolean().optional(),
|
|
22
|
+
print_progress: z.boolean().optional(),
|
|
23
|
+
print_realtime: z.boolean().optional(),
|
|
24
|
+
print_timestamps: z.boolean().optional(),
|
|
25
|
+
detect_language: z.boolean().optional(),
|
|
26
|
+
greedy_best_of: z.number().int().optional(),
|
|
27
|
+
beam_search_beam_size: z.number().int().optional(),
|
|
28
|
+
})
|
|
29
|
+
.optional();
|
|
30
|
+
const bciSessionConfigSchema = z
|
|
31
|
+
.object({
|
|
32
|
+
// Session day index used to select day-specific projection matrices.
|
|
33
|
+
// `-1` enables mel passthrough (parity testing only).
|
|
34
|
+
day_idx: z.number().int().optional(),
|
|
35
|
+
})
|
|
36
|
+
.optional();
|
|
37
|
+
const bciContextParamsSchema = z
|
|
38
|
+
.object({
|
|
39
|
+
model: z.string().optional(),
|
|
40
|
+
use_gpu: z.boolean().optional(),
|
|
41
|
+
flash_attn: z.boolean().optional(),
|
|
42
|
+
gpu_device: z.number().optional(),
|
|
43
|
+
})
|
|
44
|
+
.optional();
|
|
45
|
+
const bciMiscConfigSchema = z
|
|
46
|
+
.object({
|
|
47
|
+
caption_enabled: z.boolean().optional(),
|
|
48
|
+
})
|
|
49
|
+
.optional();
|
|
50
|
+
export const bciConfigSchema = z.object({
|
|
51
|
+
whisperConfig: bciWhisperConfigSchema,
|
|
52
|
+
bciConfig: bciSessionConfigSchema,
|
|
53
|
+
contextParams: bciContextParamsSchema,
|
|
54
|
+
miscConfig: bciMiscConfigSchema,
|
|
55
|
+
backendsDir: z.string().optional(),
|
|
56
|
+
});
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { type TranscribeSegment } from "./transcription";
|
|
3
|
+
export declare const neuralInputSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
4
|
+
type: z.ZodLiteral<"base64">;
|
|
5
|
+
value: z.ZodString;
|
|
6
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
7
|
+
type: z.ZodLiteral<"filePath">;
|
|
8
|
+
value: z.ZodString;
|
|
9
|
+
}, z.core.$strip>], "type">;
|
|
10
|
+
export declare const bciTranscribeParamsSchema: z.ZodObject<{
|
|
11
|
+
modelId: z.ZodString;
|
|
12
|
+
metadata: z.ZodOptional<z.ZodBoolean>;
|
|
13
|
+
neuralData: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
14
|
+
type: z.ZodLiteral<"base64">;
|
|
15
|
+
value: z.ZodString;
|
|
16
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
17
|
+
type: z.ZodLiteral<"filePath">;
|
|
18
|
+
value: z.ZodString;
|
|
19
|
+
}, z.core.$strip>], "type">;
|
|
20
|
+
}, z.core.$strip>;
|
|
21
|
+
export declare const bciTranscribeClientParamsSchema: z.ZodObject<{
|
|
22
|
+
modelId: z.ZodString;
|
|
23
|
+
metadata: z.ZodOptional<z.ZodBoolean>;
|
|
24
|
+
neuralData: z.ZodUnion<readonly [z.ZodString, z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>]>;
|
|
25
|
+
}, z.core.$strip>;
|
|
26
|
+
export declare const bciTranscribeRequestSchema: z.ZodObject<{
|
|
27
|
+
modelId: z.ZodString;
|
|
28
|
+
metadata: z.ZodOptional<z.ZodBoolean>;
|
|
29
|
+
neuralData: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
30
|
+
type: z.ZodLiteral<"base64">;
|
|
31
|
+
value: z.ZodString;
|
|
32
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
33
|
+
type: z.ZodLiteral<"filePath">;
|
|
34
|
+
value: z.ZodString;
|
|
35
|
+
}, z.core.$strip>], "type">;
|
|
36
|
+
type: z.ZodLiteral<"bciTranscribe">;
|
|
37
|
+
requestId: z.ZodOptional<z.ZodString>;
|
|
38
|
+
}, z.core.$strip>;
|
|
39
|
+
export declare const bciTranscribeResponseSchema: z.ZodObject<{
|
|
40
|
+
text: z.ZodOptional<z.ZodString>;
|
|
41
|
+
done: z.ZodOptional<z.ZodBoolean>;
|
|
42
|
+
stats: z.ZodOptional<z.ZodObject<{
|
|
43
|
+
audioDuration: z.ZodOptional<z.ZodNumber>;
|
|
44
|
+
realTimeFactor: z.ZodOptional<z.ZodNumber>;
|
|
45
|
+
tokensPerSecond: z.ZodOptional<z.ZodNumber>;
|
|
46
|
+
totalTokens: z.ZodOptional<z.ZodNumber>;
|
|
47
|
+
totalSegments: z.ZodOptional<z.ZodNumber>;
|
|
48
|
+
whisperEncodeTime: z.ZodOptional<z.ZodNumber>;
|
|
49
|
+
whisperDecodeTime: z.ZodOptional<z.ZodNumber>;
|
|
50
|
+
encoderTime: z.ZodOptional<z.ZodNumber>;
|
|
51
|
+
decoderTime: z.ZodOptional<z.ZodNumber>;
|
|
52
|
+
melSpecTime: z.ZodOptional<z.ZodNumber>;
|
|
53
|
+
backendDevice: z.ZodOptional<z.ZodNumber>;
|
|
54
|
+
backendId: z.ZodOptional<z.ZodNumber>;
|
|
55
|
+
gpuMemTotalMb: z.ZodOptional<z.ZodNumber>;
|
|
56
|
+
gpuMemFreeMb: z.ZodOptional<z.ZodNumber>;
|
|
57
|
+
}, z.core.$strip>>;
|
|
58
|
+
error: z.ZodOptional<z.ZodString>;
|
|
59
|
+
segment: z.ZodOptional<z.ZodObject<{
|
|
60
|
+
text: z.ZodString;
|
|
61
|
+
startMs: z.ZodNumber;
|
|
62
|
+
endMs: z.ZodNumber;
|
|
63
|
+
append: z.ZodBoolean;
|
|
64
|
+
id: z.ZodNumber;
|
|
65
|
+
}, z.core.$strip>>;
|
|
66
|
+
type: z.ZodLiteral<"bciTranscribe">;
|
|
67
|
+
}, z.core.$strip>;
|
|
68
|
+
/**
|
|
69
|
+
* Per-call overrides for the BCI addon's sliding-window streaming
|
|
70
|
+
* (`transcribeStream`). Each field maps 1:1 to the addon's `streamOpts`;
|
|
71
|
+
* any field omitted falls back to the addon default.
|
|
72
|
+
*/
|
|
73
|
+
export declare const bciStreamOptsSchema: z.ZodObject<{
|
|
74
|
+
windowTimesteps: z.ZodOptional<z.ZodNumber>;
|
|
75
|
+
hopTimesteps: z.ZodOptional<z.ZodNumber>;
|
|
76
|
+
emit: z.ZodOptional<z.ZodEnum<{
|
|
77
|
+
full: "full";
|
|
78
|
+
delta: "delta";
|
|
79
|
+
}>>;
|
|
80
|
+
}, z.core.$strip>;
|
|
81
|
+
export declare const bciTranscribeStreamRequestSchema: z.ZodObject<{
|
|
82
|
+
modelId: z.ZodString;
|
|
83
|
+
metadata: z.ZodOptional<z.ZodBoolean>;
|
|
84
|
+
type: z.ZodLiteral<"bciTranscribeStream">;
|
|
85
|
+
streamOpts: z.ZodOptional<z.ZodObject<{
|
|
86
|
+
windowTimesteps: z.ZodOptional<z.ZodNumber>;
|
|
87
|
+
hopTimesteps: z.ZodOptional<z.ZodNumber>;
|
|
88
|
+
emit: z.ZodOptional<z.ZodEnum<{
|
|
89
|
+
full: "full";
|
|
90
|
+
delta: "delta";
|
|
91
|
+
}>>;
|
|
92
|
+
}, z.core.$strip>>;
|
|
93
|
+
requestId: z.ZodOptional<z.ZodString>;
|
|
94
|
+
}, z.core.$strip>;
|
|
95
|
+
export declare const bciTranscribeStreamResponseSchema: z.ZodObject<{
|
|
96
|
+
text: z.ZodOptional<z.ZodString>;
|
|
97
|
+
done: z.ZodOptional<z.ZodBoolean>;
|
|
98
|
+
stats: z.ZodOptional<z.ZodObject<{
|
|
99
|
+
audioDuration: z.ZodOptional<z.ZodNumber>;
|
|
100
|
+
realTimeFactor: z.ZodOptional<z.ZodNumber>;
|
|
101
|
+
tokensPerSecond: z.ZodOptional<z.ZodNumber>;
|
|
102
|
+
totalTokens: z.ZodOptional<z.ZodNumber>;
|
|
103
|
+
totalSegments: z.ZodOptional<z.ZodNumber>;
|
|
104
|
+
whisperEncodeTime: z.ZodOptional<z.ZodNumber>;
|
|
105
|
+
whisperDecodeTime: z.ZodOptional<z.ZodNumber>;
|
|
106
|
+
encoderTime: z.ZodOptional<z.ZodNumber>;
|
|
107
|
+
decoderTime: z.ZodOptional<z.ZodNumber>;
|
|
108
|
+
melSpecTime: z.ZodOptional<z.ZodNumber>;
|
|
109
|
+
backendDevice: z.ZodOptional<z.ZodNumber>;
|
|
110
|
+
backendId: z.ZodOptional<z.ZodNumber>;
|
|
111
|
+
gpuMemTotalMb: z.ZodOptional<z.ZodNumber>;
|
|
112
|
+
gpuMemFreeMb: z.ZodOptional<z.ZodNumber>;
|
|
113
|
+
}, z.core.$strip>>;
|
|
114
|
+
error: z.ZodOptional<z.ZodString>;
|
|
115
|
+
segment: z.ZodOptional<z.ZodObject<{
|
|
116
|
+
text: z.ZodString;
|
|
117
|
+
startMs: z.ZodNumber;
|
|
118
|
+
endMs: z.ZodNumber;
|
|
119
|
+
append: z.ZodBoolean;
|
|
120
|
+
id: z.ZodNumber;
|
|
121
|
+
}, z.core.$strip>>;
|
|
122
|
+
type: z.ZodLiteral<"bciTranscribeStream">;
|
|
123
|
+
}, z.core.$strip>;
|
|
124
|
+
export type NeuralInput = z.infer<typeof neuralInputSchema>;
|
|
125
|
+
export type BciTranscribeParams = z.infer<typeof bciTranscribeParamsSchema>;
|
|
126
|
+
export type BciTranscribeRequest = z.infer<typeof bciTranscribeRequestSchema>;
|
|
127
|
+
export type BciTranscribeResponse = z.infer<typeof bciTranscribeResponseSchema>;
|
|
128
|
+
export type BciTranscribeClientParamsParsed = z.output<typeof bciTranscribeClientParamsSchema>;
|
|
129
|
+
export type BciStreamOpts = z.infer<typeof bciStreamOptsSchema>;
|
|
130
|
+
export type BciTranscribeStreamRequest = z.infer<typeof bciTranscribeStreamRequestSchema>;
|
|
131
|
+
export type BciTranscribeStreamResponse = z.infer<typeof bciTranscribeStreamResponseSchema>;
|
|
132
|
+
/** Client parameters for `bciTranscribe()`. */
|
|
133
|
+
export interface BciTranscribeClientParams {
|
|
134
|
+
/** Identifier returned by `loadModel()` for a loaded BCI model. */
|
|
135
|
+
modelId: string;
|
|
136
|
+
/**
|
|
137
|
+
* BCI neural input. A string is treated as a local/provider `.bin` file path;
|
|
138
|
+
* a `Uint8Array` is treated as raw neural bytes and sent as base64 on the
|
|
139
|
+
* wire.
|
|
140
|
+
*/
|
|
141
|
+
neuralData: string | Uint8Array;
|
|
142
|
+
/**
|
|
143
|
+
* When true, resolves to transcript segment metadata objects
|
|
144
|
+
* (`{ text, startMs, endMs, append, id }`) instead of joined text.
|
|
145
|
+
*/
|
|
146
|
+
metadata?: boolean;
|
|
147
|
+
}
|
|
148
|
+
export type BciTranscribeStreamClientParams = {
|
|
149
|
+
modelId: string;
|
|
150
|
+
metadata?: boolean;
|
|
151
|
+
windowTimesteps?: number;
|
|
152
|
+
hopTimesteps?: number;
|
|
153
|
+
emit?: "delta" | "full";
|
|
154
|
+
};
|
|
155
|
+
export interface BciTranscribeStreamSession {
|
|
156
|
+
/**
|
|
157
|
+
* Stable id for this in-flight BCI stream. Pass to `cancel({ requestId })`
|
|
158
|
+
* to target this duplex session without cancelling other work on the model.
|
|
159
|
+
*/
|
|
160
|
+
requestId: string;
|
|
161
|
+
write(neuralChunk: Uint8Array): void;
|
|
162
|
+
end(): void;
|
|
163
|
+
destroy(): void;
|
|
164
|
+
[Symbol.asyncIterator](): AsyncIterator<string>;
|
|
165
|
+
}
|
|
166
|
+
export interface BciTranscribeStreamMetadataSession {
|
|
167
|
+
/**
|
|
168
|
+
* Stable id for this in-flight BCI stream. Pass to `cancel({ requestId })`
|
|
169
|
+
* to target this duplex session without cancelling other work on the model.
|
|
170
|
+
*/
|
|
171
|
+
requestId: string;
|
|
172
|
+
write(neuralChunk: Uint8Array): void;
|
|
173
|
+
end(): void;
|
|
174
|
+
destroy(): void;
|
|
175
|
+
[Symbol.asyncIterator](): AsyncIterator<TranscribeSegment>;
|
|
176
|
+
}
|
|
177
|
+
//# sourceMappingURL=bci.d.ts.map
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { transcribeSegmentSchema, transcribeStatsSchema, } from "./transcription.js";
|
|
3
|
+
// Neural-signal binary input. The BCI addon consumes a raw neural buffer
|
|
4
|
+
// (not audio): pass it inline as base64 or point at a local `.bin` file.
|
|
5
|
+
export const neuralInputSchema = z.discriminatedUnion("type", [
|
|
6
|
+
z.object({
|
|
7
|
+
type: z.literal("base64").describe("Inline base64-encoded neural bytes."),
|
|
8
|
+
value: z
|
|
9
|
+
.string()
|
|
10
|
+
.describe("Base64-encoded contents of a BCI neural `.bin` recording."),
|
|
11
|
+
}),
|
|
12
|
+
z.object({
|
|
13
|
+
type: z.literal("filePath").describe("Local neural `.bin` file path."),
|
|
14
|
+
value: z
|
|
15
|
+
.string()
|
|
16
|
+
.describe("Path to a BCI neural `.bin` recording on the provider."),
|
|
17
|
+
}),
|
|
18
|
+
]);
|
|
19
|
+
const bciTranscribeBaseSchema = z.object({
|
|
20
|
+
modelId: z
|
|
21
|
+
.string()
|
|
22
|
+
.describe("Identifier returned by `loadModel()` for a loaded BCI model."),
|
|
23
|
+
metadata: z
|
|
24
|
+
.boolean()
|
|
25
|
+
.optional()
|
|
26
|
+
.describe("When true, responses yield transcript segment metadata objects (`{ text, startMs, endMs, append, id }`) instead of joined text."),
|
|
27
|
+
});
|
|
28
|
+
export const bciTranscribeParamsSchema = bciTranscribeBaseSchema.extend({
|
|
29
|
+
neuralData: neuralInputSchema.describe("Fixed wire shape for BCI neural input: either inline base64 neural bytes or a provider-local `.bin` file path."),
|
|
30
|
+
});
|
|
31
|
+
export const bciTranscribeClientParamsSchema = bciTranscribeBaseSchema.extend({
|
|
32
|
+
neuralData: z
|
|
33
|
+
.union([z.string(), z.instanceof(Uint8Array)])
|
|
34
|
+
.describe("Convenience client input for BCI neural data: pass a local/provider `.bin` file path as a string, or raw neural bytes as a `Uint8Array`. The client converts this to `neuralInputSchema` before sending the request."),
|
|
35
|
+
});
|
|
36
|
+
export const bciTranscribeRequestSchema = bciTranscribeParamsSchema.extend({
|
|
37
|
+
type: z.literal("bciTranscribe"),
|
|
38
|
+
requestId: z
|
|
39
|
+
.string()
|
|
40
|
+
.min(1)
|
|
41
|
+
.optional()
|
|
42
|
+
.describe("Stable identifier for this in-flight BCI transcription, generated by the client at call time. Surfaces on the registry so callers can target it with `cancel({ requestId })`. Optional on the wire — the server falls back to a server-generated id when the field is missing."),
|
|
43
|
+
});
|
|
44
|
+
const bciTranscriptionResultBase = z.object({
|
|
45
|
+
text: z.string().optional(),
|
|
46
|
+
done: z.boolean().optional(),
|
|
47
|
+
stats: transcribeStatsSchema.optional(),
|
|
48
|
+
error: z.string().optional(),
|
|
49
|
+
segment: transcribeSegmentSchema.optional(),
|
|
50
|
+
});
|
|
51
|
+
export const bciTranscribeResponseSchema = bciTranscriptionResultBase.extend({
|
|
52
|
+
type: z.literal("bciTranscribe"),
|
|
53
|
+
});
|
|
54
|
+
/**
|
|
55
|
+
* Per-call overrides for the BCI addon's sliding-window streaming
|
|
56
|
+
* (`transcribeStream`). Each field maps 1:1 to the addon's `streamOpts`;
|
|
57
|
+
* any field omitted falls back to the addon default.
|
|
58
|
+
*/
|
|
59
|
+
export const bciStreamOptsSchema = z
|
|
60
|
+
.object({
|
|
61
|
+
windowTimesteps: z
|
|
62
|
+
.number()
|
|
63
|
+
.int()
|
|
64
|
+
.positive()
|
|
65
|
+
.optional()
|
|
66
|
+
.describe("Decode window size in timesteps (addon default: 1500)."),
|
|
67
|
+
hopTimesteps: z
|
|
68
|
+
.number()
|
|
69
|
+
.int()
|
|
70
|
+
.positive()
|
|
71
|
+
.optional()
|
|
72
|
+
.describe("How far the window advances between decodes (addon default: 500). Must be < windowTimesteps."),
|
|
73
|
+
emit: z
|
|
74
|
+
.enum(["delta", "full"])
|
|
75
|
+
.optional()
|
|
76
|
+
.describe("'delta' (default) emits only the newly-discovered tail per window; 'full' emits the full running transcript each update."),
|
|
77
|
+
})
|
|
78
|
+
.refine((opts) => opts.windowTimesteps === undefined ||
|
|
79
|
+
opts.hopTimesteps === undefined ||
|
|
80
|
+
opts.hopTimesteps < opts.windowTimesteps, {
|
|
81
|
+
message: "hopTimesteps must be < windowTimesteps",
|
|
82
|
+
path: ["hopTimesteps"],
|
|
83
|
+
});
|
|
84
|
+
export const bciTranscribeStreamRequestSchema = bciTranscribeBaseSchema.extend({
|
|
85
|
+
type: z.literal("bciTranscribeStream"),
|
|
86
|
+
streamOpts: bciStreamOptsSchema.optional(),
|
|
87
|
+
requestId: z
|
|
88
|
+
.string()
|
|
89
|
+
.min(1)
|
|
90
|
+
.optional()
|
|
91
|
+
.describe("Stable identifier for this in-flight duplex BCI transcription, generated by the client at call time. Surfaces on the registry so callers can target it with `cancel({ requestId })`. Optional on the wire — the server falls back to a server-generated id when the field is missing."),
|
|
92
|
+
});
|
|
93
|
+
export const bciTranscribeStreamResponseSchema = bciTranscriptionResultBase.extend({
|
|
94
|
+
type: z.literal("bciTranscribeStream"),
|
|
95
|
+
});
|