@qvac/sdk 0.10.2 → 0.12.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 (326) hide show
  1. package/NOTICE +1455 -29
  2. package/README.md +2 -0
  3. package/dist/client/api/cancel.d.ts +24 -32
  4. package/dist/client/api/cancel.js +58 -31
  5. package/dist/client/api/classify.d.ts +23 -0
  6. package/dist/client/api/classify.js +43 -0
  7. package/dist/client/api/client-request-id.d.ts +17 -0
  8. package/dist/client/api/client-request-id.js +27 -0
  9. package/dist/client/api/completion-stream.d.ts +1 -1
  10. package/dist/client/api/completion-stream.js +34 -3
  11. package/dist/client/api/diffusion.d.ts +46 -0
  12. package/dist/client/api/diffusion.js +50 -1
  13. package/dist/client/api/download-asset.d.ts +12 -2
  14. package/dist/client/api/download-asset.js +21 -3
  15. package/dist/client/api/embed.d.ts +8 -4
  16. package/dist/client/api/embed.js +14 -1
  17. package/dist/client/api/get-model-info.d.ts +1 -1
  18. package/dist/client/api/index.d.ts +5 -0
  19. package/dist/client/api/index.js +5 -0
  20. package/dist/client/api/load-model.d.ts +12 -4
  21. package/dist/client/api/load-model.js +49 -2
  22. package/dist/client/api/rag.d.ts +9 -3
  23. package/dist/client/api/rag.js +23 -3
  24. package/dist/client/api/transcribe.d.ts +23 -8
  25. package/dist/client/api/transcribe.js +69 -4
  26. package/dist/client/api/unload-model.d.ts +5 -2
  27. package/dist/client/api/unload-model.js +9 -4
  28. package/dist/client/api/upscale.d.ts +45 -0
  29. package/dist/client/api/upscale.js +99 -0
  30. package/dist/client/api/video.d.ts +64 -0
  31. package/dist/client/api/video.js +147 -0
  32. package/dist/client/api/vla-helpers.d.ts +45 -0
  33. package/dist/client/api/vla-helpers.js +130 -0
  34. package/dist/client/api/vla.d.ts +65 -0
  35. package/dist/client/api/vla.js +109 -0
  36. package/dist/client/config-loader/resolve-config.node.d.ts +16 -0
  37. package/dist/client/config-loader/resolve-config.node.js +77 -23
  38. package/dist/client/plugins-factory.d.ts +8 -0
  39. package/dist/client/plugins-factory.js +10 -0
  40. package/dist/client/rpc/bare-client.js +62 -66
  41. package/dist/client/rpc/ensure-worker-ready.d.ts +9 -0
  42. package/dist/client/rpc/ensure-worker-ready.js +17 -0
  43. package/dist/client/rpc/expo-rpc-client.js +2 -1
  44. package/dist/client/rpc/node-rpc-client.js +22 -8
  45. package/dist/client/rpc/rpc-client.d.ts +2 -2
  46. package/dist/client/rpc/rpc-client.js +10 -4
  47. package/dist/client/rpc/rpc-error.d.ts +9 -0
  48. package/dist/client/rpc/rpc-error.js +105 -0
  49. package/dist/commands/bundle/bare-pack.d.ts +13 -0
  50. package/dist/commands/bundle/bare-pack.js +54 -0
  51. package/dist/commands/bundle/constants.d.ts +7 -0
  52. package/dist/commands/bundle/constants.js +23 -0
  53. package/dist/commands/bundle/entry-gen.d.ts +2 -0
  54. package/dist/commands/bundle/entry-gen.js +48 -0
  55. package/dist/commands/bundle/index.d.ts +20 -0
  56. package/dist/commands/bundle/index.js +141 -0
  57. package/dist/commands/bundle/manifest.d.ts +21 -0
  58. package/dist/commands/bundle/manifest.js +193 -0
  59. package/dist/commands/bundle/plugins.d.ts +9 -0
  60. package/dist/commands/bundle/plugins.js +51 -0
  61. package/dist/commands/index.d.ts +5 -0
  62. package/dist/commands/index.js +2 -0
  63. package/dist/commands/verify/abi.d.ts +52 -0
  64. package/dist/commands/verify/abi.js +125 -0
  65. package/dist/commands/verify/addon-source.d.ts +43 -0
  66. package/dist/commands/verify/addon-source.js +75 -0
  67. package/dist/commands/verify/bundle-source.d.ts +12 -0
  68. package/dist/commands/verify/bundle-source.js +53 -0
  69. package/dist/commands/verify/index.d.ts +59 -0
  70. package/dist/commands/verify/index.js +371 -0
  71. package/dist/commands/verify/node-modules-source.d.ts +11 -0
  72. package/dist/commands/verify/node-modules-source.js +76 -0
  73. package/dist/commands/verify/prebuilds.d.ts +15 -0
  74. package/dist/commands/verify/prebuilds.js +39 -0
  75. package/dist/examples/cancel-by-request-id.d.ts +38 -0
  76. package/dist/examples/cancel-by-request-id.js +103 -0
  77. package/dist/examples/classification/classify-image.d.ts +2 -0
  78. package/dist/examples/classification/classify-image.js +23 -0
  79. package/dist/examples/diffusion-esrgan-upscale.d.ts +2 -0
  80. package/dist/examples/diffusion-esrgan-upscale.js +78 -0
  81. package/dist/examples/diffusion-txt2vid.d.ts +2 -0
  82. package/dist/examples/diffusion-txt2vid.js +81 -0
  83. package/dist/examples/download-with-cancel.js +10 -10
  84. package/dist/examples/embed-multi-gpu.d.ts +2 -0
  85. package/dist/examples/embed-multi-gpu.js +46 -0
  86. package/dist/examples/llamacpp-multi-gpu.d.ts +2 -0
  87. package/dist/examples/llamacpp-multi-gpu.js +57 -0
  88. package/dist/examples/plugins.js +3 -7
  89. package/dist/examples/rag/rag-hyperdb/cancellation.js +20 -17
  90. package/dist/examples/tools/llamacpp-tools-gemma4.d.ts +2 -0
  91. package/dist/examples/tools/llamacpp-tools-gemma4.js +73 -0
  92. package/dist/examples/tools/llamacpp-tools-qwen35.d.ts +2 -0
  93. package/dist/examples/tools/llamacpp-tools-qwen35.js +69 -0
  94. package/dist/examples/transcription/parakeet-ctc-filesystem.js +18 -12
  95. package/dist/examples/transcription/parakeet-microphone-record.js +7 -12
  96. package/dist/examples/transcription/parakeet-microphone-stream.d.ts +2 -0
  97. package/dist/examples/transcription/parakeet-microphone-stream.js +79 -0
  98. package/dist/examples/transcription/parakeet-sortformer-streaming.d.ts +2 -0
  99. package/dist/examples/transcription/parakeet-sortformer-streaming.js +121 -0
  100. package/dist/examples/transcription/parakeet-sortformer.js +58 -55
  101. package/dist/examples/transcription/parakeet-tdt-filesystem.js +18 -15
  102. package/dist/examples/transcription/whispercpp-microphone-conversation.d.ts +2 -0
  103. package/dist/examples/transcription/whispercpp-microphone-conversation.js +107 -0
  104. package/dist/examples/tts/chatterbox.js +7 -16
  105. package/dist/examples/tts/llm-to-tts-streaming.js +3 -10
  106. package/dist/examples/tts/supertonic-multilingual.js +4 -12
  107. package/dist/examples/tts/supertonic.js +5 -12
  108. package/dist/examples/vla-smolvla.d.ts +2 -0
  109. package/dist/examples/vla-smolvla.js +75 -0
  110. package/dist/examples/voice-assistant/voice-assistant.js +3 -10
  111. package/dist/expo/plugins/find-in-ancestor-node-modules.d.ts +14 -0
  112. package/dist/expo/plugins/find-in-ancestor-node-modules.js +24 -0
  113. package/dist/expo/plugins/get-project-root.d.ts +22 -0
  114. package/dist/expo/plugins/get-project-root.js +23 -0
  115. package/dist/expo/plugins/index.d.ts +4 -0
  116. package/dist/expo/plugins/index.js +4 -0
  117. package/dist/expo/plugins/resolve-sdk-package-dir.d.ts +9 -2
  118. package/dist/expo/plugins/resolve-sdk-package-dir.js +38 -11
  119. package/dist/expo/plugins/withDeviceInfo.js +2 -1
  120. package/dist/expo/plugins/withMobileBundle.d.ts +5 -4
  121. package/dist/expo/plugins/withMobileBundle.js +42 -58
  122. package/dist/index.d.ts +6 -2
  123. package/dist/index.js +23 -2
  124. package/dist/models/registry/models.d.ts +3725 -514
  125. package/dist/models/registry/models.js +7269 -3910
  126. package/dist/models/update-models/naming.js +22 -8
  127. package/dist/pear/pre.d.ts +3 -0
  128. package/dist/pear/pre.js +9 -2
  129. package/dist/schemas/cancel.d.ts +172 -28
  130. package/dist/schemas/cancel.js +120 -19
  131. package/dist/schemas/classification.d.ts +53 -0
  132. package/dist/schemas/classification.js +33 -0
  133. package/dist/schemas/common.d.ts +860 -1379
  134. package/dist/schemas/common.js +8 -1
  135. package/dist/schemas/completion-event.d.ts +17 -0
  136. package/dist/schemas/completion-event.js +12 -1
  137. package/dist/schemas/completion-stream.d.ts +16 -1
  138. package/dist/schemas/completion-stream.js +25 -7
  139. package/dist/schemas/download-asset.d.ts +25 -9
  140. package/dist/schemas/download-asset.js +17 -6
  141. package/dist/schemas/embed.d.ts +1 -0
  142. package/dist/schemas/embed.js +5 -0
  143. package/dist/schemas/engine-addon-map.d.ts +3 -0
  144. package/dist/schemas/engine-addon-map.js +18 -5
  145. package/dist/schemas/error.d.ts +31 -0
  146. package/dist/schemas/error.js +29 -1
  147. package/dist/schemas/finetune.d.ts +2 -0
  148. package/dist/schemas/finetune.js +5 -0
  149. package/dist/schemas/get-model-info.d.ts +10 -6
  150. package/dist/schemas/get-model-info.js +2 -0
  151. package/dist/schemas/index.d.ts +3 -0
  152. package/dist/schemas/index.js +3 -0
  153. package/dist/schemas/llamacpp-config.d.ts +64 -8
  154. package/dist/schemas/llamacpp-config.js +12 -0
  155. package/dist/schemas/load-model.d.ts +4644 -8605
  156. package/dist/schemas/load-model.js +90 -7
  157. package/dist/schemas/model-src-utils.d.ts +34 -14
  158. package/dist/schemas/model-types.d.ts +54 -14
  159. package/dist/schemas/model-types.js +28 -5
  160. package/dist/schemas/ocr.d.ts +8 -3
  161. package/dist/schemas/plugin.d.ts +60 -6
  162. package/dist/schemas/plugin.js +31 -5
  163. package/dist/schemas/rag.d.ts +9 -0
  164. package/dist/schemas/rag.js +17 -9
  165. package/dist/schemas/registry.d.ts +74 -30
  166. package/dist/schemas/registry.js +5 -0
  167. package/dist/schemas/reload-config.d.ts +34 -14
  168. package/dist/schemas/sdcpp-config.d.ts +445 -16
  169. package/dist/schemas/sdcpp-config.js +387 -26
  170. package/dist/schemas/sdk-config.d.ts +2431 -2723
  171. package/dist/schemas/sdk-config.js +16 -1
  172. package/dist/schemas/sdk-errors-client.d.ts +6 -0
  173. package/dist/schemas/sdk-errors-client.js +31 -1
  174. package/dist/schemas/sdk-errors-server.d.ts +8 -1
  175. package/dist/schemas/sdk-errors-server.js +45 -5
  176. package/dist/schemas/text-to-speech.d.ts +81 -698
  177. package/dist/schemas/text-to-speech.js +46 -19
  178. package/dist/schemas/transcription-config.d.ts +40 -229
  179. package/dist/schemas/transcription-config.js +76 -15
  180. package/dist/schemas/transcription.d.ts +108 -2
  181. package/dist/schemas/transcription.js +81 -0
  182. package/dist/schemas/translate.d.ts +2 -0
  183. package/dist/schemas/translate.js +13 -2
  184. package/dist/schemas/translation-config.d.ts +90 -40
  185. package/dist/schemas/unload-model.d.ts +2 -1
  186. package/dist/schemas/unload-model.js +4 -1
  187. package/dist/schemas/vla.d.ts +87 -0
  188. package/dist/schemas/vla.js +108 -0
  189. package/dist/scripts/run-unit-tests.js +22 -3
  190. package/dist/server/bare/ops/cancel.d.ts +27 -1
  191. package/dist/server/bare/ops/cancel.js +36 -10
  192. package/dist/server/bare/ops/embed.d.ts +3 -3
  193. package/dist/server/bare/ops/embed.js +144 -28
  194. package/dist/server/bare/ops/kv-cache-utils.d.ts +0 -7
  195. package/dist/server/bare/ops/kv-cache-utils.js +8 -47
  196. package/dist/server/bare/ops/transcribe.d.ts +11 -5
  197. package/dist/server/bare/ops/transcribe.js +230 -50
  198. package/dist/server/bare/ops/translate.d.ts +1 -1
  199. package/dist/server/bare/ops/translate.js +197 -88
  200. package/dist/server/bare/plugins/ggml-classification/ops/classify.d.ts +6 -0
  201. package/dist/server/bare/plugins/ggml-classification/ops/classify.js +30 -0
  202. package/dist/server/bare/plugins/ggml-classification/plugin.d.ts +32 -0
  203. package/dist/server/bare/plugins/ggml-classification/plugin.js +55 -0
  204. package/dist/server/bare/plugins/ggml-vla/ops/vla-hparams.d.ts +3 -0
  205. package/dist/server/bare/plugins/ggml-vla/ops/vla-hparams.js +12 -0
  206. package/dist/server/bare/plugins/ggml-vla/ops/vla-run.d.ts +3 -0
  207. package/dist/server/bare/plugins/ggml-vla/ops/vla-run.js +75 -0
  208. package/dist/server/bare/plugins/ggml-vla/plugin.d.ts +54 -0
  209. package/dist/server/bare/plugins/ggml-vla/plugin.js +57 -0
  210. package/dist/server/bare/plugins/index.d.ts +3 -1
  211. package/dist/server/bare/plugins/index.js +3 -1
  212. package/dist/server/bare/plugins/llamacpp-completion/ops/completion-stream.d.ts +12 -3
  213. package/dist/server/bare/plugins/llamacpp-completion/ops/completion-stream.js +173 -172
  214. package/dist/server/bare/plugins/llamacpp-completion/ops/context-overflow.d.ts +29 -0
  215. package/dist/server/bare/plugins/llamacpp-completion/ops/context-overflow.js +65 -0
  216. package/dist/server/bare/plugins/llamacpp-completion/ops/finetune.js +125 -21
  217. package/dist/server/bare/plugins/llamacpp-completion/ops/kv-cache-session.d.ts +154 -0
  218. package/dist/server/bare/plugins/llamacpp-completion/ops/kv-cache-session.js +448 -0
  219. package/dist/server/bare/plugins/llamacpp-completion/ops/kv-cache-state.d.ts +21 -73
  220. package/dist/server/bare/plugins/llamacpp-completion/ops/kv-cache-state.js +18 -101
  221. package/dist/server/bare/plugins/llamacpp-completion/plugin.d.ts +36 -3
  222. package/dist/server/bare/plugins/llamacpp-completion/plugin.js +183 -85
  223. package/dist/server/bare/plugins/llamacpp-completion/transform.d.ts +10 -0
  224. package/dist/server/bare/plugins/llamacpp-completion/transform.js +34 -0
  225. package/dist/server/bare/plugins/llamacpp-embedding/plugin.d.ts +7 -0
  226. package/dist/server/bare/plugins/llamacpp-embedding/plugin.js +10 -1
  227. package/dist/server/bare/plugins/nmtcpp-translation/plugin.d.ts +42 -15
  228. package/dist/server/bare/plugins/nmtcpp-translation/plugin.js +5 -1
  229. package/dist/server/bare/plugins/onnx-ocr/plugin.d.ts +8 -3
  230. package/dist/server/bare/plugins/onnx-ocr/plugin.js +3 -0
  231. package/dist/server/bare/plugins/parakeet-transcription/plugin.d.ts +73 -244
  232. package/dist/server/bare/plugins/parakeet-transcription/plugin.js +68 -96
  233. package/dist/server/bare/plugins/sdcpp-generation/ops/diffusion.js +8 -0
  234. package/dist/server/bare/plugins/sdcpp-generation/ops/upscale.d.ts +3 -0
  235. package/dist/server/bare/plugins/sdcpp-generation/ops/upscale.js +40 -0
  236. package/dist/server/bare/plugins/sdcpp-generation/ops/video.d.ts +3 -0
  237. package/dist/server/bare/plugins/sdcpp-generation/ops/video.js +199 -0
  238. package/dist/server/bare/plugins/sdcpp-generation/plugin.d.ts +288 -15
  239. package/dist/server/bare/plugins/sdcpp-generation/plugin.js +150 -7
  240. package/dist/server/bare/plugins/{onnx-tts → tts-ggml}/ops/text-to-speech-stream.js +2 -15
  241. package/dist/server/bare/plugins/{onnx-tts → tts-ggml}/ops/text-to-speech.js +2 -1
  242. package/dist/server/bare/plugins/tts-ggml/plugin.d.ts +75 -0
  243. package/dist/server/bare/plugins/tts-ggml/plugin.js +189 -0
  244. package/dist/server/bare/plugins/whispercpp-transcription/plugin.d.ts +47 -3
  245. package/dist/server/bare/plugins/whispercpp-transcription/plugin.js +61 -14
  246. package/dist/server/bare/rag-hyperdb/index.d.ts +1 -1
  247. package/dist/server/bare/rag-hyperdb/index.js +1 -1
  248. package/dist/server/bare/rag-hyperdb/rag-operation-manager.d.ts +26 -4
  249. package/dist/server/bare/rag-hyperdb/rag-operation-manager.js +65 -28
  250. package/dist/server/bare/registry/model-config-utils.js +7 -0
  251. package/dist/server/bare/runtime/disposable-scope.d.ts +36 -0
  252. package/dist/server/bare/runtime/disposable-scope.js +69 -0
  253. package/dist/server/bare/runtime/index.d.ts +8 -0
  254. package/dist/server/bare/runtime/index.js +3 -0
  255. package/dist/server/bare/runtime/request-context.d.ts +49 -0
  256. package/dist/server/bare/runtime/request-context.js +1 -0
  257. package/dist/server/bare/runtime/request-id.d.ts +12 -0
  258. package/dist/server/bare/runtime/request-id.js +14 -0
  259. package/dist/server/bare/runtime/request-registry-singleton.d.ts +4 -0
  260. package/dist/server/bare/runtime/request-registry-singleton.js +27 -0
  261. package/dist/server/bare/runtime/request-registry.d.ts +136 -0
  262. package/dist/server/bare/runtime/request-registry.js +297 -0
  263. package/dist/server/bare/runtime/with-request-context.d.ts +22 -0
  264. package/dist/server/bare/runtime/with-request-context.js +53 -0
  265. package/dist/server/bare/runtime-lifecycle.js +9 -9
  266. package/dist/server/bare/types/addon-responses.d.ts +12 -1
  267. package/dist/server/env.js +4 -1
  268. package/dist/server/plugins/index.d.ts +1 -1
  269. package/dist/server/plugins/index.js +1 -1
  270. package/dist/server/plugins/registry.d.ts +1 -0
  271. package/dist/server/plugins/registry.js +5 -0
  272. package/dist/server/rpc/handler-registry.js +30 -7
  273. package/dist/server/rpc/handler-selection.d.ts +9 -0
  274. package/dist/server/rpc/handler-selection.js +14 -0
  275. package/dist/server/rpc/handler-utils.js +5 -13
  276. package/dist/server/rpc/handlers/cancel-delegated.js +28 -31
  277. package/dist/server/rpc/handlers/cancelHandler.d.ts +30 -1
  278. package/dist/server/rpc/handlers/cancelHandler.js +54 -22
  279. package/dist/server/rpc/handlers/classify.d.ts +3 -0
  280. package/dist/server/rpc/handlers/classify.js +4 -0
  281. package/dist/server/rpc/handlers/delete-cache.d.ts +9 -0
  282. package/dist/server/rpc/handlers/delete-cache.js +13 -15
  283. package/dist/server/rpc/handlers/download-asset.js +133 -40
  284. package/dist/server/rpc/handlers/index.d.ts +4 -0
  285. package/dist/server/rpc/handlers/index.js +4 -0
  286. package/dist/server/rpc/handlers/load-model/download-manager.d.ts +60 -2
  287. package/dist/server/rpc/handlers/load-model/download-manager.js +141 -8
  288. package/dist/server/rpc/handlers/load-model/handler.js +216 -98
  289. package/dist/server/rpc/handlers/load-model/http.js +3 -3
  290. package/dist/server/rpc/handlers/load-model/hyperdrive.js +1 -1
  291. package/dist/server/rpc/handlers/load-model/registry.js +1 -1
  292. package/dist/server/rpc/handlers/load-model/resolve-session.d.ts +20 -1
  293. package/dist/server/rpc/handlers/load-model/resolve-session.js +6 -5
  294. package/dist/server/rpc/handlers/load-model/resolve.d.ts +3 -2
  295. package/dist/server/rpc/handlers/load-model/resolve.js +18 -6
  296. package/dist/server/rpc/handlers/load-model/types.d.ts +24 -0
  297. package/dist/server/rpc/handlers/rag.js +133 -15
  298. package/dist/server/rpc/handlers/upscale-stream.d.ts +3 -0
  299. package/dist/server/rpc/handlers/upscale-stream.js +4 -0
  300. package/dist/server/rpc/handlers/video-stream.d.ts +3 -0
  301. package/dist/server/rpc/handlers/video-stream.js +4 -0
  302. package/dist/server/rpc/profiling/operation-metrics.js +23 -0
  303. package/dist/server/utils/completion-normalizer.js +8 -0
  304. package/dist/server/utils/config-transform.js +1 -1
  305. package/dist/server/utils/tools/dialect.js +4 -0
  306. package/dist/server/utils/tools/parser.js +16 -1
  307. package/dist/server/utils/tools/parsers/gemma4native.d.ts +4 -0
  308. package/dist/server/utils/tools/parsers/gemma4native.js +60 -0
  309. package/dist/server/utils/tools/parsers/qwen35.d.ts +4 -0
  310. package/dist/server/utils/tools/parsers/qwen35.js +120 -0
  311. package/dist/server/worker.js +14 -11
  312. package/dist/utils/aggregate-events.d.ts +9 -0
  313. package/dist/utils/aggregate-events.js +18 -3
  314. package/dist/utils/decorate-promise.d.ts +34 -0
  315. package/dist/utils/decorate-promise.js +35 -0
  316. package/dist/utils/errors-client.d.ts +18 -0
  317. package/dist/utils/errors-client.js +31 -0
  318. package/dist/utils/errors-server.d.ts +115 -2
  319. package/dist/utils/errors-server.js +148 -3
  320. package/package.json +68 -77
  321. package/dist/server/bare/plugins/onnx-tts/plugin.d.ts +0 -490
  322. package/dist/server/bare/plugins/onnx-tts/plugin.js +0 -266
  323. package/dist/server/bare/plugins/onnx-tts/wav-helper.d.ts +0 -14
  324. package/dist/server/bare/plugins/onnx-tts/wav-helper.js +0 -107
  325. /package/dist/server/bare/plugins/{onnx-tts → tts-ggml}/ops/text-to-speech-stream.d.ts +0 -0
  326. /package/dist/server/bare/plugins/{onnx-tts → tts-ggml}/ops/text-to-speech.d.ts +0 -0
@@ -0,0 +1,30 @@
1
+ import { getModel } from "../../../registry/model-registry.js";
2
+ import { classifyRequestSchema } from "../../../../../schemas/index.js";
3
+ import { nowMs } from "../../../../../profiling/index.js";
4
+ function hasClassify(model) {
5
+ return (typeof model === "object" &&
6
+ model !== null &&
7
+ "classify" in model &&
8
+ typeof model.classify === "function");
9
+ }
10
+ export async function classify(params) {
11
+ const { modelId, image, topK, width, height, channels } = classifyRequestSchema.parse(params);
12
+ const model = getModel(modelId);
13
+ if (!hasClassify(model)) {
14
+ throw new Error("Loaded model does not support classify()");
15
+ }
16
+ const imageBytes = Buffer.from(image, "base64");
17
+ const opts = {};
18
+ if (topK !== undefined)
19
+ opts.topK = topK;
20
+ if (width !== undefined)
21
+ opts.width = width;
22
+ if (height !== undefined)
23
+ opts.height = height;
24
+ if (channels !== undefined)
25
+ opts.channels = channels;
26
+ const modelStart = nowMs();
27
+ const results = await model.classify(imageBytes, opts);
28
+ const modelExecutionMs = nowMs() - modelStart;
29
+ return { results, modelExecutionMs };
30
+ }
@@ -0,0 +1,32 @@
1
+ import { type CreateModelParams, type PluginModelResult } from "../../../../schemas/index";
2
+ export declare const classificationPlugin: {
3
+ modelType: "ggml-classification";
4
+ displayName: string;
5
+ addonPackage: "@qvac/classification-ggml";
6
+ loadConfigSchema: import("zod").ZodObject<{
7
+ modelPath: import("zod").ZodOptional<import("zod").ZodString>;
8
+ topK: import("zod").ZodOptional<import("zod").ZodNumber>;
9
+ nativeLogger: import("zod").ZodOptional<import("zod").ZodBoolean>;
10
+ }, import("zod/v4/core").$strip>;
11
+ skipPrimaryModelPathValidation: true;
12
+ createModel(params: CreateModelParams): PluginModelResult;
13
+ handlers: {
14
+ classify: import("../../../../schemas/index").PluginHandlerDefinition<import("zod").ZodObject<{
15
+ modelId: import("zod").ZodString;
16
+ image: import("zod").ZodString;
17
+ topK: import("zod").ZodOptional<import("zod").ZodNumber>;
18
+ width: import("zod").ZodOptional<import("zod").ZodNumber>;
19
+ height: import("zod").ZodOptional<import("zod").ZodNumber>;
20
+ channels: import("zod").ZodOptional<import("zod").ZodLiteral<3>>;
21
+ type: import("zod").ZodLiteral<"classify">;
22
+ }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
23
+ type: import("zod").ZodLiteral<"classify">;
24
+ results: import("zod").ZodArray<import("zod").ZodObject<{
25
+ label: import("zod").ZodString;
26
+ confidence: import("zod").ZodNumber;
27
+ }, import("zod/v4/core").$strip>>;
28
+ done: import("zod").ZodOptional<import("zod").ZodBoolean>;
29
+ }, import("zod/v4/core").$strip>>;
30
+ };
31
+ };
32
+ //# sourceMappingURL=plugin.d.ts.map
@@ -0,0 +1,55 @@
1
+ import ImageClassifier from "@qvac/classification-ggml";
2
+ import { definePlugin, defineHandler, classifyRequestSchema, classifyResponseSchema, ModelType, classificationConfigSchema, ADDON_CLASSIFICATION, } from "../../../../schemas/index.js";
3
+ import { createStreamLogger, registerAddonLogger } from "../../../../logging/index.js";
4
+ import { classify } from "./ops/classify.js";
5
+ export const classificationPlugin = definePlugin({
6
+ modelType: ModelType.ggmlClassification,
7
+ displayName: "Image Classification (GGML)",
8
+ addonPackage: ADDON_CLASSIFICATION,
9
+ loadConfigSchema: classificationConfigSchema,
10
+ skipPrimaryModelPathValidation: true,
11
+ createModel(params) {
12
+ const config = (params.modelConfig ?? {});
13
+ const resolvedModelPath = config.modelPath ?? (params.modelPath || undefined);
14
+ const logger = createStreamLogger(params.modelId, ModelType.ggmlClassification);
15
+ registerAddonLogger(params.modelId, ModelType.ggmlClassification, logger);
16
+ const inner = new ImageClassifier({
17
+ ...(resolvedModelPath ? { modelPath: resolvedModelPath } : {}),
18
+ logger,
19
+ nativeLogger: config.nativeLogger ?? false,
20
+ });
21
+ // Apply the load-time `topK` as a default for classify() calls so the
22
+ // load-config field is not silently ignored. Per-request `topK` (passed
23
+ // in the second arg) wins via the `...opts` spread.
24
+ const defaultTopK = config.topK;
25
+ const model = {
26
+ load: () => inner.load(),
27
+ classify: (image, opts = {}) => inner.classify(image, {
28
+ ...(defaultTopK !== undefined && { topK: defaultTopK }),
29
+ ...opts,
30
+ }),
31
+ unload: () => inner.unload(),
32
+ };
33
+ return { model };
34
+ },
35
+ handlers: {
36
+ classify: defineHandler({
37
+ requestSchema: classifyRequestSchema,
38
+ responseSchema: classifyResponseSchema,
39
+ streaming: true,
40
+ // Classification is a single forward pass with no addon-side cancel
41
+ // surface — mirrors `ocr`/`tts`/`upscale`. The yield-once handler
42
+ // can't be interrupted partway, so we declare scope:"none".
43
+ cancel: { scope: "none" },
44
+ handler: async function* (request) {
45
+ const { results, modelExecutionMs } = await classify(request);
46
+ yield {
47
+ type: "classify",
48
+ results,
49
+ done: true,
50
+ modelExecutionMs,
51
+ };
52
+ },
53
+ }),
54
+ },
55
+ });
@@ -0,0 +1,3 @@
1
+ import { type VlaHparamsRequest, type VlaHparamsResponse } from "../../../../../schemas/index";
2
+ export declare function vlaGetHparams(request: VlaHparamsRequest): Promise<VlaHparamsResponse>;
3
+ //# sourceMappingURL=vla-hparams.d.ts.map
@@ -0,0 +1,12 @@
1
+ import { getModel } from "../../../registry/model-registry.js";
2
+ import { vlaHparamsSchema, } from "../../../../../schemas/index.js";
3
+ export function vlaGetHparams(request) {
4
+ const model = getModel(request.modelId);
5
+ // Validate the addon-reported hparams against our schema so the wire
6
+ // shape stays consistent even if the underlying addon changes.
7
+ const parsed = vlaHparamsSchema.parse(model.hparams);
8
+ return Promise.resolve({
9
+ hparams: parsed,
10
+ backendName: model.backendName ?? null,
11
+ });
12
+ }
@@ -0,0 +1,3 @@
1
+ import { type VlaRunRequest, type VlaRunResponse } from "../../../../../schemas/index";
2
+ export declare function vlaRun(request: VlaRunRequest): Promise<VlaRunResponse>;
3
+ //# sourceMappingURL=vla-run.d.ts.map
@@ -0,0 +1,75 @@
1
+ import { getModel } from "../../../registry/model-registry.js";
2
+ import {} from "../../../../../schemas/index.js";
3
+ import { decodeBase64, encodeBase64 } from "../../../../../utils/encoding.js";
4
+ function f32FromBase64(b64) {
5
+ const bytes = decodeBase64(b64);
6
+ // ArrayBuffer view must be aligned; copy if needed.
7
+ if (bytes.byteOffset === 0 && bytes.byteLength === bytes.buffer.byteLength) {
8
+ return new Float32Array(bytes.buffer);
9
+ }
10
+ const copy = new Uint8Array(bytes.byteLength);
11
+ copy.set(bytes);
12
+ return new Float32Array(copy.buffer);
13
+ }
14
+ function i32FromBase64(b64) {
15
+ const bytes = decodeBase64(b64);
16
+ if (bytes.byteOffset === 0 && bytes.byteLength === bytes.buffer.byteLength) {
17
+ return new Int32Array(bytes.buffer);
18
+ }
19
+ const copy = new Uint8Array(bytes.byteLength);
20
+ copy.set(bytes);
21
+ return new Int32Array(copy.buffer);
22
+ }
23
+ function u8FromBase64(b64) {
24
+ return decodeBase64(b64);
25
+ }
26
+ function f32ToBase64(arr) {
27
+ return encodeBase64(new Uint8Array(arr.buffer, arr.byteOffset, arr.byteLength));
28
+ }
29
+ function pickStats(raw) {
30
+ if (!raw || typeof raw !== "object")
31
+ return undefined;
32
+ const r = raw;
33
+ const out = {};
34
+ if (typeof r["vision_ms"] === "number")
35
+ out.vision_ms = r["vision_ms"];
36
+ if (typeof r["smollm2_compute_ms"] === "number")
37
+ out.smollm2_compute_ms = r["smollm2_compute_ms"];
38
+ if (typeof r["smollm2_total_ms"] === "number")
39
+ out.smollm2_total_ms = r["smollm2_total_ms"];
40
+ if (typeof r["ode_ms"] === "number")
41
+ out.ode_ms = r["ode_ms"];
42
+ if (typeof r["total_ms"] === "number")
43
+ out.total_ms = r["total_ms"];
44
+ if (typeof r["backendDevice"] === "number")
45
+ out.backendDevice = r["backendDevice"];
46
+ return Object.keys(out).length > 0 ? out : undefined;
47
+ }
48
+ export async function vlaRun(request) {
49
+ const model = getModel(request.modelId);
50
+ const images = request.images.map(f32FromBase64);
51
+ const state = f32FromBase64(request.state);
52
+ const tokens = i32FromBase64(request.tokens);
53
+ const mask = u8FromBase64(request.mask);
54
+ const noise = request.noise ? f32FromBase64(request.noise) : undefined;
55
+ const response = await model.run({
56
+ images,
57
+ imgWidth: request.imgWidth,
58
+ imgHeight: request.imgHeight,
59
+ state,
60
+ tokens,
61
+ mask,
62
+ ...(noise && { noise }),
63
+ });
64
+ const result = await response.await();
65
+ const hp = model.hparams;
66
+ if (!hp) {
67
+ throw new Error("VLA model hparams unavailable after run");
68
+ }
69
+ return {
70
+ actions: f32ToBase64(result.actions),
71
+ actionDim: hp.actionDim,
72
+ chunkSize: hp.chunkSize,
73
+ ...(pickStats(result.stats) && { stats: pickStats(result.stats) }),
74
+ };
75
+ }
@@ -0,0 +1,54 @@
1
+ import { type CreateModelParams, type PluginModelResult } from "../../../../schemas/index";
2
+ export declare const vlaPlugin: {
3
+ modelType: "ggml-vla";
4
+ displayName: string;
5
+ addonPackage: "@qvac/vla-ggml";
6
+ loadConfigSchema: import("zod").ZodObject<{
7
+ backend: import("zod").ZodOptional<import("zod").ZodEnum<{
8
+ cpu: "cpu";
9
+ auto: "auto";
10
+ }>>;
11
+ verbosity: import("zod").ZodOptional<import("zod").ZodNumber>;
12
+ }, import("zod/v4/core").$strip>;
13
+ createModel(params: CreateModelParams): PluginModelResult;
14
+ handlers: {
15
+ vlaRun: import("../../../../schemas/index").PluginHandlerDefinition<import("zod").ZodObject<{
16
+ type: import("zod").ZodLiteral<"vlaRun">;
17
+ modelId: import("zod").ZodString;
18
+ images: import("zod").ZodArray<import("zod").ZodString>;
19
+ imgWidth: import("zod").ZodNumber;
20
+ imgHeight: import("zod").ZodNumber;
21
+ state: import("zod").ZodString;
22
+ tokens: import("zod").ZodString;
23
+ mask: import("zod").ZodString;
24
+ noise: import("zod").ZodOptional<import("zod").ZodString>;
25
+ }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
26
+ actions: import("zod").ZodString;
27
+ actionDim: import("zod").ZodNumber;
28
+ chunkSize: import("zod").ZodNumber;
29
+ stats: import("zod").ZodOptional<import("zod").ZodObject<{
30
+ vision_ms: import("zod").ZodOptional<import("zod").ZodNumber>;
31
+ smollm2_compute_ms: import("zod").ZodOptional<import("zod").ZodNumber>;
32
+ smollm2_total_ms: import("zod").ZodOptional<import("zod").ZodNumber>;
33
+ ode_ms: import("zod").ZodOptional<import("zod").ZodNumber>;
34
+ total_ms: import("zod").ZodOptional<import("zod").ZodNumber>;
35
+ backendDevice: import("zod").ZodOptional<import("zod").ZodNumber>;
36
+ }, import("zod/v4/core").$strip>>;
37
+ }, import("zod/v4/core").$strip>>;
38
+ vlaHparams: import("../../../../schemas/index").PluginHandlerDefinition<import("zod").ZodObject<{
39
+ type: import("zod").ZodLiteral<"vlaHparams">;
40
+ modelId: import("zod").ZodString;
41
+ }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
42
+ hparams: import("zod").ZodObject<{
43
+ chunkSize: import("zod").ZodNumber;
44
+ actionDim: import("zod").ZodNumber;
45
+ maxActionDim: import("zod").ZodNumber;
46
+ maxStateDim: import("zod").ZodNumber;
47
+ tokenizerMaxLength: import("zod").ZodNumber;
48
+ visionImageSize: import("zod").ZodNumber;
49
+ }, import("zod/v4/core").$strip>;
50
+ backendName: import("zod").ZodNullable<import("zod").ZodString>;
51
+ }, import("zod/v4/core").$strip>>;
52
+ };
53
+ };
54
+ //# sourceMappingURL=plugin.d.ts.map
@@ -0,0 +1,57 @@
1
+ import { VlaModel } from "@qvac/vla-ggml";
2
+ import { definePlugin, defineHandler, vlaConfigSchema, vlaRunRequestSchema, vlaRunResponseSchema, vlaHparamsRequestSchema, vlaHparamsResponseSchema, ModelType, ADDON_VLA, } from "../../../../schemas/index.js";
3
+ import { createStreamLogger, registerAddonLogger } from "../../../../logging/index.js";
4
+ import { vlaRun } from "./ops/vla-run.js";
5
+ import { vlaGetHparams } from "./ops/vla-hparams.js";
6
+ // The `@qvac/vla-ggml` VlaModel exposes `load({ backend })` rather than the
7
+ // `load(force?)` signature `PluginModel` expects. Wrap it so the plugin
8
+ // framework can call `load()` and have the configured backend flow through.
9
+ function wrapVlaModel(inner, loadOpts) {
10
+ const wrapper = inner;
11
+ const originalLoad = wrapper.load.bind(wrapper);
12
+ wrapper.load = function load() {
13
+ return originalLoad(loadOpts);
14
+ };
15
+ return wrapper;
16
+ }
17
+ export const vlaPlugin = definePlugin({
18
+ modelType: ModelType.ggmlVla,
19
+ displayName: "VLA (SmolVLA ggml)",
20
+ addonPackage: ADDON_VLA,
21
+ loadConfigSchema: vlaConfigSchema,
22
+ createModel(params) {
23
+ const config = (params.modelConfig ?? {});
24
+ const logger = createStreamLogger(params.modelId, ModelType.ggmlVla);
25
+ registerAddonLogger(params.modelId, ModelType.ggmlVla, logger);
26
+ const inner = new VlaModel({
27
+ files: { model: [params.modelPath] },
28
+ ...(config.verbosity !== undefined && {
29
+ config: { verbosity: config.verbosity },
30
+ }),
31
+ logger,
32
+ opts: { stats: true },
33
+ });
34
+ const backend = config.backend ?? "auto";
35
+ const model = wrapVlaModel(inner, { backend });
36
+ return { model };
37
+ },
38
+ handlers: {
39
+ vlaRun: defineHandler({
40
+ requestSchema: vlaRunRequestSchema,
41
+ responseSchema: vlaRunResponseSchema,
42
+ streaming: false,
43
+ // The vla-ggml addon exposes a model-wide cancel(): the running ODE /
44
+ // SmolLM2 prefill is interrupted. Mirrors the diffusion plugin's
45
+ // cancel surface.
46
+ cancel: { scope: "model", hard: true },
47
+ handler: vlaRun,
48
+ }),
49
+ vlaHparams: defineHandler({
50
+ requestSchema: vlaHparamsRequestSchema,
51
+ responseSchema: vlaHparamsResponseSchema,
52
+ streaming: false,
53
+ cancel: { scope: "none" },
54
+ handler: vlaGetHparams,
55
+ }),
56
+ },
57
+ });
@@ -3,7 +3,9 @@ export { embeddingsPlugin } from "./llamacpp-embedding/plugin";
3
3
  export { whisperPlugin } from "./whispercpp-transcription/plugin";
4
4
  export { parakeetPlugin } from "./parakeet-transcription/plugin";
5
5
  export { nmtPlugin } from "./nmtcpp-translation/plugin";
6
- export { ttsPlugin } from "./onnx-tts/plugin";
6
+ export { ttsPlugin } from "./tts-ggml/plugin";
7
7
  export { ocrPlugin } from "./onnx-ocr/plugin";
8
8
  export { diffusionPlugin } from "./sdcpp-generation/plugin";
9
+ export { vlaPlugin } from "./ggml-vla/plugin";
10
+ export { classificationPlugin } from "./ggml-classification/plugin";
9
11
  //# sourceMappingURL=index.d.ts.map
@@ -3,6 +3,8 @@ export { embeddingsPlugin } from "./llamacpp-embedding/plugin.js";
3
3
  export { whisperPlugin } from "./whispercpp-transcription/plugin.js";
4
4
  export { parakeetPlugin } from "./parakeet-transcription/plugin.js";
5
5
  export { nmtPlugin } from "./nmtcpp-translation/plugin.js";
6
- export { ttsPlugin } from "./onnx-tts/plugin.js";
6
+ export { ttsPlugin } from "./tts-ggml/plugin.js";
7
7
  export { ocrPlugin } from "./onnx-ocr/plugin.js";
8
8
  export { diffusionPlugin } from "./sdcpp-generation/plugin.js";
9
+ export { vlaPlugin } from "./ggml-vla/plugin.js";
10
+ export { classificationPlugin } from "./ggml-classification/plugin.js";
@@ -1,17 +1,26 @@
1
+ import type { AbortSignal } from "bare-abort-controller";
1
2
  import type { CompletionParams, CompletionStats, GenerationParams, ResponseFormat, Tool, ToolCall, ToolDialect } from "../../../../../schemas/index";
2
- import { noteCancelRequested as noteCancelRequestedFromState } from "./kv-cache-state";
3
+ import type { DisposableScope } from "../../../runtime/disposable-scope";
4
+ import type { Logger } from "../../../../../logging/types";
3
5
  interface CompletionResult {
4
6
  modelExecutionMs: number;
5
7
  stats?: CompletionStats;
6
8
  toolCalls: ToolCall[];
7
9
  }
8
- export declare function clearCachedMessageCounts(prefix?: string): void;
9
- export declare const noteCancelRequested: typeof noteCancelRequestedFromState;
10
10
  export declare function completion(params: CompletionParams & {
11
11
  tools?: Tool[];
12
12
  generationParams?: GenerationParams;
13
13
  toolDialect?: ToolDialect;
14
14
  responseFormat?: ResponseFormat;
15
+ }, opts: {
16
+ signal: AbortSignal;
17
+ scope: DisposableScope;
18
+ /**
19
+ * Request-scoped logger forwarded to `createKvCacheSession` so
20
+ * kv-cache lines share the request's lifecycle prefix. Falls
21
+ * back to the module-level server logger when omitted.
22
+ */
23
+ logger?: Logger;
15
24
  }): AsyncGenerator<{
16
25
  token: string;
17
26
  }, CompletionResult, unknown>;