@qvac/inference 0.23.0 → 0.24.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 (426) hide show
  1. package/NOTICE +60 -28
  2. package/README.md +3 -1
  3. package/dist/api/assess-model-fit.d.ts +14 -14
  4. package/dist/api/assess-model-fit.js +14 -14
  5. package/dist/api/audio-gen.d.ts +2 -2
  6. package/dist/api/audio-gen.js +135 -44
  7. package/dist/api/batch-completion.js +2 -1
  8. package/dist/api/calc-tokens.d.ts +30 -0
  9. package/dist/api/calc-tokens.js +41 -0
  10. package/dist/api/classify.d.ts +5 -2
  11. package/dist/api/classify.js +5 -2
  12. package/dist/api/completion-stream.d.ts +1 -1
  13. package/dist/api/completion-stream.js +2 -1
  14. package/dist/api/delete-cache.d.ts +7 -1
  15. package/dist/api/delete-cache.js +11 -1
  16. package/dist/api/diffusion.d.ts +14 -1
  17. package/dist/api/diffusion.js +14 -1
  18. package/dist/api/embed.d.ts +82 -29
  19. package/dist/api/embed.js +64 -18
  20. package/dist/api/get-model-info.d.ts +1 -1
  21. package/dist/api/index.d.ts +2 -1
  22. package/dist/api/index.js +2 -1
  23. package/dist/api/rag.d.ts +1 -1
  24. package/dist/api/rag.js +1 -1
  25. package/dist/api/registry.d.ts +16 -6
  26. package/dist/api/registry.js +32 -9
  27. package/dist/api/text-to-speech.d.ts +14 -5
  28. package/dist/api/text-to-speech.js +83 -29
  29. package/dist/api/transcribe.d.ts +6 -2
  30. package/dist/api/transcribe.js +7 -1
  31. package/dist/api/vector-index.d.ts +25 -3
  32. package/dist/api/vector-index.js +17 -2
  33. package/dist/api/video-request.d.ts +15 -15
  34. package/dist/dispatch.d.ts +10 -4
  35. package/dist/dispatch.js +65 -15
  36. package/dist/engine.d.ts +1 -1
  37. package/dist/errors/index.d.ts +70 -0
  38. package/dist/errors/index.js +128 -0
  39. package/dist/handlers/assess-model-fit.d.ts +3 -21
  40. package/dist/handlers/assess-model-fit.js +4 -303
  41. package/dist/handlers/cancelHandler.d.ts +10 -9
  42. package/dist/handlers/cancelHandler.js +17 -13
  43. package/dist/handlers/completion-orchestrate.d.ts +14 -2
  44. package/dist/handlers/completion-orchestrate.js +164 -22
  45. package/dist/handlers/delete-cache.d.ts +2 -1
  46. package/dist/handlers/delete-cache.js +6 -1
  47. package/dist/handlers/download-asset.js +11 -4
  48. package/dist/handlers/get-loaded-model-info.js +1 -0
  49. package/dist/handlers/get-model-info.js +71 -2
  50. package/dist/handlers/load-model/coreml-sidecars.d.ts +2 -13
  51. package/dist/handlers/load-model/coreml-sidecars.js +16 -119
  52. package/dist/handlers/load-model/download-lock.d.ts +20 -0
  53. package/dist/handlers/load-model/download-lock.js +213 -0
  54. package/dist/handlers/load-model/download-manager.d.ts +10 -2
  55. package/dist/handlers/load-model/download-manager.js +62 -11
  56. package/dist/handlers/load-model/handler.js +88 -35
  57. package/dist/handlers/load-model/http.js +327 -205
  58. package/dist/handlers/load-model/hyperdrive.d.ts +15 -0
  59. package/dist/handlers/load-model/hyperdrive.js +123 -50
  60. package/dist/handlers/load-model/registry-client-options.d.ts +2 -0
  61. package/dist/handlers/load-model/registry-client-options.js +4 -2
  62. package/dist/handlers/load-model/registry-companion-set.d.ts +5 -0
  63. package/dist/handlers/load-model/registry-companion-set.js +19 -1
  64. package/dist/handlers/load-model/registry-delete.d.ts +5 -0
  65. package/dist/handlers/load-model/registry-delete.js +269 -0
  66. package/dist/handlers/load-model/registry-download-utils.d.ts +4 -2
  67. package/dist/handlers/load-model/registry-download-utils.js +93 -22
  68. package/dist/handlers/load-model/registry.d.ts +20 -0
  69. package/dist/handlers/load-model/registry.js +308 -175
  70. package/dist/handlers/load-model/resolve.js +4 -1
  71. package/dist/handlers/load-model/types.d.ts +2 -0
  72. package/dist/handlers/logging-stream.js +17 -5
  73. package/dist/handlers/plugin-invoke.js +152 -39
  74. package/dist/handlers/registry.d.ts +2 -2
  75. package/dist/handlers/registry.js +105 -28
  76. package/dist/handlers/rpc-server.js +7 -7
  77. package/dist/handlers/session.d.ts +11 -0
  78. package/dist/handlers/session.js +40 -0
  79. package/dist/handlers/unload-model.js +8 -3
  80. package/dist/handlers/vector-index.js +118 -19
  81. package/dist/index.d.ts +1 -1
  82. package/dist/index.js +1 -1
  83. package/dist/logging/utils.js +10 -2
  84. package/dist/model-cache-layout.d.ts +1 -0
  85. package/dist/model-cache-layout.js +2 -0
  86. package/dist/model-fit/assess.d.ts +18 -67
  87. package/dist/model-fit/assess.js +96 -665
  88. package/dist/model-fit/describe.d.ts +12 -0
  89. package/dist/model-fit/describe.js +29 -0
  90. package/dist/model-fit/description/fetch.d.ts +1 -1
  91. package/dist/model-fit/description/fetch.js +95 -16
  92. package/dist/model-fit/description/resolve-load.d.ts +5 -3
  93. package/dist/model-fit/description/resolve-load.js +14 -14
  94. package/dist/model-fit/fit-load.d.ts +23 -0
  95. package/dist/model-fit/fit-load.js +29 -0
  96. package/dist/model-fit/load-check.d.ts +15 -33
  97. package/dist/model-fit/load-check.js +50 -195
  98. package/dist/model-fit/run/engine.d.ts +12 -72
  99. package/dist/model-fit/run/engine.js +4 -8
  100. package/dist/model-fit/run/run.d.ts +10 -7
  101. package/dist/model-fit/run/run.js +22 -18
  102. package/dist/model-fit/sum.d.ts +32 -0
  103. package/dist/model-fit/sum.js +60 -0
  104. package/dist/models/registry/models.d.ts +865 -128
  105. package/dist/models/registry/models.js +3737 -2963
  106. package/dist/plugins/builtin/asr-ggml/config.d.ts +19 -4
  107. package/dist/plugins/builtin/asr-ggml/config.js +39 -3
  108. package/dist/plugins/builtin/asr-ggml/fit.d.ts +18 -0
  109. package/dist/{model-fit/request/engines/asr.js → plugins/builtin/asr-ggml/fit.js} +55 -71
  110. package/dist/plugins/builtin/audiogen-ggml/config.d.ts +6 -0
  111. package/dist/plugins/builtin/audiogen-ggml/config.js +9 -0
  112. package/dist/plugins/builtin/audiogen-ggml/fit.d.ts +3 -0
  113. package/dist/{model-fit/request/engines/audiogen.js → plugins/builtin/audiogen-ggml/fit.js} +28 -18
  114. package/dist/plugins/builtin/audiogen-ggml/ops/audio-edit-stream.d.ts +3 -1
  115. package/dist/plugins/builtin/audiogen-ggml/ops/audio-edit-stream.js +2 -1
  116. package/dist/plugins/builtin/audiogen-ggml/ops/audio-gen-encode.d.ts +17 -0
  117. package/dist/plugins/builtin/audiogen-ggml/ops/audio-gen-encode.js +68 -0
  118. package/dist/plugins/builtin/audiogen-ggml/ops/audio-gen-run.d.ts +11 -3
  119. package/dist/plugins/builtin/audiogen-ggml/ops/audio-gen-run.js +47 -11
  120. package/dist/plugins/builtin/audiogen-ggml/ops/audio-gen-stream.d.ts +3 -1
  121. package/dist/plugins/builtin/audiogen-ggml/ops/audio-gen-stream.js +2 -1
  122. package/dist/plugins/builtin/audiogen-ggml/ops/audio-understand.d.ts +3 -1
  123. package/dist/plugins/builtin/audiogen-ggml/ops/audio-understand.js +2 -1
  124. package/dist/plugins/builtin/audiogen-ggml/plugin.d.ts +143 -18
  125. package/dist/plugins/builtin/audiogen-ggml/plugin.js +13 -1
  126. package/dist/plugins/builtin/bci-whispercpp-transcription/fit.d.ts +3 -0
  127. package/dist/plugins/builtin/bci-whispercpp-transcription/fit.js +22 -0
  128. package/dist/plugins/builtin/bci-whispercpp-transcription/plugin.d.ts +45 -4
  129. package/dist/plugins/builtin/bci-whispercpp-transcription/plugin.js +8 -6
  130. package/dist/plugins/builtin/ggml-classification/plugin.d.ts +4 -1
  131. package/dist/plugins/builtin/ggml-classification/plugin.js +88 -8
  132. package/dist/plugins/builtin/ggml-image-embedding/ops/embed.d.ts +24 -0
  133. package/dist/plugins/builtin/ggml-image-embedding/ops/embed.js +184 -0
  134. package/dist/plugins/builtin/ggml-image-embedding/plugin.d.ts +120 -0
  135. package/dist/plugins/builtin/ggml-image-embedding/plugin.js +39 -0
  136. package/dist/plugins/builtin/ggml-ocr/fit.d.ts +6 -0
  137. package/dist/plugins/builtin/ggml-ocr/fit.js +19 -0
  138. package/dist/plugins/builtin/ggml-ocr/params.d.ts +1 -1
  139. package/dist/plugins/builtin/ggml-ocr/plugin.d.ts +9 -3
  140. package/dist/plugins/builtin/ggml-ocr/plugin.js +107 -21
  141. package/dist/plugins/builtin/ggml-vla/ops/vla-run.d.ts +2 -2
  142. package/dist/plugins/builtin/ggml-vla/ops/vla-run.js +18 -2
  143. package/dist/plugins/builtin/ggml-vla/plugin.d.ts +3 -3
  144. package/dist/plugins/builtin/index.d.ts +1 -0
  145. package/dist/plugins/builtin/index.js +1 -0
  146. package/dist/plugins/builtin/llamacpp-completion/fit.d.ts +3 -0
  147. package/dist/plugins/builtin/llamacpp-completion/fit.js +28 -0
  148. package/dist/plugins/builtin/llamacpp-completion/ops/batch-completion-stream.js +1 -1
  149. package/dist/plugins/builtin/llamacpp-completion/ops/cache-logger.js +15 -4
  150. package/dist/plugins/builtin/llamacpp-completion/ops/calc-tokens.d.ts +2 -0
  151. package/dist/plugins/builtin/llamacpp-completion/ops/calc-tokens.js +32 -0
  152. package/dist/plugins/builtin/llamacpp-completion/ops/completion-stats.d.ts +1 -1
  153. package/dist/plugins/builtin/llamacpp-completion/ops/completion-stream.d.ts +17 -3
  154. package/dist/plugins/builtin/llamacpp-completion/ops/completion-stream.js +61 -5
  155. package/dist/plugins/builtin/llamacpp-completion/ops/finetune.d.ts +5 -4
  156. package/dist/plugins/builtin/llamacpp-completion/ops/finetune.js +54 -19
  157. package/dist/plugins/builtin/llamacpp-completion/plugin.d.ts +148 -19
  158. package/dist/plugins/builtin/llamacpp-completion/plugin.js +26 -9
  159. package/dist/plugins/builtin/llamacpp-decision/ops/decide.d.ts +3 -1
  160. package/dist/plugins/builtin/llamacpp-decision/ops/decide.js +5 -2
  161. package/dist/plugins/builtin/llamacpp-decision/plugin.d.ts +4 -2
  162. package/dist/plugins/builtin/llamacpp-decision/plugin.js +2 -2
  163. package/dist/plugins/builtin/llamacpp-embedding/fit.d.ts +3 -0
  164. package/dist/plugins/builtin/llamacpp-embedding/fit.js +23 -0
  165. package/dist/plugins/builtin/llamacpp-embedding/plugin.d.ts +194 -4
  166. package/dist/plugins/builtin/llamacpp-embedding/plugin.js +37 -11
  167. package/dist/plugins/builtin/llamacpp-embedding/transform.d.ts +2 -2
  168. package/dist/plugins/builtin/llamacpp-embedding/transform.js +23 -2
  169. package/dist/plugins/builtin/llamacpp-rerank/ops/rerank.d.ts +3 -1
  170. package/dist/plugins/builtin/llamacpp-rerank/ops/rerank.js +5 -2
  171. package/dist/plugins/builtin/llamacpp-rerank/plugin.d.ts +6 -5
  172. package/dist/plugins/builtin/llamacpp-rerank/plugin.js +2 -3
  173. package/dist/plugins/builtin/moss-transcribe/plugin.d.ts +30 -3
  174. package/dist/plugins/builtin/moss-transcribe/plugin.js +5 -3
  175. package/dist/plugins/builtin/nmtcpp-translation/fit.d.ts +3 -0
  176. package/dist/plugins/builtin/nmtcpp-translation/fit.js +11 -0
  177. package/dist/plugins/builtin/nmtcpp-translation/plugin.d.ts +14 -5
  178. package/dist/plugins/builtin/nmtcpp-translation/plugin.js +4 -2
  179. package/dist/plugins/builtin/parakeet-transcription/plugin.d.ts +205 -9
  180. package/dist/plugins/builtin/parakeet-transcription/plugin.js +39 -13
  181. package/dist/plugins/builtin/sdcpp-generation/fit.d.ts +3 -0
  182. package/dist/plugins/builtin/sdcpp-generation/fit.js +68 -0
  183. package/dist/plugins/builtin/sdcpp-generation/load-files.d.ts +30 -0
  184. package/dist/plugins/builtin/sdcpp-generation/load-files.js +121 -0
  185. package/dist/plugins/builtin/sdcpp-generation/ops/diffusion.d.ts +4 -1
  186. package/dist/plugins/builtin/sdcpp-generation/ops/diffusion.js +8 -3
  187. package/dist/plugins/builtin/sdcpp-generation/ops/upscale.d.ts +4 -1
  188. package/dist/plugins/builtin/sdcpp-generation/ops/upscale.js +107 -22
  189. package/dist/plugins/builtin/sdcpp-generation/ops/video.d.ts +3 -1
  190. package/dist/plugins/builtin/sdcpp-generation/ops/video.js +4 -1
  191. package/dist/plugins/builtin/sdcpp-generation/ops/world.d.ts +4 -2
  192. package/dist/plugins/builtin/sdcpp-generation/ops/world.js +7 -2
  193. package/dist/plugins/builtin/sdcpp-generation/plugin.d.ts +79 -16
  194. package/dist/plugins/builtin/sdcpp-generation/plugin.js +29 -117
  195. package/dist/plugins/builtin/tts-ggml/fit.d.ts +3 -0
  196. package/dist/plugins/builtin/tts-ggml/fit.js +162 -0
  197. package/dist/plugins/builtin/tts-ggml/ops/cancel-binding.d.ts +2 -1
  198. package/dist/plugins/builtin/tts-ggml/ops/cancel-binding.js +4 -1
  199. package/dist/plugins/builtin/tts-ggml/ops/moss-options.d.ts +1 -1
  200. package/dist/plugins/builtin/tts-ggml/ops/text-to-speech-stream.d.ts +2 -1
  201. package/dist/plugins/builtin/tts-ggml/ops/text-to-speech-stream.js +22 -9
  202. package/dist/plugins/builtin/tts-ggml/ops/text-to-speech.d.ts +2 -1
  203. package/dist/plugins/builtin/tts-ggml/ops/text-to-speech.js +51 -16
  204. package/dist/plugins/builtin/tts-ggml/ops/voice-options.d.ts +50 -0
  205. package/dist/plugins/builtin/tts-ggml/ops/voice-options.js +74 -0
  206. package/dist/plugins/builtin/tts-ggml/plugin.d.ts +368 -25
  207. package/dist/plugins/builtin/tts-ggml/plugin.js +180 -31
  208. package/dist/plugins/builtin/whispercpp-transcription/plugin.d.ts +70 -7
  209. package/dist/plugins/builtin/whispercpp-transcription/plugin.js +8 -6
  210. package/dist/plugins/ops/bci-transcribe.d.ts +5 -4
  211. package/dist/plugins/ops/bci-transcribe.js +18 -4
  212. package/dist/plugins/ops/cancel.d.ts +1 -0
  213. package/dist/plugins/ops/cancel.js +11 -2
  214. package/dist/plugins/ops/embed.d.ts +5 -3
  215. package/dist/plugins/ops/embed.js +89 -34
  216. package/dist/plugins/ops/kv-cache-utils.d.ts +1 -0
  217. package/dist/plugins/ops/kv-cache-utils.js +6 -2
  218. package/dist/plugins/ops/load-model.d.ts +2 -0
  219. package/dist/plugins/ops/load-model.js +33 -16
  220. package/dist/plugins/ops/transcribe.d.ts +5 -4
  221. package/dist/plugins/ops/transcribe.js +62 -27
  222. package/dist/plugins/ops/translate.d.ts +2 -1
  223. package/dist/plugins/ops/translate.js +4 -1
  224. package/dist/plugins/ops/unload-model.d.ts +17 -1
  225. package/dist/plugins/ops/unload-model.js +31 -2
  226. package/dist/plugins/turbovec-backend.d.ts +1 -1
  227. package/dist/plugins/turbovec-backend.js +16 -1
  228. package/dist/profiling/operation-metrics.js +22 -19
  229. package/dist/rag/embedding-scope.d.ts +16 -0
  230. package/dist/rag/embedding-scope.js +81 -0
  231. package/dist/rag/handler.d.ts +25 -0
  232. package/dist/rag/handler.js +50 -16
  233. package/dist/rag/handlers/ingest.js +2 -6
  234. package/dist/rag/handlers/search.d.ts +10 -1
  235. package/dist/rag/handlers/search.js +16 -7
  236. package/dist/rag/rag-operation-manager.d.ts +27 -3
  237. package/dist/rag/rag-operation-manager.js +10 -27
  238. package/dist/registry.js +5 -0
  239. package/dist/resources/collector.d.ts +70 -36
  240. package/dist/resources/collector.js +8 -1
  241. package/dist/resources/types.d.ts +2 -0
  242. package/dist/rpc/inventory.js +1 -12
  243. package/dist/runtime/env.d.ts +5 -1
  244. package/dist/runtime/env.js +6 -21
  245. package/dist/runtime/index.d.ts +4 -1
  246. package/dist/runtime/index.js +2 -0
  247. package/dist/runtime/lifecycle.d.ts +6 -4
  248. package/dist/runtime/lifecycle.js +9 -5
  249. package/dist/runtime/model-config-utils.js +5 -1
  250. package/dist/runtime/model-registry.d.ts +28 -4
  251. package/dist/runtime/model-registry.js +46 -1
  252. package/dist/runtime/model-work-lock.d.ts +13 -0
  253. package/dist/runtime/model-work-lock.js +48 -0
  254. package/dist/runtime/registry-client.d.ts +47 -1
  255. package/dist/runtime/registry-client.js +446 -88
  256. package/dist/runtime/request-context.d.ts +9 -1
  257. package/dist/runtime/request-context.js +25 -1
  258. package/dist/runtime/request-registry.d.ts +55 -7
  259. package/dist/runtime/request-registry.js +189 -71
  260. package/dist/runtime/runtime-lifecycle.js +10 -1
  261. package/dist/runtime/session-id.d.ts +18 -0
  262. package/dist/runtime/session-id.js +20 -0
  263. package/dist/runtime/session-registry.d.ts +39 -0
  264. package/dist/runtime/session-registry.js +114 -0
  265. package/dist/runtime/vector-index-backend.d.ts +4 -0
  266. package/dist/runtime/vector-index-registry.d.ts +21 -0
  267. package/dist/runtime/vector-index-registry.js +56 -18
  268. package/dist/schemas/abort-signal.d.ts +8 -0
  269. package/dist/schemas/abort-signal.js +1 -0
  270. package/dist/schemas/assess-model-fit.d.ts +132 -282
  271. package/dist/schemas/assess-model-fit.js +82 -216
  272. package/dist/schemas/audio-gen.d.ts +278 -24
  273. package/dist/schemas/audio-gen.js +127 -23
  274. package/dist/schemas/batch-completion-stream.d.ts +105 -13
  275. package/dist/schemas/batch-completion-stream.js +8 -4
  276. package/dist/schemas/bci-config.d.ts +2 -1
  277. package/dist/schemas/bci.d.ts +54 -3
  278. package/dist/schemas/bci.js +11 -16
  279. package/dist/schemas/calc-tokens.d.ts +141 -0
  280. package/dist/schemas/calc-tokens.js +53 -0
  281. package/dist/schemas/cancel.d.ts +26 -0
  282. package/dist/schemas/cancel.js +10 -2
  283. package/dist/schemas/classification.d.ts +3 -0
  284. package/dist/schemas/classification.js +6 -2
  285. package/dist/schemas/common.d.ts +1831 -348
  286. package/dist/schemas/common.js +18 -2
  287. package/dist/schemas/completion-event.d.ts +3 -0
  288. package/dist/schemas/completion-event.js +1 -1
  289. package/dist/schemas/completion-stream.d.ts +162 -17
  290. package/dist/schemas/completion-stream.js +83 -13
  291. package/dist/schemas/config.d.ts +1212 -169
  292. package/dist/schemas/config.js +9 -13
  293. package/dist/schemas/decision.d.ts +4 -2
  294. package/dist/schemas/decision.js +2 -1
  295. package/dist/schemas/download-asset.d.ts +10 -5
  296. package/dist/schemas/download-asset.js +3 -6
  297. package/dist/schemas/embed.d.ts +286 -3
  298. package/dist/schemas/embed.js +162 -16
  299. package/dist/schemas/engine-addon-map.d.ts +1 -0
  300. package/dist/schemas/engine-addon-map.js +1 -0
  301. package/dist/schemas/errors.d.ts +12 -0
  302. package/dist/schemas/errors.js +66 -1
  303. package/dist/schemas/finetune.d.ts +14 -4
  304. package/dist/schemas/finetune.js +5 -6
  305. package/dist/schemas/heartbeat.d.ts +1 -0
  306. package/dist/schemas/heartbeat.js +5 -2
  307. package/dist/schemas/image-embedding.d.ts +27 -0
  308. package/dist/schemas/image-embedding.js +107 -0
  309. package/dist/schemas/index.d.ts +7 -3
  310. package/dist/schemas/index.js +7 -3
  311. package/dist/schemas/lifecycle.d.ts +3 -0
  312. package/dist/schemas/lifecycle.js +13 -6
  313. package/dist/schemas/llamacpp-config.d.ts +269 -22
  314. package/dist/schemas/llamacpp-config.js +86 -7
  315. package/dist/schemas/load-model.d.ts +6418 -1960
  316. package/dist/schemas/load-model.js +39 -8
  317. package/dist/schemas/logging-stream.d.ts +1 -0
  318. package/dist/schemas/logging-stream.js +5 -2
  319. package/dist/schemas/model-config-schemas.d.ts +542 -116
  320. package/dist/schemas/model-config-schemas.js +2 -0
  321. package/dist/schemas/model-fit-policy.d.ts +2 -2
  322. package/dist/schemas/model-info.d.ts +54 -56
  323. package/dist/schemas/model-info.js +17 -6
  324. package/dist/schemas/model-ops.d.ts +12 -0
  325. package/dist/schemas/model-ops.js +33 -5
  326. package/dist/schemas/model-src-utils.d.ts +10 -6
  327. package/dist/schemas/model-types.d.ts +8 -4
  328. package/dist/schemas/model-types.js +1 -0
  329. package/dist/schemas/ocr.d.ts +9 -4
  330. package/dist/schemas/ocr.js +6 -2
  331. package/dist/schemas/plugin.d.ts +62 -6
  332. package/dist/schemas/plugin.js +26 -4
  333. package/dist/schemas/profiling.d.ts +32 -32
  334. package/dist/schemas/rag.d.ts +9 -0
  335. package/dist/schemas/rag.js +10 -16
  336. package/dist/schemas/registry.d.ts +30 -10
  337. package/dist/schemas/registry.js +14 -6
  338. package/dist/schemas/reload-config.d.ts +41 -6
  339. package/dist/schemas/reload-config.js +11 -4
  340. package/dist/schemas/request-base.d.ts +39 -0
  341. package/dist/schemas/request-base.js +64 -0
  342. package/dist/schemas/rerank.d.ts +8 -7
  343. package/dist/schemas/rerank.js +6 -4
  344. package/dist/schemas/rpc-server.d.ts +3 -0
  345. package/dist/schemas/rpc-server.js +15 -15
  346. package/dist/schemas/sdcpp-config.d.ts +90 -20
  347. package/dist/schemas/sdcpp-config.js +96 -19
  348. package/dist/schemas/session.d.ts +37 -0
  349. package/dist/schemas/session.js +53 -0
  350. package/dist/schemas/system-resources.d.ts +364 -179
  351. package/dist/schemas/system-resources.js +8 -3
  352. package/dist/schemas/text-to-speech.d.ts +1343 -271
  353. package/dist/schemas/text-to-speech.js +547 -33
  354. package/dist/schemas/tools.d.ts +7 -0
  355. package/dist/schemas/tools.js +29 -0
  356. package/dist/schemas/transcription-config.d.ts +262 -2
  357. package/dist/schemas/transcription-config.js +122 -6
  358. package/dist/schemas/transcription.d.ts +93 -6
  359. package/dist/schemas/transcription.js +98 -21
  360. package/dist/schemas/translate.d.ts +2 -0
  361. package/dist/schemas/translate.js +5 -9
  362. package/dist/schemas/translation-config.d.ts +30 -20
  363. package/dist/schemas/tts-pcm.d.ts +35 -0
  364. package/dist/schemas/tts-pcm.js +69 -0
  365. package/dist/schemas/vector-index.d.ts +47 -1
  366. package/dist/schemas/vector-index.js +37 -10
  367. package/dist/schemas/vla.d.ts +3 -3
  368. package/dist/surface.d.ts +3 -3
  369. package/dist/surface.js +3 -3
  370. package/dist/utils/addon-responses.d.ts +69 -2
  371. package/dist/utils/archive.d.ts +7 -0
  372. package/dist/utils/archive.js +88 -29
  373. package/dist/utils/asr-events.d.ts +5 -0
  374. package/dist/utils/asr-events.js +10 -1
  375. package/dist/utils/cache/auto-history.js +3 -1
  376. package/dist/utils/cache/layout.d.ts +48 -0
  377. package/dist/utils/cache/layout.js +190 -0
  378. package/dist/utils/cache/paths.js +2 -4
  379. package/dist/utils/cache/types.d.ts +2 -1
  380. package/dist/utils/checksum.d.ts +5 -0
  381. package/dist/utils/checksum.js +18 -0
  382. package/dist/utils/completion-normalizer.js +286 -87
  383. package/dist/utils/gguf-tensor-extractor.d.ts +0 -6
  384. package/dist/utils/gguf-tensor-extractor.js +1 -50
  385. package/dist/utils/shard-utils.d.ts +0 -21
  386. package/dist/utils/shard-utils.js +12 -62
  387. package/dist/utils/tool-integration.d.ts +2 -2
  388. package/dist/utils/tools/defer.d.ts +39 -10
  389. package/dist/utils/tools/defer.js +72 -17
  390. package/dist/utils/tools/index.d.ts +1 -1
  391. package/dist/utils/tools/index.js +1 -1
  392. package/dist/utils/transcribe-metadata.d.ts +28 -2
  393. package/dist/utils/transcribe-metadata.js +16 -0
  394. package/dist/utils/tts-stats.d.ts +42 -0
  395. package/dist/utils/tts-stats.js +120 -22
  396. package/package.json +43 -39
  397. package/dist/model-fit/classify.d.ts +0 -6
  398. package/dist/model-fit/classify.js +0 -166
  399. package/dist/model-fit/description/project.d.ts +0 -27
  400. package/dist/model-fit/description/project.js +0 -33
  401. package/dist/model-fit/floor.d.ts +0 -31
  402. package/dist/model-fit/floor.js +0 -65
  403. package/dist/model-fit/kv-cache.d.ts +0 -23
  404. package/dist/model-fit/kv-cache.js +0 -85
  405. package/dist/model-fit/platform.d.ts +0 -14
  406. package/dist/model-fit/platform.js +0 -26
  407. package/dist/model-fit/request/create.d.ts +0 -31
  408. package/dist/model-fit/request/create.js +0 -61
  409. package/dist/model-fit/request/engines/asr.d.ts +0 -14
  410. package/dist/model-fit/request/engines/audiogen.d.ts +0 -8
  411. package/dist/model-fit/request/engines/diffusion.d.ts +0 -7
  412. package/dist/model-fit/request/engines/diffusion.js +0 -93
  413. package/dist/model-fit/request/engines/llama.d.ts +0 -12
  414. package/dist/model-fit/request/engines/llama.js +0 -44
  415. package/dist/model-fit/request/engines/nmt.d.ts +0 -8
  416. package/dist/model-fit/request/engines/nmt.js +0 -11
  417. package/dist/model-fit/request/engines/ocr.d.ts +0 -9
  418. package/dist/model-fit/request/engines/ocr.js +0 -13
  419. package/dist/model-fit/request/engines/tts.d.ts +0 -10
  420. package/dist/model-fit/request/engines/tts.js +0 -152
  421. package/dist/models/registry/resource-profiles.d.ts +0 -17
  422. package/dist/models/registry/resource-profiles.js +0 -5859
  423. package/dist/schemas/model-resource-profile.d.ts +0 -109
  424. package/dist/schemas/model-resource-profile.js +0 -80
  425. /package/dist/model-fit/{request/gpu.d.ts → gpu.d.ts} +0 -0
  426. /package/dist/model-fit/{request/gpu.js → gpu.js} +0 -0
@@ -1,9 +1,10 @@
1
1
  import { z } from 'zod';
2
+ import { trackedRequestSchema } from '../schemas/request-base.js';
2
3
  // ============== Storage vocabulary ==============
3
4
  /**
4
5
  * Storage modes of the native vector index. The `TURBOVEC_*` modes are the
5
6
  * quantised TurboVec formats and require a dimension divisible by 8 and no
6
- * greater than 1024. `F32`, `Q8` and `Q4` are the generic stores of the same
7
+ * greater than 16384. `F32`, `Q8` and `Q4` are the generic stores of the same
7
8
  * addon and accept any dimension. Declared as a name-to-value map, like
8
9
  * `ModelType`, so the contract carries the names for generated clients.
9
10
  */
@@ -67,47 +68,56 @@ export const vectorIndexIdsParamsSchema = z.object({
67
68
  export const vectorIndexWriteParamsSchema = z.object({
68
69
  path: snapshotPathSchema
69
70
  });
71
+ export const vectorIndexSetStagedSearchParamsSchema = z.object({
72
+ enabled: z.boolean()
73
+ });
70
74
  // ============== Requests ==============
71
75
  const vectorIndexTypeField = { type: z.literal('vectorIndex') };
76
+ const vectorIndexRequestFields = { ...vectorIndexTypeField, ...trackedRequestSchema.shape };
72
77
  const handleField = { indexId: indexIdSchema };
73
78
  const vectorIndexCreateRequestSchema = createVectorIndexParamsSchema.extend({
74
- ...vectorIndexTypeField,
79
+ ...vectorIndexRequestFields,
75
80
  operation: z.literal('create')
76
81
  });
77
82
  const vectorIndexLoadRequestSchema = loadVectorIndexParamsSchema.extend({
78
- ...vectorIndexTypeField,
83
+ ...vectorIndexRequestFields,
79
84
  operation: z.literal('load')
80
85
  });
81
86
  const vectorIndexAddRequestSchema = vectorIndexAddParamsSchema.extend({
82
- ...vectorIndexTypeField,
87
+ ...vectorIndexRequestFields,
83
88
  ...handleField,
84
89
  operation: z.literal('add')
85
90
  });
86
91
  const vectorIndexSearchRequestSchema = vectorIndexSearchParamsSchema.extend({
87
- ...vectorIndexTypeField,
92
+ ...vectorIndexRequestFields,
88
93
  ...handleField,
89
94
  operation: z.literal('search')
90
95
  });
91
96
  const vectorIndexRemoveRequestSchema = vectorIndexIdsParamsSchema.extend({
92
- ...vectorIndexTypeField,
97
+ ...vectorIndexRequestFields,
93
98
  ...handleField,
94
99
  operation: z.literal('remove')
95
100
  });
96
101
  const vectorIndexContainsRequestSchema = vectorIndexIdsParamsSchema.extend({
97
- ...vectorIndexTypeField,
102
+ ...vectorIndexRequestFields,
98
103
  ...handleField,
99
104
  operation: z.literal('contains')
100
105
  });
101
106
  const vectorIndexWriteRequestSchema = vectorIndexWriteParamsSchema.extend({
102
- ...vectorIndexTypeField,
107
+ ...vectorIndexRequestFields,
103
108
  ...handleField,
104
109
  operation: z.literal('write')
105
110
  });
106
111
  const vectorIndexDisposeRequestSchema = z.object({
107
- ...vectorIndexTypeField,
112
+ ...vectorIndexRequestFields,
108
113
  ...handleField,
109
114
  operation: z.literal('dispose')
110
115
  });
116
+ const vectorIndexSetStagedSearchRequestSchema = vectorIndexSetStagedSearchParamsSchema.extend({
117
+ ...vectorIndexRequestFields,
118
+ ...handleField,
119
+ operation: z.literal('setStagedSearch')
120
+ });
111
121
  export const vectorIndexRequestSchema = z.discriminatedUnion('operation', [
112
122
  vectorIndexCreateRequestSchema,
113
123
  vectorIndexLoadRequestSchema,
@@ -116,6 +126,7 @@ export const vectorIndexRequestSchema = z.discriminatedUnion('operation', [
116
126
  vectorIndexRemoveRequestSchema,
117
127
  vectorIndexContainsRequestSchema,
118
128
  vectorIndexWriteRequestSchema,
129
+ vectorIndexSetStagedSearchRequestSchema,
119
130
  vectorIndexDisposeRequestSchema
120
131
  ]);
121
132
  // ============== Responses ==============
@@ -123,8 +134,17 @@ export const vectorIndexHitSchema = z.object({
123
134
  id: z.string(),
124
135
  score: z.number()
125
136
  });
126
- const vectorIndexResponseBaseSchema = z.object(vectorIndexTypeField);
137
+ const vectorIndexResponseBaseSchema = z.object({
138
+ ...vectorIndexTypeField,
139
+ requestId: z.string().optional().describe('Identity of the request.')
140
+ });
141
+ // External providers may omit controls introduced after the original contract.
142
+ const vectorIndexStateFields = {
143
+ calibrated: z.boolean().optional(),
144
+ stagedSearch: z.boolean().optional()
145
+ };
127
146
  const vectorIndexCreateResponseSchema = vectorIndexResponseBaseSchema.extend({
147
+ ...vectorIndexStateFields,
128
148
  operation: z.literal('create'),
129
149
  indexId: indexIdSchema,
130
150
  dim: z.number().int().positive(),
@@ -134,6 +154,7 @@ const vectorIndexCreateResponseSchema = vectorIndexResponseBaseSchema.extend({
134
154
  // A loaded snapshot reports its storage only when the backend can derive it;
135
155
  // the native index exposes a bit width, and 4 bits is ambiguous.
136
156
  const vectorIndexLoadResponseSchema = vectorIndexResponseBaseSchema.extend({
157
+ ...vectorIndexStateFields,
137
158
  operation: z.literal('load'),
138
159
  indexId: indexIdSchema,
139
160
  dim: z.number().int().positive(),
@@ -141,6 +162,7 @@ const vectorIndexLoadResponseSchema = vectorIndexResponseBaseSchema.extend({
141
162
  length: lengthSchema
142
163
  });
143
164
  const vectorIndexAddResponseSchema = vectorIndexResponseBaseSchema.extend({
165
+ ...vectorIndexStateFields,
144
166
  operation: z.literal('add'),
145
167
  length: lengthSchema
146
168
  });
@@ -165,6 +187,10 @@ const vectorIndexDisposeResponseSchema = vectorIndexResponseBaseSchema.extend({
165
187
  operation: z.literal('dispose'),
166
188
  disposed: z.boolean()
167
189
  });
190
+ const vectorIndexSetStagedSearchResponseSchema = vectorIndexResponseBaseSchema.extend({
191
+ operation: z.literal('setStagedSearch'),
192
+ stagedSearch: z.boolean()
193
+ });
168
194
  export const vectorIndexResponseSchema = z.discriminatedUnion('operation', [
169
195
  vectorIndexCreateResponseSchema,
170
196
  vectorIndexLoadResponseSchema,
@@ -173,6 +199,7 @@ export const vectorIndexResponseSchema = z.discriminatedUnion('operation', [
173
199
  vectorIndexRemoveResponseSchema,
174
200
  vectorIndexContainsResponseSchema,
175
201
  vectorIndexWriteResponseSchema,
202
+ vectorIndexSetStagedSearchResponseSchema,
176
203
  vectorIndexDisposeResponseSchema
177
204
  ]);
178
205
  // ============== Helpers shared by the in-process and RPC clients ==============
@@ -44,12 +44,12 @@ export declare const vlaConfigSchema: z.ZodObject<{
44
44
  backend: z.ZodOptional<z.ZodArray<z.ZodEnum<{
45
45
  cpu: "cpu";
46
46
  auto: "auto";
47
- cuda: "cuda";
48
47
  vulkan: "vulkan";
49
- metal: "metal";
50
48
  opencl: "opencl";
51
- hip: "hip";
49
+ metal: "metal";
50
+ cuda: "cuda";
52
51
  rocm: "rocm";
52
+ hip: "hip";
53
53
  sycl: "sycl";
54
54
  }>>>;
55
55
  verbosity: z.ZodOptional<z.ZodNumber>;
package/dist/surface.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- export { type LifecycleState, type ModelProgressUpdate, type LoadModelOptions, type LoadCustomPluginModelOptions, type DownloadAssetOptions, type Tool, type ToolCall, type ToolCallWithCall, type ToolCallError, type ToolCallEvent, type CompletionEvent, type CompletionFinal, type CompletionRun, type CompletionStats, type BatchCompletionEvent, type BatchCompletionResult, type BatchCompletionRun, type BatchPrompt, type EmbedStats, VERBOSITY, type Attachment, type TranscribeStreamSession, type TranscribeStreamMetadataSession, type TranscribeStreamConversationSession, type TranscribeStreamEvent, type VadStateEvent, type EndOfTurnEvent, type TranscribeSegment, type BciConfig, type BciTranscribeClientParams, type BciTranscribeStreamClientParams, type BciTranscribeStreamSession, type BciTranscribeStreamMetadataSession, type BciStreamOpts, type NeuralInput, type TextToSpeechStreamSession, type TextToSpeechStreamResponse, type TextToSpeechStreamClientParams, type 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, ERROR_CODES, RAG_ERROR_CODES, type QvacConfig, type ModelInfo, type GetModelInfoParams, type GetLoadedModelInfoParams, type LoadedModelInfo, type GetSystemResourcesInput, type ResourceScope, type ResourceProvenance, type ResourceMetric, type GraphicsDriver, type GraphicsDriverCapabilities, type BackendProbeResult, type BackendDevice, type BackendDriver, type BackendFallback, type InferenceBackendDiagnostics, type CPUResourceCapabilities, type GPUResourceCapabilities, type SystemResourceCapabilities, type GPUResourceSample, type SystemResourceSample, type SystemResources, type LoadedInstance, type CacheFileInfo, toolSchema, type McpClient, type McpClientInput, type OCRClientParams, type OCRTextBlock, type OCROptions, type ClassifyClientParams, type ClassificationResult, type DiffusionClientParams, type DiffusionStreamResponse, type DiffusionStats, type VideoClientParams, type VideoStreamResponse, type VideoStats, type UpscaleClientParams, type UpscaleStreamResponse, type UpscaleStats, type VlaConfig, type VlaClientRunParams, type VlaClientRunResult, type VlaHparams, type VlaStats, definePlugin, defineHandler, defineDuplexHandler, type QvacPlugin, type CreateModelParams, type PluginModelResult, type ModelRegistryEntry, type ModelRegistryEntryAddon, PLUGIN_LLM, PLUGIN_EMBEDDING, PLUGIN_WHISPER, PLUGIN_BCI, PLUGIN_NMT, PLUGIN_TTS, PLUGIN_OCR, PLUGIN_DIFFUSION, PLUGIN_VLA, PLUGIN_CLASSIFICATION, BUILTIN_PLUGINS, type BuiltinPlugin, type ProfilerMode, type FinetuneValidation, type FinetuneRunParams, type FinetuneGetStateParams, type FinetuneStopParams, type FinetuneParams, type FinetuneStatus, type FinetuneProgress, type FinetuneStats, type FinetuneResult, MODEL_TYPES, ModelType } from './schemas/index.js';
1
+ export { type LifecycleState, type ModelProgressUpdate, type LoadModelOptions, type LoadCustomPluginModelOptions, type DownloadAssetOptions, type Tool, type ToolCall, type ToolCallWithCall, type ToolCallError, type ToolCallEvent, type CompletionEvent, type CompletionFinal, type CompletionRun, type CompletionStats, type BatchCompletionEvent, type BatchCompletionResult, type BatchCompletionRun, type BatchPrompt, type EmbedStats, type EmbedInput, type EmbedInputPart, type EmbedMediaSource, type EmbedLegacyParams as EmbedParams, type EmbedClientParams, type EmbedClientInput, type EmbedBatchClientParams as EmbedBatchParams, type EmbedBatchClientParams, type ImageEmbeddingConfig, type ImageEmbeddingStats, VERBOSITY, type Attachment, type HistoryContent, type HistoryContentPart, type TranscribeStreamSession, type TranscribeStreamMetadataSession, type TranscribeStreamConversationSession, type TranscribeStreamEvent, type VadStateEvent, type EndOfTurnEvent, type TranscribeSegment, type TranscribeToken, type BciConfig, type BciTranscribeClientParams, type BciTranscribeStreamClientParams, type BciTranscribeStreamSession, type BciTranscribeStreamMetadataSession, type BciStreamOpts, type NeuralInput, 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, ERROR_CODES, RAG_ERROR_CODES, type QvacConfig, type ModelInfo, type GetModelInfoParams, type GetLoadedModelInfoParams, type LoadedModelInfo, type GetSystemResourcesInput, type ResourceScope, type ResourceProvenance, type ResourceMetric, type GraphicsDriver, type GraphicsDriverCapabilities, type BackendProbeResult, type BackendDevice, type BackendDriver, type BackendFallback, type InferenceBackendDiagnostics, type CPUResourceCapabilities, type GPUResourceCapabilities, type SystemResourceCapabilities, type GPUResourceSample, type SystemResourceSample, type SystemResources, type LoadedInstance, type CacheFileInfo, toolSchema, type McpClient, type McpClientInput, type OCRClientParams, type OCRTextBlock, type OCROptions, type ClassifyClientParams, type ClassificationResult, type DiffusionClientParams, type DiffusionStreamResponse, type DiffusionStats, type VideoClientParams, type VideoStreamResponse, type VideoStats, type UpscaleClientParams, type UpscaleStreamResponse, type UpscaleStats, type VlaConfig, type VlaClientRunParams, type VlaClientRunResult, type VlaHparams, type VlaStats, definePlugin, defineHandler, defineDuplexHandler, requestParent, type PluginHandlerContext, type QvacPlugin, type CreateModelParams, type PluginModelResult, type ModelRegistryEntry, type ModelRegistryEntryAddon, PLUGIN_LLM, PLUGIN_EMBEDDING, PLUGIN_IMAGE_EMBEDDING, PLUGIN_WHISPER, PLUGIN_BCI, PLUGIN_NMT, PLUGIN_TTS, PLUGIN_OCR, PLUGIN_DIFFUSION, PLUGIN_VLA, PLUGIN_CLASSIFICATION, BUILTIN_PLUGINS, type BuiltinPlugin, type ProfilerMode, type FinetuneValidation, type FinetuneRunParams, type FinetuneGetStateParams, type FinetuneStopParams, type FinetuneParams, type FinetuneStatus, type FinetuneProgress, type FinetuneStats, type FinetuneResult, MODEL_TYPES, ModelType } from './schemas/index.js';
2
2
  export { type ToolInput, type ToolHandler } from './utils/tool-helpers.js';
3
- export { TOOL_SEARCH_NAME, buildToolSearchTool, executeToolSearch, loadedToolNames, searchDeferredTools } from './utils/tools/defer.js';
3
+ export { TOOL_SEARCH_NAME, buildToolSearchTool, executeToolSearch, loadedToolNames, resolveToolSearchSource, searchDeferredTools, type ToolSearchSource } from './utils/tools/defer.js';
4
4
  export { untilAborted } from './utils/until-aborted.js';
5
5
  export * from './schemas/index.js';
6
6
  export * from './profiling/index.js';
@@ -12,7 +12,7 @@ export { readBackendDiagnostics } from './profiling/backend-diagnostics.js';
12
12
  export { PUBLIC_MODEL_TYPES, ModelTypeAliases, modelTypeInputSchema, modelTypeSchema } from './schemas/model-types.js';
13
13
  export * from './models/registry/index.js';
14
14
  export { SUPPORTED_AUDIO_FORMATS } from './constants/audio.js';
15
- export { RpcServerOperationError, InferenceCancelledError, ContextOverflowError, type ContextOverflowErrorSizes, RequestIdConflictError, RequestNotFoundError, RequestRejectedByPolicyError, RequestValidationFailedError, ModelNotLoadedError, ModelRegistryModelNotFoundError, TranslationFailedError, PluginDefinitionInvalidError, PluginModelTypeReservedError, PluginAlreadyRegisteredError, PluginLoggingInvalidError } from './errors/index.js';
15
+ export { RpcServerOperationError, AudioEncodeFailedError, InferenceCancelledError, ContextOverflowError, type ContextOverflowErrorSizes, RequestIdConflictError, RequestNotFoundError, RequestRejectedByPolicyError, RequestValidationFailedError, SessionIdConflictError, SessionNotOpenError, ModelLeasedError, ModelReconfiguredError, OwnerOnlyError, RAGWorkspaceBusyError, ModelNotLoadedError, ModelRegistryModelNotFoundError, ModelRegistryBusyError, TranslationFailedError, InvalidSeedFromParamsError, KvCacheSeedSourceNotFoundError, KvCacheSeedSharingDisabledError, PluginDefinitionInvalidError, PluginModelTypeReservedError, PluginAlreadyRegisteredError, PluginLoggingInvalidError } from './errors/index.js';
16
16
  export type { InferenceCancelledPartial } from './errors/index.js';
17
17
  export { getLogger, LOG_ID, ALL_LOG_ID } from './logging/index.js';
18
18
  export type { Logger, LogTransport, LoggerOptions } from './logging/index.js';
package/dist/surface.js CHANGED
@@ -2,8 +2,8 @@
2
2
  // the model registry. Every `bare-*` import here is `import type` (erased at
3
3
  // build), so it pulls no runtime dependency and no engine. `index.ts` re-exports
4
4
  // it alongside the engine.
5
- export { VERBOSITY, ERROR_CODES, RAG_ERROR_CODES, toolSchema, definePlugin, defineHandler, defineDuplexHandler, PLUGIN_LLM, PLUGIN_EMBEDDING, PLUGIN_WHISPER, PLUGIN_BCI, PLUGIN_NMT, PLUGIN_TTS, PLUGIN_OCR, PLUGIN_DIFFUSION, PLUGIN_VLA, PLUGIN_CLASSIFICATION, BUILTIN_PLUGINS, MODEL_TYPES, ModelType } from './schemas/index.js';
6
- export { TOOL_SEARCH_NAME, buildToolSearchTool, executeToolSearch, loadedToolNames, searchDeferredTools } from './utils/tools/defer.js';
5
+ export { VERBOSITY, ERROR_CODES, RAG_ERROR_CODES, toolSchema, definePlugin, defineHandler, defineDuplexHandler, requestParent, PLUGIN_LLM, PLUGIN_EMBEDDING, PLUGIN_IMAGE_EMBEDDING, PLUGIN_WHISPER, PLUGIN_BCI, PLUGIN_NMT, PLUGIN_TTS, PLUGIN_OCR, PLUGIN_DIFFUSION, PLUGIN_VLA, PLUGIN_CLASSIFICATION, BUILTIN_PLUGINS, MODEL_TYPES, ModelType } from './schemas/index.js';
6
+ export { TOOL_SEARCH_NAME, buildToolSearchTool, executeToolSearch, loadedToolNames, resolveToolSearchSource, searchDeferredTools } from './utils/tools/defer.js';
7
7
  export { untilAborted } from './utils/until-aborted.js';
8
8
  // The full value-clean schema, profiling, and constant barrels: the @qvac/sdk client
9
9
  // and worker source every internal schema/const/profiling name from here, so it
@@ -25,7 +25,7 @@ export { SUPPORTED_AUDIO_FORMATS } from './constants/audio.js';
25
25
  // Error classes consumers need for `instanceof` checks: on rejected promises,
26
26
  // and on the synchronous throws of `plugins()` / `registerPlugin` (the plugin
27
27
  // group below).
28
- export { RpcServerOperationError, InferenceCancelledError, ContextOverflowError, RequestIdConflictError, RequestNotFoundError, RequestRejectedByPolicyError, RequestValidationFailedError, ModelNotLoadedError, ModelRegistryModelNotFoundError, TranslationFailedError, PluginDefinitionInvalidError, PluginModelTypeReservedError, PluginAlreadyRegisteredError, PluginLoggingInvalidError } from './errors/index.js';
28
+ export { RpcServerOperationError, AudioEncodeFailedError, InferenceCancelledError, ContextOverflowError, RequestIdConflictError, RequestNotFoundError, RequestRejectedByPolicyError, RequestValidationFailedError, SessionIdConflictError, SessionNotOpenError, ModelLeasedError, ModelReconfiguredError, OwnerOnlyError, RAGWorkspaceBusyError, ModelNotLoadedError, ModelRegistryModelNotFoundError, ModelRegistryBusyError, TranslationFailedError, InvalidSeedFromParamsError, KvCacheSeedSourceNotFoundError, KvCacheSeedSharingDisabledError, PluginDefinitionInvalidError, PluginModelTypeReservedError, PluginAlreadyRegisteredError, PluginLoggingInvalidError } from './errors/index.js';
29
29
  // Logging
30
30
  export { getLogger, LOG_ID, ALL_LOG_ID } from './logging/index.js';
31
31
  // Profiler
@@ -11,7 +11,7 @@ export interface LlmStats {
11
11
  toolDefinitionsDropped?: number;
12
12
  draftTokens?: number;
13
13
  draftAcceptedTokens?: number;
14
- backendDevice?: 'cpu' | 'gpu';
14
+ backendDevice?: 'cpu' | 'gpu' | 'npu';
15
15
  stopReason?: 'none' | 'eos' | 'antiprompt' | 'predictionLimit' | 'sequenceLimit' | 'contextOverflow';
16
16
  }
17
17
  export interface LlmResponse {
@@ -38,10 +38,52 @@ export interface TtsStats {
38
38
  gpuUnsupported?: number;
39
39
  enhancerBackendDevice?: number;
40
40
  enhancerBackendId?: number;
41
+ denoiserBackendDevice?: number;
42
+ denoiserBackendId?: number;
41
43
  /** Audio8 only, macOS / iOS: 1 while the Core ML codec sidecar is attached. */
42
44
  codecSidecarLoaded?: number;
43
45
  /** Audio8 only: 1 when the synthesis ran its codec on that sidecar, 0 on ggml. */
44
46
  codecOnCoreml?: number;
47
+ /** Parler only, macOS / iOS: 1 while the decoder / DAC Core ML sidecar is attached. */
48
+ decoderSidecarLoaded?: number;
49
+ dacSidecarLoaded?: number;
50
+ /** Parler only: 1 when the synthesis ran that stage on Core ML, 0 for ggml or a mixed run. */
51
+ decoderOnCoreml?: number;
52
+ dacOnCoreml?: number;
53
+ /** Milliseconds to the first audio, where the engine reports it. */
54
+ firstAudioMs?: number;
55
+ /** Chatterbox: T3 decode and S3Gen + HiFT wall times (ms), speech tokens T3 emitted. */
56
+ t3Ms?: number;
57
+ s3genMs?: number;
58
+ t3Tokens?: number;
59
+ /** CosyVoice3 / Audio8: the engine's own wall time (ms), the sum of its stages. */
60
+ stageTotalMs?: number;
61
+ /** CosyVoice3 stage wall times (ms). */
62
+ lmPrefillMs?: number;
63
+ lmDecodeMs?: number;
64
+ flowFrontendMs?: number;
65
+ ditEulerMs?: number;
66
+ hiftF0Ms?: number;
67
+ hiftSourceMs?: number;
68
+ hiftStftMs?: number;
69
+ hiftDecodeMs?: number;
70
+ /** CosyVoice3 work counters. */
71
+ decodeSteps?: number;
72
+ speechTokens?: number;
73
+ flowFrames?: number;
74
+ melFrames?: number;
75
+ textIds?: number;
76
+ promptSpeechTokens?: number;
77
+ /** Audio8 stage wall times (ms). */
78
+ voiceEncodeMs?: number;
79
+ promptMs?: number;
80
+ prefillMs?: number;
81
+ sampleMs?: number;
82
+ fastDecodeMs?: number;
83
+ slowDecodeMs?: number;
84
+ codecLatentMs?: number;
85
+ codecSynthMs?: number;
86
+ resampleMs?: number;
45
87
  }
46
88
  /**
47
89
  * @qvac/tts-ggml `TTSOutputChunk & SentenceStreamChunkMeta`. The chunker runs
@@ -57,6 +99,11 @@ export interface TtsOutputChunk {
57
99
  sentenceChunk?: string;
58
100
  /** True on the final pre-chunked output; undefined when it is not known up front. */
59
101
  isLast?: boolean;
102
+ /**
103
+ * CosyVoice3: the speech tokens of this synthesis. Batch output carries them
104
+ * with the PCM; native chunk streaming on a final `isLast` chunk with no PCM.
105
+ */
106
+ speechTokenIds?: number[];
60
107
  }
61
108
  export interface TtsResponse {
62
109
  stats?: TtsStats;
@@ -73,7 +120,27 @@ export interface EmbedResponse {
73
120
  stats?: EmbedStats;
74
121
  await(): Promise<Float32Array[][]>;
75
122
  }
76
- export type TranscribeStats = Partial<ASRGgml.WhisperRuntimeStats & ASRGgml.ParakeetRuntimeStats>;
123
+ /**
124
+ * MOSS-Transcribe-Diarize runtime statistics. The addon types only the whisper
125
+ * and parakeet shapes, so these are the keys `MossTranscribeModel::runtimeStats()`
126
+ * emits, under its own names.
127
+ */
128
+ export interface MossTranscribeRuntimeStats {
129
+ totalTime: number;
130
+ realTimeFactor: number;
131
+ audioDurationMs: number;
132
+ /** Output segments of the run. */
133
+ segments: number;
134
+ audioTokens: number;
135
+ promptTokens: number;
136
+ generatedTokens: number;
137
+ encodeMs: number;
138
+ prefillMs: number;
139
+ decodeMs: number;
140
+ backendDevice: number;
141
+ backendId: number;
142
+ }
143
+ export type TranscribeStats = Partial<ASRGgml.WhisperRuntimeStats & ASRGgml.ParakeetRuntimeStats & MossTranscribeRuntimeStats>;
77
144
  export type TranscribeAddonSegment = ASRGgml.TranscriptionSegment;
78
145
  export type TranscribeAddonVadEvent = ASRGgml.VadEvent;
79
146
  export type TranscribeAddonEndOfTurnEvent = ASRGgml.EndOfTurnEvent;
@@ -1,4 +1,11 @@
1
1
  import type { AbortSignal } from 'bare-abort-controller';
2
2
  export declare function isArchiveUrl(url: string): boolean;
3
3
  export declare function extractTarStream(archivePath: string, extractDir: string, useGunzip: boolean, signal?: AbortSignal): Promise<void>;
4
+ /**
5
+ * An extracted sharded archive is complete when every shard exists and the
6
+ * extraction that wrote them finished. Caches from earlier SDK versions have no
7
+ * marker, so the first load after upgrading extracts the archive again, which
8
+ * downloads it again when it came over HTTP.
9
+ */
10
+ export declare function isShardedExtractionComplete(extractDir: string, shardFilename: string): Promise<boolean>;
4
11
  export declare function extractAndValidateShardedArchive(archivePath: string, extractDir: string, signal?: AbortSignal): Promise<string>;
@@ -3,7 +3,7 @@ import path from 'bare-path';
3
3
  import { createGunzip } from 'bare-zlib';
4
4
  import tarStream from 'tar-stream';
5
5
  import Buffer from 'bare-buffer';
6
- import { detectShardedModel, generateShardFilenames, extractTensorsFromShards, validateShardedModelCache } from '../utils/shard-utils.js';
6
+ import { detectShardedModel, generateShardFilenames, checkAllShardsExist } from '../utils/shard-utils.js';
7
7
  import { ModelLoadFailedError, ArchiveExtractionFailedError, ArchiveUnsupportedTypeError, ArchiveMissingShardsError, DownloadCancelledError } from '../errors/index.js';
8
8
  import { isPathWithinBase } from '../utils/path-security.js';
9
9
  import { getEngineLogger } from '../logging/index.js';
@@ -18,7 +18,7 @@ export function isArchiveUrl(url) {
18
18
  return SUPPORTED_ARCHIVE_EXTENSIONS.some((ext) => filename.endsWith(ext));
19
19
  }
20
20
  // Whitelist of model file extensions to extract from archives
21
- const ALLOWED_MODEL_EXTENSIONS = ['.gguf', '.tensors.txt'];
21
+ const ALLOWED_MODEL_EXTENSIONS = ['.gguf'];
22
22
  function isModelFile(entryName) {
23
23
  const basename = path.basename(entryName);
24
24
  // Skip resource forks (._filename)
@@ -66,22 +66,43 @@ export async function extractTarStream(archivePath, extractDir, useGunzip, signa
66
66
  const extract = tarStream.extract();
67
67
  const gunzip = useGunzip ? createGunzip() : null;
68
68
  return new Promise((resolve, reject) => {
69
- let aborted = false;
69
+ let settled = false;
70
70
  let readStream = null;
71
- const cleanup = () => {
72
- aborted = true;
73
- readStream?.destroy();
74
- gunzip?.destroy();
75
- extract.destroy();
76
- };
77
- if (signal) {
78
- signal.addEventListener('abort', () => {
79
- cleanup();
80
- reject(new DownloadCancelledError());
71
+ // Settles, with the write's error if any, when the current entry's file is
72
+ // closed. tar-stream can emit 'finish' before the last entry's write
73
+ // completes (an archive without end-of-archive blocks), so completion
74
+ // waits for it too.
75
+ let writeClosed = Promise.resolve(undefined);
76
+ let writeStream = null;
77
+ const settle = (error) => {
78
+ if (settled)
79
+ return;
80
+ settled = true;
81
+ signal?.removeEventListener('abort', onAbort);
82
+ if (error !== undefined) {
83
+ readStream?.destroy();
84
+ gunzip?.destroy();
85
+ extract.destroy();
86
+ writeStream?.destroy();
87
+ }
88
+ // Nothing is written after the caller sees the outcome.
89
+ void writeClosed.then((writeError) => {
90
+ const outcome = error ?? writeError;
91
+ if (outcome === undefined)
92
+ resolve();
93
+ else
94
+ reject(outcome);
81
95
  });
96
+ };
97
+ const onAbort = () => settle(new DownloadCancelledError());
98
+ if (signal?.aborted) {
99
+ settle(new DownloadCancelledError());
100
+ return;
82
101
  }
102
+ signal?.addEventListener('abort', onAbort);
83
103
  extract.on('entry', (header, stream, next) => {
84
- if (aborted) {
104
+ stream.on('error', settle);
105
+ if (settled) {
85
106
  stream.resume();
86
107
  return;
87
108
  }
@@ -101,23 +122,35 @@ export async function extractTarStream(archivePath, extractDir, useGunzip, signa
101
122
  if (header.type === 'file') {
102
123
  const dir = path.dirname(filePath);
103
124
  fs.mkdirSync(dir, { recursive: true });
104
- const writeStream = fs.createWriteStream(filePath);
105
- stream.pipe(writeStream);
106
- writeStream.on('finish', next);
107
- writeStream.on('error', reject);
125
+ const entryWriteStream = fs.createWriteStream(filePath);
126
+ writeStream = entryWriteStream;
127
+ writeClosed = new Promise((resolveClose) => {
128
+ let writeError;
129
+ entryWriteStream.on('error', (error) => {
130
+ writeError = error;
131
+ settle(error);
132
+ });
133
+ entryWriteStream.on('close', () => resolveClose(writeError));
134
+ });
135
+ entryWriteStream.on('close', () => {
136
+ if (!settled)
137
+ next();
138
+ });
139
+ stream.pipe(entryWriteStream);
108
140
  }
109
141
  else {
110
- stream.on('end', next);
142
+ stream.on('end', () => {
143
+ if (!settled)
144
+ next();
145
+ });
111
146
  stream.resume();
112
147
  }
113
148
  });
114
- extract.on('finish', resolve);
115
- extract.on('error', reject);
116
- if (gunzip) {
117
- gunzip.on('error', reject);
118
- }
149
+ extract.on('finish', () => settle());
150
+ extract.on('error', settle);
151
+ gunzip?.on('error', settle);
119
152
  readStream = fs.createReadStream(archivePath);
120
- readStream.on('error', reject);
153
+ readStream.on('error', settle);
121
154
  // tar-stream's extract is a streamx Writable at runtime; cast past the
122
155
  // nominal private brand its shim can't carry (see types/tar-stream).
123
156
  const extractDest = extract;
@@ -132,13 +165,39 @@ export async function extractTarStream(archivePath, extractDir, useGunzip, signa
132
165
  }
133
166
  });
134
167
  }
135
- export async function extractAndValidateShardedArchive(archivePath, extractDir, signal) {
168
+ const EXTRACTION_COMPLETE_MARKER = '.extraction-complete';
169
+ async function pathExists(filePath) {
170
+ return fsPromises.access(filePath).then(() => true, () => false);
171
+ }
172
+ /**
173
+ * An extracted sharded archive is complete when every shard exists and the
174
+ * extraction that wrote them finished. Caches from earlier SDK versions have no
175
+ * marker, so the first load after upgrading extracts the archive again, which
176
+ * downloads it again when it came over HTTP.
177
+ */
178
+ export async function isShardedExtractionComplete(extractDir, shardFilename) {
179
+ return ((await checkAllShardsExist(extractDir, shardFilename)) &&
180
+ (await pathExists(path.join(extractDir, EXTRACTION_COMPLETE_MARKER))));
181
+ }
182
+ // Concurrent loads of one archive share an extract directory, so they share
183
+ // one extraction instead of writing the same files at the same time. A joining
184
+ // caller shares the first caller's abort signal.
185
+ const inFlightExtractions = new Map();
186
+ export function extractAndValidateShardedArchive(archivePath, extractDir, signal) {
187
+ const inFlight = inFlightExtractions.get(extractDir);
188
+ if (inFlight)
189
+ return inFlight;
190
+ const extraction = extractAndValidateShardedArchiveOnce(archivePath, extractDir, signal).finally(() => inFlightExtractions.delete(extractDir));
191
+ inFlightExtractions.set(extractDir, extraction);
192
+ return extraction;
193
+ }
194
+ async function extractAndValidateShardedArchiveOnce(archivePath, extractDir, signal) {
136
195
  // Check if shards already extracted
137
196
  try {
138
197
  const existingFiles = await fsPromises.readdir(extractDir);
139
198
  const existingShard = existingFiles.find((f) => detectShardedModel(String(f)).isSharded);
140
199
  if (existingShard) {
141
- const isComplete = await validateShardedModelCache(extractDir, String(existingShard));
200
+ const isComplete = await isShardedExtractionComplete(extractDir, String(existingShard));
142
201
  if (isComplete) {
143
202
  logger.info(`✅ Archive already extracted: ${extractDir}`);
144
203
  const shardFilenames = generateShardFilenames(String(existingShard));
@@ -151,6 +210,7 @@ export async function extractAndValidateShardedArchive(archivePath, extractDir,
151
210
  // Directory doesn't exist, proceed with extraction
152
211
  }
153
212
  logger.info(`Extracting archive: ${path.basename(archivePath)}`);
213
+ await fsPromises.rm(path.join(extractDir, EXTRACTION_COMPLETE_MARKER), { force: true });
154
214
  try {
155
215
  await extractArchive(archivePath, extractDir, signal);
156
216
  }
@@ -177,8 +237,7 @@ export async function extractAndValidateShardedArchive(archivePath, extractDir,
177
237
  throw new ArchiveMissingShardsError(shardFilename);
178
238
  }
179
239
  }
180
- // Generate tensors.txt if it doesn't exist
181
- await extractTensorsFromShards(extractDir, shardedFileName);
240
+ await fsPromises.writeFile(path.join(extractDir, EXTRACTION_COMPLETE_MARKER), '');
182
241
  logger.info(`Archive extracted to ${extractDir} successfully: ${files.length} files`);
183
242
  return path.join(extractDir, shardFilenames[0]);
184
243
  }
@@ -3,11 +3,16 @@ export declare function isVadEvent(event: ASRGgml.ASRStreamOutput): event is ASR
3
3
  export declare function isEndOfTurnEvent(event: ASRGgml.ASRStreamOutput): event is ASRGgml.EndOfTurnEvent;
4
4
  export declare function toVadStateEvent(event: ASRGgml.VadEvent): {
5
5
  speakerId?: number;
6
+ chunkIndex?: number;
7
+ timestamp?: number;
6
8
  speaking: boolean;
7
9
  probability: number;
8
10
  source: "silero" | "energy" | "sortformer";
9
11
  };
10
12
  export declare function toEndOfTurnEvent(event: ASRGgml.EndOfTurnEvent): {
13
+ confidence?: number;
14
+ chunkIndex?: number;
15
+ timestamp?: number;
11
16
  source: "parakeet";
12
17
  silenceDurationMs?: never;
13
18
  } | {
@@ -15,12 +15,21 @@ export function toVadStateEvent(event) {
15
15
  speaking: event.speaking,
16
16
  probability: event.score,
17
17
  source: event.source,
18
+ ...(event.timestamp !== undefined && { timestamp: event.timestamp }),
19
+ ...(event.chunkIndex !== undefined && { chunkIndex: event.chunkIndex }),
18
20
  ...(event.speakerId !== undefined && { speakerId: event.speakerId })
19
21
  };
20
22
  }
21
23
  export function toEndOfTurnEvent(event) {
22
24
  if (event.source === 'model-eou') {
23
- return { source: 'parakeet' };
25
+ // The native EOU boundary carries its own timing and confidence; a
26
+ // boundary the addon synthesizes from a segment has none to forward.
27
+ return {
28
+ source: 'parakeet',
29
+ ...(event.timestamp !== undefined && { timestamp: event.timestamp }),
30
+ ...(event.chunkIndex !== undefined && { chunkIndex: event.chunkIndex }),
31
+ ...(event.confidence !== undefined && { confidence: event.confidence })
32
+ };
24
33
  }
25
34
  if (event.silenceDurationMs === undefined) {
26
35
  return null;
@@ -1,7 +1,9 @@
1
1
  import { normalizeAssistantCacheContent } from '../../utils/cache-normalize.js';
2
2
  export function normalizeCacheMessage(message) {
3
3
  const { attachments, ...normalized } = message;
4
- if (message.role === 'assistant') {
4
+ // Content parts are a user-turn shape (the schema rejects them elsewhere);
5
+ // assistant text is always a plain string.
6
+ if (message.role === 'assistant' && typeof message.content === 'string') {
5
7
  normalized.content = normalizeAssistantCacheContent(message.content);
6
8
  }
7
9
  return {
@@ -0,0 +1,48 @@
1
+ import { type RegistryItem } from '../../models/registry/models.js';
2
+ /** detectShardedModel's filename pattern: `<base>-00001-of-00004.gguf`. */
3
+ export declare const SHARD_FILENAME_PATTERN: RegExp;
4
+ export declare const COREML_COMPONENTS: readonly ["analytics/coremldata.bin", "coremldata.bin", "metadata.json", "model.mil", "weights/weight.bin"];
5
+ type BundleSpec = {
6
+ sourceName: string;
7
+ targetSuffix: string;
8
+ };
9
+ export type CoremlSidecarSpec = {
10
+ source: string;
11
+ root: string;
12
+ modelStem: string;
13
+ bundles: readonly BundleSpec[];
14
+ withoutBundlesUse?: string;
15
+ };
16
+ export declare function getCoremlSidecarSpec(registryPath: string, registrySource: string, platform: string | undefined): CoremlSidecarSpec | undefined;
17
+ /** The string a Core ML companion set's key is the short hash of. */
18
+ export declare function getCoremlSetKeySource(model: RegistryItem, spec: CoremlSidecarSpec): string;
19
+ /**
20
+ * The catalog entries of every bundle the catalog publishes completely, each
21
+ * with the name it takes in the set directory. A bundle missing a component
22
+ * is left out: a partial `.mlmodelc` is not usable.
23
+ */
24
+ export declare function getCatalogCoremlSidecars(spec: CoremlSidecarSpec): {
25
+ key: string;
26
+ targetName: string;
27
+ entry: RegistryItem;
28
+ }[];
29
+ /** A single-file model's name in the models cache directory. */
30
+ export declare function getSingleFileCacheName(registryPath: string, shortHash: (input: string) => string): string;
31
+ export type ModelCacheLayout = {
32
+ /** The model's file or set directory, relative to the models cache directory. */
33
+ path: string;
34
+ /** Every registry-pinned file the model needs, relative to the models cache directory. */
35
+ files: {
36
+ path: string;
37
+ size: number;
38
+ sha256: string;
39
+ }[];
40
+ };
41
+ /**
42
+ * Where the loader keeps `model`, or `undefined` for a sharded model (its
43
+ * `sharded/` directory is not described here) or a Core ML model whose bundles
44
+ * the catalog lacks (the loader asks the live registry). `shortHash` is
45
+ * generateShortHash, passed in to avoid bare-crypto.
46
+ */
47
+ export declare function getModelCacheLayout(model: RegistryItem, platform: string | undefined, shortHash: (input: string) => string): ModelCacheLayout | undefined;
48
+ export {};