@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
@@ -1,12 +1,12 @@
1
1
  import { z } from 'zod';
2
- import { logLevelSchema } from '../schemas/logging-stream.js';
3
- import { ModelType } from '../schemas/model-types.js';
4
- import { llmConfigBaseSchema, embedConfigBaseSchema } from '../schemas/llamacpp-config.js';
5
- import { whisperConfigSchema, parakeetConfigSchema } from '../schemas/transcription-config.js';
6
- import { ocrConfigSchema } from '../schemas/ocr.js';
7
- import { sdcppConfigSchema } from '../schemas/sdcpp-config.js';
8
- import { vlaConfigSchema } from '../schemas/vla.js';
9
- import { runtimeContextSchema } from '../schemas/runtime-context.js';
2
+ import { logLevelSchema } from './logging-stream.js';
3
+ import { ModelType } from './model-types.js';
4
+ import { llmConfigBaseSchema, embedConfigBaseSchema } from './llamacpp-config.js';
5
+ import { whisperConfigSchema, parakeetConfigSchema } from './transcription-config.js';
6
+ import { ocrConfigSchema } from './ocr.js';
7
+ import { sdcppConfigSchema } from './sdcpp-config.js';
8
+ import { vlaConfigSchema } from './vla.js';
9
+ import { runtimeContextSchema } from './runtime-context.js';
10
10
  // Alias keys for user convenience (maps to canonical types)
11
11
  const AliasKeys = {
12
12
  llm: 'llm',
@@ -104,6 +104,14 @@ export const qvacConfigSchema = z.object({
104
104
  * Defaults to false; set to true to see logs on the console.
105
105
  */
106
106
  loggerConsoleOutput: z.boolean().optional(),
107
+ /**
108
+ * Timeout in milliseconds for the worker RPC handshake performed when the SDK
109
+ * initializes. Raise this on slow storage or embedded hardware where the first
110
+ * worker start (native addon load) legitimately exceeds the default.
111
+ * The `QVAC_RPC_INIT_TIMEOUT_MS` environment variable takes precedence.
112
+ * Defaults to 30000 (30 seconds).
113
+ */
114
+ rpcInitTimeoutMs: z.number().int().positive().optional(),
107
115
  /**
108
116
  * Maximum number of concurrent HTTP downloads for sharded models.
109
117
  * Higher values may improve download speed but increase memory usage.
@@ -117,6 +125,31 @@ export const qvacConfigSchema = z.object({
117
125
  * Defaults to 10000 (10 seconds).
118
126
  */
119
127
  httpConnectionTimeoutMs: z.number().int().positive().optional(),
128
+ /**
129
+ * Require HTTP model downloads to be verified against a trusted checksum.
130
+ * Sources that expose one (currently Hugging Face, via the Hub's SHA-256)
131
+ * are always verified regardless of this flag, and a mismatch always fails.
132
+ * This flag only governs the unverifiable cases:
133
+ * - false (default): a source with no available checksum downloads with a
134
+ * warning (Hugging Face URLs that expose no SHA-256, and non-Hugging-Face
135
+ * URLs which have no checksum source).
136
+ * - true: a source that should be verifiable but exposes no usable checksum
137
+ * (e.g. a Hugging Face URL without a SHA-256) is rejected; a source with no
138
+ * checksum source at all still downloads, with a warning that no checksum
139
+ * source was available.
140
+ * Defaults to false.
141
+ */
142
+ requireHttpChecksum: z.boolean().optional(),
143
+ /**
144
+ * Enforce secure transport for HTTP model downloads: reject plaintext http://
145
+ * and HTTPS->HTTP downgrade redirects (loopback exempt).
146
+ * - false (default): enforced only for Hugging Face sources, whose Hub SHA-256
147
+ * attestation a downgrade could sidestep. Bring-your-own HTTP on any host,
148
+ * plaintext included, is left as-is.
149
+ * - true: enforced for every HTTP source, so all downloads must use HTTPS.
150
+ * Defaults to false.
151
+ */
152
+ requireSecureTransport: z.boolean().optional(),
120
153
  /**
121
154
  * Maximum number of retry attempts for registry (P2P) downloads on timeout.
122
155
  * When a download times out due to a P2P connection stall, we
@@ -153,6 +186,15 @@ export const qvacConfigSchema = z.object({
153
186
  * ```
154
187
  */
155
188
  deviceDefaults: z.array(devicePatternSchema).optional(),
189
+ /**
190
+ * Create new RAG workspaces on the TurboVec index instead of HyperDB.
191
+ * The choice is per workspace and one-way: a workspace records its adapter
192
+ * on first open and keeps it regardless of later config changes. The only
193
+ * way to move an existing workspace back is `deleteWorkspace`, which
194
+ * deletes its data.
195
+ * Defaults to false.
196
+ */
197
+ ragTurbovec: z.boolean().optional(),
156
198
  /**
157
199
  * Inert: we do not read this field. Plugins are registered
158
200
  * in code with `registerPlugin` / `plugins([...])`, and there are no
@@ -1,6 +1,6 @@
1
1
  import { z } from 'zod';
2
2
  import type { AbortController } from 'bare-abort-controller';
3
- import type { ModelProgressUpdate } from '../schemas/load-model.js';
3
+ import type { ModelProgressUpdate } from './load-model.js';
4
4
  export declare const downloadAssetOptionsSchema: z.ZodPipe<z.ZodObject<{
5
5
  assetSrc: z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
6
6
  src: z.ZodString;
@@ -42,6 +42,8 @@ export declare const downloadAssetOptionsSchema: z.ZodPipe<z.ZodObject<{
42
42
  }>, z.ZodLiteral<"vad">]>>;
43
43
  }, z.core.$strip>]>;
44
44
  seed: z.ZodOptional<z.ZodBoolean>;
45
+ requireHttpChecksum: z.ZodOptional<z.ZodBoolean>;
46
+ requireSecureTransport: z.ZodOptional<z.ZodBoolean>;
45
47
  }, z.core.$strip>, z.ZodTransform<{
46
48
  seed: boolean;
47
49
  assetSrc: string | {
@@ -57,6 +59,8 @@ export declare const downloadAssetOptionsSchema: z.ZodPipe<z.ZodObject<{
57
59
  sha256Checksum?: string | undefined;
58
60
  addon?: "embeddings" | "diffusion" | "audiogen" | "tts" | "ocr" | "vla" | "llamacpp-completion" | "whispercpp-transcription" | "bci-whispercpp-transcription" | "llamacpp-embedding" | "nmtcpp-translation" | "onnx-tts" | "tts-ggml" | "parakeet-transcription" | "ggml-ocr" | "sdcpp-generation" | "audiogen-ggml" | "ggml-vla" | "ggml-classification" | "llm" | "whisper" | "bci" | "nmt" | "parakeet" | "classification" | "vad" | undefined;
59
61
  };
62
+ requireHttpChecksum?: boolean | undefined;
63
+ requireSecureTransport?: boolean | undefined;
60
64
  }, {
61
65
  assetSrc: string | {
62
66
  src: string;
@@ -72,6 +76,8 @@ export declare const downloadAssetOptionsSchema: z.ZodPipe<z.ZodObject<{
72
76
  addon?: "embeddings" | "diffusion" | "audiogen" | "tts" | "ocr" | "vla" | "llamacpp-completion" | "whispercpp-transcription" | "bci-whispercpp-transcription" | "llamacpp-embedding" | "nmtcpp-translation" | "onnx-tts" | "tts-ggml" | "parakeet-transcription" | "ggml-ocr" | "sdcpp-generation" | "audiogen-ggml" | "ggml-vla" | "ggml-classification" | "llm" | "whisper" | "bci" | "nmt" | "parakeet" | "classification" | "vad" | undefined;
73
77
  };
74
78
  seed?: boolean | undefined;
79
+ requireHttpChecksum?: boolean | undefined;
80
+ requireSecureTransport?: boolean | undefined;
75
81
  }>>;
76
82
  export declare const downloadAssetOptionsToRequestSchema: z.ZodPipe<z.ZodObject<{
77
83
  assetSrc: z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
@@ -114,6 +120,8 @@ export declare const downloadAssetOptionsToRequestSchema: z.ZodPipe<z.ZodObject<
114
120
  }>, z.ZodLiteral<"vad">]>>;
115
121
  }, z.core.$strip>]>;
116
122
  seed: z.ZodOptional<z.ZodBoolean>;
123
+ requireHttpChecksum: z.ZodOptional<z.ZodBoolean>;
124
+ requireSecureTransport: z.ZodOptional<z.ZodBoolean>;
117
125
  onProgress: z.ZodOptional<z.ZodUnknown>;
118
126
  withProgress: z.ZodOptional<z.ZodBoolean>;
119
127
  requestId: z.ZodOptional<z.ZodString>;
@@ -123,6 +131,8 @@ export declare const downloadAssetOptionsToRequestSchema: z.ZodPipe<z.ZodObject<
123
131
  withProgress: boolean;
124
132
  seed: boolean;
125
133
  requestId?: string;
134
+ requireHttpChecksum?: boolean;
135
+ requireSecureTransport?: boolean;
126
136
  }, {
127
137
  assetSrc: string | {
128
138
  src: string;
@@ -138,6 +148,8 @@ export declare const downloadAssetOptionsToRequestSchema: z.ZodPipe<z.ZodObject<
138
148
  addon?: "embeddings" | "diffusion" | "audiogen" | "tts" | "ocr" | "vla" | "llamacpp-completion" | "whispercpp-transcription" | "bci-whispercpp-transcription" | "llamacpp-embedding" | "nmtcpp-translation" | "onnx-tts" | "tts-ggml" | "parakeet-transcription" | "ggml-ocr" | "sdcpp-generation" | "audiogen-ggml" | "ggml-vla" | "ggml-classification" | "llm" | "whisper" | "bci" | "nmt" | "parakeet" | "classification" | "vad" | undefined;
139
149
  };
140
150
  seed?: boolean | undefined;
151
+ requireHttpChecksum?: boolean | undefined;
152
+ requireSecureTransport?: boolean | undefined;
141
153
  onProgress?: unknown;
142
154
  withProgress?: boolean | undefined;
143
155
  requestId?: string | undefined;
@@ -147,18 +159,24 @@ export declare const downloadAssetRequestSchema: z.ZodPipe<z.ZodObject<{
147
159
  assetSrc: z.ZodString;
148
160
  withProgress: z.ZodOptional<z.ZodBoolean>;
149
161
  seed: z.ZodOptional<z.ZodBoolean>;
162
+ requireHttpChecksum: z.ZodOptional<z.ZodBoolean>;
163
+ requireSecureTransport: z.ZodOptional<z.ZodBoolean>;
150
164
  requestId: z.ZodOptional<z.ZodString>;
151
165
  }, z.core.$strip>, z.ZodTransform<{
152
166
  seed: boolean;
153
167
  type: "downloadAsset";
154
168
  assetSrc: string;
155
169
  withProgress?: boolean | undefined;
170
+ requireHttpChecksum?: boolean | undefined;
171
+ requireSecureTransport?: boolean | undefined;
156
172
  requestId?: string | undefined;
157
173
  }, {
158
174
  type: "downloadAsset";
159
175
  assetSrc: string;
160
176
  withProgress?: boolean | undefined;
161
177
  seed?: boolean | undefined;
178
+ requireHttpChecksum?: boolean | undefined;
179
+ requireSecureTransport?: boolean | undefined;
162
180
  requestId?: string | undefined;
163
181
  }>>;
164
182
  export declare const downloadAssetResponseSchema: z.ZodObject<{
@@ -1,8 +1,11 @@
1
1
  import { z } from 'zod';
2
- import { modelSrcInputSchema, modelInputToSrcSchema } from '../schemas/model-src-utils.js';
2
+ import { modelSrcInputSchema, modelInputToSrcSchema, MODEL_SOURCE_URI_HINT } from './model-src-utils.js';
3
+ const ASSET_SRC_DESCRIPTION = `The asset to download and cache: ${MODEL_SOURCE_URI_HINT}.`;
3
4
  const downloadAssetOptionsBaseSchema = z.object({
4
- assetSrc: modelSrcInputSchema,
5
- seed: z.boolean().optional()
5
+ assetSrc: modelSrcInputSchema.describe(ASSET_SRC_DESCRIPTION),
6
+ seed: z.boolean().optional(),
7
+ requireHttpChecksum: z.boolean().optional(),
8
+ requireSecureTransport: z.boolean().optional()
6
9
  });
7
10
  export const downloadAssetOptionsSchema = downloadAssetOptionsBaseSchema.transform((data) => ({
8
11
  ...data,
@@ -23,14 +26,27 @@ export const downloadAssetOptionsToRequestSchema = downloadAssetOptionsBaseSchem
23
26
  };
24
27
  if (data.requestId !== undefined)
25
28
  out.requestId = data.requestId;
29
+ if (data.requireHttpChecksum !== undefined)
30
+ out.requireHttpChecksum = data.requireHttpChecksum;
31
+ if (data.requireSecureTransport !== undefined) {
32
+ out.requireSecureTransport = data.requireSecureTransport;
33
+ }
26
34
  return out;
27
35
  });
28
36
  export const downloadAssetRequestSchema = z
29
37
  .object({
30
38
  type: z.literal('downloadAsset'),
31
- assetSrc: z.string(),
39
+ assetSrc: z.string().describe(ASSET_SRC_DESCRIPTION),
32
40
  withProgress: z.boolean().optional(),
33
41
  seed: z.boolean().optional(),
42
+ requireHttpChecksum: z
43
+ .boolean()
44
+ .optional()
45
+ .describe('Reject a Hugging Face HTTP download that exposes no usable SHA-256 instead of downloading it unverified. Overrides the engine config for this call; defaults to the config value (false).'),
46
+ requireSecureTransport: z
47
+ .boolean()
48
+ .optional()
49
+ .describe('Reject plaintext http:// and HTTPS→HTTP downgrades for every HTTP source on this call (loopback exempt); when unset, only Hugging Face transport is hardened. Overrides the engine config for this call; defaults to the config value (false).'),
34
50
  requestId: z
35
51
  .string()
36
52
  .min(1)
@@ -1,4 +1,4 @@
1
- import { type ModelRegistryEngine, type ModelRegistryEntryAddon } from '../schemas/registry.js';
1
+ import { type ModelRegistryEngine, type ModelRegistryEntryAddon } from './registry.js';
2
2
  export declare const ENGINE_TO_ADDON: {
3
3
  readonly "llamacpp-completion": "llm";
4
4
  readonly "whispercpp-transcription": "whisper";
@@ -1,6 +1,6 @@
1
- import { ModelType } from '../schemas/model-types.js';
2
- import { ADDON_AUDIOGEN, ADDON_BCI, ADDON_CLASSIFICATION, ADDON_DIFFUSION, ADDON_EMBEDDING, ADDON_LLM, ADDON_NMT, ADDON_OCR, ADDON_PARAKEET, ADDON_TTS, ADDON_VLA, ADDON_WHISPER } from '../schemas/plugin.js';
3
- import { modelRegistryEngineSchema } from '../schemas/registry.js';
1
+ import { ModelType } from './model-types.js';
2
+ import { ADDON_AUDIOGEN, ADDON_BCI, ADDON_CLASSIFICATION, ADDON_DIFFUSION, ADDON_EMBEDDING, ADDON_LLM, ADDON_NMT, ADDON_OCR, ADDON_PARAKEET, ADDON_TTS, ADDON_VLA, ADDON_WHISPER } from './plugin.js';
3
+ import { modelRegistryEngineSchema } from './registry.js';
4
4
  // Canonical engine → addon mapping (exhaustive). `as const` preserves
5
5
  // per-key literals so the addon can be derived from the engine at the type level.
6
6
  export const ENGINE_TO_ADDON = {
@@ -1,7 +1,7 @@
1
1
  import { z } from 'zod';
2
2
  /**
3
- * Serialized shape for errors that cross a response boundary — a
4
- * delegated provider's response over `bare-rpc`, or a duplex stream.
3
+ * Serialized shape for errors that cross a response boundary — an RPC
4
+ * reply over `bare-rpc`, or a duplex stream.
5
5
  * The fields are the union of (a) the `QvacErrorBase` serialisation
6
6
  * (`name`, `code`, `message`, `stack`, `cause`, `timestamp`) and (b) the
7
7
  * `typedFields` map carrying per-class structured data a receiver uses
@@ -2,8 +2,8 @@ import { z } from 'zod';
2
2
  import { QvacErrorBase } from '@qvac/error';
3
3
  import { formatZodError } from '../utils/zod-error.js';
4
4
  /**
5
- * Serialized shape for errors that cross a response boundary — a
6
- * delegated provider's response over `bare-rpc`, or a duplex stream.
5
+ * Serialized shape for errors that cross a response boundary — an RPC
6
+ * reply over `bare-rpc`, or a duplex stream.
7
7
  * The fields are the union of (a) the `QvacErrorBase` serialisation
8
8
  * (`name`, `code`, `message`, `stack`, `cause`, `timestamp`) and (b) the
9
9
  * `typedFields` map carrying per-class structured data a receiver uses
@@ -9,8 +9,6 @@ export declare const ERROR_CODES: {
9
9
  readonly MODEL_SRC_TYPE_MISMATCH: 50009;
10
10
  readonly REQUEST_VALIDATION_FAILED: 50010;
11
11
  readonly RPC_NO_HANDLER: 50200;
12
- readonly PROVIDER_START_FAILED: 50400;
13
- readonly PROVIDER_STOP_FAILED: 50401;
14
12
  readonly CONFIG_FILE_INVALID: 50603;
15
13
  readonly CONFIG_FILE_PARSE_FAILED: 50604;
16
14
  readonly CONFIG_VALIDATION_FAILED: 50605;
@@ -19,7 +17,6 @@ export declare const ERROR_CODES: {
19
17
  readonly MODEL_ALREADY_REGISTERED: 52001;
20
18
  readonly MODEL_NOT_FOUND: 52002;
21
19
  readonly MODEL_NOT_LOADED: 52003;
22
- readonly MODEL_IS_DELEGATED: 52004;
23
20
  readonly UNKNOWN_MODEL_TYPE: 52005;
24
21
  readonly MODEL_LOAD_FAILED: 52200;
25
22
  readonly MODEL_FILE_NOT_FOUND: 52201;
@@ -81,6 +78,8 @@ export declare const ERROR_CODES: {
81
78
  readonly ARCHIVE_MISSING_SHARDS: 53013;
82
79
  readonly PARTIAL_DOWNLOAD_OFFLINE: 53014;
83
80
  readonly REGISTRY_DOWNLOAD_FAILED: 53015;
81
+ readonly INSECURE_MODEL_SOURCE: 53016;
82
+ readonly CHECKSUM_UNAVAILABLE: 53017;
84
83
  readonly DELETE_CACHE_FAILED: 53200;
85
84
  readonly INVALID_DELETE_CACHE_PARAMS: 53201;
86
85
  readonly CACHE_DIR_NOT_ABSOLUTE: 53202;
@@ -93,9 +92,6 @@ export declare const ERROR_CODES: {
93
92
  readonly AUDIO_PLAYER_FAILED: 53501;
94
93
  readonly INVALID_AUDIO_CHUNK_TYPE: 53502;
95
94
  readonly ASYNC_DISPOSE_UNAVAILABLE: 53503;
96
- readonly DELEGATE_NO_FINAL_RESPONSE: 53700;
97
- readonly DELEGATE_CONNECTION_FAILED: 53701;
98
- readonly DELEGATE_PROVIDER_ERROR: 53702;
99
95
  readonly RPC_NO_DATA_RECEIVED: 53703;
100
96
  readonly RPC_UNKNOWN_REQUEST_TYPE: 53704;
101
97
  readonly PLUGIN_NOT_FOUND: 53850;
@@ -13,9 +13,6 @@ export const ERROR_CODES = {
13
13
  REQUEST_VALIDATION_FAILED: 50010,
14
14
  // Dispatch (50,200-50,399)
15
15
  RPC_NO_HANDLER: 50200,
16
- // Provider / delegation, consumer side (50,400-50,599)
17
- PROVIDER_START_FAILED: 50400,
18
- PROVIDER_STOP_FAILED: 50401,
19
16
  // Config file resolution (50,600-50,799)
20
17
  CONFIG_FILE_INVALID: 50603,
21
18
  CONFIG_FILE_PARSE_FAILED: 50604,
@@ -27,7 +24,6 @@ export const ERROR_CODES = {
27
24
  MODEL_ALREADY_REGISTERED: 52001,
28
25
  MODEL_NOT_FOUND: 52002,
29
26
  MODEL_NOT_LOADED: 52003,
30
- MODEL_IS_DELEGATED: 52004,
31
27
  UNKNOWN_MODEL_TYPE: 52005,
32
28
  // Model loading (52,200-52,399)
33
29
  MODEL_LOAD_FAILED: 52200,
@@ -93,6 +89,8 @@ export const ERROR_CODES = {
93
89
  ARCHIVE_MISSING_SHARDS: 53013,
94
90
  PARTIAL_DOWNLOAD_OFFLINE: 53014,
95
91
  REGISTRY_DOWNLOAD_FAILED: 53015,
92
+ INSECURE_MODEL_SOURCE: 53016,
93
+ CHECKSUM_UNAVAILABLE: 53017,
96
94
  // Cache operations (53,200-53,349)
97
95
  DELETE_CACHE_FAILED: 53200,
98
96
  INVALID_DELETE_CACHE_PARAMS: 53201,
@@ -109,10 +107,7 @@ export const ERROR_CODES = {
109
107
  AUDIO_PLAYER_FAILED: 53501,
110
108
  INVALID_AUDIO_CHUNK_TYPE: 53502,
111
109
  ASYNC_DISPOSE_UNAVAILABLE: 53503,
112
- // Delegation, provider side (53,700-53,849)
113
- DELEGATE_NO_FINAL_RESPONSE: 53700,
114
- DELEGATE_CONNECTION_FAILED: 53701,
115
- DELEGATE_PROVIDER_ERROR: 53702,
110
+ // RPC transport (53,700-53,849)
116
111
  RPC_NO_DATA_RECEIVED: 53703,
117
112
  RPC_UNKNOWN_REQUEST_TYPE: 53704,
118
113
  // Plugin errors (53,850-53,899)
@@ -170,15 +165,6 @@ const errorDefinitions = {
170
165
  name: 'RPC_NO_HANDLER',
171
166
  message: (requestType) => `No handler function registered for request type: ${requestType}`
172
167
  },
173
- // Provider / delegation, consumer side
174
- [ERROR_CODES.PROVIDER_START_FAILED]: {
175
- name: 'PROVIDER_START_FAILED',
176
- message: (details) => `Failed to start provider${details ? `: ${details}` : ''}`
177
- },
178
- [ERROR_CODES.PROVIDER_STOP_FAILED]: {
179
- name: 'PROVIDER_STOP_FAILED',
180
- message: (details) => `Failed to stop provider${details ? `: ${details}` : ''}`
181
- },
182
168
  // Config file resolution
183
169
  [ERROR_CODES.CONFIG_FILE_INVALID]: {
184
170
  name: 'CONFIG_FILE_INVALID',
@@ -214,10 +200,6 @@ const errorDefinitions = {
214
200
  name: 'MODEL_NOT_LOADED',
215
201
  message: (modelId) => `Model with ID "${modelId}" is not loaded`
216
202
  },
217
- [ERROR_CODES.MODEL_IS_DELEGATED]: {
218
- name: 'MODEL_IS_DELEGATED',
219
- message: (modelId) => `Model "${modelId}" is a delegated model and cannot be accessed directly`
220
- },
221
203
  [ERROR_CODES.UNKNOWN_MODEL_TYPE]: {
222
204
  name: 'UNKNOWN_MODEL_TYPE',
223
205
  message: (modelType) => `Unknown model type: ${modelType}. Register the plugin for "${modelType}" in code with \`registerPlugin\` / \`plugins([...])\` before this call.`
@@ -354,13 +336,24 @@ const errorDefinitions = {
354
336
  },
355
337
  [ERROR_CODES.CONTEXT_OVERFLOW]: {
356
338
  name: 'CONTEXT_OVERFLOW',
357
- message: (promptTokens, ctxSize, modelId) => {
358
- const prompt = promptTokens ? `${promptTokens} prompt tokens` : 'prompt';
359
- const ctx = ctxSize
360
- ? ` exceeds the ${ctxSize}-token context window`
361
- : " exceeds the model's context window";
339
+ message: (promptTokens, ctxSize, modelId, cachedTokens, requiredTokens) => {
362
340
  const model = modelId ? ` for model "${modelId}"` : '';
363
- return `${prompt}${ctx}${model}. Reduce the prompt size or start a new conversation.`;
341
+ // Ambiguous totals can be KV cells, and the guards trigger at equality —
342
+ // unit-neutral wording, phrased as leaving no room rather than exceeding.
343
+ const capacity = ctxSize
344
+ ? `the effective context capacity (${ctxSize} units)`
345
+ : "the model's context capacity";
346
+ if (requiredTokens && cachedTokens) {
347
+ return `Conversation uses ${requiredTokens} context units (${cachedTokens} already cached) and leaves no room to generate within ${capacity}${model}. Start a new conversation or raise ctx_size.`;
348
+ }
349
+ if (requiredTokens) {
350
+ return `Request uses ${requiredTokens} context units and leaves no room to generate within ${capacity}${model}. Reduce the prompt size, start a new conversation, or raise ctx_size.`;
351
+ }
352
+ const window = ctxSize ? `the ${ctxSize}-token context window` : "the model's context window";
353
+ // The prompt-only branch below is reachable only through the public
354
+ // constructors — the parser always pairs promptTokens with requiredTokens.
355
+ const prompt = promptTokens ? `${promptTokens} prompt tokens` : 'prompt';
356
+ return `${prompt} exceeds ${window}${model}. Reduce the prompt size or start a new conversation.`;
364
357
  }
365
358
  },
366
359
  [ERROR_CODES.INVALID_AUDIO_INPUT]: {
@@ -461,6 +454,15 @@ const errorDefinitions = {
461
454
  name: 'REGISTRY_DOWNLOAD_FAILED',
462
455
  message: (details) => `Registry download failed: ${details}`
463
456
  },
457
+ [ERROR_CODES.INSECURE_MODEL_SOURCE]: {
458
+ name: 'INSECURE_MODEL_SOURCE',
459
+ message: (url, reason) => `Refusing insecure model download from ${url}: ${reason}`
460
+ },
461
+ [ERROR_CODES.CHECKSUM_UNAVAILABLE]: {
462
+ name: 'CHECKSUM_UNAVAILABLE',
463
+ message: (url) => `Model download from ${url} could not be verified against a trusted checksum ` +
464
+ `and requireHttpChecksum is enabled`
465
+ },
464
466
  [ERROR_CODES.INVALID_SHARD_URL_PATTERN]: {
465
467
  name: 'INVALID_SHARD_URL_PATTERN',
466
468
  message: (url) => `URL does not contain a valid sharded model pattern: ${url}`
@@ -533,19 +535,7 @@ const errorDefinitions = {
533
535
  name: 'ASYNC_DISPOSE_UNAVAILABLE',
534
536
  message: 'Host runtime does not expose Symbol.asyncDispose; request-lifecycle primitives require ES2024 `using`/`asyncDispose` support. Verify your runtime (Bare ≥ 1.24) and any polyfill registration.'
535
537
  },
536
- // Delegation, provider side
537
- [ERROR_CODES.DELEGATE_NO_FINAL_RESPONSE]: {
538
- name: 'DELEGATE_NO_FINAL_RESPONSE',
539
- message: 'No final response received from delegated provider'
540
- },
541
- [ERROR_CODES.DELEGATE_CONNECTION_FAILED]: {
542
- name: 'DELEGATE_CONNECTION_FAILED',
543
- message: (details) => `Failed to connect to delegated provider: ${details}`
544
- },
545
- [ERROR_CODES.DELEGATE_PROVIDER_ERROR]: {
546
- name: 'DELEGATE_PROVIDER_ERROR',
547
- message: (details, providerCode) => `Delegated provider error: ${details}` + (providerCode ? ` (code: ${providerCode})` : '')
548
- },
538
+ // RPC transport
549
539
  [ERROR_CODES.RPC_NO_DATA_RECEIVED]: {
550
540
  name: 'RPC_NO_DATA_RECEIVED',
551
541
  message: 'No data received from request'
@@ -0,0 +1,10 @@
1
+ import { z } from 'zod';
2
+ export declare const heartbeatRequestSchema: z.ZodObject<{
3
+ type: z.ZodLiteral<"heartbeat">;
4
+ }, z.core.$strip>;
5
+ export declare const heartbeatResponseSchema: z.ZodObject<{
6
+ type: z.ZodLiteral<"heartbeat">;
7
+ number: z.ZodNumber;
8
+ }, z.core.$strip>;
9
+ export type HeartbeatRequest = z.infer<typeof heartbeatRequestSchema>;
10
+ export type HeartbeatResponse = z.infer<typeof heartbeatResponseSchema>;
@@ -0,0 +1,8 @@
1
+ import { z } from 'zod';
2
+ export const heartbeatRequestSchema = z.object({
3
+ type: z.literal('heartbeat')
4
+ });
5
+ export const heartbeatResponseSchema = z.object({
6
+ type: z.literal('heartbeat'),
7
+ number: z.number()
8
+ });
@@ -1,45 +1,47 @@
1
- export * from '../schemas/model-file.js';
2
- export * from '../schemas/cancel.js';
3
- export * from '../schemas/batch-completion-stream.js';
4
- export * from '../schemas/completion-stream.js';
5
- export * from '../schemas/completion-event.js';
6
- export { toolSchema, toolCallSchema, toolCallErrorSchema, type Tool, type ToolCall, type ToolCallError, type ToolCallWithCall } from '../schemas/tools.js';
7
- export * from '../schemas/delegate.js';
8
- export * from '../schemas/model-ops.js';
9
- export * from '../schemas/download-asset.js';
10
- export * from '../schemas/embed.js';
11
- export * from '../schemas/finetune.js';
12
- export * from '../schemas/load-model.js';
13
- export * from '../schemas/reload-config.js';
14
- export * from '../schemas/logging-stream.js';
15
- export * from '../schemas/provide.js';
16
- export * from '../schemas/common.js';
17
- export * from '../schemas/transcription.js';
18
- export * from '../schemas/bci.js';
19
- export * from '../schemas/bci-config.js';
20
- export * from '../schemas/translate.js';
21
- export * from '../schemas/translation-config.js';
22
- export * from '../schemas/llamacpp-config.js';
23
- export * from '../schemas/transcription-config.js';
24
- export * from '../schemas/text-to-speech.js';
25
- export * from '../schemas/error.js';
26
- export * from '../schemas/rag.js';
27
- export * from '../schemas/ocr.js';
28
- export * from '../schemas/sdcpp-config.js';
29
- export * from '../schemas/vla.js';
30
- export * from '../schemas/classification.js';
31
- export * from '../schemas/audio-gen.js';
32
- export * from '../schemas/lifecycle.js';
33
- export { ERROR_CODES, REGISTRY_ERROR_CODES } from '../schemas/errors.js';
1
+ export * from './model-file.js';
2
+ export * from './cancel.js';
3
+ export * from './batch-completion-stream.js';
4
+ export * from './completion-stream.js';
5
+ export * from './completion-event.js';
6
+ export { toolSchema, toolCallSchema, toolCallErrorSchema, type Tool, type ToolCall, type ToolCallError, type ToolCallWithCall } from './tools.js';
7
+ export * from './heartbeat.js';
8
+ export * from './model-ops.js';
9
+ export * from './download-asset.js';
10
+ export * from './embed.js';
11
+ export * from './finetune.js';
12
+ export * from './load-model.js';
13
+ export * from './reload-config.js';
14
+ export * from './logging-stream.js';
15
+ export * from './common.js';
16
+ export * from './transcription.js';
17
+ export * from './bci.js';
18
+ export * from './bci-config.js';
19
+ export * from './translate.js';
20
+ export * from './translation-config.js';
21
+ export * from './llamacpp-config.js';
22
+ export * from './transcription-config.js';
23
+ export * from './text-to-speech.js';
24
+ export * from './error.js';
25
+ export * from './rag.js';
26
+ export * from './ocr.js';
27
+ export * from './sdcpp-config.js';
28
+ export * from './vla.js';
29
+ export * from './classification.js';
30
+ export * from './audio-gen.js';
31
+ export * from './model-config-schemas.js';
32
+ export * from './lifecycle.js';
33
+ export { ERROR_CODES, REGISTRY_ERROR_CODES } from './errors.js';
34
34
  export { ERR_CODES as RAG_ERROR_CODES } from '@qvac/rag/errors';
35
- export { qvacConfigSchema, deviceMatchSchema, deviceConfigDefaultsSchema, devicePatternSchema, type QvacConfig, type DeviceMatch, type DeviceConfigDefaults, type DevicePattern } from '../schemas/config.js';
36
- export { PROFILING_KEY, PROFILING_TRAILER_KEY, DELEGATION_BREAKDOWN_KEY, OPERATION_EVENT_KEY, MODEL_EXECUTION_KEY, BACKEND_DIAGNOSTICS_KEY, profilerModeSchema, profilerGPUResourceGaugeSchema, profilerResourceGaugeSchema, serverBreakdownSchema, delegationBreakdownSchema, operationEventSchema, profilingRequestMetaSchema, profilingResponseMetaSchema, perCallProfilingSchema, type ProfilerMode, type ServerBreakdown, type DelegationBreakdown, type OperationEvent, type ProfilingRequestMeta, type ProfilingResponseMeta, type PerCallProfiling, type ProfilerGPUResourceGauge, type ProfilerResourceGauge } from '../schemas/profiling.js';
37
- export { runtimeContextSchema, type RuntimeContext } from '../schemas/runtime-context.js';
38
- export * from '../schemas/model-info.js';
39
- export * from '../schemas/system-resources.js';
40
- export * from '../schemas/model-src-utils.js';
41
- export * from '../schemas/json-schema.js';
42
- export { type McpClient, type McpClientInput } from '../schemas/mcp-adapter.js';
43
- export { PUBLIC_MODEL_TYPES as MODEL_TYPES, ModelType, type CanonicalModelType, type ModelTypeInput, normalizeModelType, isCanonicalModelType, isModelTypeAlias } from '../schemas/model-types.js';
44
- export * from '../schemas/plugin.js';
45
- export * from '../schemas/registry.js';
35
+ export { qvacConfigSchema, deviceMatchSchema, deviceConfigDefaultsSchema, devicePatternSchema, type QvacConfig, type DeviceMatch, type DeviceConfigDefaults, type DevicePattern } from './config.js';
36
+ export { PROFILING_KEY, PROFILING_TRAILER_KEY, OPERATION_EVENT_KEY, MODEL_EXECUTION_KEY, BACKEND_DIAGNOSTICS_KEY, profilerModeSchema, profilerGPUResourceGaugeSchema, profilerResourceGaugeSchema, serverBreakdownSchema, operationEventSchema, profilingRequestMetaSchema, profilingResponseMetaSchema, perCallProfilingSchema, type ProfilerMode, type ServerBreakdown, type OperationEvent, type ProfilingRequestMeta, type ProfilingResponseMeta, type PerCallProfiling, type ProfilerGPUResourceGauge, type ProfilerResourceGauge } from './profiling.js';
37
+ export { runtimeContextSchema, type RuntimeContext } from './runtime-context.js';
38
+ export * from './model-info.js';
39
+ export * from './system-resources.js';
40
+ export * from './model-src-utils.js';
41
+ export * from './json-schema.js';
42
+ export { type McpClient, type McpClientInput } from './mcp-adapter.js';
43
+ export { PUBLIC_MODEL_TYPES as MODEL_TYPES, ModelType, type CanonicalModelType, type ModelTypeInput, normalizeModelType, isCanonicalModelType, isModelTypeAlias } from './model-types.js';
44
+ export * from './plugin.js';
45
+ export * from './registry.js';
46
+ export * from './model-resource-profile.js';
47
+ export * from './assess-model-fit.js';
@@ -1,45 +1,47 @@
1
1
  // Re-export all schemas and types
2
- export * from '../schemas/model-file.js';
3
- export * from '../schemas/cancel.js';
4
- export * from '../schemas/batch-completion-stream.js';
5
- export * from '../schemas/completion-stream.js';
6
- export * from '../schemas/completion-event.js';
7
- export { toolSchema, toolCallSchema, toolCallErrorSchema } from '../schemas/tools.js';
8
- export * from '../schemas/delegate.js';
9
- export * from '../schemas/model-ops.js';
10
- export * from '../schemas/download-asset.js';
11
- export * from '../schemas/embed.js';
12
- export * from '../schemas/finetune.js';
13
- export * from '../schemas/load-model.js';
14
- export * from '../schemas/reload-config.js';
15
- export * from '../schemas/logging-stream.js';
16
- export * from '../schemas/provide.js';
17
- export * from '../schemas/common.js';
18
- export * from '../schemas/transcription.js';
19
- export * from '../schemas/bci.js';
20
- export * from '../schemas/bci-config.js';
21
- export * from '../schemas/translate.js';
22
- export * from '../schemas/translation-config.js';
23
- export * from '../schemas/llamacpp-config.js';
24
- export * from '../schemas/transcription-config.js';
25
- export * from '../schemas/text-to-speech.js';
26
- export * from '../schemas/error.js';
27
- export * from '../schemas/rag.js';
28
- export * from '../schemas/ocr.js';
29
- export * from '../schemas/sdcpp-config.js';
30
- export * from '../schemas/vla.js';
31
- export * from '../schemas/classification.js';
32
- export * from '../schemas/audio-gen.js';
33
- export * from '../schemas/lifecycle.js';
34
- export { ERROR_CODES, REGISTRY_ERROR_CODES } from '../schemas/errors.js';
2
+ export * from './model-file.js';
3
+ export * from './cancel.js';
4
+ export * from './batch-completion-stream.js';
5
+ export * from './completion-stream.js';
6
+ export * from './completion-event.js';
7
+ export { toolSchema, toolCallSchema, toolCallErrorSchema } from './tools.js';
8
+ export * from './heartbeat.js';
9
+ export * from './model-ops.js';
10
+ export * from './download-asset.js';
11
+ export * from './embed.js';
12
+ export * from './finetune.js';
13
+ export * from './load-model.js';
14
+ export * from './reload-config.js';
15
+ export * from './logging-stream.js';
16
+ export * from './common.js';
17
+ export * from './transcription.js';
18
+ export * from './bci.js';
19
+ export * from './bci-config.js';
20
+ export * from './translate.js';
21
+ export * from './translation-config.js';
22
+ export * from './llamacpp-config.js';
23
+ export * from './transcription-config.js';
24
+ export * from './text-to-speech.js';
25
+ export * from './error.js';
26
+ export * from './rag.js';
27
+ export * from './ocr.js';
28
+ export * from './sdcpp-config.js';
29
+ export * from './vla.js';
30
+ export * from './classification.js';
31
+ export * from './audio-gen.js';
32
+ export * from './model-config-schemas.js';
33
+ export * from './lifecycle.js';
34
+ export { ERROR_CODES, REGISTRY_ERROR_CODES } from './errors.js';
35
35
  export { ERR_CODES as RAG_ERROR_CODES } from '@qvac/rag/errors';
36
- export { qvacConfigSchema, deviceMatchSchema, deviceConfigDefaultsSchema, devicePatternSchema } from '../schemas/config.js';
37
- export { PROFILING_KEY, PROFILING_TRAILER_KEY, DELEGATION_BREAKDOWN_KEY, OPERATION_EVENT_KEY, MODEL_EXECUTION_KEY, BACKEND_DIAGNOSTICS_KEY, profilerModeSchema, profilerGPUResourceGaugeSchema, profilerResourceGaugeSchema, serverBreakdownSchema, delegationBreakdownSchema, operationEventSchema, profilingRequestMetaSchema, profilingResponseMetaSchema, perCallProfilingSchema } from '../schemas/profiling.js';
38
- export { runtimeContextSchema } from '../schemas/runtime-context.js';
39
- export * from '../schemas/model-info.js';
40
- export * from '../schemas/system-resources.js';
41
- export * from '../schemas/model-src-utils.js';
42
- export * from '../schemas/json-schema.js';
43
- export { PUBLIC_MODEL_TYPES as MODEL_TYPES, ModelType, normalizeModelType, isCanonicalModelType, isModelTypeAlias } from '../schemas/model-types.js';
44
- export * from '../schemas/plugin.js';
45
- export * from '../schemas/registry.js';
36
+ export { qvacConfigSchema, deviceMatchSchema, deviceConfigDefaultsSchema, devicePatternSchema } from './config.js';
37
+ export { PROFILING_KEY, PROFILING_TRAILER_KEY, OPERATION_EVENT_KEY, MODEL_EXECUTION_KEY, BACKEND_DIAGNOSTICS_KEY, profilerModeSchema, profilerGPUResourceGaugeSchema, profilerResourceGaugeSchema, serverBreakdownSchema, operationEventSchema, profilingRequestMetaSchema, profilingResponseMetaSchema, perCallProfilingSchema } from './profiling.js';
38
+ export { runtimeContextSchema } from './runtime-context.js';
39
+ export * from './model-info.js';
40
+ export * from './system-resources.js';
41
+ export * from './model-src-utils.js';
42
+ export * from './json-schema.js';
43
+ export { PUBLIC_MODEL_TYPES as MODEL_TYPES, ModelType, normalizeModelType, isCanonicalModelType, isModelTypeAlias } from './model-types.js';
44
+ export * from './plugin.js';
45
+ export * from './registry.js';
46
+ export * from './model-resource-profile.js';
47
+ export * from './assess-model-fit.js';