@qvac/sdk 0.9.2 → 0.10.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 (343) hide show
  1. package/NOTICE +42 -95
  2. package/dist/client/api/cancel.d.ts +1 -1
  3. package/dist/client/api/cancel.js +1 -1
  4. package/dist/client/api/completion-stream.d.ts +51 -12
  5. package/dist/client/api/completion-stream.js +129 -56
  6. package/dist/client/api/delete-cache.d.ts +1 -0
  7. package/dist/client/api/delete-cache.js +1 -0
  8. package/dist/client/api/diffusion.d.ts +17 -2
  9. package/dist/client/api/diffusion.js +21 -4
  10. package/dist/client/api/embed.d.ts +4 -0
  11. package/dist/client/api/finetune.d.ts +21 -0
  12. package/dist/client/api/get-loaded-model-info.d.ts +25 -0
  13. package/dist/client/api/get-loaded-model-info.js +36 -0
  14. package/dist/client/api/get-model-info.d.ts +9 -1
  15. package/dist/client/api/get-model-info.js +8 -0
  16. package/dist/client/api/heartbeat.d.ts +2 -2
  17. package/dist/client/api/heartbeat.js +2 -2
  18. package/dist/client/api/index.d.ts +3 -1
  19. package/dist/client/api/index.js +3 -1
  20. package/dist/client/api/invoke-plugin.d.ts +16 -0
  21. package/dist/client/api/invoke-plugin.js +16 -0
  22. package/dist/client/api/load-model.d.ts +36 -3
  23. package/dist/client/api/load-model.js +31 -10
  24. package/dist/client/api/provide.d.ts +11 -5
  25. package/dist/client/api/provide.js +11 -6
  26. package/dist/client/api/rag.d.ts +9 -0
  27. package/dist/client/api/rag.js +9 -0
  28. package/dist/client/api/registry.d.ts +26 -0
  29. package/dist/client/api/registry.js +26 -0
  30. package/dist/client/api/resume.d.ts +20 -4
  31. package/dist/client/api/resume.js +20 -4
  32. package/dist/client/api/state.d.ts +23 -0
  33. package/dist/client/api/state.js +29 -0
  34. package/dist/client/api/stop-provider.d.ts +11 -5
  35. package/dist/client/api/stop-provider.js +11 -5
  36. package/dist/client/api/suspend.d.ts +21 -3
  37. package/dist/client/api/suspend.js +21 -3
  38. package/dist/client/api/text-to-speech.d.ts +64 -6
  39. package/dist/client/api/text-to-speech.js +423 -47
  40. package/dist/client/api/transcribe.d.ts +29 -4
  41. package/dist/client/api/transcribe.js +86 -28
  42. package/dist/client/api/translate.d.ts +1 -0
  43. package/dist/client/api/translate.js +1 -0
  44. package/dist/client/rpc/bare-client.js +22 -1
  45. package/dist/client/rpc/expo-rpc-client.d.ts +1 -1
  46. package/dist/client/rpc/expo-rpc-client.js +96 -4
  47. package/dist/client/rpc/node-rpc-client.js +36 -0
  48. package/dist/examples/audio/mic-input.d.ts +9 -0
  49. package/dist/examples/audio/mic-input.js +111 -0
  50. package/dist/examples/completion-events.d.ts +18 -0
  51. package/dist/examples/completion-events.js +79 -0
  52. package/dist/examples/delegated-inference/composite.js +12 -18
  53. package/dist/examples/delegated-inference/consumer-profiled.js +4 -11
  54. package/dist/examples/delegated-inference/consumer.js +8 -13
  55. package/dist/examples/delegated-inference/provider.js +11 -16
  56. package/dist/examples/diffusion-flux2-klein-img2img.d.ts +2 -0
  57. package/dist/examples/diffusion-flux2-klein-img2img.js +60 -0
  58. package/dist/examples/diffusion-flux2-klein.js +1 -0
  59. package/dist/examples/diffusion-img2img.d.ts +2 -0
  60. package/dist/examples/diffusion-img2img.js +49 -0
  61. package/dist/examples/diffusion-txt2img.js +2 -1
  62. package/dist/examples/kv-cache-example.js +11 -12
  63. package/dist/examples/llamacpp-cache.d.ts +2 -0
  64. package/dist/examples/llamacpp-cache.js +107 -0
  65. package/dist/examples/llamacpp-dynamic-tools.d.ts +2 -0
  66. package/dist/examples/llamacpp-dynamic-tools.js +144 -0
  67. package/dist/examples/llamacpp-structured-output.d.ts +2 -0
  68. package/dist/examples/llamacpp-structured-output.js +106 -0
  69. package/dist/examples/plugins.js +4 -4
  70. package/dist/examples/suspend-resume.js +21 -4
  71. package/dist/examples/{llamacpp-native-tools.js → tools/llamacpp-native-tools.js} +6 -55
  72. package/dist/examples/tools/llamacpp-tools-harmony-multiturn.d.ts +2 -0
  73. package/dist/examples/tools/llamacpp-tools-harmony-multiturn.js +81 -0
  74. package/dist/examples/tools/llamacpp-tools-pythonic.d.ts +2 -0
  75. package/dist/examples/tools/llamacpp-tools-pythonic.js +50 -0
  76. package/dist/examples/tools/shared.d.ts +21 -0
  77. package/dist/examples/tools/shared.js +42 -0
  78. package/dist/examples/transcription/parakeet-microphone-record.js +6 -33
  79. package/dist/examples/transcription/whispercpp-filesystem-streaming.js +7 -5
  80. package/dist/examples/transcription/whispercpp-filesystem.js +12 -3
  81. package/dist/examples/transcription/whispercpp-microphone-record.js +6 -29
  82. package/dist/examples/translation/translation-stream.js +5 -5
  83. package/dist/examples/tts/llm-to-tts-streaming.d.ts +16 -0
  84. package/dist/examples/tts/llm-to-tts-streaming.js +143 -0
  85. package/dist/examples/tts/supertonic-multilingual.js +3 -3
  86. package/dist/examples/tts/supertonic.js +3 -3
  87. package/dist/examples/tts/utils.d.ts +11 -1
  88. package/dist/examples/tts/utils.js +70 -17
  89. package/dist/examples/voice-assistant/voice-assistant.d.ts +2 -0
  90. package/dist/examples/voice-assistant/voice-assistant.js +207 -0
  91. package/dist/expo/plugins/withMobileBundle.js +1 -1
  92. package/dist/index.d.ts +2 -2
  93. package/dist/index.js +2 -2
  94. package/dist/logging/logger.d.ts +11 -0
  95. package/dist/logging/logger.js +11 -0
  96. package/dist/logging/types.d.ts +18 -0
  97. package/dist/models/registry/models.d.ts +6973 -7457
  98. package/dist/models/registry/models.js +6889 -6855
  99. package/dist/models/update-models/codegen.js +84 -23
  100. package/dist/models/update-models/companions.d.ts +18 -0
  101. package/dist/models/update-models/companions.js +175 -0
  102. package/dist/models/update-models/naming.js +0 -25
  103. package/dist/models/update-models/registry.d.ts +1 -0
  104. package/dist/models/update-models/registry.js +23 -3
  105. package/dist/models/update-models/types.d.ts +37 -9
  106. package/dist/profiling/index.d.ts +49 -0
  107. package/dist/profiling/index.js +49 -0
  108. package/dist/schemas/cancel.d.ts +6 -2
  109. package/dist/schemas/cancel.js +14 -7
  110. package/dist/schemas/common.d.ts +354 -271
  111. package/dist/schemas/common.js +26 -5
  112. package/dist/schemas/completion-event.d.ts +225 -0
  113. package/dist/schemas/completion-event.js +79 -0
  114. package/dist/schemas/completion-stream.d.ts +126 -31
  115. package/dist/schemas/completion-stream.js +138 -36
  116. package/dist/schemas/delegate.d.ts +0 -2
  117. package/dist/schemas/delegate.js +25 -6
  118. package/dist/schemas/download-asset.d.ts +5 -5
  119. package/dist/schemas/embed.js +21 -9
  120. package/dist/schemas/engine-addon-map.d.ts +11 -1
  121. package/dist/schemas/engine-addon-map.js +2 -2
  122. package/dist/schemas/get-loaded-model-info.d.ts +52 -0
  123. package/dist/schemas/get-loaded-model-info.js +44 -0
  124. package/dist/schemas/get-model-info.d.ts +2 -2
  125. package/dist/schemas/get-model-info.js +103 -32
  126. package/dist/schemas/heartbeat.d.ts +0 -1
  127. package/dist/schemas/index.d.ts +4 -1
  128. package/dist/schemas/index.js +4 -1
  129. package/dist/schemas/llamacpp-config.d.ts +14 -4
  130. package/dist/schemas/llamacpp-config.js +5 -0
  131. package/dist/schemas/load-model.d.ts +3233 -1260
  132. package/dist/schemas/load-model.js +23 -16
  133. package/dist/schemas/model-src-utils.d.ts +7 -6
  134. package/dist/schemas/model-src-utils.js +27 -1
  135. package/dist/schemas/model-types.d.ts +4 -4
  136. package/dist/schemas/ocr.d.ts +1 -1
  137. package/dist/schemas/plugin.d.ts +27 -3
  138. package/dist/schemas/plugin.js +27 -2
  139. package/dist/schemas/profiling.js +11 -3
  140. package/dist/schemas/provide.d.ts +1 -3
  141. package/dist/schemas/provide.js +0 -3
  142. package/dist/schemas/rag.d.ts +4 -4
  143. package/dist/schemas/registry.d.ts +10 -10
  144. package/dist/schemas/registry.js +36 -14
  145. package/dist/schemas/reload-config.d.ts +73 -7
  146. package/dist/schemas/sdcpp-config.d.ts +16 -8
  147. package/dist/schemas/sdcpp-config.js +118 -25
  148. package/dist/schemas/sdk-config.d.ts +116 -90
  149. package/dist/schemas/sdk-config.js +16 -0
  150. package/dist/schemas/sdk-errors-client.d.ts +3 -0
  151. package/dist/schemas/sdk-errors-client.js +16 -1
  152. package/dist/schemas/sdk-errors-server.d.ts +3 -0
  153. package/dist/schemas/sdk-errors-server.js +23 -0
  154. package/dist/schemas/state.d.ts +23 -0
  155. package/dist/schemas/state.js +14 -0
  156. package/dist/schemas/stop-provide.d.ts +0 -5
  157. package/dist/schemas/stop-provide.js +2 -6
  158. package/dist/schemas/text-to-speech.d.ts +93 -27
  159. package/dist/schemas/text-to-speech.js +27 -0
  160. package/dist/schemas/tools.d.ts +16 -0
  161. package/dist/schemas/tools.js +15 -0
  162. package/dist/schemas/transcription-config.d.ts +8 -8
  163. package/dist/schemas/transcription.d.ts +33 -0
  164. package/dist/schemas/transcription.js +9 -0
  165. package/dist/schemas/translate.js +59 -19
  166. package/dist/schemas/translation-config.d.ts +157 -133
  167. package/dist/schemas/translation-config.js +34 -11
  168. package/dist/server/bare/delegate-rpc-client.d.ts +1 -1
  169. package/dist/server/bare/delegate-rpc-client.js +131 -122
  170. package/dist/server/bare/hyperswarm.d.ts +2 -2
  171. package/dist/server/bare/hyperswarm.js +12 -7
  172. package/dist/server/bare/ops/cancel.js +7 -0
  173. package/dist/server/bare/ops/kv-cache-utils.d.ts +7 -10
  174. package/dist/server/bare/ops/kv-cache-utils.js +31 -40
  175. package/dist/server/bare/ops/load-model.js +0 -1
  176. package/dist/server/bare/ops/transcribe.d.ts +11 -4
  177. package/dist/server/bare/ops/transcribe.js +25 -4
  178. package/dist/server/bare/ops/translate.js +42 -4
  179. package/dist/server/bare/ops/unload-model.js +21 -19
  180. package/dist/server/bare/plugins/llamacpp-completion/ops/cache-logger.js +1 -2
  181. package/dist/server/bare/plugins/llamacpp-completion/ops/completion-stream.d.ts +13 -8
  182. package/dist/server/bare/plugins/llamacpp-completion/ops/completion-stream.js +257 -85
  183. package/dist/server/bare/plugins/llamacpp-completion/ops/kv-cache-state.d.ts +101 -0
  184. package/dist/server/bare/plugins/llamacpp-completion/ops/kv-cache-state.js +135 -0
  185. package/dist/server/bare/plugins/llamacpp-completion/plugin.d.ts +80 -22
  186. package/dist/server/bare/plugins/llamacpp-completion/plugin.js +57 -32
  187. package/dist/server/bare/plugins/llamacpp-embedding/plugin.js +10 -16
  188. package/dist/server/bare/plugins/nmtcpp-translation/plugin.d.ts +69 -44
  189. package/dist/server/bare/plugins/nmtcpp-translation/plugin.js +54 -116
  190. package/dist/server/bare/plugins/nmtcpp-translation/resolve-vocab.d.ts +32 -0
  191. package/dist/server/bare/plugins/nmtcpp-translation/resolve-vocab.js +117 -0
  192. package/dist/server/bare/plugins/onnx-ocr/plugin.d.ts +1 -1
  193. package/dist/server/bare/plugins/onnx-ocr/plugin.js +1 -2
  194. package/dist/server/bare/plugins/onnx-tts/ops/text-to-speech-stream.d.ts +7 -0
  195. package/dist/server/bare/plugins/onnx-tts/ops/text-to-speech-stream.js +116 -0
  196. package/dist/server/bare/plugins/onnx-tts/ops/text-to-speech.d.ts +2 -3
  197. package/dist/server/bare/plugins/onnx-tts/ops/text-to-speech.js +71 -9
  198. package/dist/server/bare/plugins/onnx-tts/plugin.d.ts +41 -13
  199. package/dist/server/bare/plugins/onnx-tts/plugin.js +48 -3
  200. package/dist/server/bare/plugins/parakeet-transcription/plugin.d.ts +15 -7
  201. package/dist/server/bare/plugins/parakeet-transcription/plugin.js +5 -6
  202. package/dist/server/bare/plugins/sdcpp-generation/ops/diffusion.js +6 -0
  203. package/dist/server/bare/plugins/sdcpp-generation/plugin.d.ts +8 -5
  204. package/dist/server/bare/plugins/sdcpp-generation/plugin.js +13 -13
  205. package/dist/server/bare/plugins/whispercpp-transcription/plugin.d.ts +17 -1
  206. package/dist/server/bare/plugins/whispercpp-transcription/plugin.js +40 -17
  207. package/dist/server/bare/registry/config-registry.js +14 -3
  208. package/dist/server/bare/registry/model-registry.d.ts +8 -10
  209. package/dist/server/bare/registry/model-registry.js +17 -12
  210. package/dist/server/bare/registry/registry-client.js +79 -19
  211. package/dist/server/bare/runtime-lifecycle.d.ts +2 -1
  212. package/dist/server/bare/runtime-lifecycle.js +13 -2
  213. package/dist/server/bare/types/addon-responses.d.ts +8 -3
  214. package/dist/server/bare/utils/transcribe-metadata.d.ts +21 -0
  215. package/dist/server/bare/utils/transcribe-metadata.js +28 -0
  216. package/dist/server/bare/utils/tts-stats.d.ts +22 -0
  217. package/dist/server/bare/utils/tts-stats.js +10 -0
  218. package/dist/server/rpc/create-server.d.ts +4 -1
  219. package/dist/server/rpc/create-server.js +5 -1
  220. package/dist/server/rpc/delegate-transport.js +36 -29
  221. package/dist/server/rpc/handle-request.js +28 -3
  222. package/dist/server/rpc/handler-registry.js +7 -1
  223. package/dist/server/rpc/handler-utils.d.ts +5 -0
  224. package/dist/server/rpc/handler-utils.js +22 -0
  225. package/dist/server/rpc/handlers/cancel-delegated.js +3 -5
  226. package/dist/server/rpc/handlers/cancelHandler.js +4 -5
  227. package/dist/server/rpc/handlers/completion-stream-delegated.js +14 -5
  228. package/dist/server/rpc/handlers/delete-cache.js +8 -3
  229. package/dist/server/rpc/handlers/download-asset.js +3 -24
  230. package/dist/server/rpc/handlers/get-loaded-model-info.d.ts +3 -0
  231. package/dist/server/rpc/handlers/get-loaded-model-info.js +39 -0
  232. package/dist/server/rpc/handlers/get-model-info.js +93 -84
  233. package/dist/server/rpc/handlers/heartbeat-delegated.js +2 -2
  234. package/dist/server/rpc/handlers/index.d.ts +6 -0
  235. package/dist/server/rpc/handlers/index.js +6 -0
  236. package/dist/server/rpc/handlers/load-model/download-manager.d.ts +35 -9
  237. package/dist/server/rpc/handlers/load-model/download-manager.js +142 -38
  238. package/dist/server/rpc/handlers/load-model/download-stats.d.ts +5 -4
  239. package/dist/server/rpc/handlers/load-model/download-stats.js +49 -8
  240. package/dist/server/rpc/handlers/load-model/handler.js +31 -50
  241. package/dist/server/rpc/handlers/load-model/http.d.ts +2 -2
  242. package/dist/server/rpc/handlers/load-model/http.js +97 -142
  243. package/dist/server/rpc/handlers/load-model/hyperdrive.d.ts +2 -2
  244. package/dist/server/rpc/handlers/load-model/hyperdrive.js +55 -74
  245. package/dist/server/rpc/handlers/load-model/index.d.ts +0 -1
  246. package/dist/server/rpc/handlers/load-model/index.js +0 -1
  247. package/dist/server/rpc/handlers/load-model/registry-client-options.d.ts +27 -0
  248. package/dist/server/rpc/handlers/load-model/registry-client-options.js +19 -0
  249. package/dist/server/rpc/handlers/load-model/registry-companion-set.d.ts +22 -0
  250. package/dist/server/rpc/handlers/load-model/registry-companion-set.js +208 -0
  251. package/dist/server/rpc/handlers/load-model/registry-download-utils.d.ts +24 -0
  252. package/dist/server/rpc/handlers/load-model/registry-download-utils.js +114 -0
  253. package/dist/server/rpc/handlers/load-model/registry.d.ts +2 -20
  254. package/dist/server/rpc/handlers/load-model/registry.js +109 -381
  255. package/dist/server/rpc/handlers/load-model/resolve-session.d.ts +15 -0
  256. package/dist/server/rpc/handlers/load-model/resolve-session.js +61 -0
  257. package/dist/server/rpc/handlers/load-model/resolve.d.ts +3 -3
  258. package/dist/server/rpc/handlers/load-model/resolve.js +14 -23
  259. package/dist/server/rpc/handlers/load-model/types.d.ts +11 -4
  260. package/dist/server/rpc/handlers/load-model/types.js +28 -1
  261. package/dist/server/rpc/handlers/load-model-delegated.js +2 -4
  262. package/dist/server/rpc/handlers/plugin-dispatch.js +9 -5
  263. package/dist/server/rpc/handlers/plugin-invoke.js +1 -1
  264. package/dist/server/rpc/handlers/provideHandler/connection.js +13 -2
  265. package/dist/server/rpc/handlers/provideHandler/handler.js +42 -29
  266. package/dist/server/rpc/handlers/state.d.ts +3 -0
  267. package/dist/server/rpc/handlers/state.js +7 -0
  268. package/dist/server/rpc/handlers/stopProvideHandler.d.ts +2 -2
  269. package/dist/server/rpc/handlers/stopProvideHandler.js +12 -7
  270. package/dist/server/rpc/handlers/text-to-speech-stream.d.ts +3 -0
  271. package/dist/server/rpc/handlers/text-to-speech-stream.js +4 -0
  272. package/dist/server/rpc/handlers/unload-model-delegated.js +3 -3
  273. package/dist/server/rpc/profiling/operation-metrics.js +20 -0
  274. package/dist/server/rpc/rpc-utils.js +1 -1
  275. package/dist/server/rpc/transport-selector.d.ts +3 -0
  276. package/dist/server/rpc/transport-selector.js +18 -0
  277. package/dist/server/utils/cache/auto-history.d.ts +4 -0
  278. package/dist/server/utils/cache/auto-history.js +22 -0
  279. package/dist/server/utils/{cache.d.ts → cache/paths.d.ts} +22 -5
  280. package/dist/server/utils/{cache.js → cache/paths.js} +36 -20
  281. package/dist/server/utils/cache/types.d.ts +8 -0
  282. package/dist/server/utils/cache/types.js +1 -0
  283. package/dist/server/utils/checksum.d.ts +2 -2
  284. package/dist/server/utils/checksum.js +1 -1
  285. package/dist/server/utils/clear-storage.d.ts +5 -0
  286. package/dist/server/utils/clear-storage.js +17 -0
  287. package/dist/server/utils/completion-normalizer.d.ts +17 -0
  288. package/dist/server/utils/completion-normalizer.js +413 -0
  289. package/dist/server/utils/expand-gguf-shards.d.ts +3 -0
  290. package/dist/server/utils/expand-gguf-shards.js +22 -0
  291. package/dist/server/utils/formatting.js +1 -1
  292. package/dist/server/utils/index.d.ts +4 -2
  293. package/dist/server/utils/index.js +4 -2
  294. package/dist/server/utils/qvac-paths.d.ts +2 -0
  295. package/dist/server/utils/qvac-paths.js +5 -0
  296. package/dist/server/utils/response-format.d.ts +3 -0
  297. package/dist/server/utils/response-format.js +20 -0
  298. package/dist/server/utils/tool-integration.d.ts +15 -4
  299. package/dist/server/utils/tool-integration.js +21 -41
  300. package/dist/server/utils/tools/dialect.d.ts +8 -0
  301. package/dist/server/utils/tools/dialect.js +14 -0
  302. package/dist/server/utils/tools/index.d.ts +3 -0
  303. package/dist/server/utils/tools/index.js +2 -0
  304. package/dist/server/utils/tools/parser.d.ts +6 -0
  305. package/dist/server/utils/tools/parser.js +46 -0
  306. package/dist/server/utils/tools/parsers/harmony.d.ts +4 -0
  307. package/dist/server/utils/tools/parsers/harmony.js +59 -0
  308. package/dist/server/utils/tools/parsers/hermes.d.ts +4 -0
  309. package/dist/server/utils/tools/parsers/hermes.js +100 -0
  310. package/dist/server/utils/tools/parsers/json.d.ts +6 -0
  311. package/dist/server/utils/tools/parsers/json.js +115 -0
  312. package/dist/server/utils/tools/parsers/pythonic.d.ts +4 -0
  313. package/dist/server/utils/tools/parsers/pythonic.js +267 -0
  314. package/dist/server/utils/tools/shared.d.ts +18 -0
  315. package/dist/server/utils/tools/shared.js +54 -0
  316. package/dist/server/utils/worker-lock.d.ts +3 -0
  317. package/dist/server/utils/worker-lock.js +67 -0
  318. package/dist/server/worker-core.d.ts +16 -1
  319. package/dist/server/worker-core.js +114 -14
  320. package/dist/utils/aggregate-events.d.ts +16 -0
  321. package/dist/utils/aggregate-events.js +52 -0
  322. package/dist/utils/cache-normalize.d.ts +10 -0
  323. package/dist/utils/cache-normalize.js +23 -0
  324. package/dist/utils/encoding.d.ts +8 -0
  325. package/dist/utils/encoding.js +13 -0
  326. package/dist/utils/errors-client.d.ts +12 -0
  327. package/dist/utils/errors-client.js +20 -0
  328. package/dist/utils/errors-server.d.ts +14 -0
  329. package/dist/utils/errors-server.js +31 -0
  330. package/dist/utils/load-model-validation.d.ts +7 -0
  331. package/dist/utils/load-model-validation.js +18 -0
  332. package/expo/plugins/patches/android-link.mjs +1 -1
  333. package/expo/plugins/patches/ios-link.mjs +1 -1
  334. package/package.json +14 -18
  335. package/dist/examples/translation/translation-opus.d.ts +0 -2
  336. package/dist/examples/translation/translation-opus.js +0 -33
  337. package/dist/server/bare/utils/loader-adapter.d.ts +0 -7
  338. package/dist/server/bare/utils/loader-adapter.js +0 -9
  339. package/dist/server/utils/model-path.d.ts +0 -5
  340. package/dist/server/utils/model-path.js +0 -7
  341. package/dist/server/utils/tool-parser.d.ts +0 -7
  342. package/dist/server/utils/tool-parser.js +0 -248
  343. /package/dist/examples/{llamacpp-native-tools.d.ts → tools/llamacpp-native-tools.d.ts} +0 -0
@@ -6,10 +6,26 @@ export interface InvokePluginOptions<TParams = unknown> {
6
6
  }
7
7
  /**
8
8
  * Invoke a non-streaming plugin handler.
9
+ *
10
+ * @param options - Invocation payload.
11
+ * @param options.modelId - The identifier of the model instance that owns the plugin.
12
+ * @param options.handler - Name of the plugin handler to invoke.
13
+ * @param options.params - Handler-specific parameters, passed through to the plugin.
14
+ * @param rpcOptions - Optional RPC options (timeout, profiling, force new connection, etc.).
15
+ * @returns A promise resolving to the handler's result payload (typed via the `TResponse` generic).
16
+ * @throws {QvacErrorBase} When the response type is invalid (`InvalidResponseError`) or the RPC layer fails.
9
17
  */
10
18
  export declare function invokePlugin<TResponse = unknown, TParams = unknown>(options: InvokePluginOptions<TParams>, rpcOptions?: RPCOptions): Promise<TResponse>;
11
19
  /**
12
20
  * Invoke a streaming plugin handler.
21
+ *
22
+ * @param options - Invocation payload.
23
+ * @param options.modelId - The identifier of the model instance that owns the plugin.
24
+ * @param options.handler - Name of the plugin stream handler to invoke.
25
+ * @param options.params - Handler-specific parameters, passed through to the plugin.
26
+ * @param rpcOptions - Optional RPC options (timeout, profiling, force new connection, etc.).
27
+ * @returns An async generator yielding chunk payloads (typed via the `TResponse` generic) until the stream completes.
28
+ * @throws {QvacErrorBase} When an intermediate response has the wrong type (`InvalidResponseError`) or the RPC layer fails.
13
29
  */
14
30
  export declare function invokePluginStream<TResponse = unknown, TParams = unknown>(options: InvokePluginOptions<TParams>, rpcOptions?: RPCOptions): AsyncGenerator<TResponse>;
15
31
  //# sourceMappingURL=invoke-plugin.d.ts.map
@@ -2,6 +2,14 @@ import { send, stream } from "../rpc/rpc-client.js";
2
2
  import { InvalidResponseError } from "../../utils/errors-client.js";
3
3
  /**
4
4
  * Invoke a non-streaming plugin handler.
5
+ *
6
+ * @param options - Invocation payload.
7
+ * @param options.modelId - The identifier of the model instance that owns the plugin.
8
+ * @param options.handler - Name of the plugin handler to invoke.
9
+ * @param options.params - Handler-specific parameters, passed through to the plugin.
10
+ * @param rpcOptions - Optional RPC options (timeout, profiling, force new connection, etc.).
11
+ * @returns A promise resolving to the handler's result payload (typed via the `TResponse` generic).
12
+ * @throws {QvacErrorBase} When the response type is invalid (`InvalidResponseError`) or the RPC layer fails.
5
13
  */
6
14
  export async function invokePlugin(options, rpcOptions) {
7
15
  const request = {
@@ -18,6 +26,14 @@ export async function invokePlugin(options, rpcOptions) {
18
26
  }
19
27
  /**
20
28
  * Invoke a streaming plugin handler.
29
+ *
30
+ * @param options - Invocation payload.
31
+ * @param options.modelId - The identifier of the model instance that owns the plugin.
32
+ * @param options.handler - Name of the plugin stream handler to invoke.
33
+ * @param options.params - Handler-specific parameters, passed through to the plugin.
34
+ * @param rpcOptions - Optional RPC options (timeout, profiling, force new connection, etc.).
35
+ * @returns An async generator yielding chunk payloads (typed via the `TResponse` generic) until the stream completes.
36
+ * @throws {QvacErrorBase} When an intermediate response has the wrong type (`InvalidResponseError`) or the RPC layer fails.
21
37
  */
22
38
  export async function* invokePluginStream(options, rpcOptions) {
23
39
  const request = {
@@ -1,4 +1,23 @@
1
- import { type LoadModelOptions, type ReloadConfigOptions, type RPCOptions } from "../../schemas/index";
1
+ import { type LoadModelOptions, type LoadCustomPluginModelOptions, type LoadModelDescriptorParam, type ReloadConfigOptions, type RPCOptions, type ModelDescriptor } from "../../schemas/index";
2
+ /**
3
+ * Loads a model from a descriptor; `modelType` is inferred from `modelSrc`.
4
+ * `modelConfig` narrows per-engine when `modelSrc.engine` is a literal,
5
+ * otherwise falls back to a permissive shape.
6
+ *
7
+ * @overloadLabel "From descriptor"
8
+ * @param options - Descriptor-based load options. `modelSrc` is a
9
+ * `ModelDescriptor` (e.g. one of the `LLAMA_3_2_1B_INST_Q4_0`-style
10
+ * constants); `modelType` is inferred from it.
11
+ * @param rpcOptions - Optional RPC options including per-call profiling.
12
+ * @returns Promise that resolves to the loaded model ID.
13
+ * @throws {ModelTypeRequiredError} When `modelType` cannot be inferred from `modelSrc` at runtime.
14
+ * @example
15
+ * ```typescript
16
+ * await loadModel({ modelSrc: LLAMA_3_2_1B_INST_Q4_0, modelConfig: { ctx_size: 2048 } });
17
+ * await loadModel({ modelSrc: WHISPER_TINY });
18
+ * ```
19
+ */
20
+ export declare function loadModel<S extends ModelDescriptor>(options: LoadModelDescriptorParam<S>, rpcOptions?: RPCOptions): Promise<string>;
2
21
  /**
3
22
  * Loads a machine learning model from a local path, remote URL, or Hyperdrive key.
4
23
  *
@@ -8,6 +27,7 @@ import { type LoadModelOptions, type ReloadConfigOptions, type RPCOptions } from
8
27
  * When `onProgress` is provided, the function uses streaming to provide real-time download progress.
9
28
  * Otherwise, it uses a simple request-response pattern for faster execution.
10
29
  *
30
+ * @overloadLabel "Load new model"
11
31
  * @param options - An object that defines all configuration parameters required for loading the model, including:
12
32
  * - modelSrc: The location from which the model weights are fetched (local path, remote URL, or Hyperdrive URL)
13
33
  * - modelType: The type of model ("llm", "whisper", "embeddings", "nmt", or "tts")
@@ -28,7 +48,7 @@ import { type LoadModelOptions, type ReloadConfigOptions, type RPCOptions } from
28
48
  * const localModelId = await loadModel({
29
49
  * modelSrc: "/home/user/models/llama-7b.gguf",
30
50
  * modelType: "llm",
31
- * modelConfig: { contextSize: 2048 }
51
+ * modelConfig: { ctx_size: 2048 }
32
52
  * });
33
53
  *
34
54
  * // Local file path - relative path
@@ -41,7 +61,7 @@ import { type LoadModelOptions, type ReloadConfigOptions, type RPCOptions } from
41
61
  * const hyperdriveId = await loadModel({
42
62
  * modelSrc: "pear://<hyperdrive-key>/llama-7b.gguf",
43
63
  * modelType: "llm",
44
- * modelConfig: { contextSize: 2048 }
64
+ * modelConfig: { ctx_size: 2048 }
45
65
  * });
46
66
  *
47
67
  * // Remote HTTP/HTTPS URL with progress tracking
@@ -91,9 +111,22 @@ import { type LoadModelOptions, type ReloadConfigOptions, type RPCOptions } from
91
111
  * ```
92
112
  */
93
113
  export declare function loadModel(options: LoadModelOptions, rpcOptions?: RPCOptions): Promise<string>;
114
+ /**
115
+ * Loads a custom plugin model (any non-built-in `modelType` string).
116
+ * `modelConfig` is plugin-defined; the SDK does not narrow it.
117
+ *
118
+ * @overloadLabel "Custom plugin"
119
+ * @param options - Custom plugin load options. `modelType` can be any
120
+ * string registered by a plugin; `modelConfig` is forwarded to the
121
+ * plugin's `loadModel` handler unchanged.
122
+ * @param rpcOptions - Optional RPC options including per-call profiling.
123
+ * @returns Promise that resolves to the loaded model ID.
124
+ */
125
+ export declare function loadModel<T extends string>(options: LoadCustomPluginModelOptions<T>, rpcOptions?: RPCOptions): Promise<string>;
94
126
  /**
95
127
  * Hot-reloads configuration on an already loaded model.
96
128
  *
129
+ * @overloadLabel "Hot-reload config"
97
130
  * @param options - Configuration for reloading config on an existing model:
98
131
  * - modelId: The ID of an existing loaded model
99
132
  * - modelType: The type of model (must match the loaded model)
@@ -1,21 +1,42 @@
1
1
  import { send, stream } from "../rpc/rpc-client.js";
2
2
  import { startLoggingStreamForModel } from "../logging-stream-registry.js";
3
- import { loadModelOptionsToRequestSchema, reloadConfigOptionsToRequestSchema, isModelTypeAlias, normalizeModelType, } from "../../schemas/index.js";
4
- import { ModelLoadFailedError, StreamEndedError, InvalidResponseError, } from "../../utils/errors-client.js";
3
+ import { loadModelOptionsToRequestSchema, reloadConfigOptionsToRequestSchema, isModelTypeAlias, normalizeModelType, inferModelTypeFromModelSrc, } from "../../schemas/index.js";
4
+ import { ModelLoadFailedError, ModelTypeRequiredError, StreamEndedError, InvalidResponseError, } from "../../utils/errors-client.js";
5
+ import { assertModelSrcMatchesModelType } from "../../utils/load-model-validation.js";
5
6
  import { getClientLogger } from "../../logging/index.js";
6
7
  const logger = getClientLogger();
7
8
  export async function loadModel(options, rpcOptions) {
8
9
  const isReloadConfig = "modelId" in options && !("modelSrc" in options);
9
- // Warn about deprecated alias usage
10
- if (!isReloadConfig && isModelTypeAlias(options.modelType)) {
11
- const canonical = normalizeModelType(options.modelType);
12
- logger.warn(`Model type "${options.modelType}" is an alias and will be deprecated. Use "${canonical}" instead.`);
10
+ // Infer `modelType` from `modelSrc` when omitted; the schema still validates
11
+ // the resolved options below.
12
+ let resolvedOptions = options;
13
+ if (!isReloadConfig) {
14
+ let modelType = resolvedOptions["modelType"];
15
+ if (typeof modelType === "string") {
16
+ assertModelSrcMatchesModelType(resolvedOptions["modelSrc"], modelType);
17
+ }
18
+ else if (modelType === undefined) {
19
+ const inferred = inferModelTypeFromModelSrc(resolvedOptions["modelSrc"]);
20
+ if (!inferred) {
21
+ throw new ModelTypeRequiredError();
22
+ }
23
+ resolvedOptions = { ...resolvedOptions, modelType: inferred };
24
+ modelType = inferred;
25
+ }
26
+ if (typeof modelType === "string" && isModelTypeAlias(modelType)) {
27
+ const canonical = normalizeModelType(modelType);
28
+ logger.warn(`Model type "${modelType}" is an alias and will be deprecated. Use "${canonical}" instead.`);
29
+ }
13
30
  }
14
31
  const request = isReloadConfig
15
- ? reloadConfigOptionsToRequestSchema.parse(options)
16
- : loadModelOptionsToRequestSchema.parse(options);
17
- const modelLogger = isReloadConfig ? undefined : options.logger;
18
- const onProgress = isReloadConfig ? undefined : options.onProgress;
32
+ ? reloadConfigOptionsToRequestSchema.parse(resolvedOptions)
33
+ : loadModelOptionsToRequestSchema.parse(resolvedOptions);
34
+ const modelLogger = isReloadConfig
35
+ ? undefined
36
+ : resolvedOptions["logger"];
37
+ const onProgress = isReloadConfig
38
+ ? undefined
39
+ : resolvedOptions["onProgress"];
19
40
  if (onProgress) {
20
41
  // Use streaming for progress updates
21
42
  for await (const response of stream(request, rpcOptions)) {
@@ -1,15 +1,21 @@
1
1
  import { type ProvideParams } from "../../schemas/index";
2
2
  /**
3
3
  * Starts a provider service that offers QVAC capabilities to remote peers.
4
- * The provider's keypair can be controlled via the seed option or QVAC_HYPERSWARM_SEED environment variable.
5
4
  *
6
- * @param options - Options object with required topic, optional seed, and optional firewall config
7
- * @param options.topic - Topic hex string for peer discovery
8
- * @param options.firewall - Optional firewall configuration to allow/deny specific public keys
5
+ * Consumers connect directly to the provider via its public key using
6
+ * `dht.connect(publicKey)`, so no topic or discovery configuration is needed.
7
+ * The provider's keypair (and therefore its public key) can be controlled via
8
+ * the `QVAC_HYPERSWARM_SEED` environment variable.
9
+ *
10
+ * Idempotent: calling more than once while a provider is already running
11
+ * returns the same public key without re-listening on the DHT.
12
+ *
13
+ * @param params - Options object with optional firewall config
14
+ * @param params.firewall - Optional firewall configuration to allow/deny specific public keys
9
15
  * @returns A promise that resolves to the provide response containing success status and public key
10
16
  * @throws {QvacErrorBase} When the response type is not "provide" or the request fails
11
17
  */
12
- export declare function startQVACProvider(params: ProvideParams): Promise<{
18
+ export declare function startQVACProvider(params?: ProvideParams): Promise<{
13
19
  type: "provide";
14
20
  success: boolean;
15
21
  error?: string | undefined;
@@ -3,18 +3,23 @@ import { send } from "../rpc/rpc-client.js";
3
3
  import { InvalidResponseError, ProviderStartFailedError, } from "../../utils/errors-client.js";
4
4
  /**
5
5
  * Starts a provider service that offers QVAC capabilities to remote peers.
6
- * The provider's keypair can be controlled via the seed option or QVAC_HYPERSWARM_SEED environment variable.
7
6
  *
8
- * @param options - Options object with required topic, optional seed, and optional firewall config
9
- * @param options.topic - Topic hex string for peer discovery
10
- * @param options.firewall - Optional firewall configuration to allow/deny specific public keys
7
+ * Consumers connect directly to the provider via its public key using
8
+ * `dht.connect(publicKey)`, so no topic or discovery configuration is needed.
9
+ * The provider's keypair (and therefore its public key) can be controlled via
10
+ * the `QVAC_HYPERSWARM_SEED` environment variable.
11
+ *
12
+ * Idempotent: calling more than once while a provider is already running
13
+ * returns the same public key without re-listening on the DHT.
14
+ *
15
+ * @param params - Options object with optional firewall config
16
+ * @param params.firewall - Optional firewall configuration to allow/deny specific public keys
11
17
  * @returns A promise that resolves to the provide response containing success status and public key
12
18
  * @throws {QvacErrorBase} When the response type is not "provide" or the request fails
13
19
  */
14
- export async function startQVACProvider(params) {
20
+ export async function startQVACProvider(params = {}) {
15
21
  const request = {
16
22
  type: "provide",
17
- topic: params.topic,
18
23
  firewall: params.firewall,
19
24
  };
20
25
  const response = await send(request);
@@ -6,6 +6,7 @@ import type { RagChunkParams, RagDoc, RagIngestParams, RagSaveEmbeddingsParams,
6
6
  * @param params - The parameters for chunking
7
7
  * @param params.documents - Documents to chunk (string or array)
8
8
  * @param params.chunkOpts - Chunking options (chunkSize, chunkOverlap, chunkStrategy)
9
+ * @param options - Optional RPC options (timeout, profiling, force new connection, etc.).
9
10
  * @returns Array of chunk results with id and content
10
11
  * @throws {RAGChunkFailedError} When the operation fails
11
12
  *
@@ -37,6 +38,7 @@ export declare function ragChunk(params: RagChunkParams, options?: RPCOptions):
37
38
  * @param params.workspace - Workspace for isolated storage (default: "default"). Created if it doesn't exist.
38
39
  * @param params.onProgress - Progress callback (stage, current, total)
39
40
  * @param params.progressInterval - Minimum interval between progress updates in ms
41
+ * @param options - Optional RPC options (timeout, profiling, force new connection, etc.).
40
42
  * @returns Processing results and dropped indices
41
43
  * @throws {RAGSaveFailedError} When the operation fails
42
44
  * @throws {StreamEndedError} When streaming ends unexpectedly (only when using onProgress)
@@ -76,6 +78,7 @@ export declare function ragIngest(params: RagIngestParams, options?: RPCOptions)
76
78
  * @param params.workspace - Workspace for isolated storage (default: "default"). Created if it doesn't exist.
77
79
  * @param params.onProgress - Progress callback (stage, current, total)
78
80
  * @param params.progressInterval - Minimum interval between progress updates in ms
81
+ * @param options - Optional RPC options (timeout, profiling, force new connection, etc.).
79
82
  * @returns Array of save results
80
83
  * @throws {RAGSaveFailedError} When the operation fails
81
84
  * @throws {StreamEndedError} When streaming ends unexpectedly (only when using onProgress)
@@ -109,6 +112,7 @@ export declare function ragSaveEmbeddings(params: RagSaveEmbeddingsParams, optio
109
112
  * @param params.topK - Number of top results to retrieve (default: 5)
110
113
  * @param params.n - Number of centroids to use for IVF index search (default: 3)
111
114
  * @param params.workspace - Workspace to search in (default: "default").
115
+ * @param options - Optional RPC options (timeout, profiling, force new connection, etc.).
112
116
  * @returns Array of search results with id, content, and score. Empty array if workspace doesn't exist.
113
117
  * @throws {RAGSearchFailedError} When the operation fails
114
118
  *
@@ -131,6 +135,7 @@ export declare function ragSearch(params: RagSearchParams, options?: RPCOptions)
131
135
  * @param params - The parameters for deleting embeddings
132
136
  * @param params.ids - Array of document IDs to delete
133
137
  * @param params.workspace - Workspace to delete from (default: "default")
138
+ * @param options - Optional RPC options (timeout, profiling, force new connection, etc.).
134
139
  * @throws {RAGDeleteFailedError} When the operation fails or workspace doesn't exist
135
140
  *
136
141
  * @example
@@ -155,6 +160,7 @@ export declare function ragDeleteEmbeddings(params: RagDeleteEmbeddingsParams, o
155
160
  * @param params - The parameters for reindexing
156
161
  * @param params.workspace - Workspace to reindex (default: "default"). Must already exist.
157
162
  * @param params.onProgress - Progress callback (stage, current, total)
163
+ * @param options - Optional RPC options (timeout, profiling, force new connection, etc.).
158
164
  * @returns Reindex result with `reindexed` boolean and optional `details`
159
165
  * @throws {RAGSaveFailedError} When the operation fails or workspace doesn't exist
160
166
  * @throws {StreamEndedError} When streaming ends unexpectedly (only when using onProgress)
@@ -188,6 +194,7 @@ export declare function ragReindex(params: RagReindexParams, options?: RPCOption
188
194
  * the workspace is currently loaded in memory and holding active resources
189
195
  * (Corestore, HyperDB adapter, and possibly a RAG instance).
190
196
  *
197
+ * @param options - Optional RPC options (timeout, profiling, force new connection, etc.).
191
198
  * @returns Array of workspace info with name and open status
192
199
  * @throws {RAGListWorkspacesFailedError} When the operation fails
193
200
  *
@@ -208,6 +215,7 @@ export declare function ragListWorkspaces(options?: RPCOptions): Promise<RagWork
208
215
  * @param params - The parameters for closing
209
216
  * @param params.workspace - Name of the workspace to close (default: "default")
210
217
  * @param params.deleteOnClose - If true, deletes the workspace data from disk after closing (default: false)
218
+ * @param options - Optional RPC options (timeout, profiling, force new connection, etc.).
211
219
  * @throws {RAGCloseWorkspaceFailedError} When the operation fails
212
220
  *
213
221
  * @example
@@ -226,6 +234,7 @@ export declare function ragCloseWorkspace(params?: RagCloseWorkspaceParams, opti
226
234
  *
227
235
  * @param params - The parameters for deletion
228
236
  * @param params.workspace - Name of the workspace to delete
237
+ * @param options - Optional RPC options (timeout, profiling, force new connection, etc.).
229
238
  * @throws {RAGDeleteFailedError} When the workspace doesn't exist or is currently loaded
230
239
  *
231
240
  * @example
@@ -8,6 +8,7 @@ import { InvalidResponseError, InvalidOperationError, StreamEndedError, RAGChunk
8
8
  * @param params - The parameters for chunking
9
9
  * @param params.documents - Documents to chunk (string or array)
10
10
  * @param params.chunkOpts - Chunking options (chunkSize, chunkOverlap, chunkStrategy)
11
+ * @param options - Optional RPC options (timeout, profiling, force new connection, etc.).
11
12
  * @returns Array of chunk results with id and content
12
13
  * @throws {RAGChunkFailedError} When the operation fails
13
14
  *
@@ -57,6 +58,7 @@ export async function ragChunk(params, options) {
57
58
  * @param params.workspace - Workspace for isolated storage (default: "default"). Created if it doesn't exist.
58
59
  * @param params.onProgress - Progress callback (stage, current, total)
59
60
  * @param params.progressInterval - Minimum interval between progress updates in ms
61
+ * @param options - Optional RPC options (timeout, profiling, force new connection, etc.).
60
62
  * @returns Processing results and dropped indices
61
63
  * @throws {RAGSaveFailedError} When the operation fails
62
64
  * @throws {StreamEndedError} When streaming ends unexpectedly (only when using onProgress)
@@ -137,6 +139,7 @@ export async function ragIngest(params, options) {
137
139
  * @param params.workspace - Workspace for isolated storage (default: "default"). Created if it doesn't exist.
138
140
  * @param params.onProgress - Progress callback (stage, current, total)
139
141
  * @param params.progressInterval - Minimum interval between progress updates in ms
142
+ * @param options - Optional RPC options (timeout, profiling, force new connection, etc.).
140
143
  * @returns Array of save results
141
144
  * @throws {RAGSaveFailedError} When the operation fails
142
145
  * @throws {StreamEndedError} When streaming ends unexpectedly (only when using onProgress)
@@ -207,6 +210,7 @@ export async function ragSaveEmbeddings(params, options) {
207
210
  * @param params.topK - Number of top results to retrieve (default: 5)
208
211
  * @param params.n - Number of centroids to use for IVF index search (default: 3)
209
212
  * @param params.workspace - Workspace to search in (default: "default").
213
+ * @param options - Optional RPC options (timeout, profiling, force new connection, etc.).
210
214
  * @returns Array of search results with id, content, and score. Empty array if workspace doesn't exist.
211
215
  * @throws {RAGSearchFailedError} When the operation fails
212
216
  *
@@ -249,6 +253,7 @@ export async function ragSearch(params, options) {
249
253
  * @param params - The parameters for deleting embeddings
250
254
  * @param params.ids - Array of document IDs to delete
251
255
  * @param params.workspace - Workspace to delete from (default: "default")
256
+ * @param options - Optional RPC options (timeout, profiling, force new connection, etc.).
252
257
  * @throws {RAGDeleteFailedError} When the operation fails or workspace doesn't exist
253
258
  *
254
259
  * @example
@@ -290,6 +295,7 @@ export async function ragDeleteEmbeddings(params, options) {
290
295
  * @param params - The parameters for reindexing
291
296
  * @param params.workspace - Workspace to reindex (default: "default"). Must already exist.
292
297
  * @param params.onProgress - Progress callback (stage, current, total)
298
+ * @param options - Optional RPC options (timeout, profiling, force new connection, etc.).
293
299
  * @returns Reindex result with `reindexed` boolean and optional `details`
294
300
  * @throws {RAGSaveFailedError} When the operation fails or workspace doesn't exist
295
301
  * @throws {StreamEndedError} When streaming ends unexpectedly (only when using onProgress)
@@ -359,6 +365,7 @@ export async function ragReindex(params, options) {
359
365
  * the workspace is currently loaded in memory and holding active resources
360
366
  * (Corestore, HyperDB adapter, and possibly a RAG instance).
361
367
  *
368
+ * @param options - Optional RPC options (timeout, profiling, force new connection, etc.).
362
369
  * @returns Array of workspace info with name and open status
363
370
  * @throws {RAGListWorkspacesFailedError} When the operation fails
364
371
  *
@@ -396,6 +403,7 @@ export async function ragListWorkspaces(options) {
396
403
  * @param params - The parameters for closing
397
404
  * @param params.workspace - Name of the workspace to close (default: "default")
398
405
  * @param params.deleteOnClose - If true, deletes the workspace data from disk after closing (default: false)
406
+ * @param options - Optional RPC options (timeout, profiling, force new connection, etc.).
399
407
  * @throws {RAGCloseWorkspaceFailedError} When the operation fails
400
408
  *
401
409
  * @example
@@ -431,6 +439,7 @@ export async function ragCloseWorkspace(params, options) {
431
439
  *
432
440
  * @param params - The parameters for deletion
433
441
  * @param params.workspace - Name of the workspace to delete
442
+ * @param options - Optional RPC options (timeout, profiling, force new connection, etc.).
434
443
  * @throws {RAGDeleteFailedError} When the workspace doesn't exist or is currently loaded
435
444
  *
436
445
  * @example
@@ -7,8 +7,34 @@ export interface ModelRegistrySearchParams {
7
7
  modelType?: ModelRegistryEntryAddon;
8
8
  addon?: ModelRegistryEntryAddon;
9
9
  }
10
+ /**
11
+ * Returns all available models from the QVAC distributed model registry.
12
+ *
13
+ * @returns A promise resolving to an array of `ModelRegistryEntry` describing every model the SDK's connected registry knows about.
14
+ * @throws {ModelRegistryQueryFailedError} When the registry query fails.
15
+ */
10
16
  declare function modelRegistryList(): Promise<ModelRegistryEntry[]>;
17
+ /**
18
+ * Searches the model registry with optional filters for model type, engine, and quantization.
19
+ *
20
+ * @param params - Search filters (all optional).
21
+ * @param params.filter - Free-text filter matched against model metadata.
22
+ * @param params.engine - Inference engine identifier (e.g., `"llamacpp-completion"`).
23
+ * @param params.quantization - Quantization identifier (e.g., `"Q4_K_M"`).
24
+ * @param params.modelType - Alias for `addon`; kept for backward compatibility.
25
+ * @param params.addon - Model addon / category to restrict results to.
26
+ * @returns A promise resolving to the matching `ModelRegistryEntry` entries.
27
+ * @throws {ModelRegistryQueryFailedError} When the registry query fails.
28
+ */
11
29
  declare function modelRegistrySearch(params?: ModelRegistrySearchParams): Promise<ModelRegistryEntry[]>;
30
+ /**
31
+ * Fetches a single model entry from the registry by its path and source.
32
+ *
33
+ * @param registryPath - Registry-relative path of the model to fetch.
34
+ * @param registrySource - Registry source identifier (e.g., `"huggingface"`, `"local"`).
35
+ * @returns A promise resolving to the matching `ModelRegistryEntry`.
36
+ * @throws {ModelRegistryQueryFailedError} When the model cannot be located or the registry query fails.
37
+ */
12
38
  declare function modelRegistryGetModel(registryPath: string, registrySource: string): Promise<ModelRegistryEntry>;
13
39
  export { modelRegistryList, modelRegistrySearch, modelRegistryGetModel };
14
40
  //# sourceMappingURL=registry.d.ts.map
@@ -5,6 +5,12 @@ function validateRegistryResponse(response, fallbackError) {
5
5
  throw new ModelRegistryQueryFailedError(response.error ?? fallbackError ?? "Unknown registry error");
6
6
  }
7
7
  }
8
+ /**
9
+ * Returns all available models from the QVAC distributed model registry.
10
+ *
11
+ * @returns A promise resolving to an array of `ModelRegistryEntry` describing every model the SDK's connected registry knows about.
12
+ * @throws {ModelRegistryQueryFailedError} When the registry query fails.
13
+ */
8
14
  async function modelRegistryList() {
9
15
  const request = {
10
16
  type: "modelRegistryList",
@@ -13,6 +19,18 @@ async function modelRegistryList() {
13
19
  validateRegistryResponse(response);
14
20
  return response.models;
15
21
  }
22
+ /**
23
+ * Searches the model registry with optional filters for model type, engine, and quantization.
24
+ *
25
+ * @param params - Search filters (all optional).
26
+ * @param params.filter - Free-text filter matched against model metadata.
27
+ * @param params.engine - Inference engine identifier (e.g., `"llamacpp-completion"`).
28
+ * @param params.quantization - Quantization identifier (e.g., `"Q4_K_M"`).
29
+ * @param params.modelType - Alias for `addon`; kept for backward compatibility.
30
+ * @param params.addon - Model addon / category to restrict results to.
31
+ * @returns A promise resolving to the matching `ModelRegistryEntry` entries.
32
+ * @throws {ModelRegistryQueryFailedError} When the registry query fails.
33
+ */
16
34
  async function modelRegistrySearch(params = {}) {
17
35
  const { modelType, ...rest } = params;
18
36
  const request = {
@@ -24,6 +42,14 @@ async function modelRegistrySearch(params = {}) {
24
42
  validateRegistryResponse(response);
25
43
  return response.models;
26
44
  }
45
+ /**
46
+ * Fetches a single model entry from the registry by its path and source.
47
+ *
48
+ * @param registryPath - Registry-relative path of the model to fetch.
49
+ * @param registrySource - Registry source identifier (e.g., `"huggingface"`, `"local"`).
50
+ * @returns A promise resolving to the matching `ModelRegistryEntry`.
51
+ * @throws {ModelRegistryQueryFailedError} When the model cannot be located or the registry query fails.
52
+ */
27
53
  async function modelRegistryGetModel(registryPath, registrySource) {
28
54
  const request = {
29
55
  type: "modelRegistryGetModel",
@@ -1,14 +1,30 @@
1
1
  /**
2
- * Resumes all suspended Hyperswarm and Corestore resources
2
+ * Resumes the SDK runtime: restores all suspended Hyperswarm and Corestore
3
+ * resources and releases the lifecycle gate so all SDK operations are allowed
4
+ * again.
3
5
  *
4
- * Idempotent — calling while already active is a no-op.
5
- * Also serves as the recovery path after a partial suspend failure.
6
+ * Safe to call from any lifecycle state — `resume()` is never blocked by the
7
+ * lifecycle gate (along with `suspend()` and `state()`). Idempotent. Also
8
+ * serves as the recovery path after a partial suspend failure.
6
9
  *
7
- * @throws {RPCError} When one or more resources fail to resume.
10
+ * After `resume()` resolves successfully, runtime state is `"active"` and
11
+ * non-lifecycle SDK operations are accepted normally.
12
+ *
13
+ * Behavior of in-flight operations from before the previous `suspend()`:
14
+ * - P2P / Hyperdrive downloads: continue automatically once their underlying
15
+ * swarm/corestore is restored
16
+ * - Delegated reply RPCs: auto-recover once the swarm reconnects
17
+ * (subject to delegate `timeout`)
18
+ * - Delegated stream RPCs: not recovered — re-issue after `resume()` works normally.
19
+ *
20
+ * @throws {RPCError} When one or more resources fail to resume. On partial
21
+ * failure the runtime stays `"suspended"` (operations remain blocked) so
22
+ * callers can retry `resume()`.
8
23
  *
9
24
  * @example
10
25
  * // Foreground handler
11
26
  * await resume();
27
+ * console.log(await state()); // "active"
12
28
  */
13
29
  export declare function resume(): Promise<void>;
14
30
  //# sourceMappingURL=resume.d.ts.map
@@ -1,16 +1,32 @@
1
1
  import { send } from "../rpc/rpc-client.js";
2
2
  import { InvalidResponseError } from "../../utils/errors-client.js";
3
3
  /**
4
- * Resumes all suspended Hyperswarm and Corestore resources
4
+ * Resumes the SDK runtime: restores all suspended Hyperswarm and Corestore
5
+ * resources and releases the lifecycle gate so all SDK operations are allowed
6
+ * again.
5
7
  *
6
- * Idempotent — calling while already active is a no-op.
7
- * Also serves as the recovery path after a partial suspend failure.
8
+ * Safe to call from any lifecycle state — `resume()` is never blocked by the
9
+ * lifecycle gate (along with `suspend()` and `state()`). Idempotent. Also
10
+ * serves as the recovery path after a partial suspend failure.
8
11
  *
9
- * @throws {RPCError} When one or more resources fail to resume.
12
+ * After `resume()` resolves successfully, runtime state is `"active"` and
13
+ * non-lifecycle SDK operations are accepted normally.
14
+ *
15
+ * Behavior of in-flight operations from before the previous `suspend()`:
16
+ * - P2P / Hyperdrive downloads: continue automatically once their underlying
17
+ * swarm/corestore is restored
18
+ * - Delegated reply RPCs: auto-recover once the swarm reconnects
19
+ * (subject to delegate `timeout`)
20
+ * - Delegated stream RPCs: not recovered — re-issue after `resume()` works normally.
21
+ *
22
+ * @throws {RPCError} When one or more resources fail to resume. On partial
23
+ * failure the runtime stays `"suspended"` (operations remain blocked) so
24
+ * callers can retry `resume()`.
10
25
  *
11
26
  * @example
12
27
  * // Foreground handler
13
28
  * await resume();
29
+ * console.log(await state()); // "active"
14
30
  */
15
31
  export async function resume() {
16
32
  const response = await send({ type: "resume" });
@@ -0,0 +1,23 @@
1
+ import type { LifecycleState } from "../../schemas/index";
2
+ /**
3
+ * Returns the current runtime lifecycle state.
4
+ *
5
+ * Safe to call from any lifecycle state — `state()` is never blocked by the
6
+ * lifecycle gate (along with `suspend()` and `resume()`).
7
+ *
8
+ * @returns The current lifecycle state:
9
+ * - `"active"`: all SDK operations are allowed
10
+ * - `"suspending"` | `"suspended"` | `"resuming"`: non-lifecycle operations
11
+ * throw `LifecycleOperationBlockedError`
12
+ *
13
+ * @throws {InvalidResponseError} When the response envelope does not match the request type.
14
+ *
15
+ * @example
16
+ * // Branch on lifecycle state before issuing work
17
+ * const current = await state();
18
+ * if (current !== "active") {
19
+ * await resume();
20
+ * }
21
+ */
22
+ export declare function state(): Promise<LifecycleState>;
23
+ //# sourceMappingURL=state.d.ts.map
@@ -0,0 +1,29 @@
1
+ import { send } from "../rpc/rpc-client.js";
2
+ import { InvalidResponseError } from "../../utils/errors-client.js";
3
+ /**
4
+ * Returns the current runtime lifecycle state.
5
+ *
6
+ * Safe to call from any lifecycle state — `state()` is never blocked by the
7
+ * lifecycle gate (along with `suspend()` and `resume()`).
8
+ *
9
+ * @returns The current lifecycle state:
10
+ * - `"active"`: all SDK operations are allowed
11
+ * - `"suspending"` | `"suspended"` | `"resuming"`: non-lifecycle operations
12
+ * throw `LifecycleOperationBlockedError`
13
+ *
14
+ * @throws {InvalidResponseError} When the response envelope does not match the request type.
15
+ *
16
+ * @example
17
+ * // Branch on lifecycle state before issuing work
18
+ * const current = await state();
19
+ * if (current !== "active") {
20
+ * await resume();
21
+ * }
22
+ */
23
+ export async function state() {
24
+ const response = await send({ type: "state" });
25
+ if (response.type !== "state") {
26
+ throw new InvalidResponseError("state");
27
+ }
28
+ return response.state;
29
+ }
@@ -1,13 +1,19 @@
1
- import { type StopProvideParams } from "../../schemas/index";
2
1
  /**
3
- * Stops a running provider service and leaves the specified topic.
2
+ * Stops the running provider service.
3
+ *
4
+ * After this call returns, incoming peer connections are dropped at the RPC
5
+ * layer and remote `loadModel`/`completion`/etc. requests will no longer be
6
+ * served. The keyPair stays bound on the DHT (a `swarm.listen()` cannot be
7
+ * undone without tearing down the shared swarm), so peers may still open a
8
+ * raw socket — but those sockets are immediately destroyed and no RPC server
9
+ * is mounted on them.
10
+ *
11
+ * Idempotent: calling more than once with no provider running is a no-op.
4
12
  *
5
- * @param options - Options object with required topic
6
- * @param options.topic - Topic hex string to leave
7
13
  * @returns A promise that resolves to the stop provide response containing success status
8
14
  * @throws {QvacErrorBase} When the response type is not "stopProvide" or the request fails
9
15
  */
10
- export declare function stopQVACProvider(params: StopProvideParams): Promise<{
16
+ export declare function stopQVACProvider(): Promise<{
11
17
  type: "stopProvide";
12
18
  success: boolean;
13
19
  error?: string | undefined;