@qvac/sdk 0.10.2 → 0.11.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.
Files changed (200) hide show
  1. package/NOTICE +92 -54
  2. package/dist/client/api/cancel.d.ts +24 -32
  3. package/dist/client/api/cancel.js +58 -31
  4. package/dist/client/api/client-request-id.d.ts +17 -0
  5. package/dist/client/api/client-request-id.js +27 -0
  6. package/dist/client/api/completion-stream.d.ts +1 -1
  7. package/dist/client/api/completion-stream.js +34 -3
  8. package/dist/client/api/diffusion.d.ts +46 -0
  9. package/dist/client/api/diffusion.js +50 -1
  10. package/dist/client/api/download-asset.d.ts +12 -2
  11. package/dist/client/api/download-asset.js +21 -3
  12. package/dist/client/api/embed.d.ts +8 -4
  13. package/dist/client/api/embed.js +14 -1
  14. package/dist/client/api/get-model-info.d.ts +1 -1
  15. package/dist/client/api/index.d.ts +1 -0
  16. package/dist/client/api/index.js +1 -0
  17. package/dist/client/api/load-model.d.ts +12 -4
  18. package/dist/client/api/load-model.js +25 -1
  19. package/dist/client/api/rag.d.ts +9 -3
  20. package/dist/client/api/rag.js +23 -3
  21. package/dist/client/api/transcribe.d.ts +20 -8
  22. package/dist/client/api/transcribe.js +58 -4
  23. package/dist/client/api/unload-model.d.ts +5 -2
  24. package/dist/client/api/unload-model.js +9 -4
  25. package/dist/client/api/upscale.d.ts +45 -0
  26. package/dist/client/api/upscale.js +99 -0
  27. package/dist/client/rpc/expo-rpc-client.js +2 -1
  28. package/dist/client/rpc/node-rpc-client.js +18 -7
  29. package/dist/client/rpc/rpc-client.d.ts +2 -2
  30. package/dist/client/rpc/rpc-client.js +10 -4
  31. package/dist/client/rpc/rpc-error.d.ts +9 -0
  32. package/dist/client/rpc/rpc-error.js +92 -0
  33. package/dist/examples/cancel-by-request-id.d.ts +38 -0
  34. package/dist/examples/cancel-by-request-id.js +103 -0
  35. package/dist/examples/diffusion-esrgan-upscale.d.ts +2 -0
  36. package/dist/examples/diffusion-esrgan-upscale.js +78 -0
  37. package/dist/examples/download-with-cancel.js +10 -10
  38. package/dist/examples/embed-multi-gpu.d.ts +2 -0
  39. package/dist/examples/embed-multi-gpu.js +46 -0
  40. package/dist/examples/llamacpp-multi-gpu.d.ts +2 -0
  41. package/dist/examples/llamacpp-multi-gpu.js +57 -0
  42. package/dist/examples/rag/rag-hyperdb/cancellation.js +20 -17
  43. package/dist/examples/tools/llamacpp-tools-gemma4.d.ts +2 -0
  44. package/dist/examples/tools/llamacpp-tools-gemma4.js +76 -0
  45. package/dist/examples/tools/llamacpp-tools-qwen35.d.ts +2 -0
  46. package/dist/examples/tools/llamacpp-tools-qwen35.js +70 -0
  47. package/dist/examples/transcription/whispercpp-microphone-conversation.d.ts +2 -0
  48. package/dist/examples/transcription/whispercpp-microphone-conversation.js +102 -0
  49. package/dist/examples/tts/supertonic.js +1 -1
  50. package/dist/expo/plugins/withMobileBundle.d.ts +20 -4
  51. package/dist/expo/plugins/withMobileBundle.js +44 -6
  52. package/dist/index.d.ts +5 -2
  53. package/dist/index.js +21 -1
  54. package/dist/models/registry/models.d.ts +186 -318
  55. package/dist/models/registry/models.js +1522 -1667
  56. package/dist/pear/pre.d.ts +3 -0
  57. package/dist/pear/pre.js +3 -0
  58. package/dist/schemas/cancel.d.ts +167 -28
  59. package/dist/schemas/cancel.js +119 -19
  60. package/dist/schemas/common.d.ts +427 -208
  61. package/dist/schemas/common.js +3 -1
  62. package/dist/schemas/completion-event.d.ts +14 -0
  63. package/dist/schemas/completion-event.js +11 -1
  64. package/dist/schemas/completion-stream.d.ts +15 -1
  65. package/dist/schemas/completion-stream.js +25 -7
  66. package/dist/schemas/download-asset.d.ts +15 -9
  67. package/dist/schemas/download-asset.js +17 -6
  68. package/dist/schemas/embed.d.ts +1 -0
  69. package/dist/schemas/embed.js +5 -0
  70. package/dist/schemas/error.d.ts +31 -0
  71. package/dist/schemas/error.js +29 -1
  72. package/dist/schemas/finetune.d.ts +2 -0
  73. package/dist/schemas/finetune.js +5 -0
  74. package/dist/schemas/get-model-info.d.ts +6 -6
  75. package/dist/schemas/llamacpp-config.d.ts +54 -8
  76. package/dist/schemas/llamacpp-config.js +12 -0
  77. package/dist/schemas/load-model.d.ts +1911 -1260
  78. package/dist/schemas/load-model.js +15 -0
  79. package/dist/schemas/model-src-utils.d.ts +14 -14
  80. package/dist/schemas/model-types.d.ts +10 -10
  81. package/dist/schemas/ocr.d.ts +3 -3
  82. package/dist/schemas/plugin.d.ts +40 -1
  83. package/dist/schemas/plugin.js +10 -1
  84. package/dist/schemas/rag.d.ts +9 -0
  85. package/dist/schemas/rag.js +17 -9
  86. package/dist/schemas/registry.d.ts +30 -30
  87. package/dist/schemas/reload-config.d.ts +14 -14
  88. package/dist/schemas/sdcpp-config.d.ts +131 -17
  89. package/dist/schemas/sdcpp-config.js +163 -1
  90. package/dist/schemas/sdk-config.d.ts +649 -271
  91. package/dist/schemas/sdk-errors-client.d.ts +1 -0
  92. package/dist/schemas/sdk-errors-client.js +5 -0
  93. package/dist/schemas/sdk-errors-server.d.ts +5 -0
  94. package/dist/schemas/sdk-errors-server.js +25 -0
  95. package/dist/schemas/text-to-speech.d.ts +78 -78
  96. package/dist/schemas/transcription-config.d.ts +24 -24
  97. package/dist/schemas/transcription.d.ts +56 -2
  98. package/dist/schemas/transcription.js +27 -0
  99. package/dist/schemas/translate.d.ts +2 -0
  100. package/dist/schemas/translate.js +13 -2
  101. package/dist/schemas/translation-config.d.ts +40 -40
  102. package/dist/schemas/unload-model.d.ts +2 -1
  103. package/dist/schemas/unload-model.js +4 -1
  104. package/dist/scripts/run-unit-tests.js +15 -2
  105. package/dist/server/bare/ops/cancel.d.ts +27 -1
  106. package/dist/server/bare/ops/cancel.js +36 -10
  107. package/dist/server/bare/ops/embed.d.ts +3 -3
  108. package/dist/server/bare/ops/embed.js +144 -28
  109. package/dist/server/bare/ops/kv-cache-utils.d.ts +0 -7
  110. package/dist/server/bare/ops/kv-cache-utils.js +8 -47
  111. package/dist/server/bare/ops/transcribe.d.ts +10 -5
  112. package/dist/server/bare/ops/transcribe.js +196 -41
  113. package/dist/server/bare/ops/translate.d.ts +1 -1
  114. package/dist/server/bare/ops/translate.js +197 -88
  115. package/dist/server/bare/plugins/llamacpp-completion/ops/completion-stream.d.ts +12 -3
  116. package/dist/server/bare/plugins/llamacpp-completion/ops/completion-stream.js +170 -172
  117. package/dist/server/bare/plugins/llamacpp-completion/ops/finetune.js +125 -21
  118. package/dist/server/bare/plugins/llamacpp-completion/ops/kv-cache-session.d.ts +154 -0
  119. package/dist/server/bare/plugins/llamacpp-completion/ops/kv-cache-session.js +448 -0
  120. package/dist/server/bare/plugins/llamacpp-completion/ops/kv-cache-state.d.ts +21 -73
  121. package/dist/server/bare/plugins/llamacpp-completion/ops/kv-cache-state.js +18 -101
  122. package/dist/server/bare/plugins/llamacpp-completion/plugin.d.ts +30 -3
  123. package/dist/server/bare/plugins/llamacpp-completion/plugin.js +157 -85
  124. package/dist/server/bare/plugins/llamacpp-completion/transform.d.ts +10 -0
  125. package/dist/server/bare/plugins/llamacpp-completion/transform.js +34 -0
  126. package/dist/server/bare/plugins/llamacpp-embedding/plugin.d.ts +7 -0
  127. package/dist/server/bare/plugins/llamacpp-embedding/plugin.js +10 -1
  128. package/dist/server/bare/plugins/nmtcpp-translation/plugin.d.ts +17 -15
  129. package/dist/server/bare/plugins/nmtcpp-translation/plugin.js +5 -1
  130. package/dist/server/bare/plugins/onnx-ocr/plugin.d.ts +3 -3
  131. package/dist/server/bare/plugins/onnx-ocr/plugin.js +3 -0
  132. package/dist/server/bare/plugins/onnx-tts/plugin.d.ts +39 -39
  133. package/dist/server/bare/plugins/onnx-tts/plugin.js +6 -0
  134. package/dist/server/bare/plugins/parakeet-transcription/plugin.d.ts +29 -21
  135. package/dist/server/bare/plugins/parakeet-transcription/plugin.js +4 -1
  136. package/dist/server/bare/plugins/sdcpp-generation/ops/diffusion.js +8 -0
  137. package/dist/server/bare/plugins/sdcpp-generation/ops/upscale.d.ts +3 -0
  138. package/dist/server/bare/plugins/sdcpp-generation/ops/upscale.js +40 -0
  139. package/dist/server/bare/plugins/sdcpp-generation/plugin.d.ts +91 -16
  140. package/dist/server/bare/plugins/sdcpp-generation/plugin.js +97 -7
  141. package/dist/server/bare/plugins/whispercpp-transcription/plugin.d.ts +22 -3
  142. package/dist/server/bare/plugins/whispercpp-transcription/plugin.js +50 -14
  143. package/dist/server/bare/rag-hyperdb/index.d.ts +1 -1
  144. package/dist/server/bare/rag-hyperdb/index.js +1 -1
  145. package/dist/server/bare/rag-hyperdb/rag-operation-manager.d.ts +26 -4
  146. package/dist/server/bare/rag-hyperdb/rag-operation-manager.js +65 -28
  147. package/dist/server/bare/runtime/disposable-scope.d.ts +36 -0
  148. package/dist/server/bare/runtime/disposable-scope.js +69 -0
  149. package/dist/server/bare/runtime/index.d.ts +8 -0
  150. package/dist/server/bare/runtime/index.js +3 -0
  151. package/dist/server/bare/runtime/request-context.d.ts +49 -0
  152. package/dist/server/bare/runtime/request-context.js +1 -0
  153. package/dist/server/bare/runtime/request-id.d.ts +12 -0
  154. package/dist/server/bare/runtime/request-id.js +14 -0
  155. package/dist/server/bare/runtime/request-registry-singleton.d.ts +4 -0
  156. package/dist/server/bare/runtime/request-registry-singleton.js +27 -0
  157. package/dist/server/bare/runtime/request-registry.d.ts +136 -0
  158. package/dist/server/bare/runtime/request-registry.js +297 -0
  159. package/dist/server/bare/runtime/with-request-context.d.ts +22 -0
  160. package/dist/server/bare/runtime/with-request-context.js +53 -0
  161. package/dist/server/bare/types/addon-responses.d.ts +11 -1
  162. package/dist/server/rpc/handler-registry.js +26 -7
  163. package/dist/server/rpc/handlers/cancel-delegated.js +28 -31
  164. package/dist/server/rpc/handlers/cancelHandler.d.ts +30 -1
  165. package/dist/server/rpc/handlers/cancelHandler.js +54 -22
  166. package/dist/server/rpc/handlers/delete-cache.d.ts +9 -0
  167. package/dist/server/rpc/handlers/delete-cache.js +13 -15
  168. package/dist/server/rpc/handlers/download-asset.js +133 -40
  169. package/dist/server/rpc/handlers/index.d.ts +2 -0
  170. package/dist/server/rpc/handlers/index.js +2 -0
  171. package/dist/server/rpc/handlers/load-model/download-manager.d.ts +60 -2
  172. package/dist/server/rpc/handlers/load-model/download-manager.js +141 -8
  173. package/dist/server/rpc/handlers/load-model/handler.js +213 -98
  174. package/dist/server/rpc/handlers/load-model/http.js +3 -3
  175. package/dist/server/rpc/handlers/load-model/hyperdrive.js +1 -1
  176. package/dist/server/rpc/handlers/load-model/registry.js +1 -1
  177. package/dist/server/rpc/handlers/load-model/resolve-session.d.ts +20 -1
  178. package/dist/server/rpc/handlers/load-model/resolve-session.js +6 -5
  179. package/dist/server/rpc/handlers/load-model/resolve.d.ts +3 -2
  180. package/dist/server/rpc/handlers/load-model/resolve.js +9 -6
  181. package/dist/server/rpc/handlers/load-model/types.d.ts +24 -0
  182. package/dist/server/rpc/handlers/rag.js +133 -15
  183. package/dist/server/rpc/handlers/upscale-stream.d.ts +3 -0
  184. package/dist/server/rpc/handlers/upscale-stream.js +4 -0
  185. package/dist/server/utils/completion-normalizer.js +8 -0
  186. package/dist/server/utils/tools/dialect.js +4 -0
  187. package/dist/server/utils/tools/parser.js +16 -1
  188. package/dist/server/utils/tools/parsers/gemma4native.d.ts +4 -0
  189. package/dist/server/utils/tools/parsers/gemma4native.js +60 -0
  190. package/dist/server/utils/tools/parsers/qwen35.d.ts +4 -0
  191. package/dist/server/utils/tools/parsers/qwen35.js +120 -0
  192. package/dist/utils/aggregate-events.d.ts +9 -0
  193. package/dist/utils/aggregate-events.js +18 -3
  194. package/dist/utils/decorate-promise.d.ts +34 -0
  195. package/dist/utils/decorate-promise.js +35 -0
  196. package/dist/utils/errors-client.d.ts +3 -0
  197. package/dist/utils/errors-client.js +5 -0
  198. package/dist/utils/errors-server.d.ts +85 -0
  199. package/dist/utils/errors-server.js +97 -0
  200. package/package.json +20 -15
@@ -3,6 +3,7 @@ import { execSync } from "child_process";
3
3
  import * as fs from "fs";
4
4
  import * as path from "path";
5
5
  import { resolveSDKPackageDir } from "./resolve-sdk-package-dir.js";
6
+ import { BundleVerificationFailedError } from "../../utils/errors-client.js";
6
7
  const { withDangerousMod } = configPlugins;
7
8
  const CONFIG_CANDIDATES = [
8
9
  "qvac.config.json",
@@ -18,11 +19,11 @@ const MOBILE_HOSTS = [
18
19
  "ios-x64-simulator",
19
20
  ];
20
21
  /**
21
- * Expo plugin that automatically generates the mobile worker bundle during build.
22
+ * Expo plugin: bundle, verify, then copy the mobile worker bundle.
22
23
  *
23
- * Runs qvac CLI (prefers local @qvac/cli, falls back to npx).
24
- * Uses qvac.config.* if exists, else includes all built-in plugins.
25
- * Output: node_modules/<sdk-package>/dist/worker.mobile.bundle.js
24
+ * Flow: `bundle sdk` -> assert `qvac/worker.bundle.js` exists ->
25
+ * `verify bundle` -> copy to `<sdkPackageDir>/dist/worker.mobile.bundle.js`.
26
+ * Requires a local `@qvac/cli` install. Uses `qvac.config.*` if present.
26
27
  */
27
28
  function withMobileBundle(config) {
28
29
  function buildMobileBundle(config) {
@@ -49,8 +50,10 @@ function withMobileBundle(config) {
49
50
  throw new Error(`QVAC: Bundle generation failed — ${generatedBundle} not found. ` +
50
51
  `Check qvac CLI output above for errors.`);
51
52
  }
53
+ // Verify before copying so the dist artifact only updates on success.
54
+ runVerifier(projectRoot, generatedBundle, configPath);
52
55
  fs.copyFileSync(generatedBundle, outputPath);
53
- console.log("🫡 QVAC: Mobile bundle generated");
56
+ console.log("🫡 QVAC: Mobile bundle generated and verified");
54
57
  return config;
55
58
  }
56
59
  config = withDangerousMod(config, ["android", buildMobileBundle]);
@@ -73,7 +76,7 @@ function findConfigFile(projectRoot) {
73
76
  * Prefers local @qvac/cli installation for version consistency,
74
77
  * falls back to npx for convenience when CLI is not installed.
75
78
  */
76
- function resolveCliCommand(projectRoot) {
79
+ export function resolveCliCommand(projectRoot) {
77
80
  const cliPath = path.join(projectRoot, "node_modules", "@qvac", "cli", "dist", "index.js");
78
81
  if (fs.existsSync(cliPath)) {
79
82
  return `node "${cliPath}"`;
@@ -82,6 +85,40 @@ function resolveCliCommand(projectRoot) {
82
85
  console.log(" Tip: Add @qvac/cli as a dependency for consistent versioning");
83
86
  return "npx --package=@qvac/cli qvac";
84
87
  }
88
+ /** Builds the `qvac verify bundle` command string (pure helper for tests). */
89
+ export function buildVerifyBundleCommand(opts) {
90
+ const hostFlags = opts.hosts.map((h) => `--host ${h}`).join(" ");
91
+ const configFlag = opts.configPath ? ` --config "${opts.configPath}"` : "";
92
+ return `${opts.cliCommand} verify bundle --addons-source "${opts.bundlePath}" ${hostFlags}${configFlag}`;
93
+ }
94
+ /**
95
+ * Runs `qvac verify bundle` against the freshly generated worker bundle.
96
+ * Passes the discovered `qvac.config.*` so the CLI reads `bareRuntimeVersion`
97
+ * and pins ABI checks deterministically. Without a config, the CLI falls back
98
+ * to auto-detecting Bare runtime from `node_modules` (`bare-runtime`, then
99
+ * `bare`); ABI checks stay strict when that lookup succeeds, and only skip
100
+ * (with an `unknown-runtime-version` warning) when neither is installed.
101
+ */
102
+ function runVerifier(projectRoot, generatedBundle, configPath) {
103
+ const cliCommand = resolveCliCommand(projectRoot);
104
+ if (!configPath) {
105
+ console.log("⚠️ QVAC: no qvac.config.* found — Bare runtime will be auto-detected " +
106
+ "from node_modules (bare-runtime, then bare). Add qvac.config.json " +
107
+ 'with `bareRuntimeVersion` to pin ABI checks deterministically.');
108
+ }
109
+ const verifyCommand = buildVerifyBundleCommand({
110
+ cliCommand,
111
+ bundlePath: generatedBundle,
112
+ hosts: MOBILE_HOSTS,
113
+ ...(configPath ? { configPath } : {}),
114
+ });
115
+ try {
116
+ execSync(verifyCommand, { stdio: "inherit", cwd: projectRoot });
117
+ }
118
+ catch (error) {
119
+ throw new BundleVerificationFailedError(generatedBundle, error);
120
+ }
121
+ }
85
122
  /** Runs qvac CLI with mobile-specific options */
86
123
  function runBundler(projectRoot, qvacSdkPath, configPath, deferredModules) {
87
124
  // Patch bare-kit linkers to use addons manifest
@@ -138,4 +175,5 @@ function patchBareKitLinkers(projectRoot, qvacSdkPath) {
138
175
  console.log(`⚠️ QVAC: iOS linker patch not found (${iosPatch})`);
139
176
  }
140
177
  }
178
+ export { MOBILE_HOSTS };
141
179
  export default withMobileBundle;
package/dist/index.d.ts CHANGED
@@ -1,11 +1,14 @@
1
1
  import "#polyfill-bare-globals";
2
- export { completion, deleteCache, loadModel, downloadAsset, heartbeat, startQVACProvider, stopQVACProvider, unloadModel, transcribe, transcribeStream, embed, finetune, translate, cancel, ragChunk, ragIngest, ragSaveEmbeddings, ragSearch, ragDeleteEmbeddings, ragReindex, ragListWorkspaces, ragCloseWorkspace, ragDeleteWorkspace, textToSpeech, textToSpeechStream, getModelInfo, getLoadedModelInfo, loggingStream, ocr, invokePlugin, invokePluginStream, diffusion, type DiffusionProgressTick, modelRegistryList, modelRegistrySearch, modelRegistryGetModel, type ModelRegistrySearchParams, suspend, resume, state, type FinetuneHandle, } from "./client/api/index";
2
+ export { completion, deleteCache, loadModel, downloadAsset, heartbeat, startQVACProvider, stopQVACProvider, unloadModel, transcribe, transcribeStream, embed, finetune, translate, cancel, ragChunk, ragIngest, ragSaveEmbeddings, ragSearch, ragDeleteEmbeddings, ragReindex, ragListWorkspaces, ragCloseWorkspace, ragDeleteWorkspace, textToSpeech, textToSpeechStream, getModelInfo, getLoadedModelInfo, loggingStream, ocr, invokePlugin, invokePluginStream, diffusion, type DiffusionProgressTick, upscale, modelRegistryList, modelRegistrySearch, modelRegistryGetModel, type ModelRegistrySearchParams, suspend, resume, state, type FinetuneHandle, } from "./client/api/index";
3
3
  export { close } from "./client/index";
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 EmbedStats, VERBOSITY, type Attachment, type TranscribeStreamSession, type TranscribeStreamMetadataSession, type TranscribeSegment, type TextToSpeechStreamSession, type TextToSpeechStreamResponse, type TextToSpeechStreamClientParams, 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, SDK_CLIENT_ERROR_CODES, SDK_SERVER_ERROR_CODES, type QvacConfig, type ModelInfo, type GetModelInfoParams, type GetLoadedModelInfoParams, type LoadedModelInfo, type LoadedInstance, type CacheFileInfo, toolSchema, TOOLS_MODE, type ToolsMode, type McpClient, type McpClientInput, type OCRClientParams, type OCRTextBlock, type OCROptions, type DiffusionClientParams, type DiffusionStreamResponse, type DiffusionStats, definePlugin, defineHandler, defineDuplexHandler, type QvacPlugin, type CreateModelParams, type PluginModelResult, type ModelRegistryEntry, type ModelRegistryEntryAddon, PLUGIN_LLM, PLUGIN_EMBEDDING, PLUGIN_WHISPER, PLUGIN_NMT, PLUGIN_TTS, PLUGIN_OCR, PLUGIN_DIFFUSION, SDK_DEFAULT_PLUGINS, type BuiltinPlugin, type ProfilerMode, type FinetuneValidation, type FinetuneRunParams, type FinetuneGetStateParams, type FinetuneStopParams, type FinetuneParams, type FinetuneStatus, type FinetuneProgress, type FinetuneStats, type FinetuneResult, } from "./schemas/index";
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 EmbedStats, VERBOSITY, type Attachment, type TranscribeStreamSession, type TranscribeStreamMetadataSession, type TranscribeStreamConversationSession, type TranscribeStreamEvent, type VadStateEvent, type EndOfTurnEvent, type TranscribeSegment, type TextToSpeechStreamSession, type TextToSpeechStreamResponse, type TextToSpeechStreamClientParams, 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, SDK_CLIENT_ERROR_CODES, SDK_SERVER_ERROR_CODES, type QvacConfig, type ModelInfo, type GetModelInfoParams, type GetLoadedModelInfoParams, type LoadedModelInfo, type LoadedInstance, type CacheFileInfo, toolSchema, TOOLS_MODE, type ToolsMode, type McpClient, type McpClientInput, type OCRClientParams, type OCRTextBlock, type OCROptions, type DiffusionClientParams, type DiffusionStreamResponse, type DiffusionStats, type UpscaleClientParams, type UpscaleStreamResponse, type UpscaleStats, definePlugin, defineHandler, defineDuplexHandler, type QvacPlugin, type CreateModelParams, type PluginModelResult, type ModelRegistryEntry, type ModelRegistryEntryAddon, PLUGIN_LLM, PLUGIN_EMBEDDING, PLUGIN_WHISPER, PLUGIN_NMT, PLUGIN_TTS, PLUGIN_OCR, PLUGIN_DIFFUSION, SDK_DEFAULT_PLUGINS, type BuiltinPlugin, type ProfilerMode, type FinetuneValidation, type FinetuneRunParams, type FinetuneGetStateParams, type FinetuneStopParams, type FinetuneParams, type FinetuneStatus, type FinetuneProgress, type FinetuneStats, type FinetuneResult, } from "./schemas/index";
5
5
  export { type ToolInput, type ToolHandler } from "./utils/tool-helpers";
6
6
  export { MODEL_TYPES, ModelType } from "./schemas/index";
7
7
  export * from "./models/registry/index";
8
8
  export { SUPPORTED_AUDIO_FORMATS } from "./constants/audio";
9
+ export { InferenceCancelledError } from "./utils/errors-server";
10
+ export type { InferenceCancelledPartial } from "./utils/errors-server";
11
+ export { RequestIdConflictError, RequestNotFoundError, RequestRejectedByPolicyError, } from "./utils/errors-server";
9
12
  export { getLogger, SDK_LOG_ID } from "./logging/index";
10
13
  export type { Logger, LogTransport, LoggerOptions } from "./logging/index";
11
14
  export { profiler } from "./profiling/index";
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import "#polyfill-bare-globals";
2
2
  // Public API exports only
3
- export { completion, deleteCache, loadModel, downloadAsset, heartbeat, startQVACProvider, stopQVACProvider, unloadModel, transcribe, transcribeStream, embed, finetune, translate, cancel, ragChunk, ragIngest, ragSaveEmbeddings, ragSearch, ragDeleteEmbeddings, ragReindex, ragListWorkspaces, ragCloseWorkspace, ragDeleteWorkspace, textToSpeech, textToSpeechStream, getModelInfo, getLoadedModelInfo, loggingStream, ocr, invokePlugin, invokePluginStream, diffusion, modelRegistryList, modelRegistrySearch, modelRegistryGetModel, suspend, resume, state, } from "./client/api/index.js";
3
+ export { completion, deleteCache, loadModel, downloadAsset, heartbeat, startQVACProvider, stopQVACProvider, unloadModel, transcribe, transcribeStream, embed, finetune, translate, cancel, ragChunk, ragIngest, ragSaveEmbeddings, ragSearch, ragDeleteEmbeddings, ragReindex, ragListWorkspaces, ragCloseWorkspace, ragDeleteWorkspace, textToSpeech, textToSpeechStream, getModelInfo, getLoadedModelInfo, loggingStream, ocr, invokePlugin, invokePluginStream, diffusion, upscale, modelRegistryList, modelRegistrySearch, modelRegistryGetModel, suspend, resume, state, } from "./client/api/index.js";
4
4
  export { close } from "./client/index.js";
5
5
  export { VERBOSITY, SDK_CLIENT_ERROR_CODES, SDK_SERVER_ERROR_CODES, toolSchema, TOOLS_MODE, definePlugin, defineHandler, defineDuplexHandler, PLUGIN_LLM, PLUGIN_EMBEDDING, PLUGIN_WHISPER, PLUGIN_NMT, PLUGIN_TTS, PLUGIN_OCR, PLUGIN_DIFFUSION, SDK_DEFAULT_PLUGINS, } from "./schemas/index.js";
6
6
  export {} from "./utils/tool-helpers.js";
@@ -9,6 +9,26 @@ export { MODEL_TYPES, ModelType } from "./schemas/index.js";
9
9
  // Model registry constants
10
10
  export * from "./models/registry/index.js";
11
11
  export { SUPPORTED_AUDIO_FORMATS } from "./constants/audio.js";
12
+ // Error classes that clients need for `instanceof` checks on rejected
13
+ // promises. `InferenceCancelledError` rides the standard `QvacError`
14
+ // envelope, but consumers reach for it through `instanceof` on
15
+ // `await run.final` / `run.text` / `run.toolCalls` / `run.stats`
16
+ // rejections. `RequestRejectedByPolicyError` is thrown by
17
+ // `RequestRegistry.begin(...)` when a registered concurrency policy
18
+ // (e.g. `oneAtATimePerModel` on `completion`) rejects a new request;
19
+ // it propagates out through the worker so the client can distinguish
20
+ // "the request collided with another one" from "the request failed".
21
+ //
22
+ // `RequestIdConflictError` and `RequestNotFoundError` are thrown by
23
+ // `RequestRegistry.begin(...)` / `.end(...)` on UUID collisions and
24
+ // missing-target cancels. They're surfaced here so consumers using
25
+ // the decorated-promise `requestId` can pattern-match on rejected
26
+ // cancel paths. All three classes round-trip the RPC boundary via
27
+ // the typed-error reconstructor in `client/rpc/rpc-error.ts` so
28
+ // `err instanceof <Class>` works on the consumer side, not just on
29
+ // the worker side.
30
+ export { InferenceCancelledError } from "./utils/errors-server.js";
31
+ export { RequestIdConflictError, RequestNotFoundError, RequestRejectedByPolicyError, } from "./utils/errors-server.js";
12
32
  // Logging exports
13
33
  export { getLogger, SDK_LOG_ID } from "./logging/index.js";
14
34
  // Profiler exports