@qvac/sdk 0.6.1 → 0.7.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.
Files changed (277) hide show
  1. package/LICENSE +1 -24
  2. package/NOTICE +632 -0
  3. package/README.md +2 -1
  4. package/dist/client/api/embed.js +1 -4
  5. package/dist/client/api/get-model-info.d.ts +10 -3
  6. package/dist/client/api/index.d.ts +2 -0
  7. package/dist/client/api/index.js +2 -0
  8. package/dist/client/api/invoke-plugin.d.ts +14 -0
  9. package/dist/client/api/invoke-plugin.js +38 -0
  10. package/dist/client/api/registry.d.ts +14 -0
  11. package/dist/client/api/registry.js +37 -0
  12. package/dist/client/api/transcribe.js +0 -4
  13. package/dist/client/api/unload-model.js +1 -1
  14. package/dist/client/config-loader/resolve-config.node.d.ts +3 -2
  15. package/dist/client/config-loader/resolve-config.node.js +31 -4
  16. package/dist/client/init-hooks.js +2 -1
  17. package/dist/client/rpc/bare-client.d.ts +2 -0
  18. package/dist/client/rpc/bare-client.js +48 -7
  19. package/dist/client/rpc/expo-device-info.d.ts +6 -0
  20. package/dist/client/rpc/expo-device-info.js +32 -0
  21. package/dist/client/rpc/expo-rpc-client.js +9 -32
  22. package/dist/client/rpc/node-rpc-client.d.ts +1 -1
  23. package/dist/client/rpc/node-rpc-client.js +201 -28
  24. package/dist/client/rpc/rpc-client.d.ts +1 -1
  25. package/dist/client/rpc/rpc-client.js +2 -2
  26. package/dist/constants/index.d.ts +1 -0
  27. package/dist/constants/index.js +1 -0
  28. package/dist/constants/registry.d.ts +2 -0
  29. package/dist/constants/registry.js +1 -0
  30. package/dist/examples/cache-management.js +2 -2
  31. package/dist/examples/config/plugins/plugins.config.d.ts +5 -0
  32. package/dist/examples/config/plugins/plugins.config.js +4 -0
  33. package/dist/examples/download-with-blind-relays.js +1 -1
  34. package/dist/examples/llamacpp-multimodal.js +3 -3
  35. package/dist/examples/llamacpp-native-tools.js +2 -2
  36. package/dist/examples/mcp-websearch.js +2 -2
  37. package/dist/examples/multi-model-demo.js +2 -2
  38. package/dist/examples/ocr-fasttext.js +4 -4
  39. package/dist/examples/parallel-download.js +2 -2
  40. package/dist/examples/plugins.d.ts +14 -0
  41. package/dist/examples/plugins.js +129 -0
  42. package/dist/examples/registry-query.d.ts +2 -0
  43. package/dist/examples/registry-query.js +87 -0
  44. package/dist/examples/translation/translation-bergamot-batch.js +2 -2
  45. package/dist/examples/translation/translation-bergamot.js +4 -4
  46. package/dist/examples/translation/translation-opus.js +2 -2
  47. package/dist/examples/translation/translation-stream.js +2 -2
  48. package/dist/examples/tts/chatterbox.d.ts +2 -0
  49. package/dist/examples/tts/chatterbox.js +59 -0
  50. package/dist/examples/tts/supertonic.d.ts +2 -0
  51. package/dist/examples/tts/supertonic.js +51 -0
  52. package/dist/examples/tts/utils.d.ts +17 -0
  53. package/dist/examples/tts/utils.js +93 -0
  54. package/dist/examples/whispercpp-filesystem.js +2 -3
  55. package/dist/examples/whispercpp-microphone-record.js +1 -2
  56. package/dist/examples/whispercpp-prompt.js +2 -3
  57. package/dist/expo/plugins/index.d.ts +3 -0
  58. package/dist/expo/plugins/index.js +3 -0
  59. package/dist/expo/plugins/resolve-sdk-package-dir.d.ts +15 -0
  60. package/dist/expo/plugins/resolve-sdk-package-dir.js +31 -0
  61. package/dist/expo/plugins/withAndroidArchitecture.d.ts +8 -0
  62. package/dist/expo/plugins/withAndroidArchitecture.js +52 -0
  63. package/dist/expo/plugins/withAndroidNdkVersion.d.ts +8 -0
  64. package/dist/expo/plugins/withAndroidNdkVersion.js +31 -0
  65. package/dist/expo/plugins/withDeviceInfo.d.ts +10 -0
  66. package/dist/expo/plugins/withDeviceInfo.js +48 -0
  67. package/dist/expo/plugins/withMobileBundle.d.ts +5 -2
  68. package/dist/expo/plugins/withMobileBundle.js +121 -65
  69. package/dist/expo/plugins/withQvacSDK.d.ts +4 -0
  70. package/dist/expo/plugins/withQvacSDK.js +26 -1
  71. package/dist/index.d.ts +4 -4
  72. package/dist/index.js +5 -5
  73. package/dist/models/{hyperdrive → registry}/index.js +1 -1
  74. package/dist/models/registry/models.d.ts +9056 -0
  75. package/dist/models/registry/models.js +9351 -0
  76. package/dist/models/update-models/codegen.d.ts +3 -0
  77. package/dist/models/update-models/codegen.js +135 -0
  78. package/dist/models/update-models/history.d.ts +13 -0
  79. package/dist/models/update-models/history.js +88 -0
  80. package/dist/models/update-models/index.d.ts +2 -0
  81. package/dist/models/update-models/index.js +124 -0
  82. package/dist/models/update-models/naming.d.ts +4 -0
  83. package/dist/models/update-models/naming.js +314 -0
  84. package/dist/models/update-models/processing.d.ts +8 -0
  85. package/dist/models/update-models/processing.js +67 -0
  86. package/dist/models/update-models/registry.d.ts +4 -0
  87. package/dist/models/update-models/registry.js +67 -0
  88. package/dist/models/update-models/shards.d.ts +4 -0
  89. package/dist/models/update-models/shards.js +57 -0
  90. package/dist/models/update-models/types.d.ts +60 -0
  91. package/dist/models/update-models/types.js +1 -0
  92. package/dist/models/update-models/utils.d.ts +3 -0
  93. package/dist/models/update-models/utils.js +21 -0
  94. package/dist/pear/pre.d.ts +18 -0
  95. package/dist/pear/pre.js +433 -0
  96. package/dist/schemas/common.d.ts +286 -32
  97. package/dist/schemas/common.js +12 -0
  98. package/dist/schemas/download-asset.d.ts +35 -11
  99. package/dist/schemas/download-asset.js +5 -1
  100. package/dist/schemas/engine-addon-map.d.ts +5 -0
  101. package/dist/schemas/engine-addon-map.js +49 -0
  102. package/dist/schemas/get-model-info.d.ts +32 -16
  103. package/dist/schemas/get-model-info.js +17 -8
  104. package/dist/schemas/index.d.ts +4 -1
  105. package/dist/schemas/index.js +4 -4
  106. package/dist/schemas/load-model.d.ts +2224 -900
  107. package/dist/schemas/load-model.js +130 -25
  108. package/dist/schemas/model-src-utils.d.ts +30 -12
  109. package/dist/schemas/model-src-utils.js +5 -2
  110. package/dist/schemas/model-types.d.ts +15 -4
  111. package/dist/schemas/model-types.js +21 -4
  112. package/dist/schemas/path-validation.d.ts +10 -0
  113. package/dist/schemas/path-validation.js +22 -0
  114. package/dist/schemas/plugin.d.ts +180 -0
  115. package/dist/schemas/plugin.js +132 -0
  116. package/dist/schemas/rag.d.ts +2 -2
  117. package/dist/schemas/rag.js +7 -3
  118. package/dist/schemas/registry.d.ts +338 -0
  119. package/dist/schemas/registry.js +91 -0
  120. package/dist/schemas/sdk-errors-client.d.ts +6 -6
  121. package/dist/schemas/sdk-errors-client.js +15 -15
  122. package/dist/schemas/sdk-errors-registry.d.ts +6 -0
  123. package/dist/schemas/sdk-errors-registry.js +8 -0
  124. package/dist/schemas/sdk-errors-server.d.ts +16 -2
  125. package/dist/schemas/sdk-errors-server.js +90 -10
  126. package/dist/schemas/text-to-speech.d.ts +670 -1
  127. package/dist/schemas/text-to-speech.js +51 -2
  128. package/dist/schemas/translate.d.ts +2 -2
  129. package/dist/scripts/run-security-tests-bare.d.ts +2 -0
  130. package/dist/scripts/run-security-tests-bare.js +78 -0
  131. package/dist/scripts/run-security-tests.d.ts +2 -0
  132. package/dist/scripts/run-security-tests.js +22 -0
  133. package/dist/server/bare/delegate-rpc-client.d.ts +6 -0
  134. package/dist/server/bare/delegate-rpc-client.js +136 -56
  135. package/dist/server/bare/{addons/llamacpp-embedding/handlers → ops}/embed.d.ts +1 -1
  136. package/dist/server/bare/{addons/llamacpp-embedding/handlers → ops}/embed.js +3 -3
  137. package/dist/server/bare/{addons/llamacpp-completion → ops}/kv-cache-utils.js +6 -6
  138. package/dist/server/bare/{addons → ops}/load-model.js +32 -42
  139. package/dist/server/bare/{addons/nmtcpp-translation/handlers → ops}/translate.d.ts +1 -1
  140. package/dist/server/bare/{addons/nmtcpp-translation/handlers → ops}/translate.js +5 -4
  141. package/dist/server/bare/plugins/index.d.ts +7 -0
  142. package/dist/server/bare/plugins/index.js +6 -0
  143. package/dist/server/bare/{addons/llamacpp-completion → plugins/llamacpp-completion/ops}/cache-logger.js +1 -1
  144. package/dist/server/bare/{addons/llamacpp-completion/handlers → plugins/llamacpp-completion/ops}/completion-stream.d.ts +1 -1
  145. package/dist/server/bare/{addons/llamacpp-completion/handlers → plugins/llamacpp-completion/ops}/completion-stream.js +2 -3
  146. package/dist/server/bare/plugins/llamacpp-completion/plugin.d.ts +115 -0
  147. package/dist/server/bare/plugins/llamacpp-completion/plugin.js +142 -0
  148. package/dist/server/bare/plugins/llamacpp-embedding/plugin.d.ts +24 -0
  149. package/dist/server/bare/plugins/llamacpp-embedding/plugin.js +73 -0
  150. package/dist/server/bare/plugins/nmtcpp-translation/plugin.d.ts +45 -0
  151. package/dist/server/bare/plugins/nmtcpp-translation/plugin.js +97 -0
  152. package/dist/server/bare/{addons/onnx-ocr/handlers → plugins/onnx-ocr/ops}/ocr-stream.js +2 -1
  153. package/dist/server/bare/plugins/onnx-ocr/plugin.d.ts +38 -0
  154. package/dist/server/bare/{addons/onnx-ocr/create-model.js → plugins/onnx-ocr/plugin.js} +39 -2
  155. package/dist/server/bare/{addons/onnx-tts/handlers → plugins/onnx-tts/ops}/text-to-speech.js +23 -1
  156. package/dist/server/bare/plugins/onnx-tts/plugin.d.ts +26 -0
  157. package/dist/server/bare/plugins/onnx-tts/plugin.js +162 -0
  158. package/dist/server/bare/plugins/onnx-tts/wav-helper.d.ts +14 -0
  159. package/dist/server/bare/plugins/onnx-tts/wav-helper.js +107 -0
  160. package/dist/server/bare/plugins/whispercpp-transcription/ops/transcribe-stream.d.ts +3 -0
  161. package/dist/server/bare/{addons/whispercpp-transcription/handlers → plugins/whispercpp-transcription/ops}/transcribe-stream.js +1 -2
  162. package/dist/server/bare/plugins/whispercpp-transcription/plugin.d.ts +31 -0
  163. package/dist/server/bare/plugins/whispercpp-transcription/plugin.js +74 -0
  164. package/dist/server/bare/rag-hyperdb/handlers/ingest.js +1 -1
  165. package/dist/server/bare/rag-hyperdb/handlers/search.js +1 -1
  166. package/dist/server/bare/rag-hyperdb/rag-workspace-manager.js +2 -1
  167. package/dist/server/bare/registry/config-registry.js +1 -1
  168. package/dist/server/bare/registry/registry-client.d.ts +5 -0
  169. package/dist/server/bare/registry/registry-client.js +37 -0
  170. package/dist/server/env.d.ts +22 -0
  171. package/dist/server/env.js +57 -0
  172. package/dist/server/plugins/index.d.ts +2 -0
  173. package/dist/server/plugins/index.js +1 -0
  174. package/dist/server/plugins/registry.d.ts +9 -0
  175. package/dist/server/plugins/registry.js +75 -0
  176. package/dist/server/rpc/delegate-transport.d.ts +11 -0
  177. package/dist/server/rpc/delegate-transport.js +60 -0
  178. package/dist/server/rpc/handle-request.d.ts +0 -9
  179. package/dist/server/rpc/handle-request.js +13 -321
  180. package/dist/server/rpc/handler-registry.d.ts +3 -0
  181. package/dist/server/rpc/handler-registry.js +84 -0
  182. package/dist/server/rpc/handler-utils.d.ts +22 -0
  183. package/dist/server/rpc/handler-utils.js +87 -0
  184. package/dist/server/rpc/handlers/cancelHandler.js +1 -1
  185. package/dist/server/rpc/handlers/completion-stream-delegated.js +1 -1
  186. package/dist/server/rpc/handlers/completion-stream.js +2 -43
  187. package/dist/server/rpc/handlers/delete-cache.js +1 -1
  188. package/dist/server/rpc/handlers/embed.js +2 -21
  189. package/dist/server/rpc/handlers/get-model-info.js +19 -15
  190. package/dist/server/rpc/handlers/index.d.ts +9 -0
  191. package/dist/server/rpc/handlers/index.js +9 -0
  192. package/dist/server/rpc/handlers/load-model/download-manager.d.ts +1 -0
  193. package/dist/server/rpc/handlers/load-model/download-manager.js +3 -0
  194. package/dist/server/rpc/handlers/load-model/handler.js +47 -24
  195. package/dist/server/rpc/handlers/load-model/http.js +3 -2
  196. package/dist/server/rpc/handlers/load-model/hyperdrive.js +14 -10
  197. package/dist/server/rpc/handlers/load-model/registry.d.ts +10 -0
  198. package/dist/server/rpc/handlers/load-model/registry.js +571 -0
  199. package/dist/server/rpc/handlers/load-model/resolve.js +18 -5
  200. package/dist/server/rpc/handlers/load-model-delegated.js +4 -2
  201. package/dist/server/rpc/handlers/ocr-stream.js +2 -37
  202. package/dist/server/rpc/handlers/ping.d.ts +3 -0
  203. package/dist/server/rpc/handlers/ping.js +3 -0
  204. package/dist/server/rpc/handlers/plugin-dispatch.d.ts +15 -0
  205. package/dist/server/rpc/handlers/plugin-dispatch.js +54 -0
  206. package/dist/server/rpc/handlers/plugin-invoke.d.ts +4 -0
  207. package/dist/server/rpc/handlers/plugin-invoke.js +87 -0
  208. package/dist/server/rpc/handlers/registry.d.ts +5 -0
  209. package/dist/server/rpc/handlers/registry.js +157 -0
  210. package/dist/server/rpc/handlers/text-to-speech.js +2 -5
  211. package/dist/server/rpc/handlers/transcribe-stream.js +2 -30
  212. package/dist/server/rpc/handlers/translate.js +2 -42
  213. package/dist/server/rpc/handlers/unload-model.js +1 -1
  214. package/dist/server/rpc/index.d.ts +1 -1
  215. package/dist/server/utils/archive.d.ts +1 -0
  216. package/dist/server/utils/archive.js +10 -2
  217. package/dist/server/utils/cache.d.ts +5 -0
  218. package/dist/server/utils/cache.js +26 -2
  219. package/dist/server/utils/gguf-tensor-extractor.js +3 -3
  220. package/dist/server/utils/index.d.ts +1 -1
  221. package/dist/server/utils/index.js +1 -1
  222. package/dist/server/utils/path-security.d.ts +12 -0
  223. package/dist/server/utils/path-security.js +25 -0
  224. package/dist/server/utils/shard-utils.js +3 -3
  225. package/dist/server/worker-core.d.ts +6 -0
  226. package/dist/server/worker-core.js +88 -0
  227. package/dist/server/worker.d.ts +4 -5
  228. package/dist/server/worker.js +18 -116
  229. package/dist/utils/errors-client.d.ts +9 -6
  230. package/dist/utils/errors-client.js +19 -11
  231. package/dist/utils/errors-server.d.ts +44 -5
  232. package/dist/utils/errors-server.js +82 -9
  233. package/dist/utils/path-sanitize.d.ts +17 -0
  234. package/dist/utils/path-sanitize.js +54 -0
  235. package/expo/plugins/patches/android-link.mjs +63 -0
  236. package/expo/plugins/patches/ios-link.mjs +63 -0
  237. package/package.json +72 -10
  238. package/dist/examples/text-to-speech.d.ts +0 -3
  239. package/dist/examples/text-to-speech.js +0 -137
  240. package/dist/models/hyperdrive/models.d.ts +0 -4003
  241. package/dist/models/hyperdrive/models.js +0 -4282
  242. package/dist/server/bare/addons/index.d.ts +0 -4
  243. package/dist/server/bare/addons/index.js +0 -3
  244. package/dist/server/bare/addons/llamacpp-completion/create-model.d.ts +0 -8
  245. package/dist/server/bare/addons/llamacpp-completion/create-model.js +0 -43
  246. package/dist/server/bare/addons/llamacpp-completion/index.d.ts +0 -4
  247. package/dist/server/bare/addons/llamacpp-completion/index.js +0 -3
  248. package/dist/server/bare/addons/llamacpp-embedding/create-model.d.ts +0 -8
  249. package/dist/server/bare/addons/llamacpp-embedding/create-model.js +0 -38
  250. package/dist/server/bare/addons/llamacpp-embedding/index.d.ts +0 -3
  251. package/dist/server/bare/addons/llamacpp-embedding/index.js +0 -2
  252. package/dist/server/bare/addons/nmtcpp-translation/create-model.d.ts +0 -8
  253. package/dist/server/bare/addons/nmtcpp-translation/create-model.js +0 -52
  254. package/dist/server/bare/addons/nmtcpp-translation/index.d.ts +0 -3
  255. package/dist/server/bare/addons/nmtcpp-translation/index.js +0 -2
  256. package/dist/server/bare/addons/onnx-ocr/create-model.d.ts +0 -10
  257. package/dist/server/bare/addons/onnx-ocr/index.d.ts +0 -3
  258. package/dist/server/bare/addons/onnx-ocr/index.js +0 -2
  259. package/dist/server/bare/addons/onnx-tts/create-model.d.ts +0 -10
  260. package/dist/server/bare/addons/onnx-tts/create-model.js +0 -25
  261. package/dist/server/bare/addons/onnx-tts/index.d.ts +0 -3
  262. package/dist/server/bare/addons/onnx-tts/index.js +0 -2
  263. package/dist/server/bare/addons/whispercpp-transcription/create-model.d.ts +0 -10
  264. package/dist/server/bare/addons/whispercpp-transcription/create-model.js +0 -37
  265. package/dist/server/bare/addons/whispercpp-transcription/handlers/transcribe-stream.d.ts +0 -3
  266. package/dist/server/bare/addons/whispercpp-transcription/index.d.ts +0 -3
  267. package/dist/server/bare/addons/whispercpp-transcription/index.js +0 -2
  268. /package/dist/models/{hyperdrive → registry}/index.d.ts +0 -0
  269. /package/dist/server/bare/{addons → ops}/cancel.d.ts +0 -0
  270. /package/dist/server/bare/{addons → ops}/cancel.js +0 -0
  271. /package/dist/server/bare/{addons/llamacpp-completion → ops}/kv-cache-utils.d.ts +0 -0
  272. /package/dist/server/bare/{addons → ops}/load-model.d.ts +0 -0
  273. /package/dist/server/bare/{addons → ops}/unload-model.d.ts +0 -0
  274. /package/dist/server/bare/{addons → ops}/unload-model.js +0 -0
  275. /package/dist/server/bare/{addons/llamacpp-completion → plugins/llamacpp-completion/ops}/cache-logger.d.ts +0 -0
  276. /package/dist/server/bare/{addons/onnx-ocr/handlers → plugins/onnx-ocr/ops}/ocr-stream.d.ts +0 -0
  277. /package/dist/server/bare/{addons/onnx-tts/handlers → plugins/onnx-tts/ops}/text-to-speech.d.ts +0 -0
@@ -3,10 +3,15 @@ import { llmConfigBaseSchema, embedConfigBaseSchema, } from "./llamacpp-config.j
3
3
  import { whisperConfigSchema } from "./whispercpp-config.js";
4
4
  import { delegateSchema } from "./delegate.js";
5
5
  import { nmtConfigSchema } from "./translation-config.js";
6
- import { ttsConfigSchema } from "./text-to-speech.js";
6
+ import { ttsConfigSchema, ttsChatterboxRequestConfigSchema, ttsSupertonicRequestConfigSchema, ttsRequestConfigSchema, } from "./text-to-speech.js";
7
7
  import { ocrConfigSchema } from "./ocr.js";
8
8
  import { modelSrcInputSchema, modelInputToSrcSchema, modelInputToNameSchema, } from "./model-src-utils.js";
9
- import { llmModelTypeSchema, whisperModelTypeSchema, embeddingsModelTypeSchema, nmtModelTypeSchema, ttsModelTypeSchema, ocrModelTypeSchema, ModelType, } from "./model-types.js";
9
+ import { llmModelTypeSchema, whisperModelTypeSchema, embeddingsModelTypeSchema, nmtModelTypeSchema, ttsModelTypeSchema, ocrModelTypeSchema, ModelType, ModelTypeAliases, } from "./model-types.js";
10
+ // Set of all built-in model types (canonical + aliases) for catch-all exclusion
11
+ const builtInModelTypes = new Set([
12
+ ...Object.values(ModelType),
13
+ ...Object.keys(ModelTypeAliases),
14
+ ]);
10
15
  import { reloadConfigRequestSchema } from "./reload-config.js";
11
16
  const loadModelOptionsBaseSchema = z.union([
12
17
  z.object({
@@ -42,12 +47,11 @@ const loadModelOptionsBaseSchema = z.union([
42
47
  seed: z.boolean().optional(),
43
48
  delegate: delegateSchema,
44
49
  }),
50
+ // TTS (supports both Chatterbox and Supertonic via ttsEngine discriminator)
45
51
  z.object({
46
52
  modelSrc: modelSrcInputSchema,
47
53
  modelType: ttsModelTypeSchema,
48
54
  modelConfig: ttsConfigSchema,
49
- configSrc: modelSrcInputSchema,
50
- eSpeakDataPath: z.string(),
51
55
  seed: z.boolean().optional(),
52
56
  delegate: delegateSchema,
53
57
  }),
@@ -59,6 +63,16 @@ const loadModelOptionsBaseSchema = z.union([
59
63
  seed: z.boolean().optional(),
60
64
  delegate: delegateSchema,
61
65
  }),
66
+ // Custom plugin catch-all: accepts any modelType string EXCEPT built-ins
67
+ z.object({
68
+ modelSrc: modelSrcInputSchema,
69
+ modelType: z.string().refine((val) => !builtInModelTypes.has(val), {
70
+ message: "Built-in model types must use their specific schema",
71
+ }),
72
+ modelConfig: z.record(z.string(), z.unknown()).optional(),
73
+ seed: z.boolean().optional(),
74
+ delegate: delegateSchema,
75
+ }),
62
76
  ]);
63
77
  export const loadModelOptionsSchema = loadModelOptionsBaseSchema.transform((data) => ({
64
78
  ...data,
@@ -167,25 +181,57 @@ export const loadModelOptionsToRequestSchema = z.union([
167
181
  modelSrc: modelSrcInputSchema,
168
182
  modelType: ttsModelTypeSchema,
169
183
  modelConfig: ttsConfigSchema,
170
- configSrc: modelSrcInputSchema,
171
- eSpeakDataPath: z.string(),
172
184
  seed: z.boolean().optional(),
173
185
  delegate: delegateSchema,
174
186
  onProgress: z.unknown().optional(),
175
187
  withProgress: z.boolean().optional(),
176
188
  })
177
- .transform((data) => ({
178
- type: "loadModel",
179
- modelType: ModelType.onnxTts,
180
- modelSrc: modelInputToSrcSchema.parse(data.modelSrc),
181
- modelName: modelInputToNameSchema.parse(data.modelSrc),
182
- modelConfig: data.modelConfig,
183
- seed: data.seed ?? false,
184
- withProgress: data.withProgress ?? !!data.onProgress,
185
- delegate: data.delegate,
186
- configSrc: modelInputToSrcSchema.parse(data.configSrc),
187
- eSpeakDataPath: data.eSpeakDataPath,
188
- })),
189
+ .transform((data) => {
190
+ // Keep modelConfig intact, just convert ModelSrcInput values to strings
191
+ if (data.modelConfig.ttsEngine === "chatterbox") {
192
+ return {
193
+ type: "loadModel",
194
+ modelType: ModelType.onnxTts,
195
+ modelSrc: modelInputToSrcSchema.parse(data.modelSrc),
196
+ modelName: modelInputToNameSchema.parse(data.modelSrc),
197
+ modelConfig: {
198
+ ttsEngine: "chatterbox",
199
+ language: data.modelConfig.language,
200
+ ttsTokenizerSrc: modelInputToSrcSchema.parse(data.modelConfig.ttsTokenizerSrc),
201
+ ttsSpeechEncoderSrc: modelInputToSrcSchema.parse(data.modelConfig.ttsSpeechEncoderSrc),
202
+ ttsEmbedTokensSrc: modelInputToSrcSchema.parse(data.modelConfig.ttsEmbedTokensSrc),
203
+ ttsConditionalDecoderSrc: modelInputToSrcSchema.parse(data.modelConfig.ttsConditionalDecoderSrc),
204
+ ttsLanguageModelSrc: modelInputToSrcSchema.parse(data.modelConfig.ttsLanguageModelSrc),
205
+ referenceAudioSrc: modelInputToSrcSchema.parse(data.modelConfig.referenceAudioSrc),
206
+ },
207
+ seed: data.seed ?? false,
208
+ withProgress: data.withProgress ?? !!data.onProgress,
209
+ delegate: data.delegate,
210
+ };
211
+ }
212
+ else {
213
+ return {
214
+ type: "loadModel",
215
+ modelType: ModelType.onnxTts,
216
+ modelSrc: modelInputToSrcSchema.parse(data.modelSrc),
217
+ modelName: modelInputToNameSchema.parse(data.modelSrc),
218
+ modelConfig: {
219
+ ttsEngine: "supertonic",
220
+ language: data.modelConfig.language,
221
+ ttsTokenizerSrc: modelInputToSrcSchema.parse(data.modelConfig.ttsTokenizerSrc),
222
+ ttsTextEncoderSrc: modelInputToSrcSchema.parse(data.modelConfig.ttsTextEncoderSrc),
223
+ ttsLatentDenoiserSrc: modelInputToSrcSchema.parse(data.modelConfig.ttsLatentDenoiserSrc),
224
+ ttsVoiceDecoderSrc: modelInputToSrcSchema.parse(data.modelConfig.ttsVoiceDecoderSrc),
225
+ ttsVoiceSrc: modelInputToSrcSchema.parse(data.modelConfig.ttsVoiceSrc),
226
+ ttsSpeed: data.modelConfig.ttsSpeed,
227
+ ttsNumInferenceSteps: data.modelConfig.ttsNumInferenceSteps,
228
+ },
229
+ seed: data.seed ?? false,
230
+ withProgress: data.withProgress ?? !!data.onProgress,
231
+ delegate: data.delegate,
232
+ };
233
+ }
234
+ }),
189
235
  z
190
236
  .object({
191
237
  modelSrc: modelSrcInputSchema,
@@ -210,6 +256,29 @@ export const loadModelOptionsToRequestSchema = z.union([
210
256
  ? modelInputToSrcSchema.parse(data.detectorModelSrc)
211
257
  : undefined,
212
258
  })),
259
+ // Custom plugin catch-all: accepts any modelType string EXCEPT built-ins
260
+ z
261
+ .object({
262
+ modelSrc: modelSrcInputSchema,
263
+ modelType: z.string().refine((val) => !builtInModelTypes.has(val), {
264
+ message: "Built-in model types must use their specific schema",
265
+ }),
266
+ modelConfig: z.record(z.string(), z.unknown()).optional(),
267
+ seed: z.boolean().optional(),
268
+ delegate: delegateSchema,
269
+ onProgress: z.unknown().optional(),
270
+ withProgress: z.boolean().optional(),
271
+ })
272
+ .transform((data) => ({
273
+ type: "loadModel",
274
+ modelType: data.modelType,
275
+ modelSrc: modelInputToSrcSchema.parse(data.modelSrc),
276
+ modelName: modelInputToNameSchema.parse(data.modelSrc),
277
+ modelConfig: data.modelConfig ?? {},
278
+ seed: data.seed ?? false,
279
+ withProgress: data.withProgress ?? !!data.onProgress,
280
+ delegate: data.delegate,
281
+ })),
213
282
  ]);
214
283
  const commonModelConfigSchema = z.object({
215
284
  type: z.literal("loadModel"),
@@ -217,7 +286,6 @@ const commonModelConfigSchema = z.object({
217
286
  modelName: z.string().optional(),
218
287
  projectionModelSrc: z.string().optional(),
219
288
  vadModelSrc: z.string().optional(),
220
- configSrc: z.string().optional(),
221
289
  detectorModelSrc: z.string().optional(),
222
290
  withProgress: z.boolean().optional(),
223
291
  seed: z.boolean().optional(),
@@ -244,16 +312,29 @@ export const loadNmtModelRequestSchema = commonModelConfigSchema.extend({
244
312
  srcVocabSrc: z.string().optional(),
245
313
  dstVocabSrc: z.string().optional(),
246
314
  });
315
+ export const loadTtsChatterboxModelRequestSchema = commonModelConfigSchema.extend({
316
+ modelType: z.literal(ModelType.onnxTts),
317
+ modelConfig: ttsChatterboxRequestConfigSchema,
318
+ });
319
+ export const loadTtsSupertonicModelRequestSchema = commonModelConfigSchema.extend({
320
+ modelType: z.literal(ModelType.onnxTts),
321
+ modelConfig: ttsSupertonicRequestConfigSchema,
322
+ });
247
323
  export const loadTtsModelRequestSchema = commonModelConfigSchema.extend({
248
324
  modelType: z.literal(ModelType.onnxTts),
249
- modelConfig: ttsConfigSchema, // tts has no defaults
250
- configSrc: z.string(),
251
- eSpeakDataPath: z.string(),
325
+ modelConfig: ttsRequestConfigSchema,
252
326
  });
253
327
  export const loadOcrModelRequestSchema = commonModelConfigSchema.extend({
254
328
  modelType: z.literal(ModelType.onnxOcr),
255
329
  modelConfig: ocrConfigSchema, // ocr has no defaults
256
330
  });
331
+ // Custom plugin catch-all: accepts any modelType string EXCEPT built-ins
332
+ export const loadCustomPluginModelRequestSchema = commonModelConfigSchema.extend({
333
+ modelType: z.string().refine((val) => !builtInModelTypes.has(val), {
334
+ message: "Built-in model types must use their specific schema",
335
+ }),
336
+ modelConfig: z.record(z.string(), z.unknown()).optional(),
337
+ });
257
338
  // Union of all load model request types (using z.union since each modelType accepts multiple values)
258
339
  export const loadModelSrcRequestSchema = z
259
340
  .union([
@@ -263,6 +344,7 @@ export const loadModelSrcRequestSchema = z
263
344
  loadNmtModelRequestSchema,
264
345
  loadTtsModelRequestSchema,
265
346
  loadOcrModelRequestSchema,
347
+ loadCustomPluginModelRequestSchema,
266
348
  ])
267
349
  .transform((data) => ({
268
350
  ...data,
@@ -295,6 +377,16 @@ export const modelProgressUpdateSchema = z.object({
295
377
  overallPercentage: z.number(),
296
378
  })
297
379
  .optional(),
380
+ onnxInfo: z
381
+ .object({
382
+ currentFile: z.string(),
383
+ fileIndex: z.number(),
384
+ totalFiles: z.number(),
385
+ overallDownloaded: z.number(),
386
+ overallTotal: z.number(),
387
+ overallPercentage: z.number(),
388
+ })
389
+ .optional(),
298
390
  });
299
391
  export const hyperdriveUrlSchema = z
300
392
  .string()
@@ -303,14 +395,27 @@ export const hyperdriveUrlSchema = z
303
395
  const match = url.match(/^pear:\/\/([0-9a-fA-F]{64})\/(.+)$/);
304
396
  return { key: match[1], path: match[2] };
305
397
  });
398
+ /**
399
+ * Schema for registry:// URLs (internal use only).
400
+ * Users should use model constants from @qvac/sdk instead of raw URLs.
401
+ * Format: registry://source/path/to/model.gguf
402
+ */
403
+ export const registryUrlSchema = z
404
+ .string()
405
+ .regex(/^registry:\/\/([^/]+)\/(.+)$/, "Invalid registry URL. Expected format: registry://source/path/to/model.gguf")
406
+ .transform((url) => {
407
+ const match = url.match(/^registry:\/\/([^/]+)\/(.+)$/);
408
+ return {
409
+ registrySource: match[1],
410
+ registryPath: match[2], // Path without source prefix
411
+ };
412
+ });
306
413
  export const loadModelServerParamsSchema = z.object({
307
414
  modelId: z.string(),
308
415
  modelPath: z.string(),
309
- options: loadModelOptionsSchema,
416
+ options: loadModelSrcRequestSchema,
310
417
  projectionModelPath: z.string().optional(),
311
418
  vadModelPath: z.string().optional(),
312
- ttsConfigModelPath: z.string().optional(),
313
- eSpeakDataPath: z.string().optional(),
314
419
  detectorModelPath: z.string().optional(),
315
420
  modelName: z.string().optional(),
316
421
  });
@@ -3,8 +3,11 @@ export declare const modelDescriptorSchema: z.ZodObject<{
3
3
  src: z.ZodString;
4
4
  name: z.ZodOptional<z.ZodString>;
5
5
  modelId: z.ZodOptional<z.ZodString>;
6
- hyperdriveKey: z.ZodOptional<z.ZodString>;
7
- hyperbeeKey: z.ZodOptional<z.ZodString>;
6
+ registryPath: z.ZodOptional<z.ZodString>;
7
+ registrySource: z.ZodOptional<z.ZodString>;
8
+ blobCoreKey: z.ZodOptional<z.ZodString>;
9
+ blobIndex: z.ZodOptional<z.ZodNumber>;
10
+ engine: z.ZodOptional<z.ZodString>;
8
11
  expectedSize: z.ZodOptional<z.ZodNumber>;
9
12
  sha256Checksum: z.ZodOptional<z.ZodString>;
10
13
  addon: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
@@ -26,8 +29,11 @@ export declare const modelSrcInputSchema: z.ZodUnion<readonly [z.ZodString, z.Zo
26
29
  src: z.ZodString;
27
30
  name: z.ZodOptional<z.ZodString>;
28
31
  modelId: z.ZodOptional<z.ZodString>;
29
- hyperdriveKey: z.ZodOptional<z.ZodString>;
30
- hyperbeeKey: z.ZodOptional<z.ZodString>;
32
+ registryPath: z.ZodOptional<z.ZodString>;
33
+ registrySource: z.ZodOptional<z.ZodString>;
34
+ blobCoreKey: z.ZodOptional<z.ZodString>;
35
+ blobIndex: z.ZodOptional<z.ZodNumber>;
36
+ engine: z.ZodOptional<z.ZodString>;
31
37
  expectedSize: z.ZodOptional<z.ZodNumber>;
32
38
  sha256Checksum: z.ZodOptional<z.ZodString>;
33
39
  addon: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
@@ -55,8 +61,11 @@ export declare const modelInputToSrcSchema: z.ZodPipe<z.ZodUnion<readonly [z.Zod
55
61
  src: z.ZodString;
56
62
  name: z.ZodOptional<z.ZodString>;
57
63
  modelId: z.ZodOptional<z.ZodString>;
58
- hyperdriveKey: z.ZodOptional<z.ZodString>;
59
- hyperbeeKey: z.ZodOptional<z.ZodString>;
64
+ registryPath: z.ZodOptional<z.ZodString>;
65
+ registrySource: z.ZodOptional<z.ZodString>;
66
+ blobCoreKey: z.ZodOptional<z.ZodString>;
67
+ blobIndex: z.ZodOptional<z.ZodNumber>;
68
+ engine: z.ZodOptional<z.ZodString>;
60
69
  expectedSize: z.ZodOptional<z.ZodNumber>;
61
70
  sha256Checksum: z.ZodOptional<z.ZodString>;
62
71
  addon: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
@@ -77,8 +86,11 @@ export declare const modelInputToSrcSchema: z.ZodPipe<z.ZodUnion<readonly [z.Zod
77
86
  src: string;
78
87
  name?: string | undefined;
79
88
  modelId?: string | undefined;
80
- hyperdriveKey?: string | undefined;
81
- hyperbeeKey?: string | undefined;
89
+ registryPath?: string | undefined;
90
+ registrySource?: string | undefined;
91
+ blobCoreKey?: string | undefined;
92
+ blobIndex?: number | undefined;
93
+ engine?: string | undefined;
82
94
  expectedSize?: number | undefined;
83
95
  sha256Checksum?: string | undefined;
84
96
  addon?: "llamacpp-completion" | "whispercpp-transcription" | "llamacpp-embedding" | "nmtcpp-translation" | "onnx-tts" | "onnx-ocr" | "llm" | "whisper" | "embeddings" | "nmt" | "tts" | "ocr" | "vad" | undefined;
@@ -91,8 +103,11 @@ export declare const modelInputToNameSchema: z.ZodPipe<z.ZodUnion<readonly [z.Zo
91
103
  src: z.ZodString;
92
104
  name: z.ZodOptional<z.ZodString>;
93
105
  modelId: z.ZodOptional<z.ZodString>;
94
- hyperdriveKey: z.ZodOptional<z.ZodString>;
95
- hyperbeeKey: z.ZodOptional<z.ZodString>;
106
+ registryPath: z.ZodOptional<z.ZodString>;
107
+ registrySource: z.ZodOptional<z.ZodString>;
108
+ blobCoreKey: z.ZodOptional<z.ZodString>;
109
+ blobIndex: z.ZodOptional<z.ZodNumber>;
110
+ engine: z.ZodOptional<z.ZodString>;
96
111
  expectedSize: z.ZodOptional<z.ZodNumber>;
97
112
  sha256Checksum: z.ZodOptional<z.ZodString>;
98
113
  addon: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
@@ -113,8 +128,11 @@ export declare const modelInputToNameSchema: z.ZodPipe<z.ZodUnion<readonly [z.Zo
113
128
  src: string;
114
129
  name?: string | undefined;
115
130
  modelId?: string | undefined;
116
- hyperdriveKey?: string | undefined;
117
- hyperbeeKey?: string | undefined;
131
+ registryPath?: string | undefined;
132
+ registrySource?: string | undefined;
133
+ blobCoreKey?: string | undefined;
134
+ blobIndex?: number | undefined;
135
+ engine?: string | undefined;
118
136
  expectedSize?: number | undefined;
119
137
  sha256Checksum?: string | undefined;
120
138
  addon?: "llamacpp-completion" | "whispercpp-transcription" | "llamacpp-embedding" | "nmtcpp-translation" | "onnx-tts" | "onnx-ocr" | "llm" | "whisper" | "embeddings" | "nmt" | "tts" | "ocr" | "vad" | undefined;
@@ -6,8 +6,11 @@ export const modelDescriptorSchema = z.object({
6
6
  src: z.string(),
7
7
  name: z.string().optional(),
8
8
  modelId: z.string().optional(),
9
- hyperdriveKey: z.string().optional(),
10
- hyperbeeKey: z.string().optional(),
9
+ registryPath: z.string().optional(),
10
+ registrySource: z.string().optional(),
11
+ blobCoreKey: z.string().optional(),
12
+ blobIndex: z.number().optional(),
13
+ engine: z.string().optional(),
11
14
  expectedSize: z.number().optional(),
12
15
  sha256Checksum: z.string().optional(),
13
16
  addon: addonSchema.optional(),
@@ -87,10 +87,21 @@ export declare const modelTypeSchema: z.ZodPipe<z.ZodEnum<{
87
87
  tts: "tts";
88
88
  ocr: "ocr";
89
89
  }>, z.ZodTransform<"llamacpp-completion" | "whispercpp-transcription" | "llamacpp-embedding" | "nmtcpp-translation" | "onnx-tts" | "onnx-ocr", "llamacpp-completion" | "whispercpp-transcription" | "llamacpp-embedding" | "nmtcpp-translation" | "onnx-tts" | "onnx-ocr" | "llm" | "whisper" | "embeddings" | "nmt" | "tts" | "ocr">>;
90
- /** Normalize model type input to canonical form */
91
- export declare function normalizeModelType(input: ModelTypeInput): CanonicalModelType;
92
- /** Check if input is an alias (not canonical) */
93
- export declare function isModelTypeAlias(input: ModelTypeInput): boolean;
90
+ /**
91
+ * Normalize model type input to canonical form.
92
+ * Custom plugin types (not in built-ins) are returned as-is.
93
+ */
94
+ export declare function normalizeModelType(input: string): string;
95
+ /**
96
+ * Type guard to check if a string is a canonical (built-in) model type.
97
+ * Returns false for custom plugin types.
98
+ */
99
+ export declare function isCanonicalModelType(input: string): input is CanonicalModelType;
100
+ /**
101
+ * Check if input is a built-in alias (not canonical or custom).
102
+ * Returns false for custom plugin types.
103
+ */
104
+ export declare function isModelTypeAlias(input: string): boolean;
94
105
  /**
95
106
  * LLM/Completion model type schema.
96
107
  * - Alias: `"llm"` → resolves to `"llamacpp-completion"`
@@ -75,16 +75,33 @@ export const modelTypeSchema = modelTypeInputSchema.transform((val) => {
75
75
  // Otherwise, look up in aliases
76
76
  return ModelTypeAliases[val];
77
77
  });
78
- /** Normalize model type input to canonical form */
78
+ /**
79
+ * Normalize model type input to canonical form.
80
+ * Custom plugin types (not in built-ins) are returned as-is.
81
+ */
79
82
  export function normalizeModelType(input) {
80
83
  // If already canonical, return as-is
81
84
  if (canonicalValuesSet.has(input)) {
82
85
  return input;
83
86
  }
84
- // Otherwise, look up in aliases
85
- return ModelTypeAliases[input];
87
+ // If it's an alias, normalize to canonical
88
+ if (input in ModelTypeAliases) {
89
+ return ModelTypeAliases[input];
90
+ }
91
+ // Custom plugin type - return as-is
92
+ return input;
86
93
  }
87
- /** Check if input is an alias (not canonical) */
94
+ /**
95
+ * Type guard to check if a string is a canonical (built-in) model type.
96
+ * Returns false for custom plugin types.
97
+ */
98
+ export function isCanonicalModelType(input) {
99
+ return canonicalValuesSet.has(input);
100
+ }
101
+ /**
102
+ * Check if input is a built-in alias (not canonical or custom).
103
+ * Returns false for custom plugin types.
104
+ */
88
105
  export function isModelTypeAlias(input) {
89
106
  return input in ModelTypeAliases;
90
107
  }
@@ -0,0 +1,10 @@
1
+ import { z } from "zod";
2
+ /**
3
+ * Zod refinement for path components that get joined to a base directory.
4
+ * Rejects strings containing traversal sequences (.., null bytes).
5
+ *
6
+ * DO NOT apply to fields that accept absolute user paths (e.g. audio, image,
7
+ * model, or attachment paths).
8
+ */
9
+ export declare const safePathComponent: z.ZodString;
10
+ //# sourceMappingURL=path-validation.d.ts.map
@@ -0,0 +1,22 @@
1
+ import { z } from "zod";
2
+ /**
3
+ * Zod refinement for path components that get joined to a base directory.
4
+ * Rejects strings containing traversal sequences (.., null bytes).
5
+ *
6
+ * DO NOT apply to fields that accept absolute user paths (e.g. audio, image,
7
+ * model, or attachment paths).
8
+ */
9
+ export const safePathComponent = z.string().refine((s) => {
10
+ // Reject literal traversal
11
+ if (s.includes(".."))
12
+ return false;
13
+ // Reject null bytes (literal and URL-encoded)
14
+ if (s.includes("\0") || s.toLowerCase().includes("%00"))
15
+ return false;
16
+ // Reject URL-encoded traversal (%2e = ".", %2f = "/", %5c = "\")
17
+ if (/%2e/i.test(s))
18
+ return false;
19
+ return true;
20
+ }, {
21
+ message: "Path component must not contain traversal sequences ('..', '%2e'), null bytes, or '%00'",
22
+ });
@@ -0,0 +1,180 @@
1
+ import { z } from "zod";
2
+ /**
3
+ * Definition for a plugin handler with explicit Zod schemas.
4
+ * Each handler must define its request/response schemas for validation.
5
+ */
6
+ export interface PluginHandlerDefinition<TRequest extends z.ZodType = z.ZodType, TResponse extends z.ZodType = z.ZodType> {
7
+ requestSchema: TRequest;
8
+ responseSchema: TResponse;
9
+ streaming: boolean;
10
+ /** The handler function - receives validated request, returns validated response */
11
+ handler: TRequest extends z.ZodType<infer I> ? TResponse extends z.ZodType<infer O> ? (request: I) => Promise<O> | AsyncGenerator<O> : never : never;
12
+ }
13
+ /**
14
+ * Parameters passed to createModel when loading a plugin model.
15
+ *
16
+ * Core fields are always present. The `artifacts` map contains
17
+ * additional file paths required by specific plugins (e.g., projection
18
+ * models, VAD models, config files).
19
+ *
20
+ * Built-in artifact keys:
21
+ * - `projectionModelPath` - LLM multimodal projection model
22
+ * - `vadModelPath` - Whisper voice activity detection model
23
+ * - `tokenizerPath`, `speechEncoderPath`, `embedTokensPath`, `conditionalDecoderPath`, `languageModelPath` - TTS (Chatterbox) model files
24
+ * - `referenceAudioPath` - TTS (Chatterbox) path to reference WAV file for voice cloning
25
+ * - `tokenizerPath`, `textEncoderPath`, `latentDenoiserPath`, `voiceDecoderPath` - TTS (Supertonic) model files
26
+ * - `voicePath` - TTS (Supertonic) path to voice .bin file (e.g. voices/M1.bin)
27
+ * - `speed`, `numInferenceSteps` - TTS (Supertonic) options
28
+ * - `detectorModelPath` - OCR detector model
29
+ *
30
+ * Custom plugins can define their own artifact keys.
31
+ */
32
+ export interface CreateModelParams {
33
+ modelId: string;
34
+ modelPath: string;
35
+ modelConfig?: Record<string, unknown> | undefined;
36
+ modelName?: string | undefined;
37
+ artifacts?: Record<string, string> | undefined;
38
+ }
39
+ /**
40
+ * Minimal contract for plugin models.
41
+ * All models must implement `load()`. `unload()` is optional.
42
+ */
43
+ export interface PluginModel {
44
+ load(force?: boolean): Promise<void>;
45
+ unload?(): void | Promise<void>;
46
+ }
47
+ export interface PluginModelResult {
48
+ model: PluginModel;
49
+ loader: unknown;
50
+ }
51
+ export interface PluginLogging {
52
+ module: unknown;
53
+ namespace: string;
54
+ }
55
+ /**
56
+ * Function to resolve a model source (URL or path) to a local file path.
57
+ * Passed to resolveConfig hook to allow plugins to resolve their artifacts.
58
+ */
59
+ export type ResolveModelPath = (src: string) => Promise<string>;
60
+ export interface QvacPlugin {
61
+ modelType: string;
62
+ displayName: string;
63
+ addonPackage: string;
64
+ createModel: (params: CreateModelParams) => PluginModelResult;
65
+ handlers: Record<string, PluginHandlerDefinition>;
66
+ logging?: PluginLogging | undefined;
67
+ /**
68
+ * Optional hook to resolve model sources in modelConfig to local paths.
69
+ * Called before createModel if the plugin needs to download/resolve artifacts.
70
+ * Receives the raw modelConfig and a resolve function, returns transformed config.
71
+ */
72
+ resolveConfig?: (modelConfig: Record<string, unknown>, resolve: ResolveModelPath) => Promise<Record<string, unknown>>;
73
+ }
74
+ export declare const pluginInvokeRequestSchema: z.ZodObject<{
75
+ type: z.ZodLiteral<"pluginInvoke">;
76
+ modelId: z.ZodString;
77
+ handler: z.ZodString;
78
+ params: z.ZodUnknown;
79
+ }, z.core.$strip>;
80
+ export declare const pluginInvokeResponseSchema: z.ZodObject<{
81
+ type: z.ZodLiteral<"pluginInvoke">;
82
+ result: z.ZodUnknown;
83
+ }, z.core.$strip>;
84
+ export declare const pluginInvokeStreamRequestSchema: z.ZodObject<{
85
+ type: z.ZodLiteral<"pluginInvokeStream">;
86
+ modelId: z.ZodString;
87
+ handler: z.ZodString;
88
+ params: z.ZodUnknown;
89
+ }, z.core.$strip>;
90
+ export declare const pluginInvokeStreamResponseSchema: z.ZodObject<{
91
+ type: z.ZodLiteral<"pluginInvokeStream">;
92
+ result: z.ZodUnknown;
93
+ done: z.ZodOptional<z.ZodBoolean>;
94
+ }, z.core.$strip>;
95
+ export type PluginInvokeRequest = z.infer<typeof pluginInvokeRequestSchema>;
96
+ export type PluginInvokeResponse = z.infer<typeof pluginInvokeResponseSchema>;
97
+ export type PluginInvokeStreamRequest = z.infer<typeof pluginInvokeStreamRequestSchema>;
98
+ export type PluginInvokeStreamResponse = z.infer<typeof pluginInvokeStreamResponseSchema>;
99
+ /**
100
+ * Helper function to define a plugin with full type inference.
101
+ * This is an identity function that provides type checking.
102
+ */
103
+ export declare function definePlugin<T extends QvacPlugin>(plugin: T): T;
104
+ /**
105
+ * Helper function to define a handler with full type inference.
106
+ * This is an identity function that provides type checking.
107
+ */
108
+ export declare function defineHandler<TRequest extends z.ZodType, TResponse extends z.ZodType>(definition: PluginHandlerDefinition<TRequest, TResponse>): PluginHandlerDefinition<TRequest, TResponse>;
109
+ export declare const pluginHandlerDefinitionRuntimeSchema: z.ZodObject<{
110
+ requestSchema: z.ZodObject<{
111
+ safeParse: z.ZodCustom<Function, Function>;
112
+ }, z.core.$catchall<z.ZodUnknown>>;
113
+ responseSchema: z.ZodObject<{
114
+ safeParse: z.ZodCustom<Function, Function>;
115
+ }, z.core.$catchall<z.ZodUnknown>>;
116
+ streaming: z.ZodBoolean;
117
+ handler: z.ZodCustom<Function, Function>;
118
+ }, z.core.$catchall<z.ZodUnknown>>;
119
+ export declare const pluginDefinitionRuntimeSchema: z.ZodObject<{
120
+ modelType: z.ZodString;
121
+ displayName: z.ZodString;
122
+ addonPackage: z.ZodString;
123
+ createModel: z.ZodCustom<Function, Function>;
124
+ handlers: z.ZodRecord<z.ZodString, z.ZodObject<{
125
+ requestSchema: z.ZodObject<{
126
+ safeParse: z.ZodCustom<Function, Function>;
127
+ }, z.core.$catchall<z.ZodUnknown>>;
128
+ responseSchema: z.ZodObject<{
129
+ safeParse: z.ZodCustom<Function, Function>;
130
+ }, z.core.$catchall<z.ZodUnknown>>;
131
+ streaming: z.ZodBoolean;
132
+ handler: z.ZodCustom<Function, Function>;
133
+ }, z.core.$catchall<z.ZodUnknown>>>;
134
+ logging: z.ZodOptional<z.ZodObject<{
135
+ module: z.ZodOptional<z.ZodUnknown>;
136
+ namespace: z.ZodOptional<z.ZodString>;
137
+ }, z.core.$catchall<z.ZodUnknown>>>;
138
+ }, z.core.$catchall<z.ZodUnknown>>;
139
+ /**
140
+ * LLM text completion plugin (llama.cpp).
141
+ * Provides: completion, streaming chat, tool calling.
142
+ */
143
+ export declare const PLUGIN_LLM: "@qvac/sdk/llamacpp-completion/plugin";
144
+ /**
145
+ * Text embedding plugin (llama.cpp).
146
+ * Provides: vector embeddings for RAG and semantic search.
147
+ */
148
+ export declare const PLUGIN_EMBEDDING: "@qvac/sdk/llamacpp-embedding/plugin";
149
+ /**
150
+ * Speech-to-text transcription plugin (whisper.cpp).
151
+ * Provides: audio transcription, language detection.
152
+ */
153
+ export declare const PLUGIN_WHISPER: "@qvac/sdk/whispercpp-transcription/plugin";
154
+ /**
155
+ * Neural machine translation plugin (nmt.cpp).
156
+ * Provides: text translation between languages.
157
+ */
158
+ export declare const PLUGIN_NMT: "@qvac/sdk/nmtcpp-translation/plugin";
159
+ /**
160
+ * Text-to-speech synthesis plugin (ONNX).
161
+ * Provides: speech synthesis from text.
162
+ */
163
+ export declare const PLUGIN_TTS: "@qvac/sdk/onnx-tts/plugin";
164
+ /**
165
+ * Optical character recognition plugin (ONNX).
166
+ * Provides: text extraction from images.
167
+ */
168
+ export declare const PLUGIN_OCR: "@qvac/sdk/onnx-ocr/plugin";
169
+ /**
170
+ * All built-in SDK plugins.
171
+ *
172
+ * @example
173
+ * // Use all defaults plus a custom plugin:
174
+ * const config = {
175
+ * plugins: [...SDK_DEFAULT_PLUGINS, myCustomPlugin],
176
+ * };
177
+ */
178
+ export declare const SDK_DEFAULT_PLUGINS: readonly ["@qvac/sdk/llamacpp-completion/plugin", "@qvac/sdk/llamacpp-embedding/plugin", "@qvac/sdk/whispercpp-transcription/plugin", "@qvac/sdk/nmtcpp-translation/plugin", "@qvac/sdk/onnx-tts/plugin", "@qvac/sdk/onnx-ocr/plugin"];
179
+ export type BuiltinPlugin = (typeof SDK_DEFAULT_PLUGINS)[number];
180
+ //# sourceMappingURL=plugin.d.ts.map