@qvac/inference 0.18.2 → 0.19.1

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 (396) hide show
  1. package/NOTICE +69 -36
  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/delete-cache.d.ts +7 -1
  10. package/dist/api/delete-cache.js +11 -1
  11. package/dist/api/download-asset.d.ts +1 -1
  12. package/dist/api/download-asset.js +2 -2
  13. package/dist/api/finetune.js +1 -1
  14. package/dist/api/get-loaded-model-info.d.ts +6 -10
  15. package/dist/api/get-loaded-model-info.js +6 -10
  16. package/dist/api/heartbeat.d.ts +5 -22
  17. package/dist/api/heartbeat.js +6 -23
  18. package/dist/api/index.d.ts +36 -35
  19. package/dist/api/index.js +35 -35
  20. package/dist/api/load-model.d.ts +5 -1
  21. package/dist/api/load-model.js +3 -5
  22. package/dist/api/logging-stream-registry.js +1 -1
  23. package/dist/api/resume.d.ts +0 -3
  24. package/dist/api/resume.js +0 -3
  25. package/dist/api/subscribe-logs.js +1 -1
  26. package/dist/api/suspend.d.ts +0 -4
  27. package/dist/api/suspend.js +0 -4
  28. package/dist/api/translate.d.ts +3 -1
  29. package/dist/api/translate.js +16 -8
  30. package/dist/api/unload-model.js +3 -5
  31. package/dist/api/video-request.d.ts +207 -0
  32. package/dist/api/video-request.js +18 -0
  33. package/dist/api/video.d.ts +22 -2
  34. package/dist/api/video.js +25 -15
  35. package/dist/api/vla-helpers.d.ts +1 -2
  36. package/dist/api/vla-helpers.js +1 -2
  37. package/dist/api/vla.js +1 -1
  38. package/dist/api/world-result.d.ts +71 -0
  39. package/dist/api/world-result.js +293 -0
  40. package/dist/api/world.d.ts +143 -0
  41. package/dist/api/world.js +71 -0
  42. package/dist/config/resolve-config.d.ts +1 -1
  43. package/dist/config/resolve-config.js +1 -1
  44. package/dist/constants/index.d.ts +2 -2
  45. package/dist/constants/index.js +2 -2
  46. package/dist/dispatch.js +15 -28
  47. package/dist/errors/index.d.ts +35 -31
  48. package/dist/errors/index.js +66 -56
  49. package/dist/handlers/assess-model-fit.d.ts +10 -0
  50. package/dist/handlers/assess-model-fit.js +75 -0
  51. package/dist/handlers/cancelHandler.js +1 -1
  52. package/dist/handlers/completion-orchestrate.js +1 -1
  53. package/dist/handlers/delete-cache.js +3 -0
  54. package/dist/handlers/download-asset.js +6 -5
  55. package/dist/handlers/finetune.js +1 -1
  56. package/dist/handlers/get-loaded-model-info.js +0 -12
  57. package/dist/handlers/get-model-info.js +1 -1
  58. package/dist/handlers/get-system-resources.js +8 -0
  59. package/dist/handlers/load-model/download-manager.d.ts +1 -1
  60. package/dist/handlers/load-model/download-stats.d.ts +3 -3
  61. package/dist/handlers/load-model/download-stats.js +5 -5
  62. package/dist/handlers/load-model/handler.js +6 -8
  63. package/dist/handlers/load-model/http-verify.d.ts +20 -0
  64. package/dist/handlers/load-model/http-verify.js +54 -0
  65. package/dist/handlers/load-model/http.d.ts +12 -2
  66. package/dist/handlers/load-model/http.js +119 -230
  67. package/dist/handlers/load-model/hyperdrive.d.ts +1 -1
  68. package/dist/handlers/load-model/hyperdrive.js +1 -1
  69. package/dist/handlers/load-model/index.d.ts +2 -2
  70. package/dist/handlers/load-model/index.js +2 -2
  71. package/dist/handlers/load-model/registry-companion-set.d.ts +1 -1
  72. package/dist/handlers/load-model/registry-companion-set.js +1 -1
  73. package/dist/handlers/load-model/registry-download-utils.d.ts +3 -3
  74. package/dist/handlers/load-model/registry-download-utils.js +2 -2
  75. package/dist/handlers/load-model/registry.d.ts +2 -2
  76. package/dist/handlers/load-model/registry.js +4 -4
  77. package/dist/handlers/load-model/resolve-session.d.ts +8 -1
  78. package/dist/handlers/load-model/resolve-session.js +12 -9
  79. package/dist/handlers/load-model/resolve.d.ts +4 -4
  80. package/dist/handlers/load-model/resolve.js +18 -16
  81. package/dist/handlers/load-model/safe-fetch.d.ts +44 -0
  82. package/dist/handlers/load-model/safe-fetch.js +143 -0
  83. package/dist/handlers/load-model/types.d.ts +9 -0
  84. package/dist/handlers/plugin-dispatch.js +1 -4
  85. package/dist/handlers/plugin-invoke.js +1 -4
  86. package/dist/handlers/types.d.ts +0 -2
  87. package/dist/handlers/unload-model.js +1 -4
  88. package/dist/index.d.ts +1 -1
  89. package/dist/index.js +1 -1
  90. package/dist/logging/addon.d.ts +1 -1
  91. package/dist/logging/addon.js +1 -1
  92. package/dist/logging/index.d.ts +5 -5
  93. package/dist/logging/index.js +4 -4
  94. package/dist/logging/logger.d.ts +1 -1
  95. package/dist/logging/logger.js +2 -2
  96. package/dist/models/registry/index.d.ts +1 -1
  97. package/dist/models/registry/index.js +2 -2
  98. package/dist/models/registry/models.d.ts +250 -0
  99. package/dist/models/registry/models.js +2071 -1806
  100. package/dist/models/registry/resource-profiles.d.ts +18 -0
  101. package/dist/models/registry/resource-profiles.js +4934 -0
  102. package/dist/plugins/builtin/audiogen-ggml/config.d.ts +14 -0
  103. package/dist/plugins/builtin/audiogen-ggml/config.js +23 -0
  104. package/dist/plugins/builtin/audiogen-ggml/ops/audio-gen-stream.js +47 -5
  105. package/dist/plugins/builtin/audiogen-ggml/plugin.d.ts +134 -4
  106. package/dist/plugins/builtin/audiogen-ggml/plugin.js +47 -28
  107. package/dist/plugins/builtin/bci-whispercpp-transcription/plugin.d.ts +1 -1
  108. package/dist/plugins/builtin/bci-whispercpp-transcription/plugin.js +3 -3
  109. package/dist/plugins/builtin/ggml-classification/plugin.js +1 -1
  110. package/dist/plugins/builtin/ggml-ocr/plugin.js +2 -2
  111. package/dist/plugins/builtin/ggml-vla/plugin.d.ts +1 -1
  112. package/dist/plugins/builtin/ggml-vla/plugin.js +3 -3
  113. package/dist/plugins/builtin/index.d.ts +12 -12
  114. package/dist/plugins/builtin/index.js +12 -12
  115. package/dist/plugins/builtin/llamacpp-completion/ops/batch-completion-stream.js +2 -2
  116. package/dist/plugins/builtin/llamacpp-completion/ops/completion-stats.d.ts +1 -0
  117. package/dist/plugins/builtin/llamacpp-completion/ops/completion-stats.js +3 -0
  118. package/dist/plugins/builtin/llamacpp-completion/ops/completion-stream.js +37 -26
  119. package/dist/plugins/builtin/llamacpp-completion/ops/context-overflow.d.ts +12 -11
  120. package/dist/plugins/builtin/llamacpp-completion/ops/context-overflow.js +133 -41
  121. package/dist/plugins/builtin/llamacpp-completion/ops/kv-cache-session.d.ts +15 -4
  122. package/dist/plugins/builtin/llamacpp-completion/ops/kv-cache-session.js +79 -17
  123. package/dist/plugins/builtin/llamacpp-completion/plugin.d.ts +22 -8
  124. package/dist/plugins/builtin/llamacpp-completion/plugin.js +10 -13
  125. package/dist/plugins/builtin/llamacpp-embedding/plugin.d.ts +4 -0
  126. package/dist/plugins/builtin/llamacpp-embedding/plugin.js +13 -2
  127. package/dist/plugins/builtin/nmtcpp-translation/plugin.js +2 -2
  128. package/dist/plugins/builtin/parakeet-transcription/plugin.d.ts +2 -2
  129. package/dist/plugins/builtin/parakeet-transcription/plugin.js +3 -3
  130. package/dist/plugins/builtin/sdcpp-generation/ops/upscale.js +1 -1
  131. package/dist/plugins/builtin/sdcpp-generation/ops/video.js +32 -2
  132. package/dist/plugins/builtin/sdcpp-generation/ops/world.d.ts +126 -0
  133. package/dist/plugins/builtin/sdcpp-generation/ops/world.js +820 -0
  134. package/dist/plugins/builtin/sdcpp-generation/plugin.d.ts +153 -4
  135. package/dist/plugins/builtin/sdcpp-generation/plugin.js +134 -13
  136. package/dist/plugins/builtin/tts-ggml/ops/text-to-speech-stream.js +1 -1
  137. package/dist/plugins/builtin/tts-ggml/ops/text-to-speech.js +1 -1
  138. package/dist/plugins/builtin/tts-ggml/plugin.js +2 -2
  139. package/dist/plugins/builtin/whispercpp-transcription/plugin.d.ts +2 -2
  140. package/dist/plugins/builtin/whispercpp-transcription/plugin.js +3 -3
  141. package/dist/plugins/index.d.ts +1 -1
  142. package/dist/plugins/index.js +2 -2
  143. package/dist/plugins/ops/kv-cache-utils.js +1 -1
  144. package/dist/plugins/ops/load-model.js +1 -1
  145. package/dist/plugins/ops/transcribe.js +2 -2
  146. package/dist/plugins/ops/translate.js +4 -12
  147. package/dist/plugins/ops/unload-model.js +19 -21
  148. package/dist/plugins/registry.d.ts +1 -0
  149. package/dist/plugins/registry.js +12 -0
  150. package/dist/profiling/aggregator.d.ts +1 -1
  151. package/dist/profiling/aggregator.js +1 -1
  152. package/dist/profiling/controller.d.ts +1 -1
  153. package/dist/profiling/controller.js +2 -2
  154. package/dist/profiling/envelope.d.ts +0 -1
  155. package/dist/profiling/envelope.js +0 -10
  156. package/dist/profiling/events.d.ts +2 -3
  157. package/dist/profiling/events.js +2 -9
  158. package/dist/profiling/exporters.d.ts +1 -1
  159. package/dist/profiling/exporters.js +3 -3
  160. package/dist/profiling/index.d.ts +13 -14
  161. package/dist/profiling/index.js +12 -13
  162. package/dist/profiling/operation-metrics.d.ts +1 -1
  163. package/dist/profiling/operation-metrics.js +35 -2
  164. package/dist/profiling/operation-wrappers.js +12 -15
  165. package/dist/profiling/profiler.d.ts +1 -2
  166. package/dist/profiling/profiler.js +7 -26
  167. package/dist/profiling/types.d.ts +1 -1
  168. package/dist/rag/handler.js +1 -1
  169. package/dist/rag/handlers/close-workspace.js +1 -1
  170. package/dist/rag/handlers/delete-embeddings.js +1 -1
  171. package/dist/rag/handlers/delete-workspace.js +2 -6
  172. package/dist/rag/handlers/ingest.js +1 -1
  173. package/dist/rag/handlers/list-workspaces.d.ts +1 -1
  174. package/dist/rag/handlers/list-workspaces.js +1 -1
  175. package/dist/rag/handlers/reindex.js +1 -1
  176. package/dist/rag/handlers/save-embeddings.js +1 -1
  177. package/dist/rag/handlers/search.js +1 -1
  178. package/dist/rag/index.d.ts +11 -11
  179. package/dist/rag/index.js +11 -11
  180. package/dist/rag/rag-workspace-manager.d.ts +4 -2
  181. package/dist/rag/rag-workspace-manager.js +268 -15
  182. package/dist/registry.js +8 -58
  183. package/dist/resources/collector.d.ts +3 -1
  184. package/dist/resources/collector.js +91 -9
  185. package/dist/resources/instance.d.ts +1 -1
  186. package/dist/resources/instance.js +1 -1
  187. package/dist/resources/model-fit/assess.d.ts +36 -0
  188. package/dist/resources/model-fit/assess.js +679 -0
  189. package/dist/resources/model-fit/calibration/darwin-arm64.d.ts +8 -0
  190. package/dist/resources/model-fit/calibration/darwin-arm64.js +36 -0
  191. package/dist/resources/model-fit/calibration/darwin-x64.d.ts +8 -0
  192. package/dist/resources/model-fit/calibration/darwin-x64.js +38 -0
  193. package/dist/resources/model-fit/calibration/fit.d.ts +73 -0
  194. package/dist/resources/model-fit/calibration/fit.js +152 -0
  195. package/dist/resources/model-fit/calibration/index.d.ts +37 -0
  196. package/dist/resources/model-fit/calibration/index.js +75 -0
  197. package/dist/resources/model-fit/calibration/linux-arm64.d.ts +8 -0
  198. package/dist/resources/model-fit/calibration/linux-arm64.js +38 -0
  199. package/dist/resources/model-fit/calibration/linux-x64-vulkan.d.ts +8 -0
  200. package/dist/resources/model-fit/calibration/linux-x64-vulkan.js +39 -0
  201. package/dist/resources/model-fit/calibration/linux-x64.d.ts +8 -0
  202. package/dist/resources/model-fit/calibration/linux-x64.js +38 -0
  203. package/dist/resources/model-fit/calibration/win32-x64-vulkan-shared.d.ts +8 -0
  204. package/dist/resources/model-fit/calibration/win32-x64-vulkan-shared.js +39 -0
  205. package/dist/resources/model-fit/calibration/win32-x64-vulkan.d.ts +8 -0
  206. package/dist/resources/model-fit/calibration/win32-x64-vulkan.js +36 -0
  207. package/dist/resources/model-fit/calibration/win32-x64.d.ts +8 -0
  208. package/dist/resources/model-fit/calibration/win32-x64.js +38 -0
  209. package/dist/resources/model-fit/estimators/llm.d.ts +46 -0
  210. package/dist/resources/model-fit/estimators/llm.js +222 -0
  211. package/dist/resources/model-fit/estimators/whisper.d.ts +10 -0
  212. package/dist/resources/model-fit/estimators/whisper.js +77 -0
  213. package/dist/resources/model-fit/floor.d.ts +31 -0
  214. package/dist/resources/model-fit/floor.js +65 -0
  215. package/dist/resources/model-fit/types.d.ts +120 -0
  216. package/dist/resources/model-fit/types.js +1 -0
  217. package/dist/resources/native.d.ts +1 -1
  218. package/dist/resources/native.js +15 -0
  219. package/dist/resources/normalize.d.ts +1 -1
  220. package/dist/resources/types.d.ts +14 -0
  221. package/dist/runtime/index.d.ts +5 -5
  222. package/dist/runtime/index.js +2 -2
  223. package/dist/runtime/lifecycle.js +5 -7
  224. package/dist/runtime/model-registry.d.ts +0 -14
  225. package/dist/runtime/model-registry.js +17 -40
  226. package/dist/runtime/registry-client.js +1 -1
  227. package/dist/runtime/request-context.d.ts +3 -3
  228. package/dist/runtime/request-context.js +13 -1
  229. package/dist/runtime/request-registry.d.ts +1 -1
  230. package/dist/runtime/request-registry.js +4 -5
  231. package/dist/runtime/state.d.ts +1 -1
  232. package/dist/runtime/state.js +18 -3
  233. package/dist/schemas/assess-model-fit.d.ts +311 -0
  234. package/dist/schemas/assess-model-fit.js +182 -0
  235. package/dist/schemas/audio-gen.d.ts +437 -7
  236. package/dist/schemas/audio-gen.js +131 -19
  237. package/dist/schemas/batch-completion-stream.d.ts +5 -2
  238. package/dist/schemas/batch-completion-stream.js +3 -3
  239. package/dist/schemas/bci-config.js +73 -27
  240. package/dist/schemas/bci.d.ts +3 -3
  241. package/dist/schemas/bci.js +5 -5
  242. package/dist/schemas/cancel.d.ts +5 -0
  243. package/dist/schemas/cancel.js +1 -0
  244. package/dist/schemas/classification.js +13 -6
  245. package/dist/schemas/common.d.ts +695 -335
  246. package/dist/schemas/common.js +33 -31
  247. package/dist/schemas/completion-event.d.ts +5 -2
  248. package/dist/schemas/completion-event.js +2 -1
  249. package/dist/schemas/completion-stream.d.ts +3 -5
  250. package/dist/schemas/completion-stream.js +4 -8
  251. package/dist/schemas/config.d.ts +640 -18
  252. package/dist/schemas/config.js +50 -8
  253. package/dist/schemas/download-asset.d.ts +19 -1
  254. package/dist/schemas/download-asset.js +20 -4
  255. package/dist/schemas/engine-addon-map.d.ts +1 -1
  256. package/dist/schemas/engine-addon-map.js +3 -3
  257. package/dist/schemas/error.d.ts +2 -2
  258. package/dist/schemas/error.js +2 -2
  259. package/dist/schemas/errors.d.ts +2 -6
  260. package/dist/schemas/errors.js +30 -40
  261. package/dist/schemas/heartbeat.d.ts +10 -0
  262. package/dist/schemas/heartbeat.js +8 -0
  263. package/dist/schemas/index.d.ts +46 -44
  264. package/dist/schemas/index.js +45 -43
  265. package/dist/schemas/llamacpp-config.d.ts +32 -10
  266. package/dist/schemas/llamacpp-config.js +11 -8
  267. package/dist/schemas/load-model.d.ts +2902 -1857
  268. package/dist/schemas/load-model.js +52 -52
  269. package/dist/schemas/mcp-adapter.d.ts +1 -1
  270. package/dist/schemas/model-config-schemas.d.ts +2354 -0
  271. package/dist/schemas/model-config-schemas.js +46 -0
  272. package/dist/schemas/model-info.d.ts +10 -20
  273. package/dist/schemas/model-info.js +4 -25
  274. package/dist/schemas/model-ops.d.ts +3 -1
  275. package/dist/schemas/model-ops.js +7 -2
  276. package/dist/schemas/model-resource-profile.d.ts +109 -0
  277. package/dist/schemas/model-resource-profile.js +83 -0
  278. package/dist/schemas/model-src-utils.d.ts +1 -0
  279. package/dist/schemas/model-src-utils.js +33 -13
  280. package/dist/schemas/ocr.js +48 -13
  281. package/dist/schemas/path-validation.js +8 -2
  282. package/dist/schemas/plugin.d.ts +23 -10
  283. package/dist/schemas/plugin.js +11 -0
  284. package/dist/schemas/profiling.d.ts +138 -43
  285. package/dist/schemas/profiling.js +1 -22
  286. package/dist/schemas/rag.js +1 -1
  287. package/dist/schemas/registry.js +1 -1
  288. package/dist/schemas/reload-config.d.ts +0 -2
  289. package/dist/schemas/reload-config.js +2 -3
  290. package/dist/schemas/sdcpp-config.d.ts +344 -4
  291. package/dist/schemas/sdcpp-config.js +504 -17
  292. package/dist/schemas/system-resources.d.ts +138 -0
  293. package/dist/schemas/system-resources.js +3 -1
  294. package/dist/schemas/text-to-speech.js +183 -76
  295. package/dist/schemas/transcription-config.js +253 -85
  296. package/dist/schemas/transcription.d.ts +3 -3
  297. package/dist/schemas/translate.d.ts +2 -2
  298. package/dist/schemas/translate.js +1 -1
  299. package/dist/schemas/translation-config.js +53 -25
  300. package/dist/schemas/vla.d.ts +1 -1
  301. package/dist/selection.d.ts +1 -5
  302. package/dist/selection.js +2 -6
  303. package/dist/surface.d.ts +1 -1
  304. package/dist/utils/addon-responses.d.ts +1 -0
  305. package/dist/utils/aggregate-events.d.ts +1 -1
  306. package/dist/utils/aggregate-events.js +2 -2
  307. package/dist/utils/archive.js +2 -2
  308. package/dist/utils/audio-input.js +1 -1
  309. package/dist/utils/cache/auto-history.d.ts +1 -1
  310. package/dist/utils/cache/auto-history.js +1 -1
  311. package/dist/utils/cache/paths.js +5 -5
  312. package/dist/utils/completion-normalizer.js +1 -1
  313. package/dist/utils/gguf-tensor-extractor.js +1 -1
  314. package/dist/utils/image-dimensions.d.ts +26 -0
  315. package/dist/utils/image-dimensions.js +46 -0
  316. package/dist/utils/index.d.ts +13 -10
  317. package/dist/utils/index.js +13 -10
  318. package/dist/utils/mcp-adapter.d.ts +1 -1
  319. package/dist/utils/mcp-adapter.js +1 -1
  320. package/dist/utils/path-sanitize.d.ts +7 -0
  321. package/dist/utils/path-sanitize.js +36 -0
  322. package/dist/utils/path-security.d.ts +0 -7
  323. package/dist/utils/path-security.js +1 -36
  324. package/dist/utils/shard-utils.js +3 -3
  325. package/dist/utils/tool-integration.js +1 -1
  326. package/dist/utils/tools/dialect.js +1 -1
  327. package/dist/utils/tools/index.d.ts +2 -2
  328. package/dist/utils/tools/index.js +2 -2
  329. package/dist/utils/tools/parser.js +8 -8
  330. package/dist/utils/tools/parsers/dsml.d.ts +1 -1
  331. package/dist/utils/tools/parsers/dsml.js +1 -1
  332. package/dist/utils/tools/parsers/gemma4native.d.ts +1 -1
  333. package/dist/utils/tools/parsers/gemma4native.js +1 -1
  334. package/dist/utils/tools/parsers/harmony.d.ts +1 -1
  335. package/dist/utils/tools/parsers/harmony.js +1 -1
  336. package/dist/utils/tools/parsers/hermes.d.ts +1 -1
  337. package/dist/utils/tools/parsers/hermes.js +1 -1
  338. package/dist/utils/tools/parsers/json.d.ts +1 -1
  339. package/dist/utils/tools/parsers/json.js +1 -1
  340. package/dist/utils/tools/parsers/pythonic.d.ts +1 -1
  341. package/dist/utils/tools/parsers/pythonic.js +1 -1
  342. package/dist/utils/tools/parsers/qwen35.d.ts +1 -1
  343. package/dist/utils/tools/parsers/qwen35.js +3 -3
  344. package/dist/utils/url-security.d.ts +17 -0
  345. package/dist/utils/url-security.js +75 -0
  346. package/package.json +31 -26
  347. package/dist/api/provide.d.ts +0 -23
  348. package/dist/api/provide.js +0 -32
  349. package/dist/api/stop-provider.d.ts +0 -20
  350. package/dist/api/stop-provider.js +0 -30
  351. package/dist/p2p/cancel-delegated.d.ts +0 -3
  352. package/dist/p2p/cancel-delegated.js +0 -64
  353. package/dist/p2p/completion-stream-delegated.d.ts +0 -4
  354. package/dist/p2p/completion-stream-delegated.js +0 -51
  355. package/dist/p2p/delegate-client.d.ts +0 -9
  356. package/dist/p2p/delegate-client.js +0 -219
  357. package/dist/p2p/delegate-connect-diagnostics.d.ts +0 -8
  358. package/dist/p2p/delegate-connect-diagnostics.js +0 -38
  359. package/dist/p2p/delegate-transport.d.ts +0 -18
  360. package/dist/p2p/delegate-transport.js +0 -237
  361. package/dist/p2p/error-handlers.d.ts +0 -4
  362. package/dist/p2p/error-handlers.js +0 -31
  363. package/dist/p2p/handle-request.d.ts +0 -2
  364. package/dist/p2p/handle-request.js +0 -171
  365. package/dist/p2p/handler-utils.d.ts +0 -19
  366. package/dist/p2p/handler-utils.js +0 -180
  367. package/dist/p2p/heartbeat-delegated.d.ts +0 -3
  368. package/dist/p2p/heartbeat-delegated.js +0 -32
  369. package/dist/p2p/load-model-delegated.d.ts +0 -6
  370. package/dist/p2p/load-model-delegated.js +0 -132
  371. package/dist/p2p/progress-throttle.d.ts +0 -7
  372. package/dist/p2p/progress-throttle.js +0 -47
  373. package/dist/p2p/provideHandler/connection.d.ts +0 -2
  374. package/dist/p2p/provideHandler/connection.js +0 -38
  375. package/dist/p2p/provideHandler/handler.d.ts +0 -2
  376. package/dist/p2p/provideHandler/handler.js +0 -66
  377. package/dist/p2p/provideHandler/proxy.d.ts +0 -2
  378. package/dist/p2p/provideHandler/proxy.js +0 -24
  379. package/dist/p2p/provideHandler.d.ts +0 -1
  380. package/dist/p2p/provideHandler.js +0 -2
  381. package/dist/p2p/rpc-utils.d.ts +0 -4
  382. package/dist/p2p/rpc-utils.js +0 -8
  383. package/dist/p2p/stopProvideHandler.d.ts +0 -2
  384. package/dist/p2p/stopProvideHandler.js +0 -29
  385. package/dist/p2p/swarm.d.ts +0 -9
  386. package/dist/p2p/swarm.js +0 -103
  387. package/dist/p2p/transport-selector.d.ts +0 -2
  388. package/dist/p2p/transport-selector.js +0 -18
  389. package/dist/p2p/unload-model-delegated.d.ts +0 -2
  390. package/dist/p2p/unload-model-delegated.js +0 -31
  391. package/dist/profiling/delegation-profiler.d.ts +0 -31
  392. package/dist/profiling/delegation-profiler.js +0 -155
  393. package/dist/schemas/delegate.d.ts +0 -29
  394. package/dist/schemas/delegate.js +0 -40
  395. package/dist/schemas/provide.d.ts +0 -50
  396. package/dist/schemas/provide.js +0 -32
@@ -14,7 +14,13 @@ export declare const llmPlugin: {
14
14
  device: import("zod").ZodOptional<import("zod").ZodString>;
15
15
  predict: import("zod").ZodOptional<import("zod").ZodUnion<readonly [import("zod").ZodLiteral<-1>, import("zod").ZodLiteral<-2>, import("zod").ZodNumber]>>;
16
16
  system_prompt: import("zod").ZodOptional<import("zod").ZodString>;
17
- no_mmap: import("zod").ZodOptional<import("zod").ZodBoolean>;
17
+ load_mode: import("zod").ZodOptional<import("zod").ZodEnum<{
18
+ none: "none";
19
+ mmap: "mmap";
20
+ mlock: "mlock";
21
+ "mmap+mlock": "mmap+mlock";
22
+ dio: "dio";
23
+ }>>;
18
24
  verbosity: import("zod").ZodOptional<import("zod").ZodEnum<{
19
25
  readonly ERROR: 0;
20
26
  readonly WARN: 1;
@@ -25,7 +31,6 @@ export declare const llmPlugin: {
25
31
  frequency_penalty: import("zod").ZodOptional<import("zod").ZodNumber>;
26
32
  repeat_penalty: import("zod").ZodOptional<import("zod").ZodNumber>;
27
33
  stop_sequences: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString>>;
28
- n_discarded: import("zod").ZodOptional<import("zod").ZodNumber>;
29
34
  parallel: import("zod").ZodOptional<import("zod").ZodNumber>;
30
35
  tools: import("zod").ZodOptional<import("zod").ZodBoolean>;
31
36
  'cache-type-k': import("zod").ZodOptional<import("zod").ZodString>;
@@ -38,6 +43,12 @@ export declare const llmPlugin: {
38
43
  none: "none";
39
44
  layer: "layer";
40
45
  row: "row";
46
+ tensor: "tensor";
47
+ }>>;
48
+ 'flash-attn': import("zod").ZodOptional<import("zod").ZodEnum<{
49
+ on: "on";
50
+ off: "off";
51
+ auto: "auto";
41
52
  }>>;
42
53
  'tensor-split': import("zod").ZodOptional<import("zod").ZodString>;
43
54
  openclCacheDir: import("zod").ZodOptional<import("zod").ZodString>;
@@ -104,19 +115,19 @@ export declare const llmPlugin: {
104
115
  device?: string | undefined;
105
116
  predict?: number | undefined;
106
117
  system_prompt?: string | undefined;
107
- no_mmap?: boolean | undefined;
118
+ load_mode?: "none" | "mmap" | "mlock" | "mmap+mlock" | "dio" | undefined;
108
119
  verbosity?: 0 | 3 | 2 | 1 | undefined;
109
120
  presence_penalty?: number | undefined;
110
121
  frequency_penalty?: number | undefined;
111
122
  repeat_penalty?: number | undefined;
112
123
  stop_sequences?: string[] | undefined;
113
- n_discarded?: number | undefined;
114
124
  parallel?: number | undefined;
115
125
  tools?: boolean | undefined;
116
126
  'cache-type-k'?: string | undefined;
117
127
  'cache-type-v'?: string | undefined;
118
128
  'main-gpu'?: number | "integrated" | "dedicated" | undefined;
119
- 'split-mode'?: "none" | "layer" | "row" | undefined;
129
+ 'split-mode'?: "none" | "layer" | "row" | "tensor" | undefined;
130
+ 'flash-attn'?: "on" | "off" | "auto" | undefined;
120
131
  'tensor-split'?: string | undefined;
121
132
  openclCacheDir?: string | undefined;
122
133
  reasoning_budget?: number | undefined;
@@ -137,19 +148,19 @@ export declare const llmPlugin: {
137
148
  device?: string | undefined;
138
149
  predict?: number | undefined;
139
150
  system_prompt?: string | undefined;
140
- no_mmap?: boolean | undefined;
151
+ load_mode?: "none" | "mmap" | "mlock" | "mmap+mlock" | "dio" | undefined;
141
152
  verbosity?: 0 | 3 | 2 | 1 | undefined;
142
153
  presence_penalty?: number | undefined;
143
154
  frequency_penalty?: number | undefined;
144
155
  repeat_penalty?: number | undefined;
145
156
  stop_sequences?: string[] | undefined;
146
- n_discarded?: number | undefined;
147
157
  parallel?: number | undefined;
148
158
  tools?: boolean | undefined;
149
159
  'cache-type-k'?: string | undefined;
150
160
  'cache-type-v'?: string | undefined;
151
161
  'main-gpu'?: number | "integrated" | "dedicated" | undefined;
152
- 'split-mode'?: "none" | "layer" | "row" | undefined;
162
+ 'split-mode'?: "none" | "layer" | "row" | "tensor" | undefined;
163
+ 'flash-attn'?: "on" | "off" | "auto" | undefined;
153
164
  'tensor-split'?: string | undefined;
154
165
  openclCacheDir?: string | undefined;
155
166
  reasoning_budget?: number | undefined;
@@ -280,6 +291,7 @@ export declare const llmPlugin: {
280
291
  stats: import("zod").ZodObject<{
281
292
  timeToFirstToken: import("zod").ZodOptional<import("zod").ZodNumber>;
282
293
  tokensPerSecond: import("zod").ZodOptional<import("zod").ZodNumber>;
294
+ promptTokensPerSecond: import("zod").ZodOptional<import("zod").ZodNumber>;
283
295
  cacheTokens: import("zod").ZodOptional<import("zod").ZodNumber>;
284
296
  promptTokens: import("zod").ZodOptional<import("zod").ZodNumber>;
285
297
  generatedTokens: import("zod").ZodOptional<import("zod").ZodNumber>;
@@ -317,6 +329,7 @@ export declare const llmPlugin: {
317
329
  stats: import("zod").ZodOptional<import("zod").ZodObject<{
318
330
  timeToFirstToken: import("zod").ZodOptional<import("zod").ZodNumber>;
319
331
  tokensPerSecond: import("zod").ZodOptional<import("zod").ZodNumber>;
332
+ promptTokensPerSecond: import("zod").ZodOptional<import("zod").ZodNumber>;
320
333
  cacheTokens: import("zod").ZodOptional<import("zod").ZodNumber>;
321
334
  promptTokens: import("zod").ZodOptional<import("zod").ZodNumber>;
322
335
  generatedTokens: import("zod").ZodOptional<import("zod").ZodNumber>;
@@ -440,6 +453,7 @@ export declare const llmPlugin: {
440
453
  stats: import("zod").ZodObject<{
441
454
  timeToFirstToken: import("zod").ZodOptional<import("zod").ZodNumber>;
442
455
  tokensPerSecond: import("zod").ZodOptional<import("zod").ZodNumber>;
456
+ promptTokensPerSecond: import("zod").ZodOptional<import("zod").ZodNumber>;
443
457
  cacheTokens: import("zod").ZodOptional<import("zod").ZodNumber>;
444
458
  promptTokens: import("zod").ZodOptional<import("zod").ZodNumber>;
445
459
  generatedTokens: import("zod").ZodOptional<import("zod").ZodNumber>;
@@ -56,11 +56,11 @@ import { definePlugin, defineHandler, finetuneRequestSchema, batchCompletionStre
56
56
  import { createStreamLogger, registerAddonLogger, getEngineLogger } from '../../../logging/index.js';
57
57
  import { getFirstShardPath } from '../../../utils/index.js';
58
58
  import { getModelParallel } from '../../../utils/config-transform.js';
59
- import { completion } from '../../../plugins/builtin/llamacpp-completion/ops/completion-stream.js';
60
- import { batchCompletion } from '../../../plugins/builtin/llamacpp-completion/ops/batch-completion-stream.js';
61
- import { finetune } from '../../../plugins/builtin/llamacpp-completion/ops/finetune.js';
62
- import { translate } from '../../../plugins/ops/translate.js';
63
- import { transformLlmConfig } from '../../../plugins/builtin/llamacpp-completion/transform.js';
59
+ import { completion } from './ops/completion-stream.js';
60
+ import { batchCompletion } from './ops/batch-completion-stream.js';
61
+ import { finetune } from './ops/finetune.js';
62
+ import { translate } from '../../ops/translate.js';
63
+ import { transformLlmConfig } from './transform.js';
64
64
  import { attachModelExecutionMs } from '../../../profiling/model-execution.js';
65
65
  import { getModelConfig } from '../../../runtime/model-registry.js';
66
66
  import { createCompletionNormalizer } from '../../../utils/completion-normalizer.js';
@@ -68,8 +68,8 @@ import { detectToolDialect } from '../../../utils/tool-integration.js';
68
68
  import { getRequestRegistry, withRequestContext } from '../../../runtime/index.js';
69
69
  import { generateRandomRequestId } from '../../../runtime/request-id.js';
70
70
  import { ContextOverflowError } from '../../../errors/index.js';
71
- import { isAddonContextOverflowError, parseContextOverflowMessage } from '../../../plugins/builtin/llamacpp-completion/ops/context-overflow.js';
72
- import { stoppedByLength } from '../../../plugins/builtin/llamacpp-completion/ops/completion-stats.js';
71
+ import { isAddonContextOverflowError, parseContextOverflowMessage } from './ops/context-overflow.js';
72
+ import { stoppedByLength } from './ops/completion-stats.js';
73
73
  import { isMobile } from '../../../runtime/state.js';
74
74
  import { stripMultiGpuKeys } from '../../../utils/multi-gpu-mobile.js';
75
75
  function createLlmModel(modelId, modelPath, llmConfig, projectionModelPath) {
@@ -245,8 +245,7 @@ export const llmPlugin = definePlugin({
245
245
  }
246
246
  catch (err) {
247
247
  if (isAddonContextOverflowError(err)) {
248
- const { promptTokens, ctxSize } = parseContextOverflowMessage(err instanceof Error ? err.message : '');
249
- throw new ContextOverflowError(promptTokens, ctxSize, request.modelId, err);
248
+ throw new ContextOverflowError(parseContextOverflowMessage(err instanceof Error ? err.message : ''), request.modelId, err);
250
249
  }
251
250
  // Once the registry accepts cancellation, the request signal owns the
252
251
  // terminal outcome. The addon may reject with different shapes
@@ -404,8 +403,7 @@ export const llmPlugin = definePlugin({
404
403
  // signal, so a real overflow racing a cancel surfaces as a typed
405
404
  // ContextOverflowError.
406
405
  if (isAddonContextOverflowError(err)) {
407
- const { promptTokens, ctxSize } = parseContextOverflowMessage(err instanceof Error ? err.message : '');
408
- throw new ContextOverflowError(promptTokens, ctxSize, request.modelId, err);
406
+ throw new ContextOverflowError(parseContextOverflowMessage(err instanceof Error ? err.message : ''), request.modelId, err);
409
407
  }
410
408
  // Context overflow is classified above. For every other error after
411
409
  // accepted cancellation, the request signal owns the terminal outcome
@@ -483,8 +481,7 @@ export const llmPlugin = definePlugin({
483
481
  // Same addon, same overflow path as `completionStream`. Wrap so
484
482
  // translate consumers can `instanceof ContextOverflowError` too.
485
483
  if (isAddonContextOverflowError(err)) {
486
- const { promptTokens, ctxSize } = parseContextOverflowMessage(err instanceof Error ? err.message : '');
487
- throw new ContextOverflowError(promptTokens, ctxSize, request.modelId, err);
484
+ throw new ContextOverflowError(parseContextOverflowMessage(err instanceof Error ? err.message : ''), request.modelId, err);
488
485
  }
489
486
  throw err;
490
487
  }
@@ -1,3 +1,4 @@
1
+ import type { TurboVecIndexProvider } from '@qvac/rag';
1
2
  import { type CreateModelParams, type PluginModelResult } from '../../../schemas/index.js';
2
3
  export declare const embeddingsPlugin: {
3
4
  modelType: "llamacpp-embedding";
@@ -69,6 +70,9 @@ export declare const embeddingsPlugin: {
69
70
  error: import("zod").ZodOptional<import("zod").ZodString>;
70
71
  }, import("zod/v4/core").$strip>>;
71
72
  };
73
+ capabilities: {
74
+ turbovecIndexProvider: TurboVecIndexProvider;
75
+ };
72
76
  logging: {
73
77
  module: import("@qvac/embed-llamacpp/addonLogging").AddonLogging;
74
78
  namespace: "llamacpp-embedding";
@@ -1,12 +1,20 @@
1
- import EmbedLlamacpp from '@qvac/embed-llamacpp';
1
+ import EmbedLlamacpp, { IdMapIndex } from '@qvac/embed-llamacpp';
2
2
  import embedAddonLogging from '@qvac/embed-llamacpp/addonLogging';
3
3
  import { definePlugin, defineHandler, embedRequestSchema, embedResponseSchema, ModelType, embedConfigBaseSchema, ADDON_EMBEDDING } from '../../../schemas/index.js';
4
4
  import { createStreamLogger, registerAddonLogger, getEngineLogger } from '../../../logging/index.js';
5
5
  import { getFirstShardPath } from '../../../utils/index.js';
6
- import { embed } from '../../../plugins/ops/embed.js';
6
+ import { embed } from '../../ops/embed.js';
7
7
  import { forwardModelExecution } from '../../../profiling/model-execution.js';
8
8
  import { isMobile } from '../../../runtime/state.js';
9
9
  import { stripMultiGpuKeys } from '../../../utils/multi-gpu-mobile.js';
10
+ const turbovecIndexProvider = {
11
+ create(options) {
12
+ return new IdMapIndex(options);
13
+ },
14
+ load(snapshotPath) {
15
+ return IdMapIndex.load(snapshotPath);
16
+ }
17
+ };
10
18
  function transformEmbedConfig(embedConfig) {
11
19
  const config = {
12
20
  device: embedConfig.device,
@@ -93,6 +101,9 @@ export const embeddingsPlugin = definePlugin({
93
101
  }
94
102
  })
95
103
  },
104
+ capabilities: {
105
+ turbovecIndexProvider
106
+ },
96
107
  logging: {
97
108
  module: embedAddonLogging,
98
109
  namespace: ModelType.llamacppEmbedding
@@ -3,9 +3,9 @@ import TranslationNmtcpp from '@qvac/translation-nmtcpp';
3
3
  import { definePlugin, defineHandler, translateRequestSchema, translateResponseSchema, ModelType, nmtConfigBaseSchema, ADDON_NMT, BERGAMOT_CJK_LANG_PAIRS } from '../../../schemas/index.js';
4
4
  import { createStreamLogger, registerAddonLogger } from '../../../logging/index.js';
5
5
  import path from 'bare-path';
6
- import { translate } from '../../../plugins/ops/translate.js';
6
+ import { translate } from '../../ops/translate.js';
7
7
  import { attachModelExecutionMs } from '../../../profiling/model-execution.js';
8
- import { resolveBergamotVocab } from '../../../plugins/builtin/nmtcpp-translation/resolve-vocab.js';
8
+ import { resolveBergamotVocab } from './resolve-vocab.js';
9
9
  /**
10
10
  * Derive absolute vocab paths from a resolved Bergamot model path.
11
11
  * Works for both companion-set layout (colocated files) and any layout where
@@ -59,7 +59,7 @@ export declare const parakeetPlugin: {
59
59
  silenceDurationMs: import("zod").ZodNumber;
60
60
  }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
61
61
  source: import("zod").ZodLiteral<"parakeet">;
62
- }, import("zod/v4/core").$strip>], "source">>>;
62
+ }, import("zod/v4/core").$strip>], "source">, unknown>>;
63
63
  type: import("zod").ZodLiteral<"transcribe">;
64
64
  }, import("zod/v4/core").$strip>>;
65
65
  transcribeStream: import("../../../schemas/index.js").PluginHandlerDefinition<import("zod").ZodObject<{
@@ -122,7 +122,7 @@ export declare const parakeetPlugin: {
122
122
  silenceDurationMs: import("zod").ZodNumber;
123
123
  }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
124
124
  source: import("zod").ZodLiteral<"parakeet">;
125
- }, import("zod/v4/core").$strip>], "source">>>;
125
+ }, import("zod/v4/core").$strip>], "source">, unknown>>;
126
126
  type: import("zod").ZodLiteral<"transcribeStream">;
127
127
  }, import("zod/v4/core").$strip>>;
128
128
  };
@@ -2,10 +2,10 @@ import asrAddonLogging from '@qvac/asr-ggml/addonLogging';
2
2
  import ASRGgml from '@qvac/asr-ggml';
3
3
  import { definePlugin, defineHandler, defineDuplexHandler, transcribeRequestSchema, transcribeResponseSchema, transcribeStreamRequestSchema, transcribeStreamResponseSchema, ModelType, parakeetLoadConfigSchema, LEGACY_PARAKEET_ONNX_MODEL_CONFIG_FIELDS, ADDON_ASR } from '../../../schemas/index.js';
4
4
  import { ModelLoadFailedError, TranscriptionFailedError, LegacyParakeetModelDeprecatedError } from '../../../errors/index.js';
5
- import { transcribe, transcribeStream } from '../../../plugins/ops/transcribe.js';
5
+ import { transcribe, transcribeStream } from '../../ops/transcribe.js';
6
6
  import { attachModelExecutionMs } from '../../../profiling/model-execution.js';
7
- import { buildParakeetEngineConfig } from '../../../plugins/builtin/asr-ggml/config.js';
8
- import { createAsrModelLogger } from '../../../plugins/builtin/asr-ggml/logging.js';
7
+ import { buildParakeetEngineConfig } from '../asr-ggml/config.js';
8
+ import { createAsrModelLogger } from '../asr-ggml/logging.js';
9
9
  function resolveParakeetConfig(cfg) {
10
10
  const cfgRecord = cfg;
11
11
  const legacyFields = LEGACY_PARAKEET_ONNX_MODEL_CONFIG_FIELDS.filter((name) => cfgRecord[name] !== undefined);
@@ -12,7 +12,7 @@ function asUpscalerModel(model, modelId) {
12
12
  return model;
13
13
  }
14
14
  const entry = getModelEntry(modelId);
15
- const modelType = entry && !entry.isDelegated ? entry.local.modelType : ModelType.sdcppGeneration;
15
+ const modelType = entry ? entry.local.modelType : ModelType.sdcppGeneration;
16
16
  throw new ModelOperationNotSupportedError(modelId, modelType, 'upscale', ['diffusion'], []);
17
17
  }
18
18
  export async function* upscale(request) {
@@ -52,6 +52,7 @@ var __disposeResources = (this && this.__disposeResources) || (function (Suppres
52
52
  });
53
53
  import { VideoStableDiffusion } from '@qvac/diffusion-cpp';
54
54
  import Buffer from 'bare-buffer';
55
+ import path from 'bare-path';
55
56
  import { getEngineLogger } from '../../../../logging/index.js';
56
57
  import { getModel, getModelEntry } from '../../../../runtime/model-registry.js';
57
58
  import { getRequestRegistry, withRequestContext } from '../../../../runtime/index.js';
@@ -59,7 +60,7 @@ import { generateRandomRequestId } from '../../../../runtime/request-id.js';
59
60
  import { ModelOperationNotSupportedError, PluginRequestValidationFailedError } from '../../../../errors/index.js';
60
61
  import { formatZodError } from '../../../../utils/zod-error.js';
61
62
  import { ModelType } from '../../../../schemas/index.js';
62
- import { ltxVideoRequestSchema, singleExpertVideoRequestSchema } from '../../../../schemas/sdcpp-config.js';
63
+ import { ltxVideoRequestSchema, nonLtxVideoRequestSchema, sdcppConfigSchema, singleExpertVideoRequestSchema } from '../../../../schemas/sdcpp-config.js';
63
64
  const ltxVideoModels = new WeakSet();
64
65
  const moeCapableVideoModels = new WeakSet();
65
66
  export function markLtxVideoModel(model) {
@@ -74,6 +75,11 @@ function parseVideoRequest(schema, request) {
74
75
  throw new PluginRequestValidationFailedError('videoStream', formatZodError(result.error));
75
76
  }
76
77
  }
78
+ function validateProviderPaths(request) {
79
+ if (request.lora !== undefined && !path.isAbsolute(request.lora)) {
80
+ throw new PluginRequestValidationFailedError('videoStream', 'lora must be an absolute path on the inference provider');
81
+ }
82
+ }
77
83
  // The addon reports `hasAudio` as a numeric flag (1/0); it is surfaced as
78
84
  // a boolean so consumers get a readable `stats.hasAudio` instead of a magic
79
85
  // number. Everything else passes through and is validated client-side.
@@ -96,7 +102,7 @@ function asVideoModel(model, modelId) {
96
102
  return model;
97
103
  }
98
104
  const entry = getModelEntry(modelId);
99
- const modelType = entry && !entry.isDelegated ? entry.local.modelType : ModelType.sdcppGeneration;
105
+ const modelType = entry ? entry.local.modelType : ModelType.sdcppGeneration;
100
106
  throw new ModelOperationNotSupportedError(modelId, modelType, 'video', ['diffusion'], []);
101
107
  }
102
108
  export async function* video(request) {
@@ -111,8 +117,17 @@ export async function* video(request) {
111
117
  const model = asVideoModel(getModel(request.modelId), request.modelId);
112
118
  if (ltxVideoModels.has(model))
113
119
  parseVideoRequest(ltxVideoRequestSchema, request);
120
+ else
121
+ parseVideoRequest(nonLtxVideoRequestSchema, request);
114
122
  if (!moeCapableVideoModels.has(model))
115
123
  parseVideoRequest(singleExpertVideoRequestSchema, request);
124
+ validateProviderPaths(request);
125
+ const modelEntry = getModelEntry(request.modelId);
126
+ const modelConfig = modelEntry ? sdcppConfigSchema.safeParse(modelEntry.local.config) : null;
127
+ const loraApplyMode = modelConfig?.success ? (modelConfig.data.lora_apply_mode ?? 'auto') : 'auto';
128
+ if (request.lora !== undefined && loraApplyMode !== 'at_runtime') {
129
+ requestLogger.warn(`[video] lora_apply_mode="${loraApplyMode}" may persist the request LoRA across later generations; use "at_runtime" for per-call application.`);
130
+ }
116
131
  const onAbort = () => {
117
132
  model.cancel().catch((err) => {
118
133
  requestLogger.warn(`[cancel] model.cancel() rejected during abort for modelId=${request.modelId}: ${err instanceof Error ? err.message : String(err)}`);
@@ -130,6 +145,12 @@ export async function* video(request) {
130
145
  ...(request.negative_prompt !== undefined && {
131
146
  negative_prompt: request.negative_prompt
132
147
  }),
148
+ ...(request.lora !== undefined && { lora: request.lora }),
149
+ ...(request.lora_strength !== undefined && {
150
+ lora_strength: request.lora_strength
151
+ }),
152
+ ...(request.stg_scale !== undefined && { stg_scale: request.stg_scale }),
153
+ ...(request.stg_block !== undefined && { stg_block: request.stg_block }),
133
154
  ...(request.width !== undefined && { width: request.width }),
134
155
  ...(request.height !== undefined && { height: request.height }),
135
156
  ...(request.video_frames !== undefined && {
@@ -174,6 +195,15 @@ export async function* video(request) {
174
195
  ...(request.control_frames !== undefined && {
175
196
  control_frames: request.control_frames.map((b64) => Buffer.from(b64, 'base64'))
176
197
  }),
198
+ ...(request.reference_images !== undefined && {
199
+ reference_images: request.reference_images.map((b64) => Buffer.from(b64, 'base64'))
200
+ }),
201
+ ...(request.reference_attention_strength !== undefined && {
202
+ reference_attention_strength: request.reference_attention_strength
203
+ }),
204
+ ...(request.reference_downscale_factor !== undefined && {
205
+ reference_downscale_factor: request.reference_downscale_factor
206
+ }),
177
207
  ...(request.vae_tiling !== undefined && { vae_tiling: request.vae_tiling }),
178
208
  ...(request.vae_tile_size !== undefined && {
179
209
  vae_tile_size: request.vae_tile_size
@@ -0,0 +1,126 @@
1
+ import WorldStableDiffusion from '@qvac/diffusion-cpp/world';
2
+ import type { WorldConfig } from '@qvac/diffusion-cpp/world';
3
+ import type QvacLogger from '@qvac/logging';
4
+ import type { WorldSceneRequest, WorldSceneStreamResponse, WorldStepRequest, WorldStepStreamResponse } from '../../../../schemas/sdcpp-config.js';
5
+ interface WorldSessionArgs {
6
+ modelId: string;
7
+ files: {
8
+ model: string;
9
+ taehv: string;
10
+ scene: string;
11
+ };
12
+ config: WorldConfig;
13
+ /** umT5-XXL and Wan2.2 VAE, resolved at load; scene creation needs both. */
14
+ encoders: {
15
+ t5?: string | undefined;
16
+ vae?: string | undefined;
17
+ };
18
+ /** Resolved `modelConfig.sceneSrc`, copied over the managed pack at load. */
19
+ seedScenePath?: string | undefined;
20
+ logger: QvacLogger;
21
+ /**
22
+ * The native session to drive. Constructed here when omitted, which is what
23
+ * every caller does; injecting one is how the teardown and cancellation paths
24
+ * are exercised, since the addon calls the engine C API directly and offers
25
+ * no substitution point of its own.
26
+ */
27
+ world?: NativeWorldSession;
28
+ /**
29
+ * Ceiling for a generated pack, defaulting to `MAX_SCENE_PACK_BYTES`.
30
+ * Overridable for the same reason as `world` above: the real limit is far
31
+ * larger than anything a test should write to disk.
32
+ */
33
+ maxScenePackBytes?: number;
34
+ }
35
+ /** The part of `WorldStableDiffusion` this module actually uses. */
36
+ export type NativeWorldSession = Pick<WorldStableDiffusion, 'load' | 'unload' | 'step' | 'createScene' | 'cancel'>;
37
+ /**
38
+ * All `run()` needs of a job handle is "tell me when it is over". Kept
39
+ * structural rather than importing `QvacResponse`: the addon can resolve a
40
+ * different copy of `@qvac/infer-base` than the SDK does, and a nominal type
41
+ * would make this file fail to compile on the dependency layout rather than on
42
+ * anything real.
43
+ */
44
+ interface SettleableResponse {
45
+ await(): Promise<unknown>;
46
+ }
47
+ export interface WorldSession {
48
+ load(force?: boolean): Promise<void>;
49
+ unload(): Promise<void>;
50
+ readonly scenePath: string;
51
+ /** Where a replacement world is generated before it is allowed to take over. */
52
+ readonly stagingScenePath: string;
53
+ readonly encoders: {
54
+ t5?: string | undefined;
55
+ vae?: string | undefined;
56
+ };
57
+ /**
58
+ * `world.numFramePerBlock` as configured, or undefined for the engine default.
59
+ * Exposed because the block's memory cost is count x resolution, and only the
60
+ * scene op knows the resolution.
61
+ */
62
+ readonly numFramePerBlock: number | undefined;
63
+ ensureActivated(): Promise<void>;
64
+ deactivate(): Promise<void>;
65
+ /**
66
+ * Promote a freshly generated pack, returning its bytes only when asked. The
67
+ * previous world is replaced only here, and the read is part of the same
68
+ * locked step so a concurrent unload cannot delete the pack between the two.
69
+ */
70
+ promoteStagedScene(readBytes: boolean): Promise<Buffer | undefined>;
71
+ /** Drop a failed generation, leaving the previous world usable. */
72
+ discardStagedScene(): Promise<void>;
73
+ /** Wait for native work to finish. See the note on `settleInFlight`. */
74
+ settle(): Promise<void>;
75
+ run<T extends SettleableResponse>(start: () => Promise<T>): Promise<T>;
76
+ step: WorldStableDiffusion['step'];
77
+ createScene: WorldStableDiffusion['createScene'];
78
+ cancel(): Promise<void>;
79
+ }
80
+ /**
81
+ * Server-side path for one session's scene pack. Derived from a hash of the
82
+ * caller-supplied `modelId` rather than the id itself, so the id can never
83
+ * steer the write.
84
+ *
85
+ * Deliberately unique per call, not per `modelId`. A pack keyed only on the
86
+ * model id is shared state across every process using the same cache dir: two
87
+ * workers loading the same model would write each other's world, and a pack
88
+ * orphaned by a crashed session would be adopted by the next `load()` as if the
89
+ * caller had built it — walking a world they never created. Neither is
90
+ * detectable from inside the session.
91
+ *
92
+ * Uniqueness costs nothing here because the managed pack is not a cache: it
93
+ * lives for exactly one loaded session, and callers who want to revisit a world
94
+ * pass the bytes back as `modelConfig.sceneSrc`. The one invariant that does
95
+ * matter — `createScene` writes exactly where the native session was
96
+ * constructed to read — comes from calling this ONCE per session and storing
97
+ * the result in `files.scene`, not from the path being reproducible.
98
+ *
99
+ * No garbage collection, deliberately. `unload()` removes the pack, and so does
100
+ * worker shutdown, so only a crash or SIGKILL leaks one — bounded at roughly
101
+ * 10 MB per lost session, and never adopted by a later run because the name is
102
+ * unique. The obvious mtime-based sweep is NOT safe here: a pack is written once
103
+ * at promotion and never touched again, so a session walking for hours looks
104
+ * exactly as old as an orphan, and ~/.qvac is shared across worker processes.
105
+ * Doing this properly needs a liveness marker like the one
106
+ * `planAutoCacheEvictions` gets from `activeCachePaths` in
107
+ * `server/bare/ops/kv-cache-retention.ts`. Tracked as a follow-up rather than
108
+ * guessed at here.
109
+ */
110
+ export declare function worldScenePath(modelId: string): string;
111
+ /**
112
+ * Wraps `WorldStableDiffusion` so it satisfies the plugin `load()` contract.
113
+ *
114
+ * Two things make the raw addon unusable as a plugin model. First, `load()`
115
+ * reads the scene pack, which does not exist yet when the caller intends to
116
+ * build a world with `worldCreateScene` — so activation is deferred until a
117
+ * scene is present. Second, the addon's `unload()` is synchronous down to a
118
+ * native thread join, so calling it while a job runs blocks the worker's event
119
+ * loop for the rest of that job (a walk block, or a whole scene encode plus its
120
+ * ~6.9 GB of encoder loads). We therefore track the in-flight job and wait for
121
+ * it before tearing down.
122
+ */
123
+ export declare function createWorldSession(args: WorldSessionArgs): WorldSession;
124
+ export declare function worldStep(request: WorldStepRequest): AsyncGenerator<WorldStepStreamResponse>;
125
+ export declare function worldCreateScene(request: WorldSceneRequest): AsyncGenerator<WorldSceneStreamResponse>;
126
+ export {};