@qvac/inference 0.22.0 → 0.23.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 (386) hide show
  1. package/NOTICE +59 -40
  2. package/README.md +1 -1
  3. package/dist/api/audio-gen.js +1 -1
  4. package/dist/api/completion-stream.d.ts +2 -1
  5. package/dist/api/completion-stream.js +3 -1
  6. package/dist/api/decide.js +1 -1
  7. package/dist/api/diffusion.d.ts +18 -1
  8. package/dist/api/diffusion.js +18 -1
  9. package/dist/api/download-asset.js +1 -1
  10. package/dist/api/finetune.js +1 -1
  11. package/dist/api/index.d.ts +39 -38
  12. package/dist/api/index.js +38 -37
  13. package/dist/api/load-model.js +2 -2
  14. package/dist/api/logging-stream-registry.js +11 -7
  15. package/dist/api/logging-stream.d.ts +11 -1
  16. package/dist/api/logging-stream.js +11 -2
  17. package/dist/api/registry.d.ts +2 -1
  18. package/dist/api/registry.js +5 -4
  19. package/dist/api/rerank.d.ts +17 -0
  20. package/dist/api/rerank.js +36 -0
  21. package/dist/api/subscribe-logs.js +5 -3
  22. package/dist/api/unload-model.js +1 -1
  23. package/dist/api/video.js +1 -1
  24. package/dist/api/vla.js +1 -1
  25. package/dist/api/world-result.js +1 -1
  26. package/dist/api/world.d.ts +1 -1
  27. package/dist/api/world.js +1 -1
  28. package/dist/config/resolve-config.d.ts +1 -1
  29. package/dist/config/resolve-config.js +1 -1
  30. package/dist/constants/index.d.ts +2 -2
  31. package/dist/constants/index.js +2 -2
  32. package/dist/dispatch.d.ts +3 -2
  33. package/dist/dispatch.js +16 -4
  34. package/dist/errors/index.d.ts +6 -0
  35. package/dist/errors/index.js +13 -1
  36. package/dist/handlers/assess-model-fit.d.ts +1 -1
  37. package/dist/handlers/assess-model-fit.js +4 -4
  38. package/dist/handlers/cancelHandler.js +1 -1
  39. package/dist/handlers/completion-orchestrate.js +2 -2
  40. package/dist/handlers/download-asset.js +2 -2
  41. package/dist/handlers/finetune.js +1 -1
  42. package/dist/handlers/get-loaded-model-info.js +2 -3
  43. package/dist/handlers/get-model-info.js +1 -1
  44. package/dist/handlers/load-model/coreml-sidecars.d.ts +15 -0
  45. package/dist/handlers/load-model/coreml-sidecars.js +71 -8
  46. package/dist/handlers/load-model/download-manager.d.ts +1 -1
  47. package/dist/handlers/load-model/download-stats.d.ts +2 -2
  48. package/dist/handlers/load-model/download-stats.js +3 -3
  49. package/dist/handlers/load-model/handler.js +10 -7
  50. package/dist/handlers/load-model/http-verify.d.ts +1 -1
  51. package/dist/handlers/load-model/http.d.ts +1 -1
  52. package/dist/handlers/load-model/http.js +3 -3
  53. package/dist/handlers/load-model/hyperdrive.d.ts +1 -1
  54. package/dist/handlers/load-model/hyperdrive.js +2 -2
  55. package/dist/handlers/load-model/index.d.ts +2 -2
  56. package/dist/handlers/load-model/index.js +2 -2
  57. package/dist/handlers/load-model/registry-companion-set.d.ts +1 -1
  58. package/dist/handlers/load-model/registry-companion-set.js +1 -1
  59. package/dist/handlers/load-model/registry-download-utils.d.ts +3 -3
  60. package/dist/handlers/load-model/registry-download-utils.js +2 -2
  61. package/dist/handlers/load-model/registry.d.ts +2 -2
  62. package/dist/handlers/load-model/registry.js +5 -5
  63. package/dist/handlers/load-model/resolve-session.d.ts +1 -1
  64. package/dist/handlers/load-model/resolve-session.js +11 -3
  65. package/dist/handlers/load-model/resolve.d.ts +1 -1
  66. package/dist/handlers/load-model/resolve.js +5 -5
  67. package/dist/handlers/logging-stream.d.ts +2 -1
  68. package/dist/handlers/logging-stream.js +23 -7
  69. package/dist/handlers/registry.js +4 -2
  70. package/dist/handlers/types.d.ts +7 -1
  71. package/dist/handlers/vector-index.js +2 -2
  72. package/dist/index.d.ts +1 -1
  73. package/dist/index.js +1 -1
  74. package/dist/logging/addon.d.ts +1 -1
  75. package/dist/logging/addon.js +1 -1
  76. package/dist/logging/index.d.ts +5 -5
  77. package/dist/logging/index.js +4 -4
  78. package/dist/logging/logger.d.ts +1 -1
  79. package/dist/logging/logger.js +3 -3
  80. package/dist/logging/utils.js +1 -1
  81. package/dist/{resources/model-fit → model-fit}/assess.d.ts +4 -4
  82. package/dist/{resources/model-fit → model-fit}/assess.js +3 -3
  83. package/dist/{resources/model-fit/native-probe/classify-fit.d.ts → model-fit/classify.d.ts} +2 -2
  84. package/dist/{resources/model-fit/native-probe/classify-fit.js → model-fit/classify.js} +4 -4
  85. package/dist/{resources/model-fit/fit-stub/fetch-fit-stub.d.ts → model-fit/description/fetch.d.ts} +1 -1
  86. package/dist/{resources/model-fit/fit-stub/fetch-fit-stub.js → model-fit/description/fetch.js} +5 -5
  87. package/dist/{resources/model-fit/fit-stub/project-fit-from-load.d.ts → model-fit/description/project.d.ts} +3 -3
  88. package/dist/{resources/model-fit/fit-stub/project-fit-from-load.js → model-fit/description/project.js} +2 -2
  89. package/dist/{resources/model-fit/fit-stub/resolve-load-from-stubs.d.ts → model-fit/description/resolve-load.d.ts} +3 -3
  90. package/dist/{resources/model-fit/fit-stub/resolve-load-from-stubs.js → model-fit/description/resolve-load.js} +6 -6
  91. package/dist/{resources/model-fit → model-fit}/floor.d.ts +2 -2
  92. package/dist/{resources/model-fit → model-fit}/floor.js +1 -1
  93. package/dist/{resources/model-fit → model-fit}/kv-cache.d.ts +1 -1
  94. package/dist/{resources/model-fit/native-probe/advisory-fit.d.ts → model-fit/load-check.d.ts} +8 -10
  95. package/dist/{resources/model-fit/native-probe/advisory-fit.js → model-fit/load-check.js} +14 -40
  96. package/dist/{resources/model-fit/types.d.ts → model-fit/platform.d.ts} +8 -0
  97. package/dist/{resources/model-fit/native-probe/create-fit-request.d.ts → model-fit/request/create.d.ts} +3 -3
  98. package/dist/{resources/model-fit/native-probe/create-fit-request.js → model-fit/request/create.js} +8 -8
  99. package/dist/{resources/model-fit/native-probe → model-fit/request}/engines/asr.d.ts +2 -2
  100. package/dist/{resources/model-fit/native-probe → model-fit/request}/engines/asr.js +9 -1
  101. package/dist/{resources/model-fit/native-probe → model-fit/request}/engines/audiogen.d.ts +1 -1
  102. package/dist/{resources/model-fit/native-probe → model-fit/request}/engines/audiogen.js +1 -1
  103. package/dist/{resources/model-fit/native-probe → model-fit/request}/engines/diffusion.d.ts +1 -1
  104. package/dist/model-fit/request/engines/diffusion.js +93 -0
  105. package/dist/{resources/model-fit/native-probe → model-fit/request}/engines/llama.d.ts +2 -2
  106. package/dist/{resources/model-fit/native-probe → model-fit/request}/engines/llama.js +13 -10
  107. package/dist/{resources/model-fit/native-probe → model-fit/request}/engines/nmt.d.ts +1 -1
  108. package/dist/{resources/model-fit/native-probe → model-fit/request}/engines/nmt.js +1 -1
  109. package/dist/{resources/model-fit/native-probe → model-fit/request}/engines/ocr.d.ts +1 -1
  110. package/dist/{resources/model-fit/native-probe → model-fit/request}/engines/ocr.js +1 -1
  111. package/dist/{resources/model-fit/native-probe → model-fit/request}/engines/tts.d.ts +2 -2
  112. package/dist/{resources/model-fit/native-probe → model-fit/request}/engines/tts.js +1 -1
  113. package/dist/{resources/model-fit/native-probe/engine-fit.d.ts → model-fit/run/engine.d.ts} +3 -4
  114. package/dist/{resources/model-fit/native-probe/engine-fit.js → model-fit/run/engine.js} +1 -1
  115. package/dist/model-fit/run/run.d.ts +43 -0
  116. package/dist/model-fit/run/run.js +204 -0
  117. package/dist/models/registry/index.d.ts +1 -1
  118. package/dist/models/registry/index.js +2 -2
  119. package/dist/models/registry/models.d.ts +510 -0
  120. package/dist/models/registry/models.js +2946 -2410
  121. package/dist/models/registry/resource-profiles.js +203 -1
  122. package/dist/plugins/builtin/audiogen-ggml/ops/audio-edit-stream.js +2 -2
  123. package/dist/plugins/builtin/audiogen-ggml/ops/audio-gen-stream.js +2 -2
  124. package/dist/plugins/builtin/audiogen-ggml/ops/audio-understand.js +2 -2
  125. package/dist/plugins/builtin/audiogen-ggml/plugin.d.ts +60 -54
  126. package/dist/plugins/builtin/audiogen-ggml/plugin.js +4 -4
  127. package/dist/plugins/builtin/bci-whispercpp-transcription/plugin.d.ts +26 -25
  128. package/dist/plugins/builtin/bci-whispercpp-transcription/plugin.js +4 -4
  129. package/dist/plugins/builtin/ggml-classification/plugin.d.ts +4 -4
  130. package/dist/plugins/builtin/ggml-classification/plugin.js +1 -1
  131. package/dist/plugins/builtin/ggml-ocr/plugin.d.ts +11 -10
  132. package/dist/plugins/builtin/ggml-ocr/plugin.js +4 -4
  133. package/dist/plugins/builtin/ggml-vla/plugin.d.ts +12 -12
  134. package/dist/plugins/builtin/ggml-vla/plugin.js +3 -3
  135. package/dist/plugins/builtin/index.d.ts +15 -14
  136. package/dist/plugins/builtin/index.js +15 -14
  137. package/dist/plugins/builtin/llamacpp-completion/ops/batch-completion-stream.js +5 -7
  138. package/dist/plugins/builtin/llamacpp-completion/ops/completion-stats.d.ts +2 -0
  139. package/dist/plugins/builtin/llamacpp-completion/ops/completion-stats.js +6 -0
  140. package/dist/plugins/builtin/llamacpp-completion/ops/completion-stream.d.ts +1 -0
  141. package/dist/plugins/builtin/llamacpp-completion/ops/completion-stream.js +36 -19
  142. package/dist/plugins/builtin/llamacpp-completion/ops/kv-cache-session.d.ts +5 -3
  143. package/dist/plugins/builtin/llamacpp-completion/ops/kv-cache-session.js +9 -7
  144. package/dist/plugins/builtin/llamacpp-completion/plugin.d.ts +169 -78
  145. package/dist/plugins/builtin/llamacpp-completion/plugin.js +26 -17
  146. package/dist/plugins/builtin/llamacpp-completion/transform.js +4 -0
  147. package/dist/plugins/builtin/llamacpp-decision/helpers.d.ts +0 -1
  148. package/dist/plugins/builtin/llamacpp-decision/helpers.js +7 -15
  149. package/dist/plugins/builtin/llamacpp-decision/ops/decide.js +1 -1
  150. package/dist/plugins/builtin/llamacpp-decision/plugin.d.ts +39 -33
  151. package/dist/plugins/builtin/llamacpp-decision/plugin.js +4 -3
  152. package/dist/plugins/builtin/llamacpp-embedding/plugin.d.ts +7 -6
  153. package/dist/plugins/builtin/llamacpp-embedding/plugin.js +16 -6
  154. package/dist/plugins/builtin/llamacpp-embedding/transform.js +6 -0
  155. package/dist/plugins/builtin/llamacpp-rerank/helpers.d.ts +3 -0
  156. package/dist/plugins/builtin/llamacpp-rerank/helpers.js +16 -0
  157. package/dist/plugins/builtin/llamacpp-rerank/ops/rerank.d.ts +5 -0
  158. package/dist/plugins/builtin/llamacpp-rerank/ops/rerank.js +117 -0
  159. package/dist/plugins/builtin/llamacpp-rerank/plugin.d.ts +91 -0
  160. package/dist/plugins/builtin/llamacpp-rerank/plugin.js +45 -0
  161. package/dist/plugins/builtin/moss-transcribe/plugin.d.ts +16 -16
  162. package/dist/plugins/builtin/moss-transcribe/plugin.js +4 -4
  163. package/dist/plugins/builtin/nmtcpp-translation/plugin.d.ts +18 -13
  164. package/dist/plugins/builtin/nmtcpp-translation/plugin.js +4 -4
  165. package/dist/plugins/builtin/parakeet-transcription/plugin.d.ts +29 -29
  166. package/dist/plugins/builtin/parakeet-transcription/plugin.js +4 -4
  167. package/dist/plugins/builtin/sdcpp-generation/ops/diffusion.d.ts +5 -2
  168. package/dist/plugins/builtin/sdcpp-generation/ops/diffusion.js +168 -52
  169. package/dist/plugins/builtin/sdcpp-generation/ops/video.d.ts +5 -2
  170. package/dist/plugins/builtin/sdcpp-generation/ops/video.js +19 -8
  171. package/dist/plugins/builtin/sdcpp-generation/ops/world.d.ts +2 -2
  172. package/dist/plugins/builtin/sdcpp-generation/ops/world.js +1 -1
  173. package/dist/plugins/builtin/sdcpp-generation/plugin.d.ts +90 -34
  174. package/dist/plugins/builtin/sdcpp-generation/plugin.js +45 -45
  175. package/dist/plugins/builtin/sdcpp-generation/upscaler-config.d.ts +15 -0
  176. package/dist/plugins/builtin/sdcpp-generation/upscaler-config.js +19 -0
  177. package/dist/plugins/builtin/sdcpp-generation/world-config.d.ts +8 -0
  178. package/dist/plugins/builtin/sdcpp-generation/world-config.js +9 -0
  179. package/dist/plugins/builtin/tts-ggml/ops/text-to-speech-stream.d.ts +1 -1
  180. package/dist/plugins/builtin/tts-ggml/ops/text-to-speech-stream.js +2 -2
  181. package/dist/plugins/builtin/tts-ggml/ops/text-to-speech.js +2 -2
  182. package/dist/plugins/builtin/tts-ggml/plugin.d.ts +47 -32
  183. package/dist/plugins/builtin/tts-ggml/plugin.js +3 -3
  184. package/dist/plugins/builtin/whispercpp-transcription/plugin.d.ts +34 -33
  185. package/dist/plugins/builtin/whispercpp-transcription/plugin.js +4 -4
  186. package/dist/plugins/index.d.ts +1 -1
  187. package/dist/plugins/index.js +2 -2
  188. package/dist/plugins/ops/kv-cache-utils.d.ts +4 -3
  189. package/dist/plugins/ops/kv-cache-utils.js +15 -8
  190. package/dist/plugins/ops/load-model.d.ts +8 -2
  191. package/dist/plugins/ops/load-model.js +14 -5
  192. package/dist/plugins/ops/transcribe.js +1 -1
  193. package/dist/plugins/ops/translate.js +3 -3
  194. package/dist/plugins/ops/unload-model.js +1 -1
  195. package/dist/plugins/turbovec-backend.js +5 -5
  196. package/dist/profiling/aggregator.d.ts +1 -1
  197. package/dist/profiling/aggregator.js +1 -1
  198. package/dist/profiling/controller.d.ts +1 -1
  199. package/dist/profiling/controller.js +2 -2
  200. package/dist/profiling/events.d.ts +1 -1
  201. package/dist/profiling/events.js +2 -2
  202. package/dist/profiling/exporters.d.ts +1 -1
  203. package/dist/profiling/exporters.js +3 -3
  204. package/dist/profiling/index.d.ts +13 -13
  205. package/dist/profiling/index.js +12 -12
  206. package/dist/profiling/operation-metrics.d.ts +1 -1
  207. package/dist/profiling/operation-metrics.js +2 -2
  208. package/dist/profiling/operation-wrappers.js +3 -3
  209. package/dist/profiling/profiler.js +1 -1
  210. package/dist/rag/handler.js +1 -1
  211. package/dist/rag/handlers/close-workspace.js +1 -1
  212. package/dist/rag/handlers/delete-embeddings.js +1 -1
  213. package/dist/rag/handlers/delete-workspace.js +1 -1
  214. package/dist/rag/handlers/ingest.js +1 -1
  215. package/dist/rag/handlers/list-workspaces.d.ts +1 -1
  216. package/dist/rag/handlers/list-workspaces.js +1 -1
  217. package/dist/rag/handlers/reindex.js +1 -1
  218. package/dist/rag/handlers/save-embeddings.js +1 -1
  219. package/dist/rag/handlers/search.js +1 -1
  220. package/dist/rag/index.d.ts +11 -11
  221. package/dist/rag/index.js +11 -11
  222. package/dist/rag/rag-workspace-manager.js +1 -1
  223. package/dist/registry.js +2 -1
  224. package/dist/resources/collector.d.ts +1 -1
  225. package/dist/resources/collector.js +1 -1
  226. package/dist/resources/instance.d.ts +1 -1
  227. package/dist/resources/instance.js +1 -1
  228. package/dist/resources/native.d.ts +1 -1
  229. package/dist/resources/normalize.d.ts +1 -1
  230. package/dist/rpc/inventory.js +3 -3
  231. package/dist/runtime/index.d.ts +5 -5
  232. package/dist/runtime/index.js +2 -2
  233. package/dist/runtime/lifecycle.js +7 -7
  234. package/dist/runtime/model-config-utils.js +3 -0
  235. package/dist/runtime/model-registry.d.ts +3 -1
  236. package/dist/runtime/model-registry.js +2 -1
  237. package/dist/runtime/registry-client.js +1 -1
  238. package/dist/runtime/request-context.d.ts +3 -3
  239. package/dist/runtime/request-context.js +14 -1
  240. package/dist/runtime/request-registry.d.ts +1 -1
  241. package/dist/runtime/request-registry.js +1 -1
  242. package/dist/runtime/state.d.ts +1 -1
  243. package/dist/runtime/state.js +2 -2
  244. package/dist/runtime/vector-index-backend.d.ts +2 -2
  245. package/dist/runtime/vector-index-registry.d.ts +5 -5
  246. package/dist/runtime/vector-index-registry.js +36 -13
  247. package/dist/schemas/assess-model-fit.d.ts +6 -0
  248. package/dist/schemas/assess-model-fit.js +4 -4
  249. package/dist/schemas/audio-gen.d.ts +13 -1
  250. package/dist/schemas/audio-gen.js +3 -3
  251. package/dist/schemas/batch-completion-stream.d.ts +8 -2
  252. package/dist/schemas/batch-completion-stream.js +3 -3
  253. package/dist/schemas/bci-config.d.ts +1 -0
  254. package/dist/schemas/bci-config.js +2 -2
  255. package/dist/schemas/bci.d.ts +1 -1
  256. package/dist/schemas/bci.js +2 -2
  257. package/dist/schemas/cancel.d.ts +5 -0
  258. package/dist/schemas/cancel.js +1 -0
  259. package/dist/schemas/common.d.ts +478 -100
  260. package/dist/schemas/common.js +35 -32
  261. package/dist/schemas/completion-event.d.ts +8 -2
  262. package/dist/schemas/completion-event.js +4 -1
  263. package/dist/schemas/completion-stream.d.ts +11 -2
  264. package/dist/schemas/completion-stream.js +37 -10
  265. package/dist/schemas/config.d.ts +849 -6
  266. package/dist/schemas/config.js +12 -10
  267. package/dist/schemas/decision.d.ts +8 -0
  268. package/dist/schemas/decision.js +14 -0
  269. package/dist/schemas/download-asset.d.ts +6 -4
  270. package/dist/schemas/download-asset.js +1 -1
  271. package/dist/schemas/engine-addon-map.d.ts +2 -1
  272. package/dist/schemas/engine-addon-map.js +4 -3
  273. package/dist/schemas/errors.d.ts +1 -0
  274. package/dist/schemas/errors.js +6 -1
  275. package/dist/schemas/index.d.ts +51 -50
  276. package/dist/schemas/index.js +50 -49
  277. package/dist/schemas/llamacpp-config.d.ts +182 -6
  278. package/dist/schemas/llamacpp-config.js +102 -7
  279. package/dist/schemas/load-model.d.ts +3176 -646
  280. package/dist/schemas/load-model.js +34 -1
  281. package/dist/schemas/mcp-adapter.d.ts +1 -1
  282. package/dist/schemas/model-config-schemas.d.ts +195 -1
  283. package/dist/schemas/model-config-schemas.js +14 -12
  284. package/dist/schemas/model-fit-policy.d.ts +1 -1
  285. package/dist/schemas/model-info.js +2 -2
  286. package/dist/schemas/model-resource-profile.d.ts +1 -0
  287. package/dist/schemas/model-resource-profile.js +1 -1
  288. package/dist/schemas/model-src-utils.d.ts +6 -2
  289. package/dist/schemas/model-src-utils.js +2 -2
  290. package/dist/schemas/model-types.d.ts +5 -1
  291. package/dist/schemas/model-types.js +1 -0
  292. package/dist/schemas/ocr.d.ts +2 -0
  293. package/dist/schemas/ocr.js +1 -1
  294. package/dist/schemas/plugin.d.ts +9 -3
  295. package/dist/schemas/plugin.js +6 -0
  296. package/dist/schemas/profiling.js +1 -1
  297. package/dist/schemas/rag.js +1 -1
  298. package/dist/schemas/registry.d.ts +8 -0
  299. package/dist/schemas/registry.js +2 -1
  300. package/dist/schemas/reload-config.d.ts +6 -2
  301. package/dist/schemas/reload-config.js +2 -2
  302. package/dist/schemas/rerank.d.ts +131 -0
  303. package/dist/schemas/rerank.js +102 -0
  304. package/dist/schemas/sdcpp-config.d.ts +56 -0
  305. package/dist/schemas/sdcpp-config.js +33 -15
  306. package/dist/schemas/text-to-speech.d.ts +61 -0
  307. package/dist/schemas/transcription-config.d.ts +5 -0
  308. package/dist/schemas/transcription-config.js +16 -1
  309. package/dist/schemas/transcription.d.ts +1 -1
  310. package/dist/schemas/transcription.js +1 -1
  311. package/dist/schemas/translate.d.ts +2 -2
  312. package/dist/schemas/translate.js +1 -1
  313. package/dist/schemas/translation-config.d.ts +20 -10
  314. package/dist/schemas/translation-config.js +1 -1
  315. package/dist/surface.d.ts +2 -1
  316. package/dist/surface.js +2 -1
  317. package/dist/utils/addon-responses.d.ts +2 -0
  318. package/dist/utils/aggregate-events.d.ts +1 -1
  319. package/dist/utils/aggregate-events.js +2 -2
  320. package/dist/utils/archive.js +2 -2
  321. package/dist/utils/audio/decoder.js +3 -1
  322. package/dist/utils/audio-input.js +1 -1
  323. package/dist/utils/cache/auto-history.d.ts +2 -1
  324. package/dist/utils/cache/auto-history.js +2 -2
  325. package/dist/utils/cache/paths.js +6 -6
  326. package/dist/utils/checksum.d.ts +2 -0
  327. package/dist/utils/checksum.js +41 -2
  328. package/dist/utils/completion-normalizer.js +1 -1
  329. package/dist/utils/gguf-architecture.d.ts +7 -0
  330. package/dist/utils/gguf-architecture.js +142 -0
  331. package/dist/utils/gguf-tensor-extractor.js +1 -1
  332. package/dist/utils/index.d.ts +13 -13
  333. package/dist/utils/index.js +13 -13
  334. package/dist/utils/mcp-adapter.d.ts +1 -1
  335. package/dist/utils/mcp-adapter.js +1 -1
  336. package/dist/utils/path-security.js +1 -1
  337. package/dist/utils/shard-utils.d.ts +5 -0
  338. package/dist/utils/shard-utils.js +19 -3
  339. package/dist/utils/tool-integration.d.ts +1 -0
  340. package/dist/utils/tool-integration.js +3 -6
  341. package/dist/utils/tools/defer.d.ts +16 -26
  342. package/dist/utils/tools/defer.js +50 -41
  343. package/dist/utils/tools/dialect.d.ts +15 -4
  344. package/dist/utils/tools/dialect.js +34 -5
  345. package/dist/utils/tools/index.d.ts +3 -3
  346. package/dist/utils/tools/index.js +3 -3
  347. package/dist/utils/tools/parser.js +8 -8
  348. package/dist/utils/tools/parsers/dsml.d.ts +1 -1
  349. package/dist/utils/tools/parsers/dsml.js +1 -1
  350. package/dist/utils/tools/parsers/gemma4native.d.ts +1 -1
  351. package/dist/utils/tools/parsers/gemma4native.js +1 -1
  352. package/dist/utils/tools/parsers/harmony.d.ts +1 -1
  353. package/dist/utils/tools/parsers/harmony.js +1 -1
  354. package/dist/utils/tools/parsers/hermes.d.ts +1 -1
  355. package/dist/utils/tools/parsers/hermes.js +1 -1
  356. package/dist/utils/tools/parsers/json.d.ts +1 -1
  357. package/dist/utils/tools/parsers/json.js +1 -1
  358. package/dist/utils/tools/parsers/pythonic.d.ts +1 -1
  359. package/dist/utils/tools/parsers/pythonic.js +1 -1
  360. package/dist/utils/tools/parsers/qwen35.d.ts +1 -1
  361. package/dist/utils/tools/parsers/qwen35.js +1 -1
  362. package/dist/utils/tts-stats.d.ts +1 -1
  363. package/dist/utils/until-aborted.d.ts +7 -0
  364. package/dist/utils/until-aborted.js +34 -0
  365. package/package.json +53 -45
  366. package/dist/resources/model-fit/native-probe/child-engine-fit.d.ts +0 -2
  367. package/dist/resources/model-fit/native-probe/child-engine-fit.js +0 -49
  368. package/dist/resources/model-fit/native-probe/engines/diffusion.js +0 -65
  369. package/dist/resources/model-fit/native-probe/fit-outcome.d.ts +0 -16
  370. package/dist/resources/model-fit/native-probe/fit-outcome.js +0 -1
  371. package/dist/resources/model-fit/native-probe/fit-process.d.ts +0 -27
  372. package/dist/resources/model-fit/native-probe/fit-process.js +0 -55
  373. package/dist/resources/model-fit/native-probe/fit-runner.d.ts +0 -1
  374. package/dist/resources/model-fit/native-probe/fit-runner.js +0 -58
  375. package/dist/resources/model-fit/native-probe/run-fit.d.ts +0 -24
  376. package/dist/resources/model-fit/native-probe/run-fit.js +0 -20
  377. package/dist/resources/model-fit/native-probe/run-in-process-fit.d.ts +0 -24
  378. package/dist/resources/model-fit/native-probe/run-in-process-fit.js +0 -123
  379. package/dist/resources/model-fit/native-probe/run-isolated-fit.d.ts +0 -63
  380. package/dist/resources/model-fit/native-probe/run-isolated-fit.js +0 -377
  381. package/dist/resources/model-fit/platform.d.ts +0 -9
  382. package/dist/resources/model-fit/types.js +0 -1
  383. /package/dist/{resources/model-fit → model-fit}/kv-cache.js +0 -0
  384. /package/dist/{resources/model-fit → model-fit}/platform.js +0 -0
  385. /package/dist/{resources/model-fit/native-probe/engines → model-fit/request}/gpu.d.ts +0 -0
  386. /package/dist/{resources/model-fit/native-probe/engines → model-fit/request}/gpu.js +0 -0
@@ -1,9 +1,9 @@
1
1
  import { send, stream } from '../dispatch.js';
2
- import { startLoggingStreamForModel } from './logging-stream-registry.js';
2
+ import { startLoggingStreamForModel } from '../api/logging-stream-registry.js';
3
3
  import { loadBuiltinToRequestSchema, loadCustomPluginToRequestSchema, reloadConfigOptionsToRequestSchema, isBuiltInModelType, isModelTypeAlias, normalizeModelType, inferModelTypeFromModelSrc, ModelType } from '../schemas/index.js';
4
4
  import { ModelLoadFailedError, ModelTypeRequiredError, StreamEndedError, InvalidResponseError } from '../errors/index.js';
5
5
  import { assertModelSrcMatchesModelType } from '../utils/load-model-validation.js';
6
- import { parseClientInput } from './parse-input.js';
6
+ import { parseClientInput } from '../api/parse-input.js';
7
7
  import { getAppLogger } from '../logging/index.js';
8
8
  import { decoratePromise } from '../utils/decorate-promise.js';
9
9
  import { generateRequestId } from '../runtime/request-id.js';
@@ -1,5 +1,6 @@
1
+ import { AbortController } from 'bare-abort-controller';
1
2
  import { getAppLogger } from '../logging/index.js';
2
- import { loggingStream } from './logging-stream.js';
3
+ import { loggingStream } from '../api/logging-stream.js';
3
4
  const logger = getAppLogger();
4
5
  const activeStreams = new Map();
5
6
  export function startLoggingStreamForModel(modelId, modelLogger) {
@@ -7,8 +8,10 @@ export function startLoggingStreamForModel(modelId, modelLogger) {
7
8
  logger.warn(`Logging stream already active for model ${modelId}`);
8
9
  return;
9
10
  }
10
- const streamIterator = loggingStream({ id: modelId });
11
- activeStreams.set(modelId, { logger: modelLogger, streamIterator });
11
+ const controller = new AbortController();
12
+ const streamIterator = loggingStream({ id: modelId }, { signal: controller.signal });
13
+ const entry = { logger: modelLogger, controller };
14
+ activeStreams.set(modelId, entry);
12
15
  try {
13
16
  void (async () => {
14
17
  try {
@@ -36,7 +39,9 @@ export function startLoggingStreamForModel(modelId, modelLogger) {
36
39
  logger.error(`Logging stream error for model ${modelId}:`, error);
37
40
  }
38
41
  finally {
39
- activeStreams.delete(modelId);
42
+ // A reload may have replaced this entry.
43
+ if (activeStreams.get(modelId) === entry)
44
+ activeStreams.delete(modelId);
40
45
  }
41
46
  })();
42
47
  }
@@ -50,9 +55,8 @@ export function stopLoggingStreamForModel(modelId) {
50
55
  const stream = activeStreams.get(modelId);
51
56
  if (stream) {
52
57
  activeStreams.delete(modelId);
53
- // Terminate the stream iterator - this ends the in-process stream
54
- // and the engine-side async generator terminates automatically
55
- void stream.streamIterator.return(undefined);
58
+ // `return()` would wait for a log an unloaded model never sends.
59
+ stream.controller.abort(undefined);
56
60
  logger.debug(`Stopped logging stream for model ${modelId}`);
57
61
  }
58
62
  }
@@ -1,9 +1,13 @@
1
1
  import type { LoggingStreamResponse, LoggingParams } from '../schemas/logging-stream.js';
2
+ import type { AbortableRPCOptions } from '../schemas/index.js';
2
3
  /**
3
4
  * Opens a logging stream to receive real-time logs.
4
5
  *
5
6
  * @param params - The arguments for the logging stream
6
7
  * @param params.id - The unique identifier to stream logs for
8
+ * @param options - Call options
9
+ * @param options.signal - Abort to end the stream and release the subscription
10
+ * at once, from outside the loop.
7
11
  * @returns AsyncGenerator yielding logging stream responses
8
12
  * @throws {QvacErrorBase} When the response type is invalid or when the stream fails
9
13
  *
@@ -18,6 +22,12 @@ import type { LoggingStreamResponse, LoggingParams } from '../schemas/logging-st
18
22
  * for await (const logMessage of logStream) {
19
23
  * console.log(`[${logMessage.level}] ${logMessage.namespace}: ${logMessage.message}`);
20
24
  * }
25
+ *
26
+ * // Stop from outside the loop (on Bare, AbortController is from bare-abort-controller)
27
+ * const controller = new AbortController();
28
+ * const modelLogs = loggingStream({ id: 'my-model-id' }, { signal: controller.signal });
29
+ * // later
30
+ * controller.abort();
21
31
  * ```
22
32
  */
23
- export declare function loggingStream(params: LoggingParams): AsyncGenerator<LoggingStreamResponse>;
33
+ export declare function loggingStream(params: LoggingParams, options?: AbortableRPCOptions): AsyncGenerator<LoggingStreamResponse>;
@@ -5,6 +5,9 @@ import { InvalidResponseError } from '../errors/index.js';
5
5
  *
6
6
  * @param params - The arguments for the logging stream
7
7
  * @param params.id - The unique identifier to stream logs for
8
+ * @param options - Call options
9
+ * @param options.signal - Abort to end the stream and release the subscription
10
+ * at once, from outside the loop.
8
11
  * @returns AsyncGenerator yielding logging stream responses
9
12
  * @throws {QvacErrorBase} When the response type is invalid or when the stream fails
10
13
  *
@@ -19,14 +22,20 @@ import { InvalidResponseError } from '../errors/index.js';
19
22
  * for await (const logMessage of logStream) {
20
23
  * console.log(`[${logMessage.level}] ${logMessage.namespace}: ${logMessage.message}`);
21
24
  * }
25
+ *
26
+ * // Stop from outside the loop (on Bare, AbortController is from bare-abort-controller)
27
+ * const controller = new AbortController();
28
+ * const modelLogs = loggingStream({ id: 'my-model-id' }, { signal: controller.signal });
29
+ * // later
30
+ * controller.abort();
22
31
  * ```
23
32
  */
24
- export async function* loggingStream(params) {
33
+ export async function* loggingStream(params, options) {
25
34
  const request = {
26
35
  type: 'loggingStream',
27
36
  ...params
28
37
  };
29
- const responseStream = stream(request);
38
+ const responseStream = stream(request, options);
30
39
  for await (const response of responseStream) {
31
40
  if (response.type !== 'loggingStream') {
32
41
  throw new InvalidResponseError('loggingStream');
@@ -33,7 +33,8 @@ declare function modelRegistrySearch(params?: ModelRegistrySearchParams): Promis
33
33
  * @param registryPath - Registry-relative path of the model to fetch.
34
34
  * @param registrySource - Registry source identifier (e.g., `"huggingface"`, `"local"`).
35
35
  * @returns A promise resolving to the matching `ModelRegistryEntry`.
36
- * @throws {ModelRegistryQueryFailedError} When the model cannot be located or the registry query fails.
36
+ * @throws {ModelRegistryModelNotFoundError} When the registry has no model at this source and path.
37
+ * @throws {ModelRegistryQueryFailedError} When the registry query fails.
37
38
  */
38
39
  declare function modelRegistryGetModel(registryPath: string, registrySource: string): Promise<ModelRegistryEntry>;
39
40
  export { modelRegistryList, modelRegistrySearch, modelRegistryGetModel };
@@ -1,8 +1,8 @@
1
1
  import { send } from '../dispatch.js';
2
2
  import { ModelRegistryQueryFailedError } from '../errors/index.js';
3
- function validateRegistryResponse(response, fallbackError) {
3
+ function validateRegistryResponse(response) {
4
4
  if (!response.success) {
5
- throw new ModelRegistryQueryFailedError(response.error ?? fallbackError ?? 'Unknown registry error');
5
+ throw new ModelRegistryQueryFailedError(response.error ?? 'Unknown registry error');
6
6
  }
7
7
  }
8
8
  /**
@@ -48,7 +48,8 @@ async function modelRegistrySearch(params = {}) {
48
48
  * @param registryPath - Registry-relative path of the model to fetch.
49
49
  * @param registrySource - Registry source identifier (e.g., `"huggingface"`, `"local"`).
50
50
  * @returns A promise resolving to the matching `ModelRegistryEntry`.
51
- * @throws {ModelRegistryQueryFailedError} When the model cannot be located or the registry query fails.
51
+ * @throws {ModelRegistryModelNotFoundError} When the registry has no model at this source and path.
52
+ * @throws {ModelRegistryQueryFailedError} When the registry query fails.
52
53
  */
53
54
  async function modelRegistryGetModel(registryPath, registrySource) {
54
55
  const request = {
@@ -57,7 +58,7 @@ async function modelRegistryGetModel(registryPath, registrySource) {
57
58
  registrySource
58
59
  };
59
60
  const response = (await send(request));
60
- validateRegistryResponse(response, `Model not found: ${registrySource}/${registryPath}`);
61
+ validateRegistryResponse(response);
61
62
  return response.model;
62
63
  }
63
64
  export { modelRegistryList, modelRegistrySearch, modelRegistryGetModel };
@@ -0,0 +1,17 @@
1
+ import { type RerankParams, type RerankScores, type RPCOptions } from '../schemas/index.js';
2
+ /**
3
+ * Scores documents by relevance to a query with a reranker model.
4
+ *
5
+ * @param params - Model ID, query, and the documents to score.
6
+ * @param options - Dispatch options.
7
+ * @returns A promise with a synchronous requestId for cancel(). Resolves to
8
+ * one score per document, in input order; higher is more relevant. Scores are
9
+ * the model's raw output, so compare them within one model only.
10
+ * @throws {RequestValidationFailedError} If the request is invalid.
11
+ * @throws {InferenceCancelledError} If the request is cancelled.
12
+ * @throws {RequestRejectedByPolicyError} If this model's rerank queue is full.
13
+ * @throws {InvalidResponseError} If the handler returns a malformed result.
14
+ */
15
+ export declare function rerank(params: RerankParams, options?: RPCOptions): Promise<RerankScores> & {
16
+ requestId: string;
17
+ };
@@ -0,0 +1,36 @@
1
+ import { send } from '../dispatch.js';
2
+ import { rerankParamsSchema, rerankResponseSchema } from '../schemas/index.js';
3
+ import { InvalidResponseError } from '../errors/index.js';
4
+ import { decoratePromise } from '../utils/decorate-promise.js';
5
+ import { generateRequestId } from '../runtime/request-id.js';
6
+ import { parseClientInput } from '../api/parse-input.js';
7
+ /**
8
+ * Scores documents by relevance to a query with a reranker model.
9
+ *
10
+ * @param params - Model ID, query, and the documents to score.
11
+ * @param options - Dispatch options.
12
+ * @returns A promise with a synchronous requestId for cancel(). Resolves to
13
+ * one score per document, in input order; higher is more relevant. Scores are
14
+ * the model's raw output, so compare them within one model only.
15
+ * @throws {RequestValidationFailedError} If the request is invalid.
16
+ * @throws {InferenceCancelledError} If the request is cancelled.
17
+ * @throws {RequestRejectedByPolicyError} If this model's rerank queue is full.
18
+ * @throws {InvalidResponseError} If the handler returns a malformed result.
19
+ */
20
+ export function rerank(params, options) {
21
+ const requestId = generateRequestId();
22
+ return decoratePromise(runRerank(params, requestId, options), { requestId });
23
+ }
24
+ async function runRerank(params, requestId, options) {
25
+ const input = parseClientInput(rerankParamsSchema, params);
26
+ const response = await send({ ...input, type: 'rerank', requestId }, options);
27
+ if (response.type !== 'rerank')
28
+ throw new InvalidResponseError('rerank');
29
+ const parsed = rerankResponseSchema.safeParse(response);
30
+ if (!parsed.success)
31
+ throw new InvalidResponseError('rerank', parsed.error);
32
+ const { scores } = parsed.data;
33
+ if (scores.length !== input.documents.length)
34
+ throw new InvalidResponseError('rerank');
35
+ return scores;
36
+ }
@@ -1,5 +1,6 @@
1
+ import { AbortController } from 'bare-abort-controller';
1
2
  import { getAppLogger, ALL_LOG_ID } from '../logging/index.js';
2
- import { loggingStream } from './logging-stream.js';
3
+ import { loggingStream } from '../api/logging-stream.js';
3
4
  const logger = getAppLogger();
4
5
  /**
5
6
  * Subscribes to every log through a single stream: the engine's own logs, per-model
@@ -26,7 +27,8 @@ const logger = getAppLogger();
26
27
  * ```
27
28
  */
28
29
  export function subscribeServerLogs(handler) {
29
- const streamIterator = loggingStream({ id: ALL_LOG_ID });
30
+ const controller = new AbortController();
31
+ const streamIterator = loggingStream({ id: ALL_LOG_ID }, { signal: controller.signal });
30
32
  void (async () => {
31
33
  try {
32
34
  for await (const log of streamIterator) {
@@ -38,6 +40,6 @@ export function subscribeServerLogs(handler) {
38
40
  }
39
41
  })();
40
42
  return () => {
41
- void streamIterator.return(undefined);
43
+ controller.abort(undefined);
42
44
  };
43
45
  }
@@ -1,5 +1,5 @@
1
1
  import { send, close } from '../dispatch.js';
2
- import { stopLoggingStreamForModel } from './logging-stream-registry.js';
2
+ import { stopLoggingStreamForModel } from '../api/logging-stream-registry.js';
3
3
  import { InvalidResponseError, ModelUnloadFailedError } from '../errors/index.js';
4
4
  import { getAppLogger } from '../logging/index.js';
5
5
  const logger = getAppLogger();
package/dist/api/video.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { videoStreamResponseSchema } from '../schemas/index.js';
2
- import { createVideoStreamRequest } from './video-request.js';
2
+ import { createVideoStreamRequest } from '../api/video-request.js';
3
3
  import { stream as streamRpc } from '../dispatch.js';
4
4
  import { generateRequestId } from '../runtime/request-id.js';
5
5
  import { decodeBase64 } from '../utils/encoding.js';
package/dist/api/vla.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { vlaHparamsResponseSchema, vlaRunResponseSchema, vlaSetEmbodimentResponseSchema } from '../schemas/index.js';
2
2
  import { decodeBase64, encodeBase64 } from '../utils/encoding.js';
3
- import { invokePlugin } from './invoke-plugin.js';
3
+ import { invokePlugin } from '../api/invoke-plugin.js';
4
4
  const VLA_RUN_HANDLER = 'vlaRun';
5
5
  const VLA_HPARAMS_HANDLER = 'vlaHparams';
6
6
  const VLA_SET_EMBODIMENT_HANDLER = 'vlaSetEmbodiment';
@@ -1,5 +1,5 @@
1
1
  import { MAX_SCENE_IMAGE_BYTES, walkKeySchema, worldSceneStreamRequestSchema, worldSceneStreamResponseSchema, worldStepStreamRequestSchema, worldStepStreamResponseSchema } from '../schemas/sdcpp-config.js';
2
- import { parseClientInput } from './parse-input.js';
2
+ import { parseClientInput } from '../api/parse-input.js';
3
3
  import { generateRequestId } from '../runtime/request-id.js';
4
4
  import { decodeBase64, encodeBase64 } from '../utils/encoding.js';
5
5
  import { InvalidResponseError, RequestValidationFailedError, StreamEndedError, InferenceCancelledError } from '../errors/index.js';
@@ -1,5 +1,5 @@
1
1
  import type { WorldSceneClientParams, WorldStepClientParams } from '../schemas/sdcpp-config.js';
2
- import { type WorldSceneResult, type WorldSceneResultWithPack, type WorldStepResult } from './world-result.js';
2
+ import { type WorldSceneResult, type WorldSceneResultWithPack, type WorldStepResult } from '../api/world-result.js';
3
3
  /**
4
4
  * Builds a world for an ABot-World session: the prompt and first frame are
5
5
  * encoded into a scene pack the walk then runs on.
package/dist/api/world.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { stream as streamRpc } from '../dispatch.js';
2
- import { createWorldSceneResult, createWorldStepResult } from './world-result.js';
2
+ import { createWorldSceneResult, createWorldStepResult } from '../api/world-result.js';
3
3
  export function worldCreateScene(params) {
4
4
  return createWorldSceneResult(params, streamRpc);
5
5
  }
@@ -1,4 +1,4 @@
1
- import { type QvacConfig } from './config-utils.js';
1
+ import { type QvacConfig } from '../config/config-utils.js';
2
2
  /**
3
3
  * Resolution order for Bare:
4
4
  * 1. QVAC_CONFIG_PATH environment variable
@@ -7,7 +7,7 @@ import path from 'bare-path';
7
7
  import os from 'bare-os';
8
8
  import env from 'bare-env';
9
9
  import { pathToFileURL } from 'bare-url';
10
- import { validateConfig } from './config-utils.js';
10
+ import { validateConfig } from '../config/config-utils.js';
11
11
  import { ConfigFileInvalidError, ConfigFileParseFailedError } from '../errors/index.js';
12
12
  import { getAppLogger } from '../logging/index.js';
13
13
  const SUPPORTED_CONFIG_FILE_EXTS = ['.js', '.json'];
@@ -1,2 +1,2 @@
1
- export * from './audio.js';
2
- export * from './registry.js';
1
+ export * from '../constants/audio.js';
2
+ export * from '../constants/registry.js';
@@ -1,2 +1,2 @@
1
- export * from './audio.js';
2
- export * from './registry.js';
1
+ export * from '../constants/audio.js';
2
+ export * from '../constants/registry.js';
@@ -1,7 +1,8 @@
1
- import type { Request, Response, RPCOptions } from './schemas/index.js';
1
+ import type { Request, Response, RPCOptions, AbortableRPCOptions } from './schemas/index.js';
2
2
  import Buffer from 'bare-buffer';
3
3
  export declare function send<T extends Request>(request: T, _options?: RPCOptions): Promise<Response>;
4
- export declare function stream<T extends Request>(request: T, _options?: RPCOptions): AsyncGenerator<Response>;
4
+ /** `options.signal` ends the stream only for a handler with `endsOnAbort`. */
5
+ export declare function stream<T extends Request>(request: T, options?: AbortableRPCOptions): AsyncGenerator<Response>;
5
6
  export interface DuplexWritable {
6
7
  write(chunk: Uint8Array): void;
7
8
  end(): void;
package/dist/dispatch.js CHANGED
@@ -148,10 +148,11 @@ function getProfilingMeta(request) {
148
148
  * parse would drop, so it is carried across.
149
149
  */
150
150
  function prepareRequest(request) {
151
- const withDeviceDefaults = applyDeviceDefaults(request);
152
- const profilingMeta = getProfilingMeta(withDeviceDefaults);
151
+ let withDeviceDefaults;
153
152
  let validated;
154
153
  try {
154
+ // Resolving device defaults parses the model config, so a bad value fails here.
155
+ withDeviceDefaults = applyDeviceDefaults(request);
155
156
  validated = requestSchema.parse(withDeviceDefaults);
156
157
  }
157
158
  catch (error) {
@@ -160,6 +161,7 @@ function prepareRequest(request) {
160
161
  }
161
162
  throw error;
162
163
  }
164
+ const profilingMeta = getProfilingMeta(withDeviceDefaults);
163
165
  if (profilingMeta !== undefined) {
164
166
  ;
165
167
  validated[PROFILING_KEY] = profilingMeta;
@@ -170,6 +172,11 @@ function invokeHandler(request, handler) {
170
172
  const directHandler = handler;
171
173
  return directHandler(request);
172
174
  }
175
+ function invokeStreamHandler(request, entry, handler, context) {
176
+ if (!entry.endsOnAbort)
177
+ return invokeHandler(request, handler);
178
+ return handler(request, context);
179
+ }
173
180
  function isAsyncGenerator(result) {
174
181
  return typeof result === 'object' && result !== null && Symbol.asyncIterator in result;
175
182
  }
@@ -223,18 +230,23 @@ export async function send(request, _options) {
223
230
  }
224
231
  return profileReplyHandler({ op: processed.type, request: processed }, () => invokeHandler(processed, handler));
225
232
  }
226
- export async function* stream(request, _options) {
233
+ /** `options.signal` ends the stream only for a handler with `endsOnAbort`. */
234
+ export async function* stream(request, options) {
227
235
  await ensureReady();
228
236
  assertLifecycleAllowed(request);
229
237
  const processed = prepareRequest(request);
230
238
  const entry = getHandlerEntry(processed.type);
231
239
  const handler = selectHandler(entry);
240
+ const signal = entry.endsOnAbort ? options?.signal : undefined;
241
+ if (signal?.aborted)
242
+ return;
243
+ const context = signal ? { signal } : {};
232
244
  async function* run() {
233
245
  if (handlerSupportsProgress(entry, processed)) {
234
246
  yield* streamWithProgress(processed, handler);
235
247
  return;
236
248
  }
237
- const result = invokeHandler(processed, handler);
249
+ const result = invokeStreamHandler(processed, entry, handler, context);
238
250
  if (isAsyncGenerator(result)) {
239
251
  yield* result;
240
252
  }
@@ -437,6 +437,12 @@ export declare class PathTraversalError extends QvacErrorBase {
437
437
  export declare class ModelRegistryQueryFailedError extends QvacErrorBase {
438
438
  constructor(details?: string, cause?: unknown);
439
439
  }
440
+ export declare class ModelRegistryModelNotFoundError extends QvacErrorBase {
441
+ readonly registrySource: string;
442
+ readonly registryPath: string;
443
+ constructor(registrySource: string, registryPath: string, cause?: unknown);
444
+ toErrorResponseFields(): Record<string, unknown>;
445
+ }
440
446
  export declare class RpcServerOperationError extends QvacErrorBase {
441
447
  readonly operation: string;
442
448
  readonly details: string;
@@ -1,6 +1,6 @@
1
1
  import { QvacErrorBase } from '@qvac/error';
2
2
  import { ERROR_CODES } from '../schemas/errors.js';
3
- import { createErrorOptions } from './options.js';
3
+ import { createErrorOptions } from '../errors/options.js';
4
4
  // ============== Response / request validation ==============
5
5
  export class InvalidResponseError extends QvacErrorBase {
6
6
  constructor(expected, cause) {
@@ -723,6 +723,18 @@ export class ModelRegistryQueryFailedError extends QvacErrorBase {
723
723
  super(createErrorOptions(ERROR_CODES.QVAC_MODEL_REGISTRY_QUERY_FAILED, details ? [details] : undefined, cause));
724
724
  }
725
725
  }
726
+ export class ModelRegistryModelNotFoundError extends QvacErrorBase {
727
+ registrySource;
728
+ registryPath;
729
+ constructor(registrySource, registryPath, cause) {
730
+ super(createErrorOptions(ERROR_CODES.QVAC_MODEL_REGISTRY_MODEL_NOT_FOUND, [registrySource, registryPath], cause));
731
+ this.registrySource = registrySource;
732
+ this.registryPath = registryPath;
733
+ }
734
+ toErrorResponseFields() {
735
+ return { registrySource: this.registrySource, registryPath: this.registryPath };
736
+ }
737
+ }
726
738
  export class RpcServerOperationError extends QvacErrorBase {
727
739
  operation;
728
740
  details;
@@ -1,5 +1,5 @@
1
1
  import type { AssessModelFitRequest, AssessModelFitResponse, ModelFitCandidate, ModelFitEstimateTarget } from '../schemas/assess-model-fit.js';
2
- import type { FitStubUnavailableReason } from '../resources/model-fit/fit-stub/fetch-fit-stub.js';
2
+ import type { FitStubUnavailableReason } from '../model-fit/description/fetch.js';
3
3
  /**
4
4
  * Runs a pre-download fit assessment worker-side.
5
5
  *
@@ -1,11 +1,11 @@
1
1
  import { isCanonicalModelType, normalizeModelType, ModelType } from '../schemas/index.js';
2
2
  import { inferModelTypeFromModelSrc } from '../schemas/model-src-utils.js';
3
3
  import { ModelTypeRequiredError } from '../errors/index.js';
4
- import { projectFitFromLoad } from '../resources/model-fit/fit-stub/project-fit-from-load.js';
4
+ import { projectFitFromLoad } from '../model-fit/description/project.js';
5
5
  import { getResourceCollector } from '../resources/instance.js';
6
6
  import { getConfig } from '../runtime/state.js';
7
- import { assessModelFitFromResources } from '../resources/model-fit/assess.js';
8
- import { detectPlatform } from '../resources/model-fit/platform.js';
7
+ import { assessModelFitFromResources } from '../model-fit/assess.js';
8
+ import { detectPlatform } from '../model-fit/platform.js';
9
9
  /**
10
10
  * Runs a pre-download fit assessment worker-side.
11
11
  *
@@ -72,7 +72,7 @@ function audiogenUsesGpu(config) {
72
72
  }
73
73
  /**
74
74
  * Engines that carry a GPU switch, each read at the key its own config spells
75
- * it under. These are the keys the fit builders read in `native-probe/engines`,
75
+ * it under. These are the keys the fit builders read in `model-fit/request/engines`,
76
76
  * so a projection and a device never disagree. Only bci defaults to on.
77
77
  */
78
78
  const GPU_SWITCH = {
@@ -1,6 +1,6 @@
1
1
  import { cancel as cancelByModelId } from '../plugins/ops/cancel.js';
2
2
  import { getRequestRegistry } from '../runtime/index.js';
3
- import { markClearCacheForRequest } from './load-model/download-manager.js';
3
+ import { markClearCacheForRequest } from '../handlers/load-model/download-manager.js';
4
4
  import { getEngineLogger } from '../logging/index.js';
5
5
  const logger = getEngineLogger();
6
6
  /**
@@ -1,7 +1,7 @@
1
1
  import { toolCallbackResultSchema } from '../schemas/completion-stream.js';
2
2
  import { aggregateEvents } from '../utils/aggregate-events.js';
3
3
  import { CompletionFailedError } from '../errors/index.js';
4
- import { dispatchPluginStream } from './plugin-dispatch.js';
4
+ import { dispatchPluginStream } from '../handlers/plugin-dispatch.js';
5
5
  import { executeToolSearch, TOOL_SEARCH_NAME } from '../utils/tools/defer.js';
6
6
  const DEFAULT_MAX_TOOL_TURNS = 8;
7
7
  // Generous ceiling on one client-side tool execution: long enough for a slow
@@ -159,7 +159,7 @@ export async function* orchestrateCompletion(request, runTurn, reader) {
159
159
  const defers = request.tools?.some((tool) => tool.deferLoading === true) ?? false;
160
160
  for (const call of toolCalls) {
161
161
  // `tool_search` is the SDK's own tool: it reads the registered inventory
162
- // and appends the matched definitions, so it never leaves the worker and
162
+ // and records what it loaded in the history, so it never leaves the worker and
163
163
  // the client is never asked to run it. The `toolCall` event still went
164
164
  // downstream with the turn's events, so the client can see it happened.
165
165
  if (defers && call.name === TOOL_SEARCH_NAME) {
@@ -51,8 +51,8 @@ var __disposeResources = (this && this.__disposeResources) || (function (Suppres
51
51
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
52
52
  });
53
53
  import { PROFILING_KEY, OPERATION_EVENT_KEY } from '../schemas/index.js';
54
- import { resolveModelPath, resolveModelPathWithStats } from './load-model/resolve.js';
55
- import { buildDownloadProfilingFields } from './load-model/types.js';
54
+ import { resolveModelPath, resolveModelPathWithStats } from '../handlers/load-model/resolve.js';
55
+ import { buildDownloadProfilingFields } from '../handlers/load-model/types.js';
56
56
  import { nowMs, generateProfileId } from '../profiling/clock.js';
57
57
  import { getEngineLogger } from '../logging/index.js';
58
58
  import { getRequestRegistry, withRequestContext } from '../runtime/index.js';
@@ -1,4 +1,4 @@
1
- import { dispatchPluginReply } from './plugin-dispatch.js';
1
+ import { dispatchPluginReply } from '../handlers/plugin-dispatch.js';
2
2
  import { startFinetune } from '../plugins/builtin/llamacpp-completion/ops/finetune.js';
3
3
  export async function handleFinetune(request, progressCallback) {
4
4
  if (progressCallback &&
@@ -1,6 +1,6 @@
1
1
  import { getModelEntry } from '../runtime/model-registry.js';
2
2
  import { getPlugin } from '../plugins/registry.js';
3
- import { detectToolDialectFromName } from '../utils/tools/index.js';
3
+ import { detectToolDialect } from '../utils/tool-integration.js';
4
4
  import { ModelNotFoundError } from '../errors/index.js';
5
5
  import { getEngineLogger } from '../logging/index.js';
6
6
  const logger = getEngineLogger();
@@ -25,9 +25,8 @@ export function handleGetLoadedModelInfo(request) {
25
25
  ...(plugin && { addonPackage: plugin.addonPackage }),
26
26
  ...(entry.local.name && { name: entry.local.name }),
27
27
  ...(entry.local.path && { path: entry.local.path }),
28
- // Same detection the completion normalizer uses, so callers see the dialect it parses.
29
28
  ...(handlers.includes('completionStream') && {
30
- toolDialect: detectToolDialectFromName(entry.local.name, entry.local.path)
29
+ toolDialect: detectToolDialect(modelId)
31
30
  }),
32
31
  ...(fitProbe !== undefined && { fitProbe })
33
32
  };
@@ -5,7 +5,7 @@ import { promises as fsPromises } from 'bare-fs';
5
5
  import { getShardPath, getModelsCacheDir, getSingleFileCachePath } from '../utils/cache/paths.js';
6
6
  import { validateAndJoinPath } from '../utils/path-security.js';
7
7
  import { ModelNotFoundError } from '../errors/index.js';
8
- import { findCoremlCompanionSet, findLocallyCachedCoremlCompanionSet, getCoremlSidecarSpec, getCoremlSetKey } from './load-model/coreml-sidecars.js';
8
+ import { findCoremlCompanionSet, findLocallyCachedCoremlCompanionSet, getCoremlSidecarSpec, getCoremlSetKey } from '../handlers/load-model/coreml-sidecars.js';
9
9
  import { getRegistryClient } from '../runtime/registry-client.js';
10
10
  import { getRuntimeContext } from '../runtime/state.js';
11
11
  export async function handleGetModelInfo(request) {
@@ -5,12 +5,27 @@ type BundleSpec = {
5
5
  targetSuffix: string;
6
6
  };
7
7
  export type CoremlSidecarSpec = {
8
+ source: string;
8
9
  root: string;
9
10
  modelStem: string;
10
11
  bundles: readonly BundleSpec[];
12
+ withoutBundlesUse?: string;
11
13
  };
12
14
  type CompanionSet = NonNullable<RegistryItem['companionSet']>;
13
15
  export declare function getCoremlSidecarSpec(registryPath: string, registrySource: string, platform: string | undefined): CoremlSidecarSpec | undefined;
16
+ /**
17
+ * For the encoder-less GGUF of a Core ML distribution, the model constant to
18
+ * load instead where its bundles cannot be staged. The loader stages bundles
19
+ * on macOS and iOS alone, so anywhere else such a load is refused up front
20
+ * rather than failing inside the addon after the download.
21
+ */
22
+ export declare function getCoremlOnlyAlternative(registryPath: string, registrySource: string): string | undefined;
23
+ /**
24
+ * Why a `registry://` model source cannot load on `platform`, or `undefined`
25
+ * when it can. Only the encoder-less GGUF of a Core ML distribution is refused,
26
+ * and only off Apple platforms; every other source is the loader's business.
27
+ */
28
+ export declare function getRegistryModelPlatformRefusal(modelSrc: unknown, platform: string | undefined): string | undefined;
14
29
  export declare function getCoremlSetKey(model: RegistryItem, spec: CoremlSidecarSpec): string;
15
30
  export declare function readCachedCoremlCompanionSet(model: RegistryItem, platform: string | undefined, cacheDir?: string): Promise<CompanionSet | undefined>;
16
31
  export declare function writeCachedCoremlCompanionSet(set: CompanionSet, cacheDir?: string): Promise<void>;