@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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Logger } from '
|
|
1
|
+
import type { Logger } from '../logging/index.js';
|
|
2
2
|
export declare function registerAddonLogger(modelId: string, namespace: string, logger: Logger): void;
|
|
3
3
|
export declare function unregisterAddonLogger(modelId: string): void;
|
|
4
4
|
export declare function createAddonLoggerCallback(namespace: string): (priority: number, message: string) => void;
|
package/dist/src/pear/pre.js
CHANGED
|
@@ -30,6 +30,8 @@ const CONFIG_CANDIDATES = [
|
|
|
30
30
|
const BUILTIN_PLUGINS = [
|
|
31
31
|
'@qvac/sdk/llamacpp-completion/plugin',
|
|
32
32
|
'@qvac/sdk/llamacpp-embedding/plugin',
|
|
33
|
+
'@qvac/sdk/llamacpp-decision/plugin',
|
|
34
|
+
'@qvac/sdk/llamacpp-rerank/plugin',
|
|
33
35
|
'@qvac/sdk/whispercpp-transcription/plugin',
|
|
34
36
|
'@qvac/sdk/bci-whispercpp-transcription/plugin',
|
|
35
37
|
'@qvac/sdk/nmtcpp-translation/plugin',
|
|
@@ -43,6 +45,8 @@ const BUILTIN_PLUGINS = [
|
|
|
43
45
|
const BUILTIN_PLUGIN_EXPORTS = {
|
|
44
46
|
'llamacpp-completion': 'llmPlugin',
|
|
45
47
|
'llamacpp-embedding': 'embeddingsPlugin',
|
|
48
|
+
'llamacpp-decision': 'decisionPlugin',
|
|
49
|
+
'llamacpp-rerank': 'rerankPlugin',
|
|
46
50
|
'whispercpp-transcription': 'whisperPlugin',
|
|
47
51
|
'bci-whispercpp-transcription': 'bciPlugin',
|
|
48
52
|
'nmtcpp-translation': 'nmtPlugin',
|
package/dist/src/plugin-ids.d.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
export declare const PLUGIN_LLM: "@qvac/sdk/llamacpp-completion/plugin";
|
|
2
|
+
export declare const PLUGIN_DECISION: "@qvac/sdk/llamacpp-decision/plugin";
|
|
3
|
+
export declare const PLUGIN_RERANK: "@qvac/sdk/llamacpp-rerank/plugin";
|
|
2
4
|
export declare const PLUGIN_EMBEDDING: "@qvac/sdk/llamacpp-embedding/plugin";
|
|
3
5
|
export declare const PLUGIN_WHISPER: "@qvac/sdk/whispercpp-transcription/plugin";
|
|
4
6
|
export declare const PLUGIN_BCI: "@qvac/sdk/bci-whispercpp-transcription/plugin";
|
|
7
|
+
export declare const PLUGIN_MOSS_TRANSCRIBE: "@qvac/sdk/moss-transcribe/plugin";
|
|
5
8
|
export declare const PLUGIN_NMT: "@qvac/sdk/nmtcpp-translation/plugin";
|
|
6
9
|
export declare const PLUGIN_TTS: "@qvac/sdk/tts-ggml/plugin";
|
|
7
10
|
export declare const PLUGIN_OCR: "@qvac/sdk/ggml-ocr/plugin";
|
|
@@ -9,6 +12,6 @@ export declare const PLUGIN_DIFFUSION: "@qvac/sdk/sdcpp-generation/plugin";
|
|
|
9
12
|
export declare const PLUGIN_AUDIOGEN: "@qvac/sdk/audiogen-ggml/plugin";
|
|
10
13
|
export declare const PLUGIN_VLA: "@qvac/sdk/ggml-vla/plugin";
|
|
11
14
|
export declare const PLUGIN_CLASSIFICATION: "@qvac/sdk/ggml-classification/plugin";
|
|
12
|
-
export declare const SDK_DEFAULT_PLUGINS: readonly ["@qvac/sdk/llamacpp-completion/plugin", "@qvac/sdk/llamacpp-embedding/plugin", "@qvac/sdk/whispercpp-transcription/plugin", "@qvac/sdk/bci-whispercpp-transcription/plugin", "@qvac/sdk/parakeet-transcription/plugin", "@qvac/sdk/nmtcpp-translation/plugin", "@qvac/sdk/tts-ggml/plugin", "@qvac/sdk/ggml-ocr/plugin", "@qvac/sdk/sdcpp-generation/plugin", "@qvac/sdk/audiogen-ggml/plugin", "@qvac/sdk/ggml-vla/plugin", "@qvac/sdk/ggml-classification/plugin"];
|
|
15
|
+
export declare const SDK_DEFAULT_PLUGINS: readonly ["@qvac/sdk/llamacpp-completion/plugin", "@qvac/sdk/llamacpp-embedding/plugin", "@qvac/sdk/llamacpp-decision/plugin", "@qvac/sdk/llamacpp-rerank/plugin", "@qvac/sdk/whispercpp-transcription/plugin", "@qvac/sdk/bci-whispercpp-transcription/plugin", "@qvac/sdk/parakeet-transcription/plugin", "@qvac/sdk/moss-transcribe/plugin", "@qvac/sdk/nmtcpp-translation/plugin", "@qvac/sdk/tts-ggml/plugin", "@qvac/sdk/ggml-ocr/plugin", "@qvac/sdk/sdcpp-generation/plugin", "@qvac/sdk/audiogen-ggml/plugin", "@qvac/sdk/ggml-vla/plugin", "@qvac/sdk/ggml-classification/plugin"];
|
|
13
16
|
export type BuiltinPlugin = (typeof SDK_DEFAULT_PLUGINS)[number];
|
|
14
17
|
//# sourceMappingURL=plugin-ids.d.ts.map
|
package/dist/src/plugin-ids.js
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
// Built-in plugin ids under the public @qvac/sdk name.
|
|
2
2
|
export const PLUGIN_LLM = '@qvac/sdk/llamacpp-completion/plugin';
|
|
3
|
+
export const PLUGIN_DECISION = '@qvac/sdk/llamacpp-decision/plugin';
|
|
4
|
+
export const PLUGIN_RERANK = '@qvac/sdk/llamacpp-rerank/plugin';
|
|
3
5
|
export const PLUGIN_EMBEDDING = '@qvac/sdk/llamacpp-embedding/plugin';
|
|
4
6
|
export const PLUGIN_WHISPER = '@qvac/sdk/whispercpp-transcription/plugin';
|
|
5
7
|
export const PLUGIN_BCI = '@qvac/sdk/bci-whispercpp-transcription/plugin';
|
|
8
|
+
export const PLUGIN_MOSS_TRANSCRIBE = '@qvac/sdk/moss-transcribe/plugin';
|
|
6
9
|
const PLUGIN_PARAKEET = '@qvac/sdk/parakeet-transcription/plugin';
|
|
7
10
|
export const PLUGIN_NMT = '@qvac/sdk/nmtcpp-translation/plugin';
|
|
8
11
|
export const PLUGIN_TTS = '@qvac/sdk/tts-ggml/plugin';
|
|
@@ -14,9 +17,12 @@ export const PLUGIN_CLASSIFICATION = '@qvac/sdk/ggml-classification/plugin';
|
|
|
14
17
|
export const SDK_DEFAULT_PLUGINS = [
|
|
15
18
|
PLUGIN_LLM,
|
|
16
19
|
PLUGIN_EMBEDDING,
|
|
20
|
+
PLUGIN_DECISION,
|
|
21
|
+
PLUGIN_RERANK,
|
|
17
22
|
PLUGIN_WHISPER,
|
|
18
23
|
PLUGIN_BCI,
|
|
19
24
|
PLUGIN_PARAKEET,
|
|
25
|
+
PLUGIN_MOSS_TRANSCRIBE,
|
|
20
26
|
PLUGIN_NMT,
|
|
21
27
|
PLUGIN_TTS,
|
|
22
28
|
PLUGIN_OCR,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
export { llmConfigBaseSchema as llamacppCompletionConfigSchema, embedConfigBaseSchema as llamacppEmbeddingConfigSchema, modelSrcInputSchema as modelSourceSchema, type LlmConfigInput as LlamacppCompletionConfig, type EmbedConfigInput as LlamacppEmbeddingConfig, type ModelSrcInput as ModelSource } from '@qvac/inference/surface';
|
|
1
|
+
export { llmConfigBaseSchema as llamacppCompletionConfigSchema, embedConfigBaseSchema as llamacppEmbeddingConfigSchema, decisionConfigBaseSchema as llamacppDecisionConfigSchema, rerankConfigBaseSchema as llamacppRerankConfigSchema, modelSrcInputSchema as modelSourceSchema, type LlmConfigInput as LlamacppCompletionConfig, type EmbedConfigInput as LlamacppEmbeddingConfig, type DecisionConfigInput as LlamacppDecisionConfig, type RerankConfigInput as LlamacppRerankConfig, type ModelSrcInput as ModelSource } from '@qvac/inference/surface';
|
|
2
2
|
export { configSchemaForModelType, MODEL_CONFIG_SCHEMA_BY_TYPE } from '@qvac/inference/surface';
|
|
3
|
+
export { modelFitPolicySchema, type ModelFitPolicy } from '@qvac/inference/surface';
|
|
3
4
|
//# sourceMappingURL=public.d.ts.map
|
|
@@ -2,10 +2,11 @@
|
|
|
2
2
|
// (aliased from @qvac/inference's schemas) so consumers such as the CLI can import
|
|
3
3
|
// a model's `modelConfig` schema and read its field descriptions without depending
|
|
4
4
|
// on internal identifiers.
|
|
5
|
-
export { llmConfigBaseSchema as llamacppCompletionConfigSchema, embedConfigBaseSchema as llamacppEmbeddingConfigSchema, modelSrcInputSchema as modelSourceSchema } from '@qvac/inference/surface';
|
|
5
|
+
export { llmConfigBaseSchema as llamacppCompletionConfigSchema, embedConfigBaseSchema as llamacppEmbeddingConfigSchema, decisionConfigBaseSchema as llamacppDecisionConfigSchema, rerankConfigBaseSchema as llamacppRerankConfigSchema, modelSrcInputSchema as modelSourceSchema } from '@qvac/inference/surface';
|
|
6
6
|
// Resolve any model's `modelConfig` schema by model type (canonical, alias, or
|
|
7
7
|
// engine string) and read its field descriptions — the map is the single source
|
|
8
8
|
// of truth, so a newly added model type is available here automatically. Lets
|
|
9
9
|
// tools such as the CLI's `qvac configure` document every addon's config
|
|
10
10
|
// without a hand-maintained per-addon list.
|
|
11
11
|
export { configSchemaForModelType, MODEL_CONFIG_SCHEMA_BY_TYPE } from '@qvac/inference/surface';
|
|
12
|
+
export { modelFitPolicySchema } from '@qvac/inference/surface';
|
|
@@ -36,6 +36,9 @@ export declare const SDK_CLIENT_ERROR_CODES: {
|
|
|
36
36
|
readonly BARE_RUNTIME_BINARY_NOT_FOUND: 50614;
|
|
37
37
|
readonly HOST_PREBUILDS_INSTALL_REFUSED: 50615;
|
|
38
38
|
readonly HOST_PREBUILDS_INSTALL_FAILED: 50616;
|
|
39
|
+
readonly ADDON_LINK_FAILED: 50617;
|
|
40
|
+
readonly BARE_PACK_NODE_UNSUPPORTED: 50618;
|
|
41
|
+
readonly HOST_PREBUILDS_MISSING: 50619;
|
|
39
42
|
readonly PROFILER_INVALID_CAPACITY: 50800;
|
|
40
43
|
};
|
|
41
44
|
declare const clientErrorDefinitions: ErrorCodesMap;
|
|
@@ -42,6 +42,9 @@ export const SDK_CLIENT_ERROR_CODES = {
|
|
|
42
42
|
BARE_RUNTIME_BINARY_NOT_FOUND: 50614,
|
|
43
43
|
HOST_PREBUILDS_INSTALL_REFUSED: 50615,
|
|
44
44
|
HOST_PREBUILDS_INSTALL_FAILED: 50616,
|
|
45
|
+
ADDON_LINK_FAILED: 50617,
|
|
46
|
+
BARE_PACK_NODE_UNSUPPORTED: 50618,
|
|
47
|
+
HOST_PREBUILDS_MISSING: 50619,
|
|
45
48
|
// Profiler Errors (50,800-50,899)
|
|
46
49
|
PROFILER_INVALID_CAPACITY: 50800
|
|
47
50
|
};
|
|
@@ -171,6 +174,10 @@ const clientErrorDefinitions = {
|
|
|
171
174
|
name: 'BARE_PACK_ERROR',
|
|
172
175
|
message: (exitCode, entryPath, outputPath) => `bare-pack exited with code ${exitCode}\n\n Entry file: ${entryPath}\n Output file: ${outputPath}\n\n Run bare-pack manually for more details.`
|
|
173
176
|
},
|
|
177
|
+
[SDK_CLIENT_ERROR_CODES.BARE_PACK_NODE_UNSUPPORTED]: {
|
|
178
|
+
name: 'BARE_PACK_NODE_UNSUPPORTED',
|
|
179
|
+
message: (nodeVersion, requiredRange) => `bare-pack needs Node ${requiredRange}; found Node v${nodeVersion}. Upgrade Node and run the bundle again.`
|
|
180
|
+
},
|
|
174
181
|
[SDK_CLIENT_ERROR_CODES.INVALID_PLUGIN_SPECIFIER]: {
|
|
175
182
|
name: 'INVALID_PLUGIN_SPECIFIER',
|
|
176
183
|
message: (specifiers) => `Invalid plugin specifiers (must end with /plugin):\n${specifiers}`
|
|
@@ -197,6 +204,15 @@ const clientErrorDefinitions = {
|
|
|
197
204
|
? `\n\n Fix the error, or add them to the dependencies in package.json, pinned to these exact versions, and reinstall:\n${dependencies}`
|
|
198
205
|
: '')
|
|
199
206
|
},
|
|
207
|
+
[SDK_CLIENT_ERROR_CODES.ADDON_LINK_FAILED]: {
|
|
208
|
+
name: 'ADDON_LINK_FAILED',
|
|
209
|
+
message: (hosts, reason) => `Linking the native addons failed\n\n Hosts: ${hosts}\n Reason: ${reason}`
|
|
210
|
+
},
|
|
211
|
+
[SDK_CLIENT_ERROR_CODES.HOST_PREBUILDS_MISSING]: {
|
|
212
|
+
name: 'HOST_PREBUILDS_MISSING',
|
|
213
|
+
message: (dependencies) => "Bundling failed: split addons resolve their native code through `#host-addon`, which needs each mobile host's platform package installed." +
|
|
214
|
+
`\n\n Add them to the dependencies in package.json, pinned to these exact versions, and reinstall (or bundle with installMissingPrebuilds):\n${dependencies}`
|
|
215
|
+
},
|
|
200
216
|
// Profiler Errors (50,800-50,899)
|
|
201
217
|
[SDK_CLIENT_ERROR_CODES.PROFILER_INVALID_CAPACITY]: {
|
|
202
218
|
name: 'PROFILER_INVALID_CAPACITY',
|
|
@@ -15,6 +15,7 @@ export declare const SDK_SERVER_ERROR_CODES: {
|
|
|
15
15
|
readonly TTS_REFERENCE_AUDIO_REQUIRED: 52209;
|
|
16
16
|
readonly LEGACY_PARAKEET_MODEL_DEPRECATED: 52210;
|
|
17
17
|
readonly LEGACY_TTS_MODEL_DEPRECATED: 52211;
|
|
18
|
+
readonly MODEL_FIT_REFUSED: 52212;
|
|
18
19
|
readonly RPC_SERVER_OPERATION_FAILED: 52423;
|
|
19
20
|
readonly MODEL_UNLOAD_FAILED: 52400;
|
|
20
21
|
readonly EMBED_FAILED: 52401;
|
|
@@ -100,6 +101,7 @@ export declare const SDK_SERVER_ERROR_CODES: {
|
|
|
100
101
|
readonly LIFECYCLE_OPERATION_BLOCKED: 53602;
|
|
101
102
|
readonly PATH_TRAVERSAL: 53900;
|
|
102
103
|
readonly QVAC_MODEL_REGISTRY_QUERY_FAILED: 53950;
|
|
104
|
+
readonly QVAC_MODEL_REGISTRY_MODEL_NOT_FOUND: 53951;
|
|
103
105
|
};
|
|
104
106
|
declare const serverErrorDefinitions: ErrorCodesMap;
|
|
105
107
|
export { serverErrorDefinitions as SDK_SERVER_ERROR_DEFINITIONS };
|
|
@@ -20,6 +20,7 @@ export const SDK_SERVER_ERROR_CODES = {
|
|
|
20
20
|
TTS_REFERENCE_AUDIO_REQUIRED: 52209,
|
|
21
21
|
LEGACY_PARAKEET_MODEL_DEPRECATED: 52210,
|
|
22
22
|
LEGACY_TTS_MODEL_DEPRECATED: 52211,
|
|
23
|
+
MODEL_FIT_REFUSED: 52212,
|
|
23
24
|
// Model Operations (52,400-52,799)
|
|
24
25
|
RPC_SERVER_OPERATION_FAILED: 52423,
|
|
25
26
|
MODEL_UNLOAD_FAILED: 52400,
|
|
@@ -117,7 +118,8 @@ export const SDK_SERVER_ERROR_CODES = {
|
|
|
117
118
|
PATH_TRAVERSAL: 53900,
|
|
118
119
|
// QVAC Model Registry Operations (53,950-54,000)
|
|
119
120
|
// Note: Registry client errors (19,001-20,000) are re-thrown directly
|
|
120
|
-
QVAC_MODEL_REGISTRY_QUERY_FAILED: 53950
|
|
121
|
+
QVAC_MODEL_REGISTRY_QUERY_FAILED: 53950,
|
|
122
|
+
QVAC_MODEL_REGISTRY_MODEL_NOT_FOUND: 53951
|
|
121
123
|
};
|
|
122
124
|
const serverErrorDefinitions = {
|
|
123
125
|
// Model Registry Errors (52,001-52,199)
|
|
@@ -178,6 +180,10 @@ const serverErrorDefinitions = {
|
|
|
178
180
|
name: 'LEGACY_TTS_MODEL_DEPRECATED',
|
|
179
181
|
message: (legacyFields) => `Legacy ONNX TTS modelConfig fields are no longer supported (${legacyFields ?? 'unknown fields'}). As of @qvac/tts-ggml the addon uses GGUF bundles: supply the primary GGUF via modelSrc, set language in modelConfig, and for Chatterbox add s3genModelSrc (e.g. loadModel({ modelSrc: TTS_T3_TURBO_EN_CHATTERBOX_Q8_0, modelType: "tts", modelConfig: { ttsEngine: "chatterbox", language: "en", s3genModelSrc: TTS_S3GEN_EN_CHATTERBOX } })). Supertonic multilingual mode is selected by the GGUF (e.g. TTS_MULTILINGUAL_SUPERTONIC2_Q8_0) plus language — not ttsSupertonicMultilingual.`
|
|
180
182
|
},
|
|
183
|
+
[SDK_SERVER_ERROR_CODES.MODEL_FIT_REFUSED]: {
|
|
184
|
+
name: 'MODEL_FIT_REFUSED',
|
|
185
|
+
message: (modelType, reason, detail) => `${modelType}: the engine fitter projects this load will not fit (${reason})${detail ? `: ${detail}` : ''}`
|
|
186
|
+
},
|
|
181
187
|
// Model Operations (52,400-52,799)
|
|
182
188
|
[SDK_SERVER_ERROR_CODES.RPC_SERVER_OPERATION_FAILED]: {
|
|
183
189
|
name: 'RPC_SERVER_OPERATION_FAILED',
|
|
@@ -560,6 +566,10 @@ const serverErrorDefinitions = {
|
|
|
560
566
|
[SDK_SERVER_ERROR_CODES.QVAC_MODEL_REGISTRY_QUERY_FAILED]: {
|
|
561
567
|
name: 'QVAC_MODEL_REGISTRY_QUERY_FAILED',
|
|
562
568
|
message: (details) => `QVAC model registry query failed${details ? `: ${details}` : ''}`
|
|
569
|
+
},
|
|
570
|
+
[SDK_SERVER_ERROR_CODES.QVAC_MODEL_REGISTRY_MODEL_NOT_FOUND]: {
|
|
571
|
+
name: 'QVAC_MODEL_REGISTRY_MODEL_NOT_FOUND',
|
|
572
|
+
message: (registrySource, registryPath) => `QVAC model registry has no model at ${registrySource}/${registryPath}`
|
|
563
573
|
}
|
|
564
574
|
};
|
|
565
575
|
const serverDefinitionsToRegister = Object.fromEntries(Object.entries(serverErrorDefinitions).filter(([code]) => !isCodeRegistered(Number(code))));
|
|
@@ -1,5 +1,10 @@
|
|
|
1
|
+
import { type AbortSignal } from 'bare-abort-controller';
|
|
1
2
|
export declare function getNextCommandId(): number;
|
|
2
3
|
export declare function isTerminalChunk<T>(value: T): value is T & {
|
|
3
4
|
done: true;
|
|
4
5
|
};
|
|
6
|
+
/** Aborts when the client destroys its end of `wire` (and after a normal end). */
|
|
7
|
+
export declare function signalOnWireClose(wire: {
|
|
8
|
+
on(event: 'close', listener: () => void): unknown;
|
|
9
|
+
}): AbortSignal;
|
|
5
10
|
//# sourceMappingURL=rpc-utils.d.ts.map
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { AbortController } from 'bare-abort-controller';
|
|
1
2
|
let commandCounter = 0;
|
|
2
3
|
export function getNextCommandId() {
|
|
3
4
|
commandCounter = (commandCounter + 1) % Number.MAX_SAFE_INTEGER;
|
|
@@ -6,3 +7,9 @@ export function getNextCommandId() {
|
|
|
6
7
|
export function isTerminalChunk(value) {
|
|
7
8
|
return typeof value === 'object' && value !== null && 'done' in value && value.done === true;
|
|
8
9
|
}
|
|
10
|
+
/** Aborts when the client destroys its end of `wire` (and after a normal end). */
|
|
11
|
+
export function signalOnWireClose(wire) {
|
|
12
|
+
const controller = new AbortController();
|
|
13
|
+
wire.on('close', () => controller.abort(undefined));
|
|
14
|
+
return controller.signal;
|
|
15
|
+
}
|
|
@@ -2,7 +2,7 @@ import fs from 'bare-fs';
|
|
|
2
2
|
import path from 'bare-path';
|
|
3
3
|
import os from 'bare-os';
|
|
4
4
|
import { getServerLogger } from '../../logging/index.js';
|
|
5
|
-
import { getQvacPath } from '
|
|
5
|
+
import { getQvacPath } from '../../server/utils/qvac-paths.js';
|
|
6
6
|
const logger = getServerLogger();
|
|
7
7
|
const LOCK_FILENAME = '.worker.lock';
|
|
8
8
|
function getLockFilePath() {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { CompletionError, CompletionEvent, CompletionFinal, CompletionStats, StopReason, ToolCall, ToolCallError } from '@qvac/inference/surface';
|
|
2
|
-
import { type ToolHandlerMap } from '
|
|
2
|
+
import { type ToolHandlerMap } from '../utils/tool-helpers.js';
|
|
3
3
|
export type AggregatedEvents = {
|
|
4
4
|
contentText: string;
|
|
5
5
|
thinkingText: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { normalizeAssistantCacheContent } from '
|
|
2
|
-
import { attachHandlersToToolCalls } from '
|
|
1
|
+
import { normalizeAssistantCacheContent } from '../utils/cache-normalize.js';
|
|
2
|
+
import { attachHandlersToToolCalls } from '../utils/tool-helpers.js';
|
|
3
3
|
export function aggregateEvents(events) {
|
|
4
4
|
let contentText = '';
|
|
5
5
|
let thinkingText = '';
|
|
@@ -91,6 +91,9 @@ export declare class BarePackNotInstalledError extends QvacErrorBase {
|
|
|
91
91
|
export declare class BarePackError extends QvacErrorBase {
|
|
92
92
|
constructor(exitCode: number, entryPath: string, outputPath: string, cause?: unknown);
|
|
93
93
|
}
|
|
94
|
+
export declare class BarePackNodeUnsupportedError extends QvacErrorBase {
|
|
95
|
+
constructor(nodeVersion: string, requiredRange: string, cause?: unknown);
|
|
96
|
+
}
|
|
94
97
|
export declare class InvalidPluginSpecifierError extends QvacErrorBase {
|
|
95
98
|
constructor(specifiers: string[], cause?: unknown);
|
|
96
99
|
}
|
|
@@ -115,6 +118,13 @@ export declare class HostPrebuildsInstallFailedError extends QvacErrorBase {
|
|
|
115
118
|
readonly dependencies: Record<string, string>;
|
|
116
119
|
constructor(details: string, dependencies: Record<string, string>, cause?: unknown);
|
|
117
120
|
}
|
|
121
|
+
export declare class AddonLinkFailedError extends QvacErrorBase {
|
|
122
|
+
constructor(hosts: string[], cause: unknown);
|
|
123
|
+
}
|
|
124
|
+
export declare class HostPrebuildsMissingError extends QvacErrorBase {
|
|
125
|
+
readonly dependencies: Record<string, string>;
|
|
126
|
+
constructor(dependencies: Record<string, string>, cause?: unknown);
|
|
127
|
+
}
|
|
118
128
|
export declare class ConfigFileNotFoundError extends QvacErrorBase {
|
|
119
129
|
constructor(searchPaths: string, cause?: unknown);
|
|
120
130
|
}
|
|
@@ -150,6 +150,11 @@ export class BarePackError extends QvacErrorBase {
|
|
|
150
150
|
super(createErrorOptions(SDK_CLIENT_ERROR_CODES.BARE_PACK_ERROR, [exitCode, entryPath, outputPath], cause));
|
|
151
151
|
}
|
|
152
152
|
}
|
|
153
|
+
export class BarePackNodeUnsupportedError extends QvacErrorBase {
|
|
154
|
+
constructor(nodeVersion, requiredRange, cause) {
|
|
155
|
+
super(createErrorOptions(SDK_CLIENT_ERROR_CODES.BARE_PACK_NODE_UNSUPPORTED, [nodeVersion, requiredRange], cause));
|
|
156
|
+
}
|
|
157
|
+
}
|
|
153
158
|
export class InvalidPluginSpecifierError extends QvacErrorBase {
|
|
154
159
|
constructor(specifiers, cause) {
|
|
155
160
|
const list = specifiers.map((s) => ` - ${s}`).join('\n');
|
|
@@ -187,6 +192,19 @@ export class HostPrebuildsInstallFailedError extends QvacErrorBase {
|
|
|
187
192
|
this.dependencies = dependencies;
|
|
188
193
|
}
|
|
189
194
|
}
|
|
195
|
+
export class AddonLinkFailedError extends QvacErrorBase {
|
|
196
|
+
constructor(hosts, cause) {
|
|
197
|
+
const reason = cause instanceof Error ? cause.message : String(cause);
|
|
198
|
+
super(createErrorOptions(SDK_CLIENT_ERROR_CODES.ADDON_LINK_FAILED, [hosts.join(', '), reason], cause));
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
export class HostPrebuildsMissingError extends QvacErrorBase {
|
|
202
|
+
dependencies;
|
|
203
|
+
constructor(dependencies, cause) {
|
|
204
|
+
super(createErrorOptions(SDK_CLIENT_ERROR_CODES.HOST_PREBUILDS_MISSING, [formatDependencyPins(dependencies)], cause));
|
|
205
|
+
this.dependencies = dependencies;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
190
208
|
function formatDependencyPins(dependencies) {
|
|
191
209
|
return Object.entries(dependencies)
|
|
192
210
|
.map(([name, version]) => ` "${name}": "${version}"`)
|
|
@@ -389,5 +389,11 @@ export declare class PathTraversalError extends QvacErrorBase {
|
|
|
389
389
|
export declare class ModelRegistryQueryFailedError extends QvacErrorBase {
|
|
390
390
|
constructor(details?: string, cause?: unknown);
|
|
391
391
|
}
|
|
392
|
+
export declare class ModelRegistryModelNotFoundError extends QvacErrorBase {
|
|
393
|
+
readonly registrySource: string;
|
|
394
|
+
readonly registryPath: string;
|
|
395
|
+
constructor(registrySource: string, registryPath: string, cause?: unknown);
|
|
396
|
+
toErrorResponseFields(): Record<string, unknown>;
|
|
397
|
+
}
|
|
392
398
|
export { RpcServerOperationError } from '@qvac/inference/surface';
|
|
393
399
|
//# sourceMappingURL=errors-server.d.ts.map
|
|
@@ -640,4 +640,16 @@ export class ModelRegistryQueryFailedError extends QvacErrorBase {
|
|
|
640
640
|
super(createErrorOptions(SDK_SERVER_ERROR_CODES.QVAC_MODEL_REGISTRY_QUERY_FAILED, details ? [details] : undefined, cause));
|
|
641
641
|
}
|
|
642
642
|
}
|
|
643
|
+
export class ModelRegistryModelNotFoundError extends QvacErrorBase {
|
|
644
|
+
registrySource;
|
|
645
|
+
registryPath;
|
|
646
|
+
constructor(registrySource, registryPath, cause) {
|
|
647
|
+
super(createErrorOptions(SDK_SERVER_ERROR_CODES.QVAC_MODEL_REGISTRY_MODEL_NOT_FOUND, [registrySource, registryPath], cause));
|
|
648
|
+
this.registrySource = registrySource;
|
|
649
|
+
this.registryPath = registryPath;
|
|
650
|
+
}
|
|
651
|
+
toErrorResponseFields() {
|
|
652
|
+
return { registrySource: this.registrySource, registryPath: this.registryPath };
|
|
653
|
+
}
|
|
654
|
+
}
|
|
643
655
|
export { RpcServerOperationError } from '@qvac/inference/surface';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Tool } from '@qvac/inference/surface';
|
|
2
2
|
import type { McpClientInput } from '@qvac/inference/surface';
|
|
3
|
-
import type { ToolHandler } from '
|
|
3
|
+
import type { ToolHandler } from '../utils/tool-helpers.js';
|
|
4
4
|
export type { McpClient, McpClientInput } from '@qvac/inference/surface';
|
|
5
5
|
export type ToolHandlerMap = Map<string, ToolHandler>;
|
|
6
6
|
export type McpToolsResult = {
|
|
@@ -1,25 +1,29 @@
|
|
|
1
|
-
import { mapValues } from '
|
|
2
|
-
const VALID_TYPES = ['string', 'number', 'integer', 'boolean', 'object', 'array'];
|
|
1
|
+
import { mapValues } from '../utils/object.js';
|
|
2
|
+
const VALID_TYPES = ['string', 'number', 'integer', 'boolean', 'object', 'array', 'null'];
|
|
3
3
|
function isValidType(value) {
|
|
4
|
+
if (Array.isArray(value))
|
|
5
|
+
return value.length > 0 && value.every(isValidType);
|
|
4
6
|
return typeof value === 'string' && VALID_TYPES.includes(value);
|
|
5
7
|
}
|
|
6
8
|
function convertMcpToolToTool(mcpTool) {
|
|
7
|
-
|
|
9
|
+
// `$defs` and other top-level keywords stay, so a nested `$ref` still resolves.
|
|
10
|
+
const { $schema: _schema, title: _title, ...inputSchema } = mcpTool.inputSchema;
|
|
8
11
|
const properties = inputSchema.properties ?? {};
|
|
9
12
|
const required = inputSchema.required ?? [];
|
|
13
|
+
// Only an unrecognised `type` is replaced; a missing one is left alone because
|
|
14
|
+
// `anyOf`/`oneOf` properties carry their types in the branches.
|
|
10
15
|
const convertedProperties = mapValues(properties, (prop) => {
|
|
11
|
-
const { type
|
|
12
|
-
return
|
|
13
|
-
|
|
14
|
-
...
|
|
15
|
-
...(enumVal && { enum: enumVal })
|
|
16
|
-
};
|
|
16
|
+
const { type } = prop;
|
|
17
|
+
return type === undefined || isValidType(type)
|
|
18
|
+
? prop
|
|
19
|
+
: { ...prop, type: 'string' };
|
|
17
20
|
});
|
|
18
21
|
return {
|
|
19
22
|
type: 'function',
|
|
20
23
|
name: mcpTool.name,
|
|
21
24
|
description: mcpTool.description ?? '',
|
|
22
25
|
parameters: {
|
|
26
|
+
...inputSchema,
|
|
23
27
|
type: 'object',
|
|
24
28
|
properties: convertedProperties,
|
|
25
29
|
required: required.length > 0 ? required : undefined
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { z } from 'zod';
|
|
2
2
|
import { type Tool, type ToolCall, type ToolCallWithCall } from '@qvac/inference/surface';
|
|
3
3
|
type ZodObjectType = z.ZodObject<z.ZodRawShape>;
|
|
4
4
|
export type ToolHandler = (args: Record<string, unknown>) => Promise<unknown>;
|
|
@@ -1,66 +1,34 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
1
2
|
import { toolSchema } from '@qvac/inference/surface';
|
|
2
|
-
import { InvalidToolsArrayError, InvalidToolSchemaError } from '
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
default:
|
|
17
|
-
return 'string';
|
|
3
|
+
import { InvalidToolsArrayError, InvalidToolSchemaError } from '../utils/errors-client.js';
|
|
4
|
+
// Zod's integer bounds; they add nothing a tool grammar needs.
|
|
5
|
+
const SAFE_INTEGER_BOUNDS = new Set([Number.MIN_SAFE_INTEGER, Number.MAX_SAFE_INTEGER]);
|
|
6
|
+
function dropSafeIntegerBounds(node) {
|
|
7
|
+
if (Array.isArray(node))
|
|
8
|
+
return node.map(dropSafeIntegerBounds);
|
|
9
|
+
if (!node || typeof node !== 'object')
|
|
10
|
+
return node;
|
|
11
|
+
const out = {};
|
|
12
|
+
for (const [key, value] of Object.entries(node)) {
|
|
13
|
+
if ((key === 'minimum' || key === 'maximum') && SAFE_INTEGER_BOUNDS.has(value)) {
|
|
14
|
+
continue;
|
|
15
|
+
}
|
|
16
|
+
out[key] = dropSafeIntegerBounds(value);
|
|
18
17
|
}
|
|
18
|
+
return out;
|
|
19
|
+
}
|
|
20
|
+
function zodToToolParameters(schema) {
|
|
21
|
+
const { $schema: _schema, ...json } = dropSafeIntegerBounds(z.toJSONSchema(schema, { io: 'input', unrepresentable: 'any' }));
|
|
22
|
+
return { ...json, type: 'object', properties: json['properties'] ?? {} };
|
|
19
23
|
}
|
|
20
24
|
export function convertToolInput(input) {
|
|
21
|
-
const zodSchema = input.parameters;
|
|
22
|
-
// Try both shape and def.shape for Zod v4 compatibility
|
|
23
|
-
const shape = zodSchema.shape || (typeof zodSchema.def?.shape === 'object' ? zodSchema.def.shape : {});
|
|
24
|
-
const properties = {};
|
|
25
|
-
const required = [];
|
|
26
|
-
for (const [key, value] of Object.entries(shape)) {
|
|
27
|
-
const field = value;
|
|
28
|
-
const fieldType = field.type || field.def?.type || 'string';
|
|
29
|
-
const isOptional = fieldType === 'optional';
|
|
30
|
-
let actualType = isOptional ? 'string' : fieldType;
|
|
31
|
-
let actualDescription = field.description;
|
|
32
|
-
if (isOptional && field.def?.innerType) {
|
|
33
|
-
const innerType = field.def.innerType;
|
|
34
|
-
actualType = innerType.type || innerType.def?.type || 'string';
|
|
35
|
-
// Get description from inner type if not on wrapper
|
|
36
|
-
if (!actualDescription && innerType.description) {
|
|
37
|
-
actualDescription = innerType.description;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
properties[key] = {
|
|
41
|
-
type: zodTypeToJsonSchemaType(actualType)
|
|
42
|
-
};
|
|
43
|
-
if (actualDescription) {
|
|
44
|
-
properties[key].description = actualDescription;
|
|
45
|
-
}
|
|
46
|
-
if (field.def?.values) {
|
|
47
|
-
properties[key].enum = field.def.values;
|
|
48
|
-
}
|
|
49
|
-
if (!isOptional) {
|
|
50
|
-
required.push(key);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
25
|
const tool = {
|
|
54
26
|
type: 'function',
|
|
55
27
|
name: input.name,
|
|
56
28
|
description: input.description,
|
|
57
29
|
...(input.deferLoading !== undefined && { deferLoading: input.deferLoading }),
|
|
58
30
|
...(input.group !== undefined && { group: input.group }),
|
|
59
|
-
parameters:
|
|
60
|
-
type: 'object',
|
|
61
|
-
properties,
|
|
62
|
-
required: required.length > 0 ? required : undefined
|
|
63
|
-
}
|
|
31
|
+
parameters: zodToToolParameters(input.parameters)
|
|
64
32
|
};
|
|
65
33
|
return toolSchema.parse(tool);
|
|
66
34
|
}
|
|
@@ -2,6 +2,7 @@ import RPC from 'bare-rpc';
|
|
|
2
2
|
export declare function createBareKitRPCServer(): RPC;
|
|
3
3
|
export interface IPCClientOptions {
|
|
4
4
|
onDisconnect?: () => void;
|
|
5
|
+
authToken?: string | undefined;
|
|
5
6
|
}
|
|
6
7
|
export declare function createIPCClient(socketPath: string, options?: IPCClientOptions): RPC;
|
|
7
8
|
//# sourceMappingURL=create-server.d.ts.map
|
|
@@ -42,5 +42,10 @@ export function createIPCClient(socketPath, options) {
|
|
|
42
42
|
logger.warn('IPC socket closed — parent process likely terminated');
|
|
43
43
|
options?.onDisconnect?.();
|
|
44
44
|
});
|
|
45
|
+
// Pipe and Unix-socket clients have no reader for this line, so a token
|
|
46
|
+
// inherited from the parent's environment must not reach them.
|
|
47
|
+
if (options?.authToken && socketPath.startsWith('tcp://')) {
|
|
48
|
+
socket.write(options.authToken + '\n');
|
|
49
|
+
}
|
|
45
50
|
return new RPC(socket, handleRequest);
|
|
46
51
|
}
|
|
@@ -4,7 +4,7 @@ import { sendErrorResponse, sendStreamErrorResponse } from '../server/error-hand
|
|
|
4
4
|
import { PluginHandlerTypeMismatchError } from '../utils/errors-server.js';
|
|
5
5
|
import { handleInitConfig, isInitConfigMessage, handleShutdown, isShutdownMessage } from './handler-utils.js';
|
|
6
6
|
import { createServerProfiler } from '../server/rpc/profiling/index.js';
|
|
7
|
-
import { isTerminalChunk } from '../server/rpc/rpc-utils.js';
|
|
7
|
+
import { isTerminalChunk, signalOnWireClose } from '../server/rpc/rpc-utils.js';
|
|
8
8
|
import { createProgressThrottle } from '../server/rpc/progress-throttle.js';
|
|
9
9
|
export async function handleRequest(req) {
|
|
10
10
|
let profiler;
|
|
@@ -65,6 +65,8 @@ async function streamToWire(req, request, profiler, throttleProgress) {
|
|
|
65
65
|
const wire = req.createResponseStream();
|
|
66
66
|
profiler.startHandler();
|
|
67
67
|
let sentFinalChunk = false;
|
|
68
|
+
// Lets an `endsOnAbort` handler (log stream) release its source when the client aborts.
|
|
69
|
+
const signal = signalOnWireClose(wire);
|
|
68
70
|
// A progress stream (a reply op that streams because of `withProgress`) can
|
|
69
71
|
// emit hundreds of updates, so batch them on a time window before writing to
|
|
70
72
|
// keep IPC and UI churn down. Native data streams like completion tokens pass
|
|
@@ -75,7 +77,7 @@ async function streamToWire(req, request, profiler, throttleProgress) {
|
|
|
75
77
|
})
|
|
76
78
|
: undefined;
|
|
77
79
|
try {
|
|
78
|
-
for await (const response of stream(request)) {
|
|
80
|
+
for await (const response of stream(request, { signal })) {
|
|
79
81
|
if (isTerminalChunk(response)) {
|
|
80
82
|
throttle?.flush();
|
|
81
83
|
profiler.endHandler();
|
|
@@ -28,7 +28,7 @@ export function isShutdownMessage(data) {
|
|
|
28
28
|
}
|
|
29
29
|
export async function handleShutdown(req) {
|
|
30
30
|
try {
|
|
31
|
-
const { cleanupForTerminate } = await import('
|
|
31
|
+
const { cleanupForTerminate } = await import('../worker/lifecycle.js');
|
|
32
32
|
await cleanupForTerminate();
|
|
33
33
|
req.reply(JSON.stringify({ success: true }), 'utf-8');
|
|
34
34
|
}
|
package/dist/src/worker/index.js
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Default worker entry point that registers ALL built-in plugins.
|
|
3
3
|
*/
|
|
4
|
-
import { initializeWorker, ensureRPCSetup } from '
|
|
4
|
+
import { initializeWorker, ensureRPCSetup } from '../worker/lifecycle.js';
|
|
5
5
|
import { getServerLogger } from '../logging/index.js';
|
|
6
6
|
import { registerPlugins } from '@qvac/inference/plugins';
|
|
7
7
|
import { llmPlugin } from '@qvac/inference/llamacpp-completion/plugin';
|
|
8
|
+
import { decisionPlugin } from '@qvac/inference/llamacpp-decision/plugin';
|
|
9
|
+
import { rerankPlugin } from '@qvac/inference/llamacpp-rerank/plugin';
|
|
8
10
|
import { embeddingsPlugin } from '@qvac/inference/llamacpp-embedding/plugin';
|
|
9
11
|
import { whisperPlugin } from '@qvac/inference/whispercpp-transcription/plugin';
|
|
10
12
|
import { bciPlugin } from '@qvac/inference/bci-whispercpp-transcription/plugin';
|
|
13
|
+
import { mossTranscribePlugin } from '@qvac/inference/moss-transcribe/plugin';
|
|
11
14
|
import { parakeetPlugin } from '@qvac/inference/parakeet-transcription/plugin';
|
|
12
15
|
import { nmtPlugin } from '@qvac/inference/nmtcpp-translation/plugin';
|
|
13
16
|
import { ttsPlugin } from '@qvac/inference/tts-ggml/plugin';
|
|
@@ -22,9 +25,12 @@ logger.info('🐻 Hello from Bare');
|
|
|
22
25
|
registerPlugins([
|
|
23
26
|
llmPlugin,
|
|
24
27
|
embeddingsPlugin,
|
|
28
|
+
decisionPlugin,
|
|
29
|
+
rerankPlugin,
|
|
25
30
|
whisperPlugin,
|
|
26
31
|
bciPlugin,
|
|
27
32
|
parakeetPlugin,
|
|
33
|
+
mossTranscribePlugin,
|
|
28
34
|
nmtPlugin,
|
|
29
35
|
ttsPlugin,
|
|
30
36
|
ocrPlugin,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import os from 'bare-os';
|
|
2
2
|
import Signal from 'bare-signals';
|
|
3
|
-
import { createBareKitRPCServer, createIPCClient } from '
|
|
3
|
+
import { createBareKitRPCServer, createIPCClient } from '../worker/create-server.js';
|
|
4
4
|
import { initEnv, getValidatedEnv } from '../server/env.js';
|
|
5
5
|
import { initialize as initializeEngine, close as closeEngine, cleanupForTerminate as cleanupEngineForTerminate } from '@qvac/inference/engine';
|
|
6
6
|
import { getServerLogger } from '../logging/index.js';
|
|
@@ -50,6 +50,13 @@ export function initializeWorker() {
|
|
|
50
50
|
logger.debug('Arguments to worker:', Bare.argv);
|
|
51
51
|
return { hasRPCConfig };
|
|
52
52
|
}
|
|
53
|
+
// Read once and unset so processes the worker spawns don't inherit it.
|
|
54
|
+
function takeIPCAuthToken() {
|
|
55
|
+
const token = os.getEnv('QVAC_IPC_AUTH_TOKEN');
|
|
56
|
+
if (token !== undefined)
|
|
57
|
+
os.unsetEnv('QVAC_IPC_AUTH_TOKEN');
|
|
58
|
+
return token;
|
|
59
|
+
}
|
|
53
60
|
export function ensureRPCSetup() {
|
|
54
61
|
if (rpcInitialized)
|
|
55
62
|
return;
|
|
@@ -62,7 +69,8 @@ export function ensureRPCSetup() {
|
|
|
62
69
|
if (ipcSocketPath) {
|
|
63
70
|
logger.info(`Running in desktop mode, connecting to IPC socket: ${ipcSocketPath}`);
|
|
64
71
|
const rpc = createIPCClient(ipcSocketPath, {
|
|
65
|
-
onDisconnect: () => void shutdownWorker('ipc-disconnect')
|
|
72
|
+
onDisconnect: () => void shutdownWorker('ipc-disconnect'),
|
|
73
|
+
authToken: takeIPCAuthToken()
|
|
66
74
|
});
|
|
67
75
|
logger.debug('Desktop IPC client created?', !!rpc);
|
|
68
76
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@qvac/inference/llamacpp-decision/plugin';
|