@qvac/inference 0.18.2 → 0.19.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 (388) hide show
  1. package/NOTICE +11 -2
  2. package/README.md +1 -5
  3. package/dist/api/assess-model-fit.d.ts +16 -0
  4. package/dist/api/assess-model-fit.js +27 -0
  5. package/dist/api/audio-gen.d.ts +4 -4
  6. package/dist/api/audio-gen.js +17 -6
  7. package/dist/api/completion-stream.d.ts +1 -1
  8. package/dist/api/completion-stream.js +1 -1
  9. package/dist/api/download-asset.d.ts +1 -1
  10. package/dist/api/download-asset.js +2 -2
  11. package/dist/api/finetune.js +1 -1
  12. package/dist/api/get-loaded-model-info.d.ts +6 -10
  13. package/dist/api/get-loaded-model-info.js +6 -10
  14. package/dist/api/heartbeat.d.ts +5 -22
  15. package/dist/api/heartbeat.js +6 -23
  16. package/dist/api/index.d.ts +36 -35
  17. package/dist/api/index.js +35 -35
  18. package/dist/api/load-model.d.ts +5 -1
  19. package/dist/api/load-model.js +3 -5
  20. package/dist/api/logging-stream-registry.js +1 -1
  21. package/dist/api/resume.d.ts +0 -3
  22. package/dist/api/resume.js +0 -3
  23. package/dist/api/subscribe-logs.js +1 -1
  24. package/dist/api/suspend.d.ts +0 -4
  25. package/dist/api/suspend.js +0 -4
  26. package/dist/api/translate.d.ts +3 -1
  27. package/dist/api/translate.js +16 -8
  28. package/dist/api/unload-model.js +3 -5
  29. package/dist/api/video-request.d.ts +207 -0
  30. package/dist/api/video-request.js +18 -0
  31. package/dist/api/video.d.ts +22 -2
  32. package/dist/api/video.js +25 -15
  33. package/dist/api/vla-helpers.d.ts +1 -2
  34. package/dist/api/vla-helpers.js +1 -2
  35. package/dist/api/vla.js +1 -1
  36. package/dist/api/world-result.d.ts +71 -0
  37. package/dist/api/world-result.js +293 -0
  38. package/dist/api/world.d.ts +143 -0
  39. package/dist/api/world.js +71 -0
  40. package/dist/config/resolve-config.d.ts +1 -1
  41. package/dist/config/resolve-config.js +1 -1
  42. package/dist/constants/index.d.ts +2 -2
  43. package/dist/constants/index.js +2 -2
  44. package/dist/dispatch.js +15 -28
  45. package/dist/errors/index.d.ts +35 -31
  46. package/dist/errors/index.js +66 -56
  47. package/dist/handlers/assess-model-fit.d.ts +10 -0
  48. package/dist/handlers/assess-model-fit.js +75 -0
  49. package/dist/handlers/cancelHandler.js +1 -1
  50. package/dist/handlers/completion-orchestrate.js +1 -1
  51. package/dist/handlers/download-asset.js +6 -5
  52. package/dist/handlers/finetune.js +1 -1
  53. package/dist/handlers/get-loaded-model-info.js +0 -12
  54. package/dist/handlers/get-model-info.js +1 -1
  55. package/dist/handlers/get-system-resources.js +8 -0
  56. package/dist/handlers/load-model/download-manager.d.ts +1 -1
  57. package/dist/handlers/load-model/download-stats.d.ts +3 -3
  58. package/dist/handlers/load-model/download-stats.js +5 -5
  59. package/dist/handlers/load-model/handler.js +6 -8
  60. package/dist/handlers/load-model/http-verify.d.ts +20 -0
  61. package/dist/handlers/load-model/http-verify.js +54 -0
  62. package/dist/handlers/load-model/http.d.ts +12 -2
  63. package/dist/handlers/load-model/http.js +119 -230
  64. package/dist/handlers/load-model/hyperdrive.d.ts +1 -1
  65. package/dist/handlers/load-model/hyperdrive.js +1 -1
  66. package/dist/handlers/load-model/index.d.ts +2 -2
  67. package/dist/handlers/load-model/index.js +2 -2
  68. package/dist/handlers/load-model/registry-companion-set.d.ts +1 -1
  69. package/dist/handlers/load-model/registry-companion-set.js +1 -1
  70. package/dist/handlers/load-model/registry-download-utils.d.ts +3 -3
  71. package/dist/handlers/load-model/registry-download-utils.js +2 -2
  72. package/dist/handlers/load-model/registry.d.ts +2 -2
  73. package/dist/handlers/load-model/registry.js +4 -4
  74. package/dist/handlers/load-model/resolve-session.d.ts +8 -1
  75. package/dist/handlers/load-model/resolve-session.js +12 -9
  76. package/dist/handlers/load-model/resolve.d.ts +4 -4
  77. package/dist/handlers/load-model/resolve.js +18 -16
  78. package/dist/handlers/load-model/safe-fetch.d.ts +44 -0
  79. package/dist/handlers/load-model/safe-fetch.js +143 -0
  80. package/dist/handlers/load-model/types.d.ts +9 -0
  81. package/dist/handlers/plugin-dispatch.js +1 -4
  82. package/dist/handlers/plugin-invoke.js +1 -4
  83. package/dist/handlers/types.d.ts +0 -2
  84. package/dist/handlers/unload-model.js +1 -4
  85. package/dist/index.d.ts +1 -1
  86. package/dist/index.js +1 -1
  87. package/dist/logging/addon.d.ts +1 -1
  88. package/dist/logging/addon.js +1 -1
  89. package/dist/logging/index.d.ts +5 -5
  90. package/dist/logging/index.js +4 -4
  91. package/dist/logging/logger.d.ts +1 -1
  92. package/dist/logging/logger.js +2 -2
  93. package/dist/models/registry/index.d.ts +1 -1
  94. package/dist/models/registry/index.js +2 -2
  95. package/dist/models/registry/models.d.ts +250 -0
  96. package/dist/models/registry/models.js +2071 -1806
  97. package/dist/models/registry/resource-profiles.d.ts +18 -0
  98. package/dist/models/registry/resource-profiles.js +4934 -0
  99. package/dist/plugins/builtin/audiogen-ggml/config.d.ts +14 -0
  100. package/dist/plugins/builtin/audiogen-ggml/config.js +23 -0
  101. package/dist/plugins/builtin/audiogen-ggml/ops/audio-gen-stream.js +47 -5
  102. package/dist/plugins/builtin/audiogen-ggml/plugin.d.ts +134 -4
  103. package/dist/plugins/builtin/audiogen-ggml/plugin.js +47 -28
  104. package/dist/plugins/builtin/bci-whispercpp-transcription/plugin.d.ts +1 -1
  105. package/dist/plugins/builtin/bci-whispercpp-transcription/plugin.js +3 -3
  106. package/dist/plugins/builtin/ggml-classification/plugin.js +1 -1
  107. package/dist/plugins/builtin/ggml-ocr/plugin.js +2 -2
  108. package/dist/plugins/builtin/ggml-vla/plugin.d.ts +1 -1
  109. package/dist/plugins/builtin/ggml-vla/plugin.js +3 -3
  110. package/dist/plugins/builtin/index.d.ts +12 -12
  111. package/dist/plugins/builtin/index.js +12 -12
  112. package/dist/plugins/builtin/llamacpp-completion/ops/batch-completion-stream.js +2 -2
  113. package/dist/plugins/builtin/llamacpp-completion/ops/completion-stream.js +37 -26
  114. package/dist/plugins/builtin/llamacpp-completion/ops/context-overflow.d.ts +12 -11
  115. package/dist/plugins/builtin/llamacpp-completion/ops/context-overflow.js +133 -41
  116. package/dist/plugins/builtin/llamacpp-completion/ops/kv-cache-session.d.ts +7 -1
  117. package/dist/plugins/builtin/llamacpp-completion/ops/kv-cache-session.js +26 -4
  118. package/dist/plugins/builtin/llamacpp-completion/plugin.d.ts +19 -8
  119. package/dist/plugins/builtin/llamacpp-completion/plugin.js +10 -13
  120. package/dist/plugins/builtin/llamacpp-embedding/plugin.d.ts +4 -0
  121. package/dist/plugins/builtin/llamacpp-embedding/plugin.js +13 -2
  122. package/dist/plugins/builtin/nmtcpp-translation/plugin.js +2 -2
  123. package/dist/plugins/builtin/parakeet-transcription/plugin.d.ts +2 -2
  124. package/dist/plugins/builtin/parakeet-transcription/plugin.js +3 -3
  125. package/dist/plugins/builtin/sdcpp-generation/ops/upscale.js +1 -1
  126. package/dist/plugins/builtin/sdcpp-generation/ops/video.js +32 -2
  127. package/dist/plugins/builtin/sdcpp-generation/ops/world.d.ts +126 -0
  128. package/dist/plugins/builtin/sdcpp-generation/ops/world.js +820 -0
  129. package/dist/plugins/builtin/sdcpp-generation/plugin.d.ts +153 -4
  130. package/dist/plugins/builtin/sdcpp-generation/plugin.js +134 -13
  131. package/dist/plugins/builtin/tts-ggml/ops/text-to-speech-stream.js +1 -1
  132. package/dist/plugins/builtin/tts-ggml/ops/text-to-speech.js +1 -1
  133. package/dist/plugins/builtin/tts-ggml/plugin.js +2 -2
  134. package/dist/plugins/builtin/whispercpp-transcription/plugin.d.ts +2 -2
  135. package/dist/plugins/builtin/whispercpp-transcription/plugin.js +3 -3
  136. package/dist/plugins/index.d.ts +1 -1
  137. package/dist/plugins/index.js +2 -2
  138. package/dist/plugins/ops/kv-cache-utils.js +1 -1
  139. package/dist/plugins/ops/load-model.js +1 -1
  140. package/dist/plugins/ops/transcribe.js +2 -2
  141. package/dist/plugins/ops/translate.js +4 -12
  142. package/dist/plugins/ops/unload-model.js +19 -21
  143. package/dist/plugins/registry.d.ts +1 -0
  144. package/dist/plugins/registry.js +12 -0
  145. package/dist/profiling/aggregator.d.ts +1 -1
  146. package/dist/profiling/aggregator.js +1 -1
  147. package/dist/profiling/controller.d.ts +1 -1
  148. package/dist/profiling/controller.js +2 -2
  149. package/dist/profiling/envelope.d.ts +0 -1
  150. package/dist/profiling/envelope.js +0 -10
  151. package/dist/profiling/events.d.ts +2 -3
  152. package/dist/profiling/events.js +2 -9
  153. package/dist/profiling/exporters.d.ts +1 -1
  154. package/dist/profiling/exporters.js +3 -3
  155. package/dist/profiling/index.d.ts +13 -14
  156. package/dist/profiling/index.js +12 -13
  157. package/dist/profiling/operation-metrics.d.ts +1 -1
  158. package/dist/profiling/operation-metrics.js +35 -2
  159. package/dist/profiling/operation-wrappers.js +12 -15
  160. package/dist/profiling/profiler.d.ts +1 -2
  161. package/dist/profiling/profiler.js +7 -26
  162. package/dist/profiling/types.d.ts +1 -1
  163. package/dist/rag/handler.js +1 -1
  164. package/dist/rag/handlers/close-workspace.js +1 -1
  165. package/dist/rag/handlers/delete-embeddings.js +1 -1
  166. package/dist/rag/handlers/delete-workspace.js +2 -6
  167. package/dist/rag/handlers/ingest.js +1 -1
  168. package/dist/rag/handlers/list-workspaces.d.ts +1 -1
  169. package/dist/rag/handlers/list-workspaces.js +1 -1
  170. package/dist/rag/handlers/reindex.js +1 -1
  171. package/dist/rag/handlers/save-embeddings.js +1 -1
  172. package/dist/rag/handlers/search.js +1 -1
  173. package/dist/rag/index.d.ts +11 -11
  174. package/dist/rag/index.js +11 -11
  175. package/dist/rag/rag-workspace-manager.d.ts +4 -2
  176. package/dist/rag/rag-workspace-manager.js +268 -15
  177. package/dist/registry.js +8 -58
  178. package/dist/resources/collector.d.ts +3 -1
  179. package/dist/resources/collector.js +91 -9
  180. package/dist/resources/instance.d.ts +1 -1
  181. package/dist/resources/instance.js +1 -1
  182. package/dist/resources/model-fit/assess.d.ts +36 -0
  183. package/dist/resources/model-fit/assess.js +578 -0
  184. package/dist/resources/model-fit/calibration/darwin-arm64.d.ts +8 -0
  185. package/dist/resources/model-fit/calibration/darwin-arm64.js +36 -0
  186. package/dist/resources/model-fit/calibration/darwin-x64.d.ts +8 -0
  187. package/dist/resources/model-fit/calibration/darwin-x64.js +38 -0
  188. package/dist/resources/model-fit/calibration/fit.d.ts +73 -0
  189. package/dist/resources/model-fit/calibration/fit.js +152 -0
  190. package/dist/resources/model-fit/calibration/index.d.ts +37 -0
  191. package/dist/resources/model-fit/calibration/index.js +75 -0
  192. package/dist/resources/model-fit/calibration/linux-arm64.d.ts +8 -0
  193. package/dist/resources/model-fit/calibration/linux-arm64.js +38 -0
  194. package/dist/resources/model-fit/calibration/linux-x64-vulkan.d.ts +8 -0
  195. package/dist/resources/model-fit/calibration/linux-x64-vulkan.js +39 -0
  196. package/dist/resources/model-fit/calibration/linux-x64.d.ts +8 -0
  197. package/dist/resources/model-fit/calibration/linux-x64.js +38 -0
  198. package/dist/resources/model-fit/calibration/win32-x64-vulkan-shared.d.ts +8 -0
  199. package/dist/resources/model-fit/calibration/win32-x64-vulkan-shared.js +39 -0
  200. package/dist/resources/model-fit/calibration/win32-x64-vulkan.d.ts +8 -0
  201. package/dist/resources/model-fit/calibration/win32-x64-vulkan.js +36 -0
  202. package/dist/resources/model-fit/calibration/win32-x64.d.ts +8 -0
  203. package/dist/resources/model-fit/calibration/win32-x64.js +38 -0
  204. package/dist/resources/model-fit/estimators/llm.d.ts +45 -0
  205. package/dist/resources/model-fit/estimators/llm.js +220 -0
  206. package/dist/resources/model-fit/estimators/whisper.d.ts +10 -0
  207. package/dist/resources/model-fit/estimators/whisper.js +77 -0
  208. package/dist/resources/model-fit/types.d.ts +120 -0
  209. package/dist/resources/model-fit/types.js +1 -0
  210. package/dist/resources/native.d.ts +1 -1
  211. package/dist/resources/native.js +14 -0
  212. package/dist/resources/normalize.d.ts +1 -1
  213. package/dist/resources/types.d.ts +16 -0
  214. package/dist/runtime/index.d.ts +5 -5
  215. package/dist/runtime/index.js +2 -2
  216. package/dist/runtime/lifecycle.js +5 -7
  217. package/dist/runtime/model-registry.d.ts +0 -14
  218. package/dist/runtime/model-registry.js +17 -40
  219. package/dist/runtime/registry-client.js +1 -1
  220. package/dist/runtime/request-context.d.ts +3 -3
  221. package/dist/runtime/request-context.js +13 -1
  222. package/dist/runtime/request-registry.d.ts +1 -1
  223. package/dist/runtime/request-registry.js +4 -5
  224. package/dist/runtime/state.d.ts +1 -1
  225. package/dist/runtime/state.js +18 -3
  226. package/dist/schemas/assess-model-fit.d.ts +271 -0
  227. package/dist/schemas/assess-model-fit.js +153 -0
  228. package/dist/schemas/audio-gen.d.ts +434 -4
  229. package/dist/schemas/audio-gen.js +131 -19
  230. package/dist/schemas/batch-completion-stream.d.ts +2 -2
  231. package/dist/schemas/batch-completion-stream.js +3 -3
  232. package/dist/schemas/bci-config.js +73 -27
  233. package/dist/schemas/bci.d.ts +2 -2
  234. package/dist/schemas/bci.js +5 -5
  235. package/dist/schemas/cancel.d.ts +5 -0
  236. package/dist/schemas/cancel.js +1 -0
  237. package/dist/schemas/classification.js +13 -6
  238. package/dist/schemas/common.d.ts +662 -331
  239. package/dist/schemas/common.js +33 -31
  240. package/dist/schemas/completion-event.d.ts +2 -2
  241. package/dist/schemas/completion-event.js +1 -1
  242. package/dist/schemas/completion-stream.d.ts +1 -5
  243. package/dist/schemas/completion-stream.js +4 -8
  244. package/dist/schemas/config.d.ts +640 -18
  245. package/dist/schemas/config.js +50 -8
  246. package/dist/schemas/download-asset.d.ts +19 -1
  247. package/dist/schemas/download-asset.js +20 -4
  248. package/dist/schemas/engine-addon-map.d.ts +1 -1
  249. package/dist/schemas/engine-addon-map.js +3 -3
  250. package/dist/schemas/error.d.ts +2 -2
  251. package/dist/schemas/error.js +2 -2
  252. package/dist/schemas/errors.d.ts +2 -6
  253. package/dist/schemas/errors.js +30 -40
  254. package/dist/schemas/heartbeat.d.ts +10 -0
  255. package/dist/schemas/heartbeat.js +8 -0
  256. package/dist/schemas/index.d.ts +46 -44
  257. package/dist/schemas/index.js +45 -43
  258. package/dist/schemas/llamacpp-config.d.ts +32 -10
  259. package/dist/schemas/llamacpp-config.js +11 -8
  260. package/dist/schemas/load-model.d.ts +2933 -1948
  261. package/dist/schemas/load-model.js +52 -52
  262. package/dist/schemas/mcp-adapter.d.ts +1 -1
  263. package/dist/schemas/model-config-schemas.d.ts +2354 -0
  264. package/dist/schemas/model-config-schemas.js +46 -0
  265. package/dist/schemas/model-info.d.ts +10 -20
  266. package/dist/schemas/model-info.js +4 -25
  267. package/dist/schemas/model-ops.d.ts +0 -1
  268. package/dist/schemas/model-ops.js +1 -2
  269. package/dist/schemas/model-resource-profile.d.ts +109 -0
  270. package/dist/schemas/model-resource-profile.js +83 -0
  271. package/dist/schemas/model-src-utils.d.ts +1 -0
  272. package/dist/schemas/model-src-utils.js +33 -13
  273. package/dist/schemas/ocr.js +48 -13
  274. package/dist/schemas/path-validation.js +8 -2
  275. package/dist/schemas/plugin.d.ts +14 -1
  276. package/dist/schemas/plugin.js +11 -0
  277. package/dist/schemas/profiling.d.ts +138 -43
  278. package/dist/schemas/profiling.js +1 -22
  279. package/dist/schemas/rag.js +1 -1
  280. package/dist/schemas/registry.js +1 -1
  281. package/dist/schemas/reload-config.d.ts +0 -2
  282. package/dist/schemas/reload-config.js +2 -3
  283. package/dist/schemas/sdcpp-config.d.ts +344 -4
  284. package/dist/schemas/sdcpp-config.js +504 -17
  285. package/dist/schemas/system-resources.d.ts +138 -0
  286. package/dist/schemas/system-resources.js +3 -1
  287. package/dist/schemas/text-to-speech.js +183 -76
  288. package/dist/schemas/transcription-config.js +253 -85
  289. package/dist/schemas/transcription.d.ts +3 -3
  290. package/dist/schemas/translate.d.ts +2 -2
  291. package/dist/schemas/translate.js +1 -1
  292. package/dist/schemas/translation-config.js +53 -25
  293. package/dist/schemas/vla.d.ts +1 -1
  294. package/dist/selection.d.ts +1 -5
  295. package/dist/selection.js +2 -6
  296. package/dist/surface.d.ts +1 -1
  297. package/dist/utils/aggregate-events.d.ts +1 -1
  298. package/dist/utils/aggregate-events.js +2 -2
  299. package/dist/utils/archive.js +2 -2
  300. package/dist/utils/audio-input.js +1 -1
  301. package/dist/utils/cache/auto-history.d.ts +1 -1
  302. package/dist/utils/cache/auto-history.js +1 -1
  303. package/dist/utils/cache/paths.js +5 -5
  304. package/dist/utils/completion-normalizer.js +1 -1
  305. package/dist/utils/gguf-tensor-extractor.js +1 -1
  306. package/dist/utils/image-dimensions.d.ts +26 -0
  307. package/dist/utils/image-dimensions.js +46 -0
  308. package/dist/utils/index.d.ts +13 -10
  309. package/dist/utils/index.js +13 -10
  310. package/dist/utils/mcp-adapter.d.ts +1 -1
  311. package/dist/utils/mcp-adapter.js +1 -1
  312. package/dist/utils/path-sanitize.d.ts +7 -0
  313. package/dist/utils/path-sanitize.js +36 -0
  314. package/dist/utils/path-security.d.ts +0 -7
  315. package/dist/utils/path-security.js +1 -36
  316. package/dist/utils/shard-utils.js +3 -3
  317. package/dist/utils/tool-integration.js +1 -1
  318. package/dist/utils/tools/dialect.js +1 -1
  319. package/dist/utils/tools/index.d.ts +2 -2
  320. package/dist/utils/tools/index.js +2 -2
  321. package/dist/utils/tools/parser.js +8 -8
  322. package/dist/utils/tools/parsers/dsml.d.ts +1 -1
  323. package/dist/utils/tools/parsers/dsml.js +1 -1
  324. package/dist/utils/tools/parsers/gemma4native.d.ts +1 -1
  325. package/dist/utils/tools/parsers/gemma4native.js +1 -1
  326. package/dist/utils/tools/parsers/harmony.d.ts +1 -1
  327. package/dist/utils/tools/parsers/harmony.js +1 -1
  328. package/dist/utils/tools/parsers/hermes.d.ts +1 -1
  329. package/dist/utils/tools/parsers/hermes.js +1 -1
  330. package/dist/utils/tools/parsers/json.d.ts +1 -1
  331. package/dist/utils/tools/parsers/json.js +1 -1
  332. package/dist/utils/tools/parsers/pythonic.d.ts +1 -1
  333. package/dist/utils/tools/parsers/pythonic.js +1 -1
  334. package/dist/utils/tools/parsers/qwen35.d.ts +1 -1
  335. package/dist/utils/tools/parsers/qwen35.js +3 -3
  336. package/dist/utils/url-security.d.ts +17 -0
  337. package/dist/utils/url-security.js +75 -0
  338. package/package.json +31 -26
  339. package/dist/api/provide.d.ts +0 -23
  340. package/dist/api/provide.js +0 -32
  341. package/dist/api/stop-provider.d.ts +0 -20
  342. package/dist/api/stop-provider.js +0 -30
  343. package/dist/p2p/cancel-delegated.d.ts +0 -3
  344. package/dist/p2p/cancel-delegated.js +0 -64
  345. package/dist/p2p/completion-stream-delegated.d.ts +0 -4
  346. package/dist/p2p/completion-stream-delegated.js +0 -51
  347. package/dist/p2p/delegate-client.d.ts +0 -9
  348. package/dist/p2p/delegate-client.js +0 -219
  349. package/dist/p2p/delegate-connect-diagnostics.d.ts +0 -8
  350. package/dist/p2p/delegate-connect-diagnostics.js +0 -38
  351. package/dist/p2p/delegate-transport.d.ts +0 -18
  352. package/dist/p2p/delegate-transport.js +0 -237
  353. package/dist/p2p/error-handlers.d.ts +0 -4
  354. package/dist/p2p/error-handlers.js +0 -31
  355. package/dist/p2p/handle-request.d.ts +0 -2
  356. package/dist/p2p/handle-request.js +0 -171
  357. package/dist/p2p/handler-utils.d.ts +0 -19
  358. package/dist/p2p/handler-utils.js +0 -180
  359. package/dist/p2p/heartbeat-delegated.d.ts +0 -3
  360. package/dist/p2p/heartbeat-delegated.js +0 -32
  361. package/dist/p2p/load-model-delegated.d.ts +0 -6
  362. package/dist/p2p/load-model-delegated.js +0 -132
  363. package/dist/p2p/progress-throttle.d.ts +0 -7
  364. package/dist/p2p/progress-throttle.js +0 -47
  365. package/dist/p2p/provideHandler/connection.d.ts +0 -2
  366. package/dist/p2p/provideHandler/connection.js +0 -38
  367. package/dist/p2p/provideHandler/handler.d.ts +0 -2
  368. package/dist/p2p/provideHandler/handler.js +0 -66
  369. package/dist/p2p/provideHandler/proxy.d.ts +0 -2
  370. package/dist/p2p/provideHandler/proxy.js +0 -24
  371. package/dist/p2p/provideHandler.d.ts +0 -1
  372. package/dist/p2p/provideHandler.js +0 -2
  373. package/dist/p2p/rpc-utils.d.ts +0 -4
  374. package/dist/p2p/rpc-utils.js +0 -8
  375. package/dist/p2p/stopProvideHandler.d.ts +0 -2
  376. package/dist/p2p/stopProvideHandler.js +0 -29
  377. package/dist/p2p/swarm.d.ts +0 -9
  378. package/dist/p2p/swarm.js +0 -103
  379. package/dist/p2p/transport-selector.d.ts +0 -2
  380. package/dist/p2p/transport-selector.js +0 -18
  381. package/dist/p2p/unload-model-delegated.d.ts +0 -2
  382. package/dist/p2p/unload-model-delegated.js +0 -31
  383. package/dist/profiling/delegation-profiler.d.ts +0 -31
  384. package/dist/profiling/delegation-profiler.js +0 -155
  385. package/dist/schemas/delegate.d.ts +0 -29
  386. package/dist/schemas/delegate.js +0 -40
  387. package/dist/schemas/provide.d.ts +0 -50
  388. package/dist/schemas/provide.js +0 -32
@@ -0,0 +1,46 @@
1
+ import { llmConfigBaseSchema, embedConfigBaseSchema } from './llamacpp-config.js';
2
+ import { whisperConfigSchema, parakeetRuntimeConfigSchema } from './transcription-config.js';
3
+ import { bciConfigSchema } from './bci-config.js';
4
+ import { nmtConfigBaseSchema } from './translation-config.js';
5
+ import { ttsLoadConfigSchema } from './text-to-speech.js';
6
+ import { ocrConfigSchema } from './ocr.js';
7
+ import { sdcppConfigSchema } from './sdcpp-config.js';
8
+ import { audioGenConfigSchema } from './audio-gen.js';
9
+ import { vlaConfigSchema } from './vla.js';
10
+ import { classificationConfigSchema } from './classification.js';
11
+ import { ModelType, normalizeModelType } from './model-types.js';
12
+ // Canonical model type -> the `modelConfig` schema whose fields a user
13
+ // configures. This is the describable, user-facing config surface: base/runtime
14
+ // schemas and the load-time discriminated unions (tts / nmt / audiogen),
15
+ // excluding the legacy ONNX deprecation placeholders. It is the single source
16
+ // tools read to document config fields — the describe-guard test checks every
17
+ // entry carries `.describe()` text, and the CLI's `qvac configure` resolves a
18
+ // model's schema through here to render field docs.
19
+ //
20
+ // `satisfies Record<...>` makes a newly added model type a compile error until
21
+ // its config schema is wired here, so a new addon can't silently ship without
22
+ // documented, tool-visible config. `onnx-tts` is a legacy alias that routes to
23
+ // `tts-ggml`, so it is not a key of its own.
24
+ export const MODEL_CONFIG_SCHEMA_BY_TYPE = {
25
+ [ModelType.llamacppCompletion]: llmConfigBaseSchema,
26
+ [ModelType.whispercppTranscription]: whisperConfigSchema,
27
+ [ModelType.bciWhispercppTranscription]: bciConfigSchema,
28
+ [ModelType.llamacppEmbedding]: embedConfigBaseSchema,
29
+ [ModelType.nmtcppTranslation]: nmtConfigBaseSchema,
30
+ [ModelType.ttsGgml]: ttsLoadConfigSchema,
31
+ [ModelType.parakeetTranscription]: parakeetRuntimeConfigSchema,
32
+ [ModelType.ggmlOcr]: ocrConfigSchema,
33
+ [ModelType.sdcppGeneration]: sdcppConfigSchema,
34
+ [ModelType.audiogenGgml]: audioGenConfigSchema,
35
+ [ModelType.ggmlVla]: vlaConfigSchema,
36
+ [ModelType.ggmlClassification]: classificationConfigSchema
37
+ };
38
+ // Resolve a model's `modelConfig` schema from any accepted model-type input: a
39
+ // canonical type (`tts-ggml`), a backward-compat alias (`tts`), or an engine /
40
+ // addon string that normalizes to one. Returns undefined for types with no
41
+ // configurable surface (e.g. `onnx-vad`) or unknown custom plugin types.
42
+ export function configSchemaForModelType(modelType) {
43
+ const canonical = normalizeModelType(modelType);
44
+ const key = canonical === ModelType.onnxTts ? ModelType.ttsGgml : canonical;
45
+ return MODEL_CONFIG_SCHEMA_BY_TYPE[key];
46
+ }
@@ -134,9 +134,14 @@ export declare const getLoadedModelInfoRequestSchema: z.ZodObject<{
134
134
  modelId: z.ZodString;
135
135
  type: z.ZodLiteral<"getLoadedModelInfo">;
136
136
  }, z.core.$strip>;
137
- export declare const loadedModelInfoSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
137
+ /**
138
+ * Loaded model info: routing plugin known on this node, so modelType +
139
+ * handler vocabulary are authoritative. `toolDialect` is the tool-call dialect
140
+ * the completion normalizer parses for this model (completion-capable models
141
+ * only), letting a consumer replay a prior tool call in the model's own dialect.
142
+ */
143
+ export declare const loadedModelInfoSchema: z.ZodObject<{
138
144
  modelId: z.ZodString;
139
- isDelegated: z.ZodLiteral<false>;
140
145
  modelType: z.ZodString;
141
146
  handlers: z.ZodArray<z.ZodString>;
142
147
  displayName: z.ZodOptional<z.ZodString>;
@@ -153,19 +158,11 @@ export declare const loadedModelInfoSchema: z.ZodDiscriminatedUnion<[z.ZodObject
153
158
  gemma4: "gemma4";
154
159
  dsml: "dsml";
155
160
  }>>;
156
- }, z.core.$strip>, z.ZodObject<{
157
- modelId: z.ZodString;
158
- isDelegated: z.ZodLiteral<true>;
159
- handlers: z.ZodArray<z.ZodString>;
160
- providerInfo: z.ZodObject<{
161
- providerPublicKey: z.ZodString;
162
- }, z.core.$strip>;
163
- }, z.core.$strip>], "isDelegated">;
161
+ }, z.core.$strip>;
164
162
  export declare const getLoadedModelInfoResponseSchema: z.ZodObject<{
165
163
  type: z.ZodLiteral<"getLoadedModelInfo">;
166
- info: z.ZodDiscriminatedUnion<[z.ZodObject<{
164
+ info: z.ZodObject<{
167
165
  modelId: z.ZodString;
168
- isDelegated: z.ZodLiteral<false>;
169
166
  modelType: z.ZodString;
170
167
  handlers: z.ZodArray<z.ZodString>;
171
168
  displayName: z.ZodOptional<z.ZodString>;
@@ -182,14 +179,7 @@ export declare const getLoadedModelInfoResponseSchema: z.ZodObject<{
182
179
  gemma4: "gemma4";
183
180
  dsml: "dsml";
184
181
  }>>;
185
- }, z.core.$strip>, z.ZodObject<{
186
- modelId: z.ZodString;
187
- isDelegated: z.ZodLiteral<true>;
188
- handlers: z.ZodArray<z.ZodString>;
189
- providerInfo: z.ZodObject<{
190
- providerPublicKey: z.ZodString;
191
- }, z.core.$strip>;
192
- }, z.core.$strip>], "isDelegated">;
182
+ }, z.core.$strip>;
193
183
  }, z.core.$strip>;
194
184
  export type GetLoadedModelInfoParams = z.input<typeof getLoadedModelInfoParamsSchema>;
195
185
  export type GetLoadedModelInfoRequest = z.infer<typeof getLoadedModelInfoRequestSchema>;
@@ -1,5 +1,5 @@
1
1
  import { z } from 'zod';
2
- import { toolDialectSchema } from '../schemas/completion-stream.js';
2
+ import { toolDialectSchema } from './completion-stream.js';
3
3
  // ============== Model info (catalog) ==============
4
4
  export const getModelInfoParamsSchema = z.object({
5
5
  name: z.string().describe("The model's registry name (as found in QVAC's built-in catalog).")
@@ -98,19 +98,15 @@ export const getLoadedModelInfoParamsSchema = z.object({
98
98
  export const getLoadedModelInfoRequestSchema = getLoadedModelInfoParamsSchema.extend({
99
99
  type: z.literal('getLoadedModelInfo')
100
100
  });
101
- const delegatedProviderInfoSchema = z.object({
102
- providerPublicKey: z.string()
103
- });
104
101
  /**
105
- * Loaded local model: routing plugin known on this node, so modelType +
102
+ * Loaded model info: routing plugin known on this node, so modelType +
106
103
  * handler vocabulary are authoritative. `toolDialect` is the tool-call dialect
107
104
  * the completion normalizer parses for this model (completion-capable models
108
105
  * only), letting a consumer replay a prior tool call in the model's own dialect.
109
106
  */
110
- const localLoadedModelInfoSchema = z
107
+ export const loadedModelInfoSchema = z
111
108
  .object({
112
109
  modelId: z.string(),
113
- isDelegated: z.literal(false),
114
110
  modelType: z.string(),
115
111
  handlers: z.array(z.string()),
116
112
  displayName: z.string().optional(),
@@ -120,24 +116,7 @@ const localLoadedModelInfoSchema = z
120
116
  path: z.string().optional(),
121
117
  toolDialect: toolDialectSchema.optional()
122
118
  })
123
- .meta({ title: 'LocalLoadedModelInfo' });
124
- /**
125
- * Loaded delegated model: this node only stores routing info, so `modelType`,
126
- * `displayName`, `addonPackage`, `loadedAt`, `name`, and `path` are absent,
127
- * and `handlers` is always empty.
128
- */
129
- const delegatedLoadedModelInfoSchema = z
130
- .object({
131
- modelId: z.string(),
132
- isDelegated: z.literal(true),
133
- handlers: z.array(z.string()),
134
- providerInfo: delegatedProviderInfoSchema
135
- })
136
- .meta({ title: 'DelegatedLoadedModelInfo' });
137
- export const loadedModelInfoSchema = z.discriminatedUnion('isDelegated', [
138
- localLoadedModelInfoSchema,
139
- delegatedLoadedModelInfoSchema
140
- ]);
119
+ .meta({ title: 'LoadedModelInfo' });
141
120
  export const getLoadedModelInfoResponseSchema = z.object({
142
121
  type: z.literal('getLoadedModelInfo'),
143
122
  info: loadedModelInfoSchema
@@ -29,7 +29,6 @@ export declare const unloadModelResponseSchema: z.ZodObject<{
29
29
  success: z.ZodBoolean;
30
30
  error: z.ZodOptional<z.ZodString>;
31
31
  hasActiveModels: z.ZodOptional<z.ZodBoolean>;
32
- hasActiveProviders: z.ZodOptional<z.ZodBoolean>;
33
32
  }, z.core.$strip>;
34
33
  export type UnloadModelParams = z.input<typeof unloadModelParamsSchema>;
35
34
  export type UnloadModelRequest = z.infer<typeof unloadModelRequestSchema>;
@@ -35,6 +35,5 @@ export const unloadModelResponseSchema = z.object({
35
35
  type: z.literal('unloadModel'),
36
36
  success: z.boolean(),
37
37
  error: z.string().optional(),
38
- hasActiveModels: z.boolean().optional(),
39
- hasActiveProviders: z.boolean().optional()
38
+ hasActiveModels: z.boolean().optional()
40
39
  });
@@ -0,0 +1,109 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * One group of transformer blocks that size their KV cache identically.
4
+ *
5
+ * Files that describe attention per layer (e.g. `gemma4`, whose
6
+ * `head_count_kv` and `sliding_window_pattern` hold one entry per block) are
7
+ * collapsed into these classes, so an estimator can sum the real cache instead
8
+ * of assuming every block is the widest one.
9
+ */
10
+ export declare const kvLayerClassSchema: z.ZodObject<{
11
+ count: z.ZodNumber;
12
+ headCountKv: z.ZodNumber;
13
+ keyLength: z.ZodNumber;
14
+ valueLength: z.ZodNumber;
15
+ windowed: z.ZodBoolean;
16
+ }, z.core.$strip>;
17
+ /**
18
+ * Transformer shape facts read out of a model's GGUF key-value metadata at
19
+ * catalog-generation time, from what the registry captured at ingest.
20
+ *
21
+ * Absent for non-GGUF artifacts and for GGUF files whose metadata extraction
22
+ * failed — that absence is what makes a pre-download estimate unknown rather
23
+ * than wrong.
24
+ */
25
+ export declare const ggufFactsSchema: z.ZodObject<{
26
+ architecture: z.ZodString;
27
+ blockCount: z.ZodNumber;
28
+ headCount: z.ZodNumber;
29
+ headCountKv: z.ZodNumber;
30
+ keyLength: z.ZodNumber;
31
+ valueLength: z.ZodNumber;
32
+ embeddingLength: z.ZodNumber;
33
+ contextLength: z.ZodNumber;
34
+ parameterCount: z.ZodOptional<z.ZodNumber>;
35
+ slidingWindow: z.ZodOptional<z.ZodNumber>;
36
+ keyLengthSwa: z.ZodOptional<z.ZodNumber>;
37
+ valueLengthSwa: z.ZodOptional<z.ZodNumber>;
38
+ kvLayerClasses: z.ZodOptional<z.ZodArray<z.ZodObject<{
39
+ count: z.ZodNumber;
40
+ headCountKv: z.ZodNumber;
41
+ keyLength: z.ZodNumber;
42
+ valueLength: z.ZodNumber;
43
+ windowed: z.ZodBoolean;
44
+ }, z.core.$strip>>>;
45
+ fullAttentionInterval: z.ZodOptional<z.ZodNumber>;
46
+ ssmStateSize: z.ZodOptional<z.ZodNumber>;
47
+ ssmConvKernel: z.ZodOptional<z.ZodNumber>;
48
+ ssmInnerSize: z.ZodOptional<z.ZodNumber>;
49
+ ssmGroupCount: z.ZodOptional<z.ZodNumber>;
50
+ assumptions: z.ZodOptional<z.ZodArray<z.ZodString>>;
51
+ }, z.core.$strip>;
52
+ /**
53
+ * Per-model data the pre-download resource estimators consume. Generated into
54
+ * `models/registry/resource-profiles.ts` alongside the model catalog.
55
+ *
56
+ * Profiles hold facts only — no memory numbers — so re-calibrating an estimator
57
+ * never requires regenerating the catalog.
58
+ */
59
+ export declare const modelResourceProfileSchema: z.ZodObject<{
60
+ schemaVersion: z.ZodLiteral<1>;
61
+ engine: z.ZodEnum<{
62
+ "llamacpp-completion": "llamacpp-completion";
63
+ "whispercpp-transcription": "whispercpp-transcription";
64
+ "bci-whispercpp-transcription": "bci-whispercpp-transcription";
65
+ "llamacpp-embedding": "llamacpp-embedding";
66
+ "nmtcpp-translation": "nmtcpp-translation";
67
+ "onnx-tts": "onnx-tts";
68
+ "tts-ggml": "tts-ggml";
69
+ "parakeet-transcription": "parakeet-transcription";
70
+ "ggml-ocr": "ggml-ocr";
71
+ "sdcpp-generation": "sdcpp-generation";
72
+ "audiogen-ggml": "audiogen-ggml";
73
+ "ggml-vla": "ggml-vla";
74
+ "ggml-classification": "ggml-classification";
75
+ "onnx-vad": "onnx-vad";
76
+ }>;
77
+ artifactBytes: z.ZodNumber;
78
+ ggufFacts: z.ZodOptional<z.ZodObject<{
79
+ architecture: z.ZodString;
80
+ blockCount: z.ZodNumber;
81
+ headCount: z.ZodNumber;
82
+ headCountKv: z.ZodNumber;
83
+ keyLength: z.ZodNumber;
84
+ valueLength: z.ZodNumber;
85
+ embeddingLength: z.ZodNumber;
86
+ contextLength: z.ZodNumber;
87
+ parameterCount: z.ZodOptional<z.ZodNumber>;
88
+ slidingWindow: z.ZodOptional<z.ZodNumber>;
89
+ keyLengthSwa: z.ZodOptional<z.ZodNumber>;
90
+ valueLengthSwa: z.ZodOptional<z.ZodNumber>;
91
+ kvLayerClasses: z.ZodOptional<z.ZodArray<z.ZodObject<{
92
+ count: z.ZodNumber;
93
+ headCountKv: z.ZodNumber;
94
+ keyLength: z.ZodNumber;
95
+ valueLength: z.ZodNumber;
96
+ windowed: z.ZodBoolean;
97
+ }, z.core.$strip>>>;
98
+ fullAttentionInterval: z.ZodOptional<z.ZodNumber>;
99
+ ssmStateSize: z.ZodOptional<z.ZodNumber>;
100
+ ssmConvKernel: z.ZodOptional<z.ZodNumber>;
101
+ ssmInnerSize: z.ZodOptional<z.ZodNumber>;
102
+ ssmGroupCount: z.ZodOptional<z.ZodNumber>;
103
+ assumptions: z.ZodOptional<z.ZodArray<z.ZodString>>;
104
+ }, z.core.$strip>>;
105
+ assumptions: z.ZodOptional<z.ZodArray<z.ZodString>>;
106
+ }, z.core.$strip>;
107
+ export type KvLayerClass = z.infer<typeof kvLayerClassSchema>;
108
+ export type GgufFacts = z.infer<typeof ggufFactsSchema>;
109
+ export type ModelResourceProfile = z.infer<typeof modelResourceProfileSchema>;
@@ -0,0 +1,83 @@
1
+ import { z } from 'zod';
2
+ import { modelRegistryEngineSchema } from './registry.js';
3
+ /**
4
+ * One group of transformer blocks that size their KV cache identically.
5
+ *
6
+ * Files that describe attention per layer (e.g. `gemma4`, whose
7
+ * `head_count_kv` and `sliding_window_pattern` hold one entry per block) are
8
+ * collapsed into these classes, so an estimator can sum the real cache instead
9
+ * of assuming every block is the widest one.
10
+ */
11
+ export const kvLayerClassSchema = z.object({
12
+ count: z.number().describe('Number of blocks in this class.'),
13
+ headCountKv: z.number().describe('KV heads per block in this class.'),
14
+ keyLength: z.number().describe('Key head dimension for this class, in elements.'),
15
+ valueLength: z.number().describe('Value head dimension for this class, in elements.'),
16
+ windowed: z
17
+ .boolean()
18
+ .describe('True when these blocks use sliding-window attention, so their cache is capped at `slidingWindow` tokens rather than the full context.')
19
+ });
20
+ /**
21
+ * Transformer shape facts read out of a model's GGUF key-value metadata at
22
+ * catalog-generation time, from what the registry captured at ingest.
23
+ *
24
+ * Absent for non-GGUF artifacts and for GGUF files whose metadata extraction
25
+ * failed — that absence is what makes a pre-download estimate unknown rather
26
+ * than wrong.
27
+ */
28
+ export const ggufFactsSchema = z.object({
29
+ architecture: z.string().describe('`general.architecture`, e.g. `qwen35`, `bert`.'),
30
+ blockCount: z.number().describe('Number of transformer blocks (layers).'),
31
+ headCount: z.number().describe('Attention heads per block.'),
32
+ headCountKv: z
33
+ .number()
34
+ .describe('KV heads per block; the maximum when the file stores one value per layer.'),
35
+ keyLength: z.number().describe('Key head dimension, in elements.'),
36
+ valueLength: z.number().describe('Value head dimension, in elements.'),
37
+ embeddingLength: z.number().describe('Model embedding width, in elements.'),
38
+ contextLength: z.number().describe('Trained context window, in tokens.'),
39
+ parameterCount: z.number().optional().describe('Total parameters, when the file records it.'),
40
+ slidingWindow: z
41
+ .number()
42
+ .optional()
43
+ .describe('Sliding-window size, in tokens, for sliding-window-attention models.'),
44
+ keyLengthSwa: z.number().optional().describe('Key head dimension on sliding-window blocks.'),
45
+ valueLengthSwa: z.number().optional().describe('Value head dimension on sliding-window blocks.'),
46
+ kvLayerClasses: z
47
+ .array(kvLayerClassSchema)
48
+ .optional()
49
+ .describe('Per-layer KV-cache breakdown, when the file describes attention per block. Absent means the flat fields above describe every block.'),
50
+ fullAttentionInterval: z
51
+ .number()
52
+ .optional()
53
+ .describe('For hybrid attention/recurrent models: only every Nth block holds a KV cache, the rest hold a fixed-size state.'),
54
+ ssmStateSize: z.number().optional().describe('SSM state size, for hybrid recurrent models.'),
55
+ ssmConvKernel: z.number().optional().describe('SSM convolution kernel width.'),
56
+ ssmInnerSize: z.number().optional().describe('SSM inner width.'),
57
+ ssmGroupCount: z.number().optional().describe('SSM group count.'),
58
+ assumptions: z
59
+ .array(z.string())
60
+ .optional()
61
+ .describe('Notes on any value that was derived rather than read from the file.')
62
+ });
63
+ /**
64
+ * Per-model data the pre-download resource estimators consume. Generated into
65
+ * `models/registry/resource-profiles.ts` alongside the model catalog.
66
+ *
67
+ * Profiles hold facts only — no memory numbers — so re-calibrating an estimator
68
+ * never requires regenerating the catalog.
69
+ */
70
+ export const modelResourceProfileSchema = z.object({
71
+ schemaVersion: z.literal(1).describe('Bumped whenever the emitted profile shape changes.'),
72
+ engine: modelRegistryEngineSchema.describe('Canonical inference engine identifier.'),
73
+ artifactBytes: z
74
+ .number()
75
+ .describe('Total bytes that land on disk for this model: the summed shards, or every file of its companion set.'),
76
+ ggufFacts: ggufFactsSchema
77
+ .optional()
78
+ .describe('Absent when the model is not a GGUF or the registry has no usable metadata for it.'),
79
+ assumptions: z
80
+ .array(z.string())
81
+ .optional()
82
+ .describe('Notes on how the numbers above were derived.')
83
+ });
@@ -1,4 +1,5 @@
1
1
  import { z } from 'zod';
2
+ export declare const MODEL_SOURCE_URI_HINT = "a local file path, an HTTP(S) URL, or a `registry://` / `pear://` URI";
2
3
  export declare const modelDescriptorSchema: z.ZodObject<{
3
4
  src: z.ZodString;
4
5
  name: z.ZodOptional<z.ZodString>;
@@ -1,20 +1,40 @@
1
1
  import { z } from 'zod';
2
- import { modelTypeInputSchema, normalizeModelType, isCanonicalModelType, isModelTypeAlias } from '../schemas/model-types.js';
3
- import { resolveCanonicalEngine } from '../schemas/engine-addon-map.js';
2
+ import { modelTypeInputSchema, normalizeModelType, isCanonicalModelType, isModelTypeAlias } from './model-types.js';
3
+ import { resolveCanonicalEngine } from './engine-addon-map.js';
4
4
  // Addon field accepts model type inputs plus "vad"
5
5
  const addonSchema = z.union([modelTypeInputSchema, z.literal('vad')]);
6
+ // Shared phrasing for the accepted model-source locations, reused by every
7
+ // field-level `.describe()` that documents a model/asset source.
8
+ export const MODEL_SOURCE_URI_HINT = 'a local file path, an HTTP(S) URL, or a `registry://` / `pear://` URI';
6
9
  export const modelDescriptorSchema = z.object({
7
- src: z.string(),
8
- name: z.string().optional(),
9
- modelId: z.string().optional(),
10
- registryPath: z.string().optional(),
11
- registrySource: z.string().optional(),
12
- blobCoreKey: z.string().optional(),
13
- blobIndex: z.number().optional(),
14
- engine: z.string().optional(),
15
- expectedSize: z.number().optional(),
16
- sha256Checksum: z.string().optional(),
17
- addon: addonSchema.optional()
10
+ src: z.string().describe(`Location of the model file: ${MODEL_SOURCE_URI_HINT}.`),
11
+ name: z
12
+ .string()
13
+ .optional()
14
+ .describe('Display name for this model instance; overrides the name derived from the source.'),
15
+ modelId: z
16
+ .string()
17
+ .optional()
18
+ .describe('Unique identifier used to reference the model in QVAC calls.'),
19
+ registryPath: z
20
+ .string()
21
+ .optional()
22
+ .describe('Registry-relative path to the model (set for registry-backed models).'),
23
+ registrySource: z.string().optional().describe('Registry source identifier, e.g. `huggingface`.'),
24
+ blobCoreKey: z.string().optional().describe('Hyperdrive blob core key for the model file.'),
25
+ blobIndex: z
26
+ .number()
27
+ .optional()
28
+ .describe('Internal: index of this shard within its Hyperdrive blob core, for sharded models.'),
29
+ engine: z
30
+ .string()
31
+ .optional()
32
+ .describe('Canonical inference engine identifier, e.g. `llamacpp-completion`.'),
33
+ expectedSize: z.number().optional().describe('Expected total size of the model file in bytes.'),
34
+ sha256Checksum: z.string().optional().describe('Expected SHA-256 checksum of the model file.'),
35
+ addon: addonSchema
36
+ .optional()
37
+ .describe('Inference addon / capability category this model belongs to.')
18
38
  });
19
39
  export const modelSrcInputSchema = z.union([z.string(), modelDescriptorSchema]);
20
40
  /**
@@ -1,21 +1,56 @@
1
1
  import { z } from 'zod';
2
- import { modelSrcInputSchema } from '../schemas/model-src-utils.js';
2
+ import { modelSrcInputSchema } from './model-src-utils.js';
3
3
  // Model config — maps to @qvac/ocr-ggml `OcrGgmlParams`. Legacy ONNX-only knobs
4
4
  // (useGPU, timeout, pipelineMode, decodingMethod, straightenPages) are dropped;
5
5
  // zod's default (non-strict) object strips them silently if still passed.
6
6
  export const ocrConfigSchema = z.object({
7
- langList: z.array(z.string()).optional(),
8
- pipelineType: z.enum(['easyocr', 'doctr']).optional(),
9
- magRatio: z.number().optional(),
10
- canvasSize: z.number().optional(),
11
- defaultRotationAngles: z.array(z.number()).optional(),
12
- contrastRetry: z.boolean().optional(),
13
- lowConfidenceThreshold: z.number().optional(),
14
- recognizerBatchSize: z.number().optional(),
15
- nThreads: z.number().optional(),
16
- backendDevice: z.enum(['cpu', 'vulkan', 'metal', 'opencl']).optional(),
17
- gpuDevice: z.number().optional(),
18
- detectorModelSrc: modelSrcInputSchema.optional()
7
+ langList: z
8
+ .array(z.string())
9
+ .optional()
10
+ .describe("Languages handled by the recognizer, e.g. `['en']` or `['en', 'fr']`. Required for `easyocr`; ignored by the language-agnostic `doctr` pipeline."),
11
+ pipelineType: z
12
+ .enum(['easyocr', 'doctr'])
13
+ .optional()
14
+ .describe("OCR pipeline: `'easyocr'` (CRAFT detector + CRNN recognizer, default) or `'doctr'` (DBNet detector + doctr recognizer, language-agnostic)."),
15
+ magRatio: z
16
+ .number()
17
+ .optional()
18
+ .describe('Detection magnification ratio (easyocr only). Default 1.5.'),
19
+ canvasSize: z
20
+ .number()
21
+ .optional()
22
+ .describe('Detection canvas cap (long side, px) applied after `magRatio` scaling; lower it on memory-constrained targets. Default 2560. easyocr only.'),
23
+ defaultRotationAngles: z
24
+ .array(z.number())
25
+ .optional()
26
+ .describe('Rotation angles tried when the primary pass is low-confidence (easyocr only). Default [90, 270].'),
27
+ contrastRetry: z
28
+ .boolean()
29
+ .optional()
30
+ .describe('Retry low-confidence boxes with contrast adjustment (easyocr only). Default false.'),
31
+ lowConfidenceThreshold: z
32
+ .number()
33
+ .optional()
34
+ .describe('Confidence threshold below which contrast-retry kicks in (easyocr only). Default 0.4.'),
35
+ recognizerBatchSize: z
36
+ .number()
37
+ .optional()
38
+ .describe('Recognizer batch size (easyocr only). Default 32.'),
39
+ nThreads: z
40
+ .number()
41
+ .optional()
42
+ .describe("GGML CPU thread count: `0` (default) auto-detects physical cores, `> 0` sets an explicit count, `< 0` leaves the backend's default unchanged."),
43
+ backendDevice: z
44
+ .enum(['cpu', 'vulkan', 'metal', 'opencl'])
45
+ .optional()
46
+ .describe("ggml backend device: `'cpu'` (default), `'vulkan'`, `'metal'`, or `'opencl'`. Falls back to CPU when the requested GPU device is unavailable."),
47
+ gpuDevice: z
48
+ .number()
49
+ .optional()
50
+ .describe("0-based GPU device index for `'vulkan'`/`'metal'`/`'opencl'`; when omitted, prefers a discrete GPU. Ignored for `'cpu'`."),
51
+ detectorModelSrc: modelSrcInputSchema
52
+ .optional()
53
+ .describe('Text-detector model source (easyocr: CRAFT; doctr: DBNet). Derived from the recognizer model source when omitted.')
19
54
  });
20
55
  // Image input types
21
56
  export const imageInputSchema = z.discriminatedUnion('type', [
@@ -1,4 +1,8 @@
1
1
  import { z } from 'zod';
2
+ // Import from the dependency-free module: this schema is re-exported through
3
+ // the Node-safe `@qvac/inference/surface`, and `@/utils/path-security` pulls in
4
+ // `bare-path` at runtime.
5
+ import { sanitizePathComponent } from '../utils/path-sanitize.js';
2
6
  /**
3
7
  * Zod refinement for path components that get joined to a base directory.
4
8
  * Rejects strings containing traversal sequences (.., null bytes).
@@ -16,7 +20,9 @@ export const safePathComponent = z.string().refine((s) => {
16
20
  // Reject URL-encoded traversal (%2e = ".", %2f = "/", %5c = "\")
17
21
  if (/%2e/i.test(s))
18
22
  return false;
19
- return true;
23
+ // Reject components that resolve to the directory they are joined against.
24
+ const sanitized = sanitizePathComponent(s);
25
+ return sanitized.split('/').some((segment) => segment !== '' && segment !== '.');
20
26
  }, {
21
- message: "Path component must not contain traversal sequences ('..', '%2e'), null bytes, or '%00'"
27
+ message: "Path component must name a child path and not contain traversal sequences ('..', '%2e'), null bytes, or '%00'"
22
28
  });
@@ -1,6 +1,8 @@
1
1
  import { z } from 'zod';
2
2
  import type Buffer from 'bare-buffer';
3
- import type { ModelSrcInput } from '../schemas/model-src-utils.js';
3
+ import type { TurboVecIndexProvider } from '@qvac/rag';
4
+ import type { ModelSrcInput } from './model-src-utils.js';
5
+ import type { RuntimeContext } from './runtime-context.js';
4
6
  /**
5
7
  * Granularity at which the addon can cancel.
6
8
  * - `"request"` — addon cancels a specific in-flight `requestId`.
@@ -87,6 +89,9 @@ export interface PluginLogging {
87
89
  module: unknown;
88
90
  namespace: string;
89
91
  }
92
+ export interface QvacPluginCapabilities {
93
+ turbovecIndexProvider?: TurboVecIndexProvider;
94
+ }
90
95
  /**
91
96
  * Function to resolve a model source (URL or path) to a local file path.
92
97
  * Passed to resolveConfig hook to allow plugins to resolve their artifacts.
@@ -101,6 +106,7 @@ export interface ResolveContext {
101
106
  modelSrc: string;
102
107
  modelType: string;
103
108
  modelName?: string;
109
+ platform?: RuntimeContext['platform'];
104
110
  }
105
111
  /**
106
112
  * Result from plugin resolveConfig hook.
@@ -118,6 +124,7 @@ export interface QvacPlugin<TConfig = Record<string, unknown>, TArtifactKeys ext
118
124
  createModel: (params: CreateModelParams) => PluginModelResult;
119
125
  handlers: Record<string, PluginHandlerDefinition>;
120
126
  logging?: PluginLogging | undefined;
127
+ capabilities?: QvacPluginCapabilities | undefined;
121
128
  /** When true, skips file-existence validation for modelPath. Use for plugins that derive paths from config. */
122
129
  skipPrimaryModelPathValidation?: boolean;
123
130
  /**
@@ -238,6 +245,12 @@ export declare const pluginDefinitionRuntimeSchema: z.ZodObject<{
238
245
  module: z.ZodOptional<z.ZodUnknown>;
239
246
  namespace: z.ZodOptional<z.ZodString>;
240
247
  }, z.core.$catchall<z.ZodUnknown>>>;
248
+ capabilities: z.ZodOptional<z.ZodObject<{
249
+ turbovecIndexProvider: z.ZodOptional<z.ZodObject<{
250
+ create: z.ZodCustom<Function, Function>;
251
+ load: z.ZodCustom<Function, Function>;
252
+ }, z.core.$strip>>;
253
+ }, z.core.$catchall<z.ZodUnknown>>>;
241
254
  resolveConfig: z.ZodOptional<z.ZodCustom<Function, Function>>;
242
255
  skipPrimaryModelPathValidation: z.ZodOptional<z.ZodBoolean>;
243
256
  }, z.core.$catchall<z.ZodUnknown>>;
@@ -119,6 +119,17 @@ export const pluginDefinitionRuntimeSchema = z
119
119
  })
120
120
  .catchall(z.unknown())
121
121
  .optional(),
122
+ capabilities: z
123
+ .object({
124
+ turbovecIndexProvider: z
125
+ .object({
126
+ create: functionRuntimeSchema,
127
+ load: functionRuntimeSchema
128
+ })
129
+ .optional()
130
+ })
131
+ .catchall(z.unknown())
132
+ .optional(),
122
133
  resolveConfig: functionRuntimeSchema.optional(),
123
134
  skipPrimaryModelPathValidation: z.boolean().optional()
124
135
  })