@qvac/sdk 0.19.1 → 0.20.1
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 +78 -55
- package/README.md +3 -1
- package/dist/examples/abot-world.js +3 -3
- package/dist/examples/advisory-model-fit.d.ts +59 -0
- package/dist/examples/advisory-model-fit.js +156 -0
- package/dist/examples/asr/parakeet-nemotron-filesystem.d.ts +2 -0
- package/dist/examples/asr/parakeet-nemotron-filesystem.js +170 -0
- package/dist/examples/audiogen/edit-music.d.ts +2 -0
- package/dist/examples/audiogen/edit-music.js +121 -0
- package/dist/examples/audiogen/understand-music.d.ts +2 -0
- package/dist/examples/audiogen/understand-music.js +73 -0
- package/dist/examples/diffusion-ic-lora-ltx.js +3 -3
- package/dist/examples/diffusion-img2vid.js +1 -1
- package/dist/examples/diffusion-txt2vid-minimax-h3.d.ts +2 -0
- package/dist/examples/diffusion-txt2vid-minimax-h3.js +64 -0
- package/dist/examples/diffusion-txt2vid.js +1 -1
- package/dist/examples/rag/rag-turbovec.d.ts +2 -0
- package/dist/examples/rag/rag-turbovec.js +58 -0
- package/dist/examples/tts/audio8.js +5 -5
- package/dist/examples/tts/chatterbox-enhanced.js +4 -5
- package/dist/examples/tts/chatterbox-multilingual.js +5 -5
- package/dist/examples/tts/chatterbox.js +5 -5
- package/dist/examples/tts/cosyvoice3.js +5 -5
- package/dist/examples/tts/llm-to-tts-streaming.js +12 -2
- package/dist/examples/tts/parler.js +5 -5
- package/dist/examples/tts/supertonic-enhanced.js +4 -5
- package/dist/examples/tts/supertonic-multilingual.js +5 -5
- package/dist/examples/tts/supertonic.js +5 -5
- package/dist/scripts/contract/build-contract.d.ts +1 -1
- package/dist/scripts/contract/constants-registry.d.ts +31 -0
- package/dist/scripts/contract/constants-registry.js +13 -2
- package/dist/scripts/contract/method-shapes.d.ts +3 -0
- package/dist/scripts/contract/method-shapes.js +3 -0
- package/dist/src/client/api/assess-model-fit.d.ts +9 -4
- package/dist/src/client/api/assess-model-fit.js +9 -4
- package/dist/src/client/api/audio-edit.d.ts +36 -0
- package/dist/src/client/api/audio-edit.js +38 -0
- package/dist/src/client/api/audio-gen-result.d.ts +5 -1
- package/dist/src/client/api/audio-gen-result.js +105 -52
- package/dist/src/client/api/audio-gen.d.ts +38 -1
- package/dist/src/client/api/audio-gen.js +38 -1
- package/dist/src/client/api/audio-understand.d.ts +25 -0
- package/dist/src/client/api/audio-understand.js +27 -0
- package/dist/src/client/api/index.d.ts +3 -0
- package/dist/src/client/api/index.js +3 -0
- package/dist/src/client/api/text-to-speech.d.ts +31 -4
- package/dist/src/client/api/text-to-speech.js +118 -21
- package/dist/src/client/api/vector-index.d.ts +143 -0
- package/dist/src/client/api/vector-index.js +168 -0
- package/dist/src/client/api/world.d.ts +2 -2
- package/dist/src/commands/bundle/manifest.d.ts +2 -0
- package/dist/src/commands/verify/addon-source.d.ts +6 -0
- package/dist/src/commands/verify/bundle-source.d.ts +2 -0
- package/dist/src/commands/verify/bundle-source.js +155 -1
- package/dist/src/commands/verify/index.js +1 -0
- package/dist/src/commands/verify/prebuilds.d.ts +23 -0
- package/dist/src/commands/verify/prebuilds.js +129 -13
- package/dist/src/commands/verify/resource-collectors.js +2 -1
- package/dist/src/expo/plugins/patches/qvac-platform-addons.d.ts +23 -0
- package/dist/src/expo/plugins/patches/qvac-platform-addons.js +94 -0
- package/dist/src/expo/plugins/withMobileBundle.d.ts +9 -6
- package/dist/src/expo/plugins/withMobileBundle.js +54 -34
- package/dist/src/index.d.ts +3 -3
- package/dist/src/index.js +7 -3
- package/dist/src/schemas/sdk-errors-server.d.ts +4 -0
- package/dist/src/schemas/sdk-errors-server.js +22 -0
- package/dist/src/utils/aggregate-events.d.ts +3 -1
- package/dist/src/utils/aggregate-events.js +7 -1
- package/dist/src/utils/errors-server.d.ts +12 -0
- package/dist/src/utils/errors-server.js +21 -0
- package/package.json +23 -17
- package/src/electron-forge/index.cjs +86 -14
- package/src/expo/plugins/patches/android-link.mjs +18 -9
- package/src/expo/plugins/patches/ios-link.mjs +18 -9
- package/src/expo/plugins/patches/qvac-platform-addons.ts +124 -0
|
@@ -13,13 +13,19 @@ const { withDangerousMod } = configPlugins;
|
|
|
13
13
|
/** Modules to defer from mobile bundles (not available at bundle time) */
|
|
14
14
|
const DEFERRED_MODULES = ['expo-file-system', 'react-native-bare-kit'];
|
|
15
15
|
/**
|
|
16
|
-
* Desktop-only
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
* `android-arm64` prebuild and fails bundle verification.
|
|
16
|
+
* Desktop-only spawn path, deferred so bare-pack does not walk `bare-process`
|
|
17
|
+
* -> `bare-posix` (no `android-arm64` prebuild). Mobile advisory uses
|
|
18
|
+
* in-process `@qvac/model-fit` (`fitParams`), not this subprocess.
|
|
20
19
|
*/
|
|
21
20
|
const MOBILE_UNSUPPORTED_MODULES = ['bare-runtime/spawn', '@qvac/model-fit/process'];
|
|
22
|
-
const
|
|
21
|
+
const MOBILE_HOSTS_BY_PLATFORM = {
|
|
22
|
+
android: ['android-arm64'],
|
|
23
|
+
ios: ['ios-arm64', 'ios-arm64-simulator', 'ios-x64-simulator']
|
|
24
|
+
};
|
|
25
|
+
/** Compiled resolver copied beside each patched linker as this filename. */
|
|
26
|
+
const PLATFORM_ADDON_RESOLVER = 'qvac-platform-addons.mjs';
|
|
27
|
+
/** Every mobile host, in platform order. The bundle covers all of them. */
|
|
28
|
+
const MOBILE_HOSTS = [...MOBILE_HOSTS_BY_PLATFORM.android, ...MOBILE_HOSTS_BY_PLATFORM.ios];
|
|
23
29
|
/**
|
|
24
30
|
* Expo plugin: bundle, verify, then copy the mobile worker bundle.
|
|
25
31
|
*
|
|
@@ -43,9 +49,13 @@ function withMobileBundle(config) {
|
|
|
43
49
|
...MOBILE_UNSUPPORTED_MODULES,
|
|
44
50
|
`${sdkPackage.name}/worker.mobile.bundle`
|
|
45
51
|
];
|
|
46
|
-
|
|
52
|
+
// The bundle is one shared artifact both platforms import, so it is built
|
|
53
|
+
// for every mobile host: a dual-platform `expo prebuild` runs this mod twice
|
|
54
|
+
// and the second run would otherwise overwrite the first platform's bundle
|
|
55
|
+
// with one that resolved the other platform's conditions.
|
|
56
|
+
const linkerPaths = await runBundler(projectRoot, sdkPackage.dir, configPath, deferredModules, MOBILE_HOSTS);
|
|
47
57
|
const generatedBundle = path.join(projectRoot, 'qvac', 'worker.bundle.js');
|
|
48
|
-
await runVerifier(projectRoot, generatedBundle, configPath);
|
|
58
|
+
await runVerifier(projectRoot, generatedBundle, configPath, mobileHostsForPlatform(config.modRequest.platform));
|
|
49
59
|
fs.copyFileSync(generatedBundle, outputPath);
|
|
50
60
|
if (config.modRequest.platform === 'ios' && linkerPaths.ios !== null) {
|
|
51
61
|
await runIOSAddonLinker(linkerPaths.ios);
|
|
@@ -57,6 +67,12 @@ function withMobileBundle(config) {
|
|
|
57
67
|
config = withDangerousMod(config, ['ios', buildMobileBundle]);
|
|
58
68
|
return config;
|
|
59
69
|
}
|
|
70
|
+
function mobileHostsForPlatform(platform) {
|
|
71
|
+
if (platform !== 'android' && platform !== 'ios') {
|
|
72
|
+
throw new Error(`QVAC: withMobileBundle only supports android and ios builds, got "${platform}"`);
|
|
73
|
+
}
|
|
74
|
+
return MOBILE_HOSTS_BY_PLATFORM[platform];
|
|
75
|
+
}
|
|
60
76
|
/** Finds qvac.config.* file in project root */
|
|
61
77
|
function findConfigFile(projectRoot) {
|
|
62
78
|
for (const candidate of CONFIG_CANDIDATES) {
|
|
@@ -67,7 +83,7 @@ function findConfigFile(projectRoot) {
|
|
|
67
83
|
}
|
|
68
84
|
return null;
|
|
69
85
|
}
|
|
70
|
-
async function runVerifier(projectRoot, generatedBundle, configPath) {
|
|
86
|
+
async function runVerifier(projectRoot, generatedBundle, configPath, hosts) {
|
|
71
87
|
if (!configPath) {
|
|
72
88
|
console.log('⚠️ QVAC: no qvac.config.* found — Bare runtime will be auto-detected ' +
|
|
73
89
|
'from node_modules (bare-runtime, then bare). Add qvac.config.json ' +
|
|
@@ -76,20 +92,20 @@ async function runVerifier(projectRoot, generatedBundle, configPath) {
|
|
|
76
92
|
const result = await verifyBundle({
|
|
77
93
|
projectRoot,
|
|
78
94
|
addonsSource: generatedBundle,
|
|
79
|
-
hosts
|
|
95
|
+
hosts,
|
|
80
96
|
...(configPath ? { configPath } : {})
|
|
81
97
|
});
|
|
82
98
|
if (hasErrors(result)) {
|
|
83
99
|
throw new BundleVerificationFailedError(generatedBundle, new Error(formatVerifyBundleResult(result)));
|
|
84
100
|
}
|
|
85
101
|
}
|
|
86
|
-
async function runBundler(projectRoot, qvacSdkPath, configPath, deferredModules) {
|
|
102
|
+
async function runBundler(projectRoot, qvacSdkPath, configPath, deferredModules, hosts) {
|
|
87
103
|
const linkerPaths = patchBareKitLinkers(projectRoot, qvacSdkPath);
|
|
88
104
|
await bundleSdk({
|
|
89
105
|
projectRoot,
|
|
90
106
|
sdkPath: qvacSdkPath,
|
|
91
107
|
...(configPath ? { configPath } : {}),
|
|
92
|
-
hosts
|
|
108
|
+
hosts,
|
|
93
109
|
defer: deferredModules,
|
|
94
110
|
quiet: true
|
|
95
111
|
});
|
|
@@ -131,33 +147,37 @@ function patchBareKitLinkers(projectRoot, qvacSdkPath) {
|
|
|
131
147
|
return { android: null, ios: null };
|
|
132
148
|
}
|
|
133
149
|
const patchesDir = path.join(qvacSdkPath, 'src', 'expo', 'plugins', 'patches');
|
|
150
|
+
const resolver = compiledPlatformAddonResolver(qvacSdkPath);
|
|
134
151
|
if (!fs.existsSync(patchesDir)) {
|
|
135
152
|
console.log(`⚠️ QVAC: patches directory not found (${patchesDir}), skipping linker patch`);
|
|
136
153
|
return { android: null, ios: null };
|
|
137
154
|
}
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
const
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
iosLinkerPath = iosTarget;
|
|
156
|
-
}
|
|
157
|
-
else {
|
|
158
|
-
console.log(`⚠️ QVAC: iOS linker patch not found (${iosPatch})`);
|
|
155
|
+
return {
|
|
156
|
+
android: copyLinkerPatch(patchesDir, resolver, path.join(bareKitPath, 'android'), 'android-link.mjs'),
|
|
157
|
+
ios: copyLinkerPatch(patchesDir, resolver, path.join(bareKitPath, 'ios'), 'ios-link.mjs')
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Copies one linker patch and the split-addon resolver it imports, returning the
|
|
162
|
+
* installed linker path. The resolver has to sit beside the linker: the patch is
|
|
163
|
+
* installed into react-native-bare-kit and imports it relatively.
|
|
164
|
+
*/
|
|
165
|
+
function copyLinkerPatch(patchesDir, resolver, targetDir, patchName) {
|
|
166
|
+
const patch = path.join(patchesDir, patchName);
|
|
167
|
+
if (!fs.existsSync(patch) || !fs.existsSync(resolver)) {
|
|
168
|
+
// Installing the patch without the resolver it imports would break linking
|
|
169
|
+
// outright, so leave the stock linker in place instead.
|
|
170
|
+
console.log(`⚠️ QVAC: linker patch incomplete (${patch}), leaving the stock linker`);
|
|
171
|
+
return null;
|
|
159
172
|
}
|
|
160
|
-
|
|
173
|
+
const target = path.join(targetDir, 'link.mjs');
|
|
174
|
+
fs.copyFileSync(patch, target);
|
|
175
|
+
fs.copyFileSync(resolver, path.join(targetDir, PLATFORM_ADDON_RESOLVER));
|
|
176
|
+
console.log(`✅ QVAC: Patched ${path.basename(targetDir)}/link.mjs for manifest-aware linking`);
|
|
177
|
+
return target;
|
|
178
|
+
}
|
|
179
|
+
function compiledPlatformAddonResolver(qvacSdkPath) {
|
|
180
|
+
return path.join(qvacSdkPath, 'dist', 'src', 'expo', 'plugins', 'patches', 'qvac-platform-addons.js');
|
|
161
181
|
}
|
|
162
|
-
export { MOBILE_HOSTS, MOBILE_UNSUPPORTED_MODULES, patchBareKitLinkers, runIOSAddonLinker };
|
|
182
|
+
export { MOBILE_HOSTS, MOBILE_HOSTS_BY_PLATFORM, MOBILE_UNSUPPORTED_MODULES, mobileHostsForPlatform, patchBareKitLinkers, runIOSAddonLinker };
|
|
163
183
|
export default withMobileBundle;
|
package/dist/src/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { batchCompletion, completion, deleteCache, loadModel, downloadAsset, heartbeat, unloadModel, transcribe, transcribeStream, bciTranscribe, bciTranscribeStream, embed, finetune, translate, cancel, ragChunk, ragIngest, ragSaveEmbeddings, ragSearch, ragDeleteEmbeddings, ragReindex, ragListWorkspaces, ragCloseWorkspace, ragDeleteWorkspace, textToSpeech, textToSpeechStream, getModelInfo, getLoadedModelInfo, getSystemResources, assessModelFit, loggingStream, subscribeServerLogs, type ServerLogHandler, ocr, invokePlugin, invokePluginStream, diffusion, type DiffusionProgressTick, classify, video, type VideoProgressTick, upscale, worldCreateScene, worldStep, type WorldStepResult, type WorldStepProgressTick, type WorldSceneResult, type WorldSceneResultWithPack, modelRegistryList, modelRegistrySearch, modelRegistryGetModel, type ModelRegistrySearchParams, suspend, resume, state, vla, vlaHparams, vlaSetEmbodiment, vlaPreprocessImage, vlaPadState, VLA_DEFAULT_IMAGE_SIZE, audioGen, type FinetuneHandle } from './client/api/index.js';
|
|
1
|
+
export { batchCompletion, completion, deleteCache, loadModel, downloadAsset, heartbeat, unloadModel, transcribe, transcribeStream, bciTranscribe, bciTranscribeStream, embed, finetune, translate, cancel, ragChunk, ragIngest, ragSaveEmbeddings, ragSearch, ragDeleteEmbeddings, ragReindex, ragListWorkspaces, ragCloseWorkspace, ragDeleteWorkspace, createVectorIndex, loadVectorIndex, type VectorIndex, textToSpeech, textToSpeechStream, getModelInfo, getLoadedModelInfo, getSystemResources, assessModelFit, loggingStream, subscribeServerLogs, type ServerLogHandler, ocr, invokePlugin, invokePluginStream, diffusion, type DiffusionProgressTick, classify, video, type VideoProgressTick, upscale, worldCreateScene, worldStep, type WorldStepResult, type WorldStepProgressTick, type WorldSceneResult, type WorldSceneResultWithPack, modelRegistryList, modelRegistrySearch, modelRegistryGetModel, type ModelRegistrySearchParams, suspend, resume, state, vla, vlaHparams, vlaSetEmbodiment, vlaPreprocessImage, vlaPadState, VLA_DEFAULT_IMAGE_SIZE, audioGen, audioEdit, audioUnderstand, type FinetuneHandle } from './client/api/index.js';
|
|
2
2
|
export { close } from './client/index.js';
|
|
3
3
|
export { plugins } from './client/plugins-factory.js';
|
|
4
|
-
export { type LifecycleState, type ModelProgressUpdate, type LoadModelOptions, type LoadCustomPluginModelOptions, type DownloadAssetOptions, type Tool, type ToolCall, type ToolCallWithCall, type ToolCallError, type ToolCallEvent, type CompletionEvent, type CompletionFinal, type CompletionRun, type CompletionStats, type BatchCompletionEvent, type BatchCompletionResult, type BatchCompletionRun, type BatchPrompt, type EmbedStats, type TranscribeStats, VERBOSITY, type Attachment, type TranscribeStreamSession, type TranscribeStreamMetadataSession, type TranscribeStreamConversationSession, type TranscribeStreamEvent, type VadStateEvent, type EndOfTurnEvent, type TranscribeSegment, type BciConfig, type BciTranscribeClientParams, type BciTranscribeStreamClientParams, type BciTranscribeStreamSession, type BciTranscribeStreamMetadataSession, type BciStreamOpts, type NeuralInput, type TextToSpeechStreamSession, type TextToSpeechStreamResponse, type TextToSpeechStreamClientParams, type TtsClientParamsInput, type TtsParlerEmotion, type TtsParlerLoadConfig, type TtsParlerRuntimeConfig, TTS_PACES, TTS_COSYVOICE3_EMOTIONS, TTS_COSYVOICE3_INSTRUCT_DIALECTS, TTS_COSYVOICE3_INSTRUCT_VOLUMES, TTS_COSYVOICE3_INSTRUCT_STYLES, type TtsPace, type TtsCosyvoice3Emotion, type TtsCosyvoice3Instruct, type TtsCosyvoice3LoadConfig, type TtsCosyvoice3RuntimeConfig, type TtsAudio8LoadConfig, type TtsAudio8RuntimeConfig, type CompletionParams, type ToolDialect, type RagSearchResult, type RagSaveEmbeddingsResult, type RagReindexResult, type RagEmbeddedDoc, type RagDoc, type RagWorkspaceInfo, type RagCloseWorkspaceParams, type RagDeleteWorkspaceParams, type RagIngestStage, type RagReindexStage, type RagSaveStage, RAG_ERROR_CODES, type QvacConfig, type ModelInfo, type GetModelInfoParams, type GetLoadedModelInfoParams, type LoadedModelInfo, type GetSystemResourcesInput, type ResourceScope, type ResourceProvenance, type ResourceMetric, type GraphicsDriver, type GraphicsDriverCapabilities, type BackendProbeResult, type BackendDevice, type BackendDriver, type BackendFallback, type InferenceBackendDiagnostics, type CPUResourceCapabilities, type GPUResourceCapabilities, type SystemResourceCapabilities, type GPUResourceSample, type SystemResourceSample, type SystemResources, type AssessModelFitInput, type AssessModelFitResult, type LoadedInstance, type CacheFileInfo, toolSchema, type McpClient, type McpClientInput, type OCRClientParams, type OCRTextBlock, type OCROptions, type ClassifyClientParams, type ClassificationResult, type DiffusionClientParams, type DiffusionStreamResponse, type DiffusionStats, AUDIOGEN_ENGINES, AUDIOGEN_TASK_TYPES, AUDIOGEN_INPUT_SAMPLE_RATE, AUDIOGEN_INPUT_CHANNELS, AUDIOGEN_INPUT_MAX_SECONDS, type AudioGenEngine, type AudioGenTaskType, type AudioGenAudioInput, type AudioGenClientParams, type AudioGenConfig, type AudioGenRuntimeConfig, type AudioGenProgress, type AudioGenAudio, type AudioGenStats, type AudioGenResult, type AudioGenStreamResponse, type VideoClientParams, type VideoStreamResponse, type VideoStats, type UpscaleClientParams, type UpscaleStreamResponse, type UpscaleStats, type WalkKey, type WalkKeysInput, type WorldStepClientParams, type WorldStepStreamResponse, type WorldStepStats, type WorldSceneClientParams, type WorldSceneStreamResponse, type WorldSceneStats, type VlaConfig, type VlaClientRunParams, type VlaClientRunResult, type VlaEmbodimentSelection, type VlaEmbodimentSelector, type VlaHparams, type VlaStats, definePlugin, defineHandler, defineDuplexHandler, PluginDefinitionInvalidError, type QvacPlugin, type CreateModelParams, type PluginModelResult, type ModelRegistryEntry, type ModelRegistryEntryAddon, type ProfilerMode, type FinetuneValidation, type FinetuneRunParams, type FinetuneGetStateParams, type FinetuneStopParams, type FinetuneParams, type FinetuneStatus, type FinetuneProgress, type FinetuneStats, type FinetuneResult } from '@qvac/inference/surface';
|
|
4
|
+
export { type LifecycleState, type ModelProgressUpdate, type LoadModelOptions, type LoadCustomPluginModelOptions, type DownloadAssetOptions, type Tool, type ToolCall, type ToolCallWithCall, type ToolCallError, type ToolCallEvent, type CompletionEvent, type CompletionFinal, type CompletionRun, type CompletionStats, type BatchCompletionEvent, type BatchCompletionResult, type BatchCompletionRun, type BatchPrompt, type EmbedStats, type TranscribeStats, VERBOSITY, type Attachment, type TranscribeStreamSession, type TranscribeStreamMetadataSession, type TranscribeStreamConversationSession, type TranscribeStreamEvent, type VadStateEvent, type EndOfTurnEvent, type TranscribeSegment, type BciConfig, type BciTranscribeClientParams, type BciTranscribeStreamClientParams, type BciTranscribeStreamSession, type BciTranscribeStreamMetadataSession, type BciStreamOpts, type NeuralInput, type TextToSpeechStreamSession, type TextToSpeechStreamResponse, type TextToSpeechStreamClientParams, type TtsClientParamsInput, type TextToSpeechStreamResult, type TtsSentenceChunkUpdate, type TtsResponse, type TtsStats, TTS_ENGINES, type TtsEngine, TTS_PARLER_EMOTIONS, type TtsParlerEmotion, type TtsParlerLoadConfig, type TtsParlerRuntimeConfig, TTS_PACES, TTS_SENTENCE_DELIMITER_PRESETS, type TtsSentenceDelimiterPreset, TTS_CHATTERBOX_LANGUAGES, type TtsChatterboxLanguage, type TtsChatterboxLoadConfig, type TtsChatterboxRuntimeConfig, TTS_SUPERTONIC_LANGUAGES, type TtsSupertonicLanguage, type TtsSupertonicLoadConfig, type TtsSupertonicRuntimeConfig, TTS_COSYVOICE3_EMOTIONS, TTS_COSYVOICE3_INSTRUCT_DIALECTS, TTS_COSYVOICE3_INSTRUCT_VOLUMES, TTS_COSYVOICE3_INSTRUCT_STYLES, type TtsPace, type TtsCosyvoice3Emotion, type TtsCosyvoice3Instruct, type TtsCosyvoice3LoadConfig, type TtsCosyvoice3RuntimeConfig, type TtsAudio8LoadConfig, type TtsAudio8RuntimeConfig, type CompletionParams, type ToolDialect, type RagSearchResult, type RagSaveEmbeddingsResult, type RagReindexResult, type RagEmbeddedDoc, type RagDoc, type RagWorkspaceInfo, type RagCloseWorkspaceParams, type RagDeleteWorkspaceParams, type RagIngestStage, type RagReindexStage, type RagSaveStage, RAG_ERROR_CODES, VectorIndexStorage, DEFAULT_VECTOR_INDEX_STORAGE, type VectorId, type VectorIndexHit, type CreateVectorIndexParams, type LoadVectorIndexParams, type VectorIndexAddParams, type VectorIndexIdsParams, type VectorIndexSearchParams, type VectorIndexWriteParams, type QvacConfig, type ModelInfo, type GetModelInfoParams, type GetLoadedModelInfoParams, type LoadedModelInfo, type GetSystemResourcesInput, type ResourceScope, type ResourceProvenance, type ResourceMetric, type GraphicsDriver, type GraphicsDriverCapabilities, type BackendProbeResult, type BackendDevice, type BackendDriver, type BackendFallback, type InferenceBackendDiagnostics, type CPUResourceCapabilities, type GPUResourceCapabilities, type SystemResourceCapabilities, type GPUResourceSample, type SystemResourceSample, type SystemResources, type AssessModelFitInput, type AssessModelFitResult, type LoadedInstance, type CacheFileInfo, toolSchema, type McpClient, type McpClientInput, type OCRClientParams, type OCRTextBlock, type OCROptions, type ClassifyClientParams, type ClassificationResult, type DiffusionClientParams, type DiffusionStreamResponse, type DiffusionStats, AUDIOGEN_ENGINES, AUDIOGEN_TASK_TYPES, AUDIOGEN_TRACKS, AUDIOGEN_INPUT_SAMPLE_RATE, AUDIOGEN_INPUT_CHANNELS, AUDIOGEN_INPUT_MAX_SECONDS, AUDIOGEN_MAX_AUDIO_CODES, AUDIOGEN_EDIT_OPERATIONS, AUDIOGEN_REPAINT_MODES, type AudioGenEngine, type AudioGenTaskType, type AudioGenTrack, type AudioGenAudioInput, type AudioGenClientParams, type AudioGenConfig, type AudioGenRuntimeConfig, type AudioGenProgress, type AudioGenAudio, type AudioGenStats, type AudioGenResult, type AudioGenStreamResponse, type AudioGenEditOperationType, type AudioGenRepaintMode, type AudioEditPrompt, type AudioEditFlowEditOperation, type AudioEditRepaintOperation, type AudioEditOperation, type AudioEditClientParams, type AudioEditStreamResponse, type AudioUnderstandClientParams, type AudioUnderstandResponse, type AudioGenUnderstandResult, type AudioUnderstandResult, type VideoClientParams, type VideoStreamResponse, type VideoStats, type UpscaleClientParams, type UpscaleStreamResponse, type UpscaleStats, type WalkKey, type WalkKeysInput, type WorldStepClientParams, type WorldStepStreamResponse, type WorldStepStats, type WorldSceneClientParams, type WorldSceneStreamResponse, type WorldSceneStats, type VlaConfig, type VlaClientRunParams, type VlaClientRunResult, type VlaEmbodimentSelection, type VlaEmbodimentSelector, type VlaHparams, type VlaStats, definePlugin, defineHandler, defineDuplexHandler, PluginDefinitionInvalidError, type QvacPlugin, type CreateModelParams, type PluginModelResult, type ModelRegistryEntry, type ModelRegistryEntryAddon, type ProfilerMode, type FinetuneValidation, type FinetuneRunParams, type FinetuneGetStateParams, type FinetuneStopParams, type FinetuneParams, type FinetuneStatus, type FinetuneProgress, type FinetuneStats, type FinetuneResult } from '@qvac/inference/surface';
|
|
5
5
|
export { SDK_CLIENT_ERROR_CODES } from './schemas/sdk-errors-client.js';
|
|
6
6
|
export { SDK_SERVER_ERROR_CODES } from './schemas/sdk-errors-server.js';
|
|
7
7
|
export { PLUGIN_LLM, PLUGIN_EMBEDDING, PLUGIN_WHISPER, PLUGIN_BCI, PLUGIN_NMT, PLUGIN_TTS, PLUGIN_OCR, PLUGIN_DIFFUSION, PLUGIN_AUDIOGEN, PLUGIN_VLA, PLUGIN_CLASSIFICATION, SDK_DEFAULT_PLUGINS, type BuiltinPlugin } from './plugin-ids.js';
|
|
@@ -12,7 +12,7 @@ export { SUPPORTED_AUDIO_FORMATS } from '@qvac/inference/surface';
|
|
|
12
12
|
export { InferenceCancelledError } from './utils/errors-server.js';
|
|
13
13
|
export type { InferenceCancelledPartial } from './utils/errors-server.js';
|
|
14
14
|
export { ContextOverflowError, type ContextOverflowErrorSizes, RequestIdConflictError, RequestNotFoundError, RequestRejectedByPolicyError, TranslationFailedError } from './utils/errors-server.js';
|
|
15
|
-
export { BareRuntimeBinaryNotFoundError, WorkerCrashedError, WorkerShutdownError, WorkerStartupError, RequestValidationFailedError, StreamEndedError } from './utils/errors-client.js';
|
|
15
|
+
export { BareRuntimeBinaryNotFoundError, WorkerCrashedError, WorkerShutdownError, WorkerStartupError, RequestValidationFailedError, StreamEndedError, TextToSpeechStreamFailedError } from './utils/errors-client.js';
|
|
16
16
|
export { getLogger, SDK_LOG_ID, SDK_ALL_LOG_ID } from './logging/index.js';
|
|
17
17
|
export type { Logger, LogTransport, LoggerOptions } from './logging/index.js';
|
|
18
18
|
export { profiler, attachBackendDiagnostics } from '@qvac/inference/surface';
|
package/dist/src/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// Public API exports only
|
|
2
|
-
export { batchCompletion, completion, deleteCache, loadModel, downloadAsset, heartbeat, unloadModel, transcribe, transcribeStream, bciTranscribe, bciTranscribeStream, embed, finetune, translate, cancel, ragChunk, ragIngest, ragSaveEmbeddings, ragSearch, ragDeleteEmbeddings, ragReindex, ragListWorkspaces, ragCloseWorkspace, ragDeleteWorkspace, textToSpeech, textToSpeechStream, getModelInfo, getLoadedModelInfo, getSystemResources, assessModelFit, loggingStream, subscribeServerLogs, ocr, invokePlugin, invokePluginStream, diffusion, classify, video, upscale, worldCreateScene, worldStep, modelRegistryList, modelRegistrySearch, modelRegistryGetModel, suspend, resume, state, vla, vlaHparams, vlaSetEmbodiment, vlaPreprocessImage, vlaPadState, VLA_DEFAULT_IMAGE_SIZE, audioGen } from './client/api/index.js';
|
|
2
|
+
export { batchCompletion, completion, deleteCache, loadModel, downloadAsset, heartbeat, unloadModel, transcribe, transcribeStream, bciTranscribe, bciTranscribeStream, embed, finetune, translate, cancel, ragChunk, ragIngest, ragSaveEmbeddings, ragSearch, ragDeleteEmbeddings, ragReindex, ragListWorkspaces, ragCloseWorkspace, ragDeleteWorkspace, createVectorIndex, loadVectorIndex, textToSpeech, textToSpeechStream, getModelInfo, getLoadedModelInfo, getSystemResources, assessModelFit, loggingStream, subscribeServerLogs, ocr, invokePlugin, invokePluginStream, diffusion, classify, video, upscale, worldCreateScene, worldStep, modelRegistryList, modelRegistrySearch, modelRegistryGetModel, suspend, resume, state, vla, vlaHparams, vlaSetEmbodiment, vlaPreprocessImage, vlaPadState, VLA_DEFAULT_IMAGE_SIZE, audioGen, audioEdit, audioUnderstand } from './client/api/index.js';
|
|
3
3
|
export { close } from './client/index.js';
|
|
4
4
|
export { plugins } from './client/plugins-factory.js';
|
|
5
|
-
export { VERBOSITY, TTS_PACES, TTS_COSYVOICE3_EMOTIONS, TTS_COSYVOICE3_INSTRUCT_DIALECTS, TTS_COSYVOICE3_INSTRUCT_VOLUMES, TTS_COSYVOICE3_INSTRUCT_STYLES, RAG_ERROR_CODES, toolSchema, AUDIOGEN_ENGINES, AUDIOGEN_TASK_TYPES, AUDIOGEN_INPUT_SAMPLE_RATE, AUDIOGEN_INPUT_CHANNELS, AUDIOGEN_INPUT_MAX_SECONDS, definePlugin, defineHandler, defineDuplexHandler, PluginDefinitionInvalidError } from '@qvac/inference/surface';
|
|
5
|
+
export { VERBOSITY, TTS_ENGINES, TTS_PARLER_EMOTIONS, TTS_PACES, TTS_SENTENCE_DELIMITER_PRESETS, TTS_CHATTERBOX_LANGUAGES, TTS_SUPERTONIC_LANGUAGES, TTS_COSYVOICE3_EMOTIONS, TTS_COSYVOICE3_INSTRUCT_DIALECTS, TTS_COSYVOICE3_INSTRUCT_VOLUMES, TTS_COSYVOICE3_INSTRUCT_STYLES, RAG_ERROR_CODES, VectorIndexStorage, DEFAULT_VECTOR_INDEX_STORAGE, toolSchema, AUDIOGEN_ENGINES, AUDIOGEN_TASK_TYPES, AUDIOGEN_TRACKS, AUDIOGEN_INPUT_SAMPLE_RATE, AUDIOGEN_INPUT_CHANNELS, AUDIOGEN_INPUT_MAX_SECONDS, AUDIOGEN_MAX_AUDIO_CODES, AUDIOGEN_EDIT_OPERATIONS, AUDIOGEN_REPAINT_MODES, definePlugin, defineHandler, defineDuplexHandler, PluginDefinitionInvalidError } from '@qvac/inference/surface';
|
|
6
6
|
// SDK-owned error-code objects: `SDK_CLIENT_ERROR_CODES` holds transport/client
|
|
7
7
|
// codes absent from @qvac/inference, and `SDK_SERVER_ERROR_CODES` carries the
|
|
8
8
|
// client-side error definitions (`addCodes` message registry) that
|
|
@@ -52,7 +52,11 @@ export { ContextOverflowError, RequestIdConflictError, RequestNotFoundError, Req
|
|
|
52
52
|
// `StreamEndedError` is raised by the streaming result helpers (upscale, world)
|
|
53
53
|
// when the RPC stream closes without a terminal `done` frame. Exported for the
|
|
54
54
|
// same reason as the rest of this block: matching on it requires the class.
|
|
55
|
-
|
|
55
|
+
// `TextToSpeechStreamFailedError` is what `textToSpeech()` throws for an
|
|
56
|
+
// invalid stream/sentenceStream combination, and what the duplex TTS session
|
|
57
|
+
// throws on a write after end — its own JSDoc named it long before it was
|
|
58
|
+
// exported.
|
|
59
|
+
export { BareRuntimeBinaryNotFoundError, WorkerCrashedError, WorkerShutdownError, WorkerStartupError, RequestValidationFailedError, StreamEndedError, TextToSpeechStreamFailedError } from './utils/errors-client.js';
|
|
56
60
|
// Logging exports
|
|
57
61
|
export { getLogger, SDK_LOG_ID, SDK_ALL_LOG_ID } from './logging/index.js';
|
|
58
62
|
// Profiler exports
|
|
@@ -50,6 +50,10 @@ export declare const SDK_SERVER_ERROR_CODES: {
|
|
|
50
50
|
readonly RAG_LIST_WORKSPACES_FAILED: 52809;
|
|
51
51
|
readonly RAG_CHUNK_FAILED: 52810;
|
|
52
52
|
readonly RAG_WORKSPACE_NOT_OPEN: 52811;
|
|
53
|
+
readonly VECTOR_INDEX_PROVIDER_UNAVAILABLE: 52850;
|
|
54
|
+
readonly VECTOR_INDEX_NOT_FOUND: 52851;
|
|
55
|
+
readonly VECTOR_INDEX_INVALID_VECTORS: 52852;
|
|
56
|
+
readonly VECTOR_INDEX_FAILED: 52853;
|
|
53
57
|
readonly FILE_NOT_FOUND: 53000;
|
|
54
58
|
readonly DOWNLOAD_CANCELLED: 53001;
|
|
55
59
|
readonly CHECKSUM_VALIDATION_FAILED: 53002;
|
|
@@ -57,6 +57,11 @@ export const SDK_SERVER_ERROR_CODES = {
|
|
|
57
57
|
RAG_LIST_WORKSPACES_FAILED: 52809,
|
|
58
58
|
RAG_CHUNK_FAILED: 52810,
|
|
59
59
|
RAG_WORKSPACE_NOT_OPEN: 52811,
|
|
60
|
+
// Vector index (52,850-52,899)
|
|
61
|
+
VECTOR_INDEX_PROVIDER_UNAVAILABLE: 52850,
|
|
62
|
+
VECTOR_INDEX_NOT_FOUND: 52851,
|
|
63
|
+
VECTOR_INDEX_INVALID_VECTORS: 52852,
|
|
64
|
+
VECTOR_INDEX_FAILED: 52853,
|
|
60
65
|
// Download/Resource Errors (53,000-53,199)
|
|
61
66
|
FILE_NOT_FOUND: 53000,
|
|
62
67
|
DOWNLOAD_CANCELLED: 53001,
|
|
@@ -340,6 +345,23 @@ const serverErrorDefinitions = {
|
|
|
340
345
|
name: 'RAG_WORKSPACE_NOT_OPEN',
|
|
341
346
|
message: (workspace) => `RAG workspace '${workspace}' is not open`
|
|
342
347
|
},
|
|
348
|
+
// Vector index (52,850-52,899)
|
|
349
|
+
[SDK_SERVER_ERROR_CODES.VECTOR_INDEX_PROVIDER_UNAVAILABLE]: {
|
|
350
|
+
name: 'VECTOR_INDEX_PROVIDER_UNAVAILABLE',
|
|
351
|
+
message: () => 'No vector index provider is registered. Register a plugin that exposes the turbovecIndexProvider capability, such as the built-in llamacpp-embedding plugin'
|
|
352
|
+
},
|
|
353
|
+
[SDK_SERVER_ERROR_CODES.VECTOR_INDEX_NOT_FOUND]: {
|
|
354
|
+
name: 'VECTOR_INDEX_NOT_FOUND',
|
|
355
|
+
message: (indexId) => `Vector index '${indexId}' is not open. It was disposed or the worker restarted; create a new index or load a snapshot`
|
|
356
|
+
},
|
|
357
|
+
[SDK_SERVER_ERROR_CODES.VECTOR_INDEX_INVALID_VECTORS]: {
|
|
358
|
+
name: 'VECTOR_INDEX_INVALID_VECTORS',
|
|
359
|
+
message: (details) => `Invalid vector input: ${details}`
|
|
360
|
+
},
|
|
361
|
+
[SDK_SERVER_ERROR_CODES.VECTOR_INDEX_FAILED]: {
|
|
362
|
+
name: 'VECTOR_INDEX_FAILED',
|
|
363
|
+
message: (details) => `Vector index operation failed: ${details}`
|
|
364
|
+
},
|
|
343
365
|
// Download/Resource Errors (53,000-53,199)
|
|
344
366
|
[SDK_SERVER_ERROR_CODES.FILE_NOT_FOUND]: {
|
|
345
367
|
name: 'FILE_NOT_FOUND',
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import type { CompletionError, CompletionEvent, CompletionFinal, CompletionStats, StopReason, ToolCall } from '@qvac/inference/surface';
|
|
1
|
+
import type { CompletionError, CompletionEvent, CompletionFinal, CompletionStats, StopReason, ToolCall, ToolCallError } from '@qvac/inference/surface';
|
|
2
2
|
import { type ToolHandlerMap } from './tool-helpers.js';
|
|
3
3
|
export type AggregatedEvents = {
|
|
4
4
|
contentText: string;
|
|
5
5
|
thinkingText: string;
|
|
6
6
|
stats: CompletionStats | undefined;
|
|
7
7
|
toolCalls: ToolCall[];
|
|
8
|
+
/** Tool-call regions that failed to parse or validate; see `CompletionFinal.toolErrors`. */
|
|
9
|
+
toolErrors: ToolCallError[];
|
|
8
10
|
rawFullText: string | undefined;
|
|
9
11
|
error: CompletionError | undefined;
|
|
10
12
|
stopReason: StopReason | undefined;
|
|
@@ -9,6 +9,7 @@ export function aggregateEvents(events) {
|
|
|
9
9
|
let stopReason;
|
|
10
10
|
let cancelled = false;
|
|
11
11
|
const toolCalls = [];
|
|
12
|
+
const toolErrors = [];
|
|
12
13
|
for (const event of events) {
|
|
13
14
|
if (event.type === 'contentDelta') {
|
|
14
15
|
contentText += event.text;
|
|
@@ -22,6 +23,9 @@ export function aggregateEvents(events) {
|
|
|
22
23
|
else if (event.type === 'toolCall') {
|
|
23
24
|
toolCalls.push(event.call);
|
|
24
25
|
}
|
|
26
|
+
else if (event.type === 'toolError') {
|
|
27
|
+
toolErrors.push(event.error);
|
|
28
|
+
}
|
|
25
29
|
else if (event.type === 'completionDone') {
|
|
26
30
|
if ('raw' in event && event.raw) {
|
|
27
31
|
rawFullText = event.raw.fullText;
|
|
@@ -47,6 +51,7 @@ export function aggregateEvents(events) {
|
|
|
47
51
|
thinkingText,
|
|
48
52
|
stats,
|
|
49
53
|
toolCalls,
|
|
54
|
+
toolErrors,
|
|
50
55
|
rawFullText,
|
|
51
56
|
error,
|
|
52
57
|
stopReason,
|
|
@@ -54,7 +59,7 @@ export function aggregateEvents(events) {
|
|
|
54
59
|
};
|
|
55
60
|
}
|
|
56
61
|
export function buildFinalFromEvents(events, handlers) {
|
|
57
|
-
const { contentText, thinkingText, stats, toolCalls, rawFullText, error, stopReason, cancelled } = aggregateEvents(events);
|
|
62
|
+
const { contentText, thinkingText, stats, toolCalls, toolErrors, rawFullText, error, stopReason, cancelled } = aggregateEvents(events);
|
|
58
63
|
const attachedToolCalls = attachHandlersToToolCalls(toolCalls, handlers);
|
|
59
64
|
const fullText = rawFullText ?? contentText;
|
|
60
65
|
const cacheableAssistantContent = attachedToolCalls.length === 0 ? normalizeAssistantCacheContent(fullText) : undefined;
|
|
@@ -62,6 +67,7 @@ export function buildFinalFromEvents(events, handlers) {
|
|
|
62
67
|
contentText,
|
|
63
68
|
...(thinkingText && { thinkingText }),
|
|
64
69
|
toolCalls: attachedToolCalls,
|
|
70
|
+
...(toolErrors.length > 0 && { toolErrors }),
|
|
65
71
|
...(stats && { stats }),
|
|
66
72
|
raw: { fullText },
|
|
67
73
|
...(cacheableAssistantContent !== undefined && {
|
|
@@ -240,6 +240,18 @@ export declare class RAGUnknownOperationError extends QvacErrorBase {
|
|
|
240
240
|
export declare class RAGHyperDBFailedError extends QvacErrorBase {
|
|
241
241
|
constructor(details: string, cause?: unknown);
|
|
242
242
|
}
|
|
243
|
+
export declare class VectorIndexProviderUnavailableError extends QvacErrorBase {
|
|
244
|
+
constructor(cause?: unknown);
|
|
245
|
+
}
|
|
246
|
+
export declare class VectorIndexNotFoundError extends QvacErrorBase {
|
|
247
|
+
constructor(indexId: string, cause?: unknown);
|
|
248
|
+
}
|
|
249
|
+
export declare class VectorIndexInvalidVectorsError extends QvacErrorBase {
|
|
250
|
+
constructor(details: string, cause?: unknown);
|
|
251
|
+
}
|
|
252
|
+
export declare class VectorIndexFailedError extends QvacErrorBase {
|
|
253
|
+
constructor(details: string, cause?: unknown);
|
|
254
|
+
}
|
|
243
255
|
export declare class FileNotFoundError extends QvacErrorBase {
|
|
244
256
|
constructor(path: string, cause?: unknown);
|
|
245
257
|
}
|
|
@@ -375,6 +375,27 @@ export class RAGHyperDBFailedError extends QvacErrorBase {
|
|
|
375
375
|
super(createErrorOptions(SDK_SERVER_ERROR_CODES.RAG_HYPERDB_FAILED, [details], cause));
|
|
376
376
|
}
|
|
377
377
|
}
|
|
378
|
+
// ============== Vector Index Errors ==============
|
|
379
|
+
export class VectorIndexProviderUnavailableError extends QvacErrorBase {
|
|
380
|
+
constructor(cause) {
|
|
381
|
+
super(createErrorOptions(SDK_SERVER_ERROR_CODES.VECTOR_INDEX_PROVIDER_UNAVAILABLE, undefined, cause));
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
export class VectorIndexNotFoundError extends QvacErrorBase {
|
|
385
|
+
constructor(indexId, cause) {
|
|
386
|
+
super(createErrorOptions(SDK_SERVER_ERROR_CODES.VECTOR_INDEX_NOT_FOUND, [indexId], cause));
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
export class VectorIndexInvalidVectorsError extends QvacErrorBase {
|
|
390
|
+
constructor(details, cause) {
|
|
391
|
+
super(createErrorOptions(SDK_SERVER_ERROR_CODES.VECTOR_INDEX_INVALID_VECTORS, [details], cause));
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
export class VectorIndexFailedError extends QvacErrorBase {
|
|
395
|
+
constructor(details, cause) {
|
|
396
|
+
super(createErrorOptions(SDK_SERVER_ERROR_CODES.VECTOR_INDEX_FAILED, [details], cause));
|
|
397
|
+
}
|
|
398
|
+
}
|
|
378
399
|
// ============== Download/Resource Errors ==============
|
|
379
400
|
export class FileNotFoundError extends QvacErrorBase {
|
|
380
401
|
constructor(path, cause) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@qvac/sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.20.1",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -212,23 +212,22 @@
|
|
|
212
212
|
"changelog:generate": "node ../../scripts/sdk/generate-changelog-sdk-pod.cjs --package=sdk && prettier --write changelog"
|
|
213
213
|
},
|
|
214
214
|
"dependencies": {
|
|
215
|
-
"@qvac/
|
|
216
|
-
"@qvac/
|
|
217
|
-
"@qvac/bci-whispercpp": "^0.
|
|
218
|
-
"@qvac/classification-ggml": "^0.
|
|
219
|
-
"@qvac/decoder-audio": "^0.
|
|
220
|
-
"@qvac/diffusion-cpp": "^0.
|
|
221
|
-
"@qvac/embed-llamacpp": "^0.
|
|
215
|
+
"@qvac/asr-ggml": "^0.5.3",
|
|
216
|
+
"@qvac/audiogen-ggml": "^0.4.0",
|
|
217
|
+
"@qvac/bci-whispercpp": "^0.9.1",
|
|
218
|
+
"@qvac/classification-ggml": "^0.26.1",
|
|
219
|
+
"@qvac/decoder-audio": "^0.6.0",
|
|
220
|
+
"@qvac/diffusion-cpp": "^0.24.0",
|
|
221
|
+
"@qvac/embed-llamacpp": "^0.41.1",
|
|
222
222
|
"@qvac/error": "^0.1.1",
|
|
223
|
-
"@qvac/inference": "^0.
|
|
223
|
+
"@qvac/inference": "^0.20.0",
|
|
224
224
|
"@qvac/langdetect-text": "^0.1.2",
|
|
225
|
-
"@qvac/llm-llamacpp": "^0.
|
|
225
|
+
"@qvac/llm-llamacpp": "^0.53.0",
|
|
226
226
|
"@qvac/logging": "^0.1.0",
|
|
227
|
-
"@qvac/ocr-ggml": "^0.
|
|
228
|
-
"@qvac/
|
|
229
|
-
"@qvac/
|
|
230
|
-
"@qvac/
|
|
231
|
-
"@qvac/vla-ggml": "^0.24.0",
|
|
227
|
+
"@qvac/ocr-ggml": "^0.24.1",
|
|
228
|
+
"@qvac/translation-nmtcpp": "^0.16.1",
|
|
229
|
+
"@qvac/tts-ggml": "^0.9.1",
|
|
230
|
+
"@qvac/vla-ggml": "^0.27.1",
|
|
232
231
|
"bare-abort-controller": "^1.0.0",
|
|
233
232
|
"bare-cpu-info": "0.1.1",
|
|
234
233
|
"bare-crypto": "^1.15.0",
|
|
@@ -252,13 +251,16 @@
|
|
|
252
251
|
"semver": "^7.8.0",
|
|
253
252
|
"tar-stream": "^3.1.8",
|
|
254
253
|
"which-runtime": "^1.3.2",
|
|
255
|
-
"zod": "^4.3.0"
|
|
254
|
+
"zod": "^4.3.0",
|
|
255
|
+
"bare-buffer": "^3.4.2"
|
|
256
256
|
},
|
|
257
257
|
"devDependencies": {
|
|
258
258
|
"@electron-forge/plugin-base": "^7.11.1",
|
|
259
259
|
"@expo/config-plugins": "^54.0.4",
|
|
260
|
+
"bare-module": "^6.2.0",
|
|
260
261
|
"@lancedb/lancedb": "^0.21.3",
|
|
261
262
|
"@modelcontextprotocol/sdk": "^1.12.1",
|
|
263
|
+
"apache-arrow": "^18.1.0",
|
|
262
264
|
"@sqliteai/sqlite-wasm": "3.50.4-sync.0.8.30-vector.0.9.23",
|
|
263
265
|
"@types/brittle": "^3.5.0",
|
|
264
266
|
"@types/node": "^24.2.1",
|
|
@@ -281,7 +283,7 @@
|
|
|
281
283
|
"pear-pipe": "^1.0.6",
|
|
282
284
|
"prettier": "^3.9.4",
|
|
283
285
|
"prettier-config-holepunch": "^2.0.0",
|
|
284
|
-
"react-native-bare-kit": "^0.
|
|
286
|
+
"react-native-bare-kit": "^0.15.5",
|
|
285
287
|
"tsc-alias": "^1.8.17",
|
|
286
288
|
"tsx": "4.23.1",
|
|
287
289
|
"typescript": "^5.9.3",
|
|
@@ -293,6 +295,7 @@
|
|
|
293
295
|
"expo-build-properties": ">=0.12.0",
|
|
294
296
|
"expo-device": ">=8.0.0",
|
|
295
297
|
"expo-file-system": ">=19.0.0",
|
|
298
|
+
"expo-modules-core": ">=3.0.0",
|
|
296
299
|
"pear-pipe": ">=1.0.0",
|
|
297
300
|
"react-native-bare-kit": "*",
|
|
298
301
|
"tsx": "*"
|
|
@@ -313,6 +316,9 @@
|
|
|
313
316
|
"expo-file-system": {
|
|
314
317
|
"optional": true
|
|
315
318
|
},
|
|
319
|
+
"expo-modules-core": {
|
|
320
|
+
"optional": true
|
|
321
|
+
},
|
|
316
322
|
"pear-pipe": {
|
|
317
323
|
"optional": true
|
|
318
324
|
},
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* @qvac/sdk/electron-forge
|
|
3
3
|
*
|
|
4
4
|
* Electron Forge plugin: bundles the QVAC worker, verifies its native addons,
|
|
5
|
-
* then configures Electron Packager to tree-shake unused @qvac/* addons
|
|
6
|
-
* non-target prebuilds.
|
|
5
|
+
* then configures Electron Packager to tree-shake unused @qvac/* addons (along
|
|
6
|
+
* with their per-platform prebuild packages) and non-target prebuilds.
|
|
7
7
|
*
|
|
8
8
|
* macOS universal (`arch: "universal"`) is not supported — native addon
|
|
9
9
|
* prebuilds are arch-specific. Build darwin-arm64 and darwin-x64 separately.
|
|
@@ -146,16 +146,45 @@ function findQvacScopeDir(startDir) {
|
|
|
146
146
|
}
|
|
147
147
|
|
|
148
148
|
/**
|
|
149
|
-
*
|
|
150
|
-
*
|
|
149
|
+
* Reads the addon a per-platform prebuild package ships binaries for.
|
|
150
|
+
*
|
|
151
|
+
* Addons that split their prebuilds (`@qvac/tts-ggml` since 0.9.0, along with
|
|
152
|
+
* `@qvac/asr-ggml` 0.5.0 and `@qvac/audiogen-ggml` 0.4.0) publish the host's
|
|
153
|
+
* `.bare` in `@qvac/<addon>-<host>` (iOS flavours grouped as
|
|
154
|
+
* `@qvac/<addon>-ios`). Those packages carry no top-level `addon: true`;
|
|
155
|
+
* instead they embed an inner `addon/` package named after the meta addon.
|
|
156
|
+
* Returns that addon name, or null when `pkgDir` is not a platform package.
|
|
157
|
+
* Exposed for unit testing.
|
|
158
|
+
*/
|
|
159
|
+
function readPlatformPackageAddon(pkgDir) {
|
|
160
|
+
const addonPkgJsonPath = path.join(pkgDir, 'addon', 'package.json')
|
|
161
|
+
if (!fs.existsSync(addonPkgJsonPath)) return null
|
|
162
|
+
|
|
163
|
+
try {
|
|
164
|
+
const pkg = JSON.parse(fs.readFileSync(addonPkgJsonPath, 'utf8'))
|
|
165
|
+
if (pkg.addon === true && typeof pkg.name === 'string' && pkg.name.length > 0) {
|
|
166
|
+
return pkg.name
|
|
167
|
+
}
|
|
168
|
+
} catch (err) {
|
|
169
|
+
logger.warn(`Failed to parse ${addonPkgJsonPath}: ${err.message}`)
|
|
170
|
+
}
|
|
171
|
+
return null
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* Discovers installed @qvac packages by scanning node_modules/@qvac: the
|
|
176
|
+
* addons (`addon: true` in package.json) and the per-platform prebuild
|
|
177
|
+
* packages, each mapped to the addon it belongs to.
|
|
151
178
|
*/
|
|
152
179
|
function discoverQvacAddonPackages(projectDir) {
|
|
180
|
+
const nothing = { addons: [], platformPackages: [] }
|
|
181
|
+
|
|
153
182
|
let scopeDir
|
|
154
183
|
try {
|
|
155
184
|
scopeDir = findQvacScopeDir(projectDir)
|
|
156
185
|
} catch (err) {
|
|
157
186
|
logger.warn(err.message)
|
|
158
|
-
return
|
|
187
|
+
return nothing
|
|
159
188
|
}
|
|
160
189
|
|
|
161
190
|
let entries
|
|
@@ -163,10 +192,11 @@ function discoverQvacAddonPackages(projectDir) {
|
|
|
163
192
|
entries = fs.readdirSync(scopeDir)
|
|
164
193
|
} catch (err) {
|
|
165
194
|
logger.fsError('discoverQvacAddonPackages', err)
|
|
166
|
-
return
|
|
195
|
+
return nothing
|
|
167
196
|
}
|
|
168
197
|
|
|
169
|
-
const
|
|
198
|
+
const addons = []
|
|
199
|
+
const platformPackages = []
|
|
170
200
|
|
|
171
201
|
for (const name of entries) {
|
|
172
202
|
const pkgDir = path.join(scopeDir, name)
|
|
@@ -175,18 +205,25 @@ function discoverQvacAddonPackages(projectDir) {
|
|
|
175
205
|
const pkgJsonPath = path.join(pkgDir, 'package.json')
|
|
176
206
|
if (!fs.existsSync(pkgJsonPath)) continue
|
|
177
207
|
|
|
208
|
+
const packageName = `@qvac/${name}`
|
|
178
209
|
try {
|
|
179
210
|
const pkg = JSON.parse(fs.readFileSync(pkgJsonPath, 'utf8'))
|
|
180
211
|
if (pkg.addon === true) {
|
|
181
|
-
|
|
212
|
+
addons.push(packageName)
|
|
213
|
+
continue
|
|
182
214
|
}
|
|
183
215
|
} catch (err) {
|
|
184
216
|
logger.warn(`Failed to parse ${pkgJsonPath}: ${err.message}`)
|
|
217
|
+
continue
|
|
185
218
|
}
|
|
219
|
+
|
|
220
|
+
const addon = readPlatformPackageAddon(pkgDir)
|
|
221
|
+
if (addon !== null) platformPackages.push({ name: packageName, addon })
|
|
186
222
|
}
|
|
187
223
|
|
|
188
|
-
|
|
189
|
-
|
|
224
|
+
addons.sort()
|
|
225
|
+
platformPackages.sort((a, b) => a.name.localeCompare(b.name))
|
|
226
|
+
return { addons, platformPackages }
|
|
190
227
|
}
|
|
191
228
|
|
|
192
229
|
/**
|
|
@@ -203,20 +240,36 @@ function diffAddons(installed, required) {
|
|
|
203
240
|
}
|
|
204
241
|
|
|
205
242
|
/**
|
|
206
|
-
*
|
|
243
|
+
* Pure diff: per-platform prebuild packages whose addon is not in the
|
|
244
|
+
* required set. A platform package ships only its addon's binaries, so it
|
|
245
|
+
* follows that addon's include/exclude decision.
|
|
246
|
+
* Exposed for unit testing.
|
|
247
|
+
*/
|
|
248
|
+
function diffPlatformPackages(platformPackages, required) {
|
|
249
|
+
const requiredSet = new Set(required)
|
|
250
|
+
const exclusions = []
|
|
251
|
+
for (const { name, addon } of platformPackages) {
|
|
252
|
+
if (!requiredSet.has(addon)) exclusions.push(name)
|
|
253
|
+
}
|
|
254
|
+
return exclusions
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
/**
|
|
258
|
+
* Computes the list of installed @qvac addons that aren't in `required`,
|
|
259
|
+
* plus the per-platform prebuild packages of those excluded addons.
|
|
207
260
|
* Logs include/exclude decisions for each discovered package.
|
|
208
261
|
*/
|
|
209
262
|
function computeExclusions(required, projectDir) {
|
|
210
|
-
const
|
|
263
|
+
const { addons, platformPackages } = discoverQvacAddonPackages(projectDir)
|
|
211
264
|
|
|
212
|
-
if (
|
|
265
|
+
if (addons.length === 0) {
|
|
213
266
|
logger.warn('No @qvac addon packages discovered. Skipping addon exclusions.')
|
|
214
267
|
return []
|
|
215
268
|
}
|
|
216
269
|
|
|
217
270
|
const requiredSet = new Set(required)
|
|
218
271
|
const exclusions = []
|
|
219
|
-
for (const pkg of
|
|
272
|
+
for (const pkg of addons) {
|
|
220
273
|
if (requiredSet.has(pkg)) {
|
|
221
274
|
logger.info(`Including required addon: ${pkg}`)
|
|
222
275
|
} else {
|
|
@@ -224,6 +277,14 @@ function computeExclusions(required, projectDir) {
|
|
|
224
277
|
exclusions.push(pkg)
|
|
225
278
|
}
|
|
226
279
|
}
|
|
280
|
+
for (const { name, addon } of platformPackages) {
|
|
281
|
+
if (requiredSet.has(addon)) {
|
|
282
|
+
logger.info(`Including platform package ${name} (prebuilds for ${addon})`)
|
|
283
|
+
} else {
|
|
284
|
+
logger.info(`Excluding platform package ${name} (prebuilds for unused addon ${addon})`)
|
|
285
|
+
exclusions.push(name)
|
|
286
|
+
}
|
|
287
|
+
}
|
|
227
288
|
return exclusions
|
|
228
289
|
}
|
|
229
290
|
|
|
@@ -594,6 +655,15 @@ async function runBundleAndVerify(commands, projectDir, options) {
|
|
|
594
655
|
)
|
|
595
656
|
}
|
|
596
657
|
|
|
658
|
+
// Narrowed prebuild checks are otherwise invisible in the log.
|
|
659
|
+
const narrowed = verifyResult.addons.filter(
|
|
660
|
+
(addon) => Array.isArray(addon.linkedHosts) && addon.linkedHosts.length < hosts.length
|
|
661
|
+
)
|
|
662
|
+
for (const addon of narrowed) {
|
|
663
|
+
const where = addon.linkedHosts.length === 0 ? 'no host' : addon.linkedHosts.join(', ')
|
|
664
|
+
logger.info(`verifyBundle: ${addon.name}@${addon.version} is linked on ${where}`)
|
|
665
|
+
}
|
|
666
|
+
|
|
597
667
|
return bundleResult
|
|
598
668
|
}
|
|
599
669
|
|
|
@@ -772,6 +842,8 @@ module.exports.QvacForgePluginError = QvacForgePluginError
|
|
|
772
842
|
// Internal helpers exposed for unit tests. Not part of the stable API.
|
|
773
843
|
module.exports.createIgnore = createIgnore
|
|
774
844
|
module.exports.diffAddons = diffAddons
|
|
845
|
+
module.exports.diffPlatformPackages = diffPlatformPackages
|
|
846
|
+
module.exports.readPlatformPackageAddon = readPlatformPackageAddon
|
|
775
847
|
module.exports.detectTargetHosts = detectTargetHosts
|
|
776
848
|
module.exports.resolveHosts = resolveHosts
|
|
777
849
|
module.exports.runBundleAndVerify = runBundleAndVerify
|