@qvac/sdk 0.9.2 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (333) hide show
  1. package/NOTICE +15 -68
  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-native-tools.js +2 -8
  68. package/dist/examples/llamacpp-structured-output.d.ts +2 -0
  69. package/dist/examples/llamacpp-structured-output.js +106 -0
  70. package/dist/examples/llamacpp-tools-pythonic.d.ts +2 -0
  71. package/dist/examples/llamacpp-tools-pythonic.js +69 -0
  72. package/dist/examples/plugins.js +4 -4
  73. package/dist/examples/suspend-resume.js +21 -4
  74. package/dist/examples/transcription/parakeet-microphone-record.js +6 -33
  75. package/dist/examples/transcription/whispercpp-filesystem-streaming.js +7 -5
  76. package/dist/examples/transcription/whispercpp-filesystem.js +12 -3
  77. package/dist/examples/transcription/whispercpp-microphone-record.js +6 -29
  78. package/dist/examples/translation/translation-stream.js +5 -5
  79. package/dist/examples/tts/llm-to-tts-streaming.d.ts +16 -0
  80. package/dist/examples/tts/llm-to-tts-streaming.js +143 -0
  81. package/dist/examples/tts/supertonic-multilingual.js +3 -3
  82. package/dist/examples/tts/supertonic.js +3 -3
  83. package/dist/examples/tts/utils.d.ts +11 -1
  84. package/dist/examples/tts/utils.js +70 -17
  85. package/dist/examples/voice-assistant/voice-assistant.d.ts +2 -0
  86. package/dist/examples/voice-assistant/voice-assistant.js +207 -0
  87. package/dist/expo/plugins/withMobileBundle.js +1 -1
  88. package/dist/index.d.ts +2 -2
  89. package/dist/index.js +2 -2
  90. package/dist/logging/logger.d.ts +11 -0
  91. package/dist/logging/logger.js +11 -0
  92. package/dist/logging/types.d.ts +18 -0
  93. package/dist/models/registry/models.d.ts +6620 -6185
  94. package/dist/models/registry/models.js +6296 -5318
  95. package/dist/models/update-models/codegen.js +84 -23
  96. package/dist/models/update-models/companions.d.ts +18 -0
  97. package/dist/models/update-models/companions.js +175 -0
  98. package/dist/models/update-models/naming.js +0 -25
  99. package/dist/models/update-models/registry.js +4 -2
  100. package/dist/models/update-models/types.d.ts +37 -9
  101. package/dist/profiling/index.d.ts +49 -0
  102. package/dist/profiling/index.js +49 -0
  103. package/dist/schemas/cancel.d.ts +6 -2
  104. package/dist/schemas/cancel.js +14 -7
  105. package/dist/schemas/common.d.ts +353 -271
  106. package/dist/schemas/common.js +26 -5
  107. package/dist/schemas/completion-event.d.ts +225 -0
  108. package/dist/schemas/completion-event.js +79 -0
  109. package/dist/schemas/completion-stream.d.ts +122 -31
  110. package/dist/schemas/completion-stream.js +137 -36
  111. package/dist/schemas/delegate.d.ts +0 -2
  112. package/dist/schemas/delegate.js +25 -6
  113. package/dist/schemas/download-asset.d.ts +5 -5
  114. package/dist/schemas/embed.js +21 -9
  115. package/dist/schemas/engine-addon-map.d.ts +11 -1
  116. package/dist/schemas/engine-addon-map.js +2 -2
  117. package/dist/schemas/get-loaded-model-info.d.ts +52 -0
  118. package/dist/schemas/get-loaded-model-info.js +44 -0
  119. package/dist/schemas/get-model-info.d.ts +2 -2
  120. package/dist/schemas/get-model-info.js +103 -32
  121. package/dist/schemas/heartbeat.d.ts +0 -1
  122. package/dist/schemas/index.d.ts +4 -1
  123. package/dist/schemas/index.js +4 -1
  124. package/dist/schemas/llamacpp-config.d.ts +14 -4
  125. package/dist/schemas/llamacpp-config.js +5 -0
  126. package/dist/schemas/load-model.d.ts +3233 -1260
  127. package/dist/schemas/load-model.js +23 -16
  128. package/dist/schemas/model-src-utils.d.ts +7 -6
  129. package/dist/schemas/model-src-utils.js +27 -1
  130. package/dist/schemas/model-types.d.ts +4 -4
  131. package/dist/schemas/ocr.d.ts +1 -1
  132. package/dist/schemas/plugin.d.ts +27 -3
  133. package/dist/schemas/plugin.js +27 -2
  134. package/dist/schemas/profiling.js +11 -3
  135. package/dist/schemas/provide.d.ts +1 -3
  136. package/dist/schemas/provide.js +0 -3
  137. package/dist/schemas/rag.d.ts +4 -4
  138. package/dist/schemas/registry.d.ts +10 -10
  139. package/dist/schemas/registry.js +36 -14
  140. package/dist/schemas/reload-config.d.ts +73 -7
  141. package/dist/schemas/sdcpp-config.d.ts +16 -8
  142. package/dist/schemas/sdcpp-config.js +118 -25
  143. package/dist/schemas/sdk-config.d.ts +116 -90
  144. package/dist/schemas/sdk-config.js +16 -0
  145. package/dist/schemas/sdk-errors-client.d.ts +3 -0
  146. package/dist/schemas/sdk-errors-client.js +16 -1
  147. package/dist/schemas/sdk-errors-server.d.ts +3 -0
  148. package/dist/schemas/sdk-errors-server.js +23 -0
  149. package/dist/schemas/state.d.ts +23 -0
  150. package/dist/schemas/state.js +14 -0
  151. package/dist/schemas/stop-provide.d.ts +0 -5
  152. package/dist/schemas/stop-provide.js +2 -6
  153. package/dist/schemas/text-to-speech.d.ts +93 -27
  154. package/dist/schemas/text-to-speech.js +27 -0
  155. package/dist/schemas/tools.d.ts +16 -0
  156. package/dist/schemas/tools.js +15 -0
  157. package/dist/schemas/transcription-config.d.ts +8 -8
  158. package/dist/schemas/transcription.d.ts +33 -0
  159. package/dist/schemas/transcription.js +9 -0
  160. package/dist/schemas/translate.js +59 -19
  161. package/dist/schemas/translation-config.d.ts +157 -133
  162. package/dist/schemas/translation-config.js +34 -11
  163. package/dist/server/bare/delegate-rpc-client.d.ts +1 -1
  164. package/dist/server/bare/delegate-rpc-client.js +131 -122
  165. package/dist/server/bare/hyperswarm.d.ts +2 -2
  166. package/dist/server/bare/hyperswarm.js +12 -7
  167. package/dist/server/bare/ops/cancel.js +7 -0
  168. package/dist/server/bare/ops/kv-cache-utils.d.ts +7 -10
  169. package/dist/server/bare/ops/kv-cache-utils.js +31 -40
  170. package/dist/server/bare/ops/load-model.js +0 -1
  171. package/dist/server/bare/ops/transcribe.d.ts +11 -4
  172. package/dist/server/bare/ops/transcribe.js +25 -4
  173. package/dist/server/bare/ops/translate.js +42 -4
  174. package/dist/server/bare/ops/unload-model.js +21 -19
  175. package/dist/server/bare/plugins/llamacpp-completion/ops/cache-logger.js +1 -2
  176. package/dist/server/bare/plugins/llamacpp-completion/ops/completion-stream.d.ts +13 -8
  177. package/dist/server/bare/plugins/llamacpp-completion/ops/completion-stream.js +257 -85
  178. package/dist/server/bare/plugins/llamacpp-completion/ops/kv-cache-state.d.ts +101 -0
  179. package/dist/server/bare/plugins/llamacpp-completion/ops/kv-cache-state.js +135 -0
  180. package/dist/server/bare/plugins/llamacpp-completion/plugin.d.ts +79 -22
  181. package/dist/server/bare/plugins/llamacpp-completion/plugin.js +57 -32
  182. package/dist/server/bare/plugins/llamacpp-embedding/plugin.js +10 -16
  183. package/dist/server/bare/plugins/nmtcpp-translation/plugin.d.ts +69 -44
  184. package/dist/server/bare/plugins/nmtcpp-translation/plugin.js +113 -94
  185. package/dist/server/bare/plugins/onnx-ocr/plugin.d.ts +1 -1
  186. package/dist/server/bare/plugins/onnx-ocr/plugin.js +1 -2
  187. package/dist/server/bare/plugins/onnx-tts/ops/text-to-speech-stream.d.ts +7 -0
  188. package/dist/server/bare/plugins/onnx-tts/ops/text-to-speech-stream.js +116 -0
  189. package/dist/server/bare/plugins/onnx-tts/ops/text-to-speech.d.ts +2 -3
  190. package/dist/server/bare/plugins/onnx-tts/ops/text-to-speech.js +71 -9
  191. package/dist/server/bare/plugins/onnx-tts/plugin.d.ts +41 -13
  192. package/dist/server/bare/plugins/onnx-tts/plugin.js +48 -3
  193. package/dist/server/bare/plugins/parakeet-transcription/plugin.d.ts +15 -7
  194. package/dist/server/bare/plugins/parakeet-transcription/plugin.js +5 -6
  195. package/dist/server/bare/plugins/sdcpp-generation/ops/diffusion.js +6 -0
  196. package/dist/server/bare/plugins/sdcpp-generation/plugin.d.ts +8 -5
  197. package/dist/server/bare/plugins/sdcpp-generation/plugin.js +13 -13
  198. package/dist/server/bare/plugins/whispercpp-transcription/plugin.d.ts +17 -1
  199. package/dist/server/bare/plugins/whispercpp-transcription/plugin.js +40 -17
  200. package/dist/server/bare/registry/config-registry.js +14 -3
  201. package/dist/server/bare/registry/model-registry.d.ts +8 -10
  202. package/dist/server/bare/registry/model-registry.js +17 -12
  203. package/dist/server/bare/registry/registry-client.js +79 -19
  204. package/dist/server/bare/runtime-lifecycle.d.ts +2 -1
  205. package/dist/server/bare/runtime-lifecycle.js +13 -2
  206. package/dist/server/bare/types/addon-responses.d.ts +8 -3
  207. package/dist/server/bare/utils/transcribe-metadata.d.ts +21 -0
  208. package/dist/server/bare/utils/transcribe-metadata.js +28 -0
  209. package/dist/server/bare/utils/tts-stats.d.ts +22 -0
  210. package/dist/server/bare/utils/tts-stats.js +10 -0
  211. package/dist/server/rpc/create-server.d.ts +4 -1
  212. package/dist/server/rpc/create-server.js +5 -1
  213. package/dist/server/rpc/delegate-transport.js +36 -29
  214. package/dist/server/rpc/handle-request.js +28 -3
  215. package/dist/server/rpc/handler-registry.js +7 -1
  216. package/dist/server/rpc/handler-utils.d.ts +5 -0
  217. package/dist/server/rpc/handler-utils.js +22 -0
  218. package/dist/server/rpc/handlers/cancel-delegated.js +3 -5
  219. package/dist/server/rpc/handlers/cancelHandler.js +4 -5
  220. package/dist/server/rpc/handlers/completion-stream-delegated.js +14 -5
  221. package/dist/server/rpc/handlers/delete-cache.js +8 -3
  222. package/dist/server/rpc/handlers/download-asset.js +3 -24
  223. package/dist/server/rpc/handlers/get-loaded-model-info.d.ts +3 -0
  224. package/dist/server/rpc/handlers/get-loaded-model-info.js +39 -0
  225. package/dist/server/rpc/handlers/get-model-info.js +93 -84
  226. package/dist/server/rpc/handlers/heartbeat-delegated.js +2 -2
  227. package/dist/server/rpc/handlers/index.d.ts +6 -0
  228. package/dist/server/rpc/handlers/index.js +6 -0
  229. package/dist/server/rpc/handlers/load-model/download-manager.d.ts +35 -9
  230. package/dist/server/rpc/handlers/load-model/download-manager.js +142 -38
  231. package/dist/server/rpc/handlers/load-model/download-stats.d.ts +5 -4
  232. package/dist/server/rpc/handlers/load-model/download-stats.js +49 -8
  233. package/dist/server/rpc/handlers/load-model/handler.js +31 -50
  234. package/dist/server/rpc/handlers/load-model/http.d.ts +2 -2
  235. package/dist/server/rpc/handlers/load-model/http.js +97 -142
  236. package/dist/server/rpc/handlers/load-model/hyperdrive.d.ts +2 -2
  237. package/dist/server/rpc/handlers/load-model/hyperdrive.js +55 -74
  238. package/dist/server/rpc/handlers/load-model/index.d.ts +0 -1
  239. package/dist/server/rpc/handlers/load-model/index.js +0 -1
  240. package/dist/server/rpc/handlers/load-model/registry-client-options.d.ts +27 -0
  241. package/dist/server/rpc/handlers/load-model/registry-client-options.js +19 -0
  242. package/dist/server/rpc/handlers/load-model/registry-companion-set.d.ts +22 -0
  243. package/dist/server/rpc/handlers/load-model/registry-companion-set.js +208 -0
  244. package/dist/server/rpc/handlers/load-model/registry-download-utils.d.ts +24 -0
  245. package/dist/server/rpc/handlers/load-model/registry-download-utils.js +114 -0
  246. package/dist/server/rpc/handlers/load-model/registry.d.ts +2 -20
  247. package/dist/server/rpc/handlers/load-model/registry.js +109 -381
  248. package/dist/server/rpc/handlers/load-model/resolve-session.d.ts +15 -0
  249. package/dist/server/rpc/handlers/load-model/resolve-session.js +61 -0
  250. package/dist/server/rpc/handlers/load-model/resolve.d.ts +3 -3
  251. package/dist/server/rpc/handlers/load-model/resolve.js +14 -23
  252. package/dist/server/rpc/handlers/load-model/types.d.ts +11 -4
  253. package/dist/server/rpc/handlers/load-model/types.js +28 -1
  254. package/dist/server/rpc/handlers/load-model-delegated.js +2 -4
  255. package/dist/server/rpc/handlers/plugin-dispatch.js +9 -5
  256. package/dist/server/rpc/handlers/plugin-invoke.js +1 -1
  257. package/dist/server/rpc/handlers/provideHandler/connection.js +13 -2
  258. package/dist/server/rpc/handlers/provideHandler/handler.js +42 -29
  259. package/dist/server/rpc/handlers/state.d.ts +3 -0
  260. package/dist/server/rpc/handlers/state.js +7 -0
  261. package/dist/server/rpc/handlers/stopProvideHandler.d.ts +2 -2
  262. package/dist/server/rpc/handlers/stopProvideHandler.js +12 -7
  263. package/dist/server/rpc/handlers/text-to-speech-stream.d.ts +3 -0
  264. package/dist/server/rpc/handlers/text-to-speech-stream.js +4 -0
  265. package/dist/server/rpc/handlers/unload-model-delegated.js +3 -3
  266. package/dist/server/rpc/profiling/operation-metrics.js +20 -0
  267. package/dist/server/rpc/rpc-utils.js +1 -1
  268. package/dist/server/rpc/transport-selector.d.ts +3 -0
  269. package/dist/server/rpc/transport-selector.js +18 -0
  270. package/dist/server/utils/cache/auto-history.d.ts +4 -0
  271. package/dist/server/utils/cache/auto-history.js +22 -0
  272. package/dist/server/utils/{cache.d.ts → cache/paths.d.ts} +22 -5
  273. package/dist/server/utils/{cache.js → cache/paths.js} +36 -20
  274. package/dist/server/utils/cache/types.d.ts +8 -0
  275. package/dist/server/utils/cache/types.js +1 -0
  276. package/dist/server/utils/checksum.d.ts +2 -2
  277. package/dist/server/utils/checksum.js +1 -1
  278. package/dist/server/utils/clear-storage.d.ts +5 -0
  279. package/dist/server/utils/clear-storage.js +17 -0
  280. package/dist/server/utils/completion-normalizer.d.ts +17 -0
  281. package/dist/server/utils/completion-normalizer.js +301 -0
  282. package/dist/server/utils/expand-gguf-shards.d.ts +3 -0
  283. package/dist/server/utils/expand-gguf-shards.js +22 -0
  284. package/dist/server/utils/formatting.js +1 -1
  285. package/dist/server/utils/index.d.ts +4 -2
  286. package/dist/server/utils/index.js +4 -2
  287. package/dist/server/utils/qvac-paths.d.ts +2 -0
  288. package/dist/server/utils/qvac-paths.js +5 -0
  289. package/dist/server/utils/response-format.d.ts +3 -0
  290. package/dist/server/utils/response-format.js +20 -0
  291. package/dist/server/utils/tool-integration.d.ts +15 -4
  292. package/dist/server/utils/tool-integration.js +21 -41
  293. package/dist/server/utils/tools/dialect.d.ts +8 -0
  294. package/dist/server/utils/tools/dialect.js +12 -0
  295. package/dist/server/utils/tools/index.d.ts +3 -0
  296. package/dist/server/utils/tools/index.js +2 -0
  297. package/dist/server/utils/tools/parser.d.ts +6 -0
  298. package/dist/server/utils/tools/parser.js +40 -0
  299. package/dist/server/utils/tools/parsers/hermes.d.ts +4 -0
  300. package/dist/server/utils/tools/parsers/hermes.js +100 -0
  301. package/dist/server/utils/tools/parsers/json.d.ts +6 -0
  302. package/dist/server/utils/tools/parsers/json.js +115 -0
  303. package/dist/server/utils/tools/parsers/pythonic.d.ts +4 -0
  304. package/dist/server/utils/tools/parsers/pythonic.js +267 -0
  305. package/dist/server/utils/tools/shared.d.ts +18 -0
  306. package/dist/server/utils/tools/shared.js +54 -0
  307. package/dist/server/utils/worker-lock.d.ts +3 -0
  308. package/dist/server/utils/worker-lock.js +67 -0
  309. package/dist/server/worker-core.d.ts +16 -1
  310. package/dist/server/worker-core.js +114 -14
  311. package/dist/utils/aggregate-events.d.ts +16 -0
  312. package/dist/utils/aggregate-events.js +52 -0
  313. package/dist/utils/cache-normalize.d.ts +10 -0
  314. package/dist/utils/cache-normalize.js +23 -0
  315. package/dist/utils/encoding.d.ts +8 -0
  316. package/dist/utils/encoding.js +13 -0
  317. package/dist/utils/errors-client.d.ts +12 -0
  318. package/dist/utils/errors-client.js +20 -0
  319. package/dist/utils/errors-server.d.ts +14 -0
  320. package/dist/utils/errors-server.js +31 -0
  321. package/dist/utils/load-model-validation.d.ts +7 -0
  322. package/dist/utils/load-model-validation.js +18 -0
  323. package/expo/plugins/patches/android-link.mjs +1 -1
  324. package/expo/plugins/patches/ios-link.mjs +1 -1
  325. package/package.json +14 -18
  326. package/dist/examples/translation/translation-opus.d.ts +0 -2
  327. package/dist/examples/translation/translation-opus.js +0 -33
  328. package/dist/server/bare/utils/loader-adapter.d.ts +0 -7
  329. package/dist/server/bare/utils/loader-adapter.js +0 -9
  330. package/dist/server/utils/model-path.d.ts +0 -5
  331. package/dist/server/utils/model-path.js +0 -7
  332. package/dist/server/utils/tool-parser.d.ts +0 -7
  333. package/dist/server/utils/tool-parser.js +0 -248
@@ -11,7 +11,17 @@ export declare function int16ArrayToBuffer(samples: number[]): Buffer;
11
11
  */
12
12
  export declare function createWav(audioBuffer: number[], sampleRate: number, filename: string): void;
13
13
  /**
14
- * Play audio using system audio players
14
+ * Play a WAV buffer by streaming it into ffplay over stdin.
15
+ *
16
+ * ffplay ships with ffmpeg and is cross-platform (macOS/Linux/Windows), so
17
+ * we avoid the old "write to /tmp then shell out to afplay/aplay/powershell"
18
+ * dance — no temp files, no platform switch, no hardcoded /tmp path (which
19
+ * doesn't exist on Windows). Requires ffplay on PATH.
15
20
  */
21
+ /**
22
+ * Play one mono s16le PCM chunk (as a minimal WAV) and wait for the player to finish.
23
+ * Chunks are played sequentially when awaited in order — suitable for streaming TTS output.
24
+ */
25
+ export declare function playPcmInt16Chunk(samples: number[], sampleRate: number): Promise<void>;
16
26
  export declare function playAudio(audioBuffer: Buffer): void;
17
27
  //# sourceMappingURL=utils.d.ts.map
@@ -1,6 +1,7 @@
1
1
  import { writeFileSync, unlinkSync } from "fs";
2
- import { spawnSync } from "child_process";
3
- import { platform } from "os";
2
+ import { spawn, spawnSync } from "child_process";
3
+ import { platform, tmpdir } from "os";
4
+ import { join } from "path";
4
5
  /**
5
6
  * Create WAV header for 16-bit PCM audio
6
7
  */
@@ -46,13 +47,30 @@ export function createWav(audioBuffer, sampleRate, filename) {
46
47
  console.log(`WAV file saved as: ${filename}`);
47
48
  }
48
49
  /**
49
- * Play audio using system audio players
50
+ * Play a WAV buffer by streaming it into ffplay over stdin.
51
+ *
52
+ * ffplay ships with ffmpeg and is cross-platform (macOS/Linux/Windows), so
53
+ * we avoid the old "write to /tmp then shell out to afplay/aplay/powershell"
54
+ * dance — no temp files, no platform switch, no hardcoded /tmp path (which
55
+ * doesn't exist on Windows). Requires ffplay on PATH.
50
56
  */
51
- export function playAudio(audioBuffer) {
57
+ /**
58
+ * Play one mono s16le PCM chunk (as a minimal WAV) and wait for the player to finish.
59
+ * Chunks are played sequentially when awaited in order — suitable for streaming TTS output.
60
+ */
61
+ export function playPcmInt16Chunk(samples, sampleRate) {
62
+ if (samples.length === 0) {
63
+ return Promise.resolve();
64
+ }
65
+ const audioData = int16ArrayToBuffer(samples);
66
+ const wavHeader = createWavHeader(audioData.length, sampleRate);
67
+ const wavFile = Buffer.concat([wavHeader, audioData]);
68
+ // `os.tmpdir()` resolves to the OS-specific temp directory (e.g. `%TEMP%`
69
+ // on Windows), so the Windows branch below no longer tries to read a
70
+ // POSIX-only `/tmp/...` path.
71
+ const tempFile = join(tmpdir(), `qvac-tts-chunk-${Date.now()}-${Math.random().toString(16).slice(2)}.wav`);
72
+ writeFileSync(tempFile, wavFile);
52
73
  const currentPlatform = platform();
53
- const tempFile = `/tmp/audio-${Date.now()}.wav`;
54
- // Write audio buffer to temporary file
55
- writeFileSync(tempFile, audioBuffer);
56
74
  let audioPlayer;
57
75
  let args;
58
76
  switch (currentPlatform) {
@@ -75,19 +93,54 @@ export function playAudio(audioBuffer) {
75
93
  audioPlayer = "aplay";
76
94
  args = [tempFile];
77
95
  }
78
- const result = spawnSync(audioPlayer, args, {
79
- stdio: ["inherit", "inherit", "inherit"],
96
+ return new Promise(function (resolve, reject) {
97
+ const proc = spawn(audioPlayer, args, { stdio: "ignore" });
98
+ proc.on("error", function (err) {
99
+ try {
100
+ unlinkSync(tempFile);
101
+ }
102
+ catch {
103
+ // ignore
104
+ }
105
+ reject(err);
106
+ });
107
+ proc.on("close", function (code) {
108
+ try {
109
+ unlinkSync(tempFile);
110
+ }
111
+ catch {
112
+ // ignore
113
+ }
114
+ if (code === 0) {
115
+ resolve();
116
+ }
117
+ else {
118
+ reject(new Error(`Audio player exited with code ${code}`));
119
+ }
120
+ });
121
+ });
122
+ }
123
+ export function playAudio(audioBuffer) {
124
+ const result = spawnSync("ffplay", [
125
+ "-hide_banner",
126
+ "-loglevel",
127
+ "error",
128
+ "-autoexit",
129
+ "-nodisp",
130
+ "-i",
131
+ "pipe:0",
132
+ ], {
133
+ input: audioBuffer,
134
+ stdio: ["pipe", "inherit", "inherit"],
80
135
  });
81
- try {
82
- unlinkSync(tempFile);
83
- }
84
- catch {
85
- // Ignore cleanup errors
86
- }
87
136
  if (result.error) {
88
- throw new Error(`Audio player failed: ${result.error.message}`);
137
+ const code = result.error.code;
138
+ if (code === "ENOENT") {
139
+ throw new Error("ffplay not found on PATH. Install ffmpeg (ffplay ships with it) and retry.");
140
+ }
141
+ throw new Error(`ffplay failed: ${result.error.message}`);
89
142
  }
90
143
  if (result.status !== 0) {
91
- throw new Error(`Audio player exited with code ${result.status}`);
144
+ throw new Error(`ffplay exited with code ${result.status}`);
92
145
  }
93
146
  }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=voice-assistant.d.ts.map
@@ -0,0 +1,207 @@
1
+ /**
2
+ * Real-time Voice Assistant: mic → Whisper (with Silero VAD) → Llama → Supertonic TTS.
3
+ *
4
+ * Usage: bun run examples/voice-assistant/voice-assistant.ts
5
+ *
6
+ * Speak a question; the VAD detects when you pause, the utterance is
7
+ * transcribed, sent to the LLM, and the response is spoken back. The loop
8
+ * continues until you press Ctrl+C. While the assistant is speaking, mic
9
+ * audio is dropped so it does not hear itself.
10
+ *
11
+ * Requirements: FFmpeg installed, microphone access, speakers.
12
+ */
13
+ import { loadModel, unloadModel, transcribeStream, completion, textToSpeech, WHISPER_TINY, VAD_SILERO_5_1_2, LLAMA_3_2_1B_INST_Q4_0, TTS_SUPERTONIC2_OFFICIAL_TEXT_ENCODER_SUPERTONE_FP32, TTS_SUPERTONIC2_OFFICIAL_DURATION_PREDICTOR_SUPERTONE_FP32, TTS_SUPERTONIC2_OFFICIAL_VECTOR_ESTIMATOR_SUPERTONE_FP32, TTS_SUPERTONIC2_OFFICIAL_VOCODER_SUPERTONE_FP32, TTS_SUPERTONIC2_OFFICIAL_UNICODE_INDEXER_SUPERTONE_FP32, TTS_SUPERTONIC2_OFFICIAL_TTS_CONFIG_SUPERTONE, TTS_SUPERTONIC2_OFFICIAL_VOICE_STYLE_SUPERTONE, } from "@qvac/sdk";
14
+ import { spawnSync } from "child_process";
15
+ import { startMicrophone } from "../audio/mic-input";
16
+ import { createWavHeader, int16ArrayToBuffer, playAudio } from "../tts/utils";
17
+ const MIC_SAMPLE_RATE = 16000;
18
+ const TTS_SAMPLE_RATE = 44100;
19
+ const SYSTEM_PROMPT = "You are a concise, friendly voice assistant. Keep responses under two sentences. " +
20
+ "Never use markdown, lists, or code blocks — your output will be spoken aloud.";
21
+ // VAD parameters tuned for conversational speech without the assistant looping
22
+ // on its own echo. These defaults are deliberately conservative:
23
+ // - threshold 0.6: less sensitive than Silero's default; avoids triggering
24
+ // on TTS reverb bleeding into the mic or low-level background noise.
25
+ // - min_speech_duration_ms 300: drops short clicks/breaths and stray words.
26
+ // - min_silence_duration_ms 700: requires a longer quiet tail before
27
+ // committing a segment. Crucial for preventing self-hearing feedback loops
28
+ // where Whisper hallucinates content from near-silent audio.
29
+ // - max_speech_duration_s 15: caps runaway utterances.
30
+ // - speech_pad_ms 200: padding improves accuracy on utterance edges.
31
+ // If the assistant cuts you off mid-sentence, raise min_silence_duration_ms.
32
+ // If it keeps hallucinating / talking to itself, raise threshold to 0.7 and/or
33
+ // min_silence_duration_ms to 900.
34
+ const VAD_PARAMS = {
35
+ threshold: 0.6,
36
+ min_speech_duration_ms: 300,
37
+ min_silence_duration_ms: 700,
38
+ max_speech_duration_s: 15.0,
39
+ speech_pad_ms: 200,
40
+ };
41
+ // Short grace period after TTS playback before we start listening again.
42
+ // Gives the speaker amp / room reverb a moment to fully settle so the first
43
+ // post-playback mic frames don't get transcribed as the tail of our own voice.
44
+ const POST_PLAYBACK_COOLDOWN_MS = 300;
45
+ // Minimum characters for an utterance to be considered meaningful. Whisper
46
+ // frequently hallucinates single words like "you", ".", or "Thanks." from
47
+ // silence or faint noise; these short phantoms are the main driver of the
48
+ // self-hearing feedback loop, so we drop them.
49
+ const MIN_UTTERANCE_CHARS = 3;
50
+ function isMeaningfulTranscript(text) {
51
+ const trimmed = text.trim();
52
+ if (trimmed.length === 0)
53
+ return false;
54
+ if (trimmed.includes("[No speech detected]"))
55
+ return false;
56
+ // Whisper sometimes emits non-linguistic cues on silence, e.g. "[BLANK_AUDIO]".
57
+ if (/^\[[^\]]+\]$/.test(trimmed))
58
+ return false;
59
+ // Strip punctuation/whitespace for the length check so ". . ." is rejected.
60
+ const letters = trimmed.replace(/[^\p{L}\p{N}]/gu, "");
61
+ if (letters.length < MIN_UTTERANCE_CHARS)
62
+ return false;
63
+ return true;
64
+ }
65
+ function sleep(ms) {
66
+ return new Promise((resolve) => setTimeout(resolve, ms));
67
+ }
68
+ // ── Main ──
69
+ for (const tool of ["ffmpeg", "ffplay"]) {
70
+ const r = spawnSync(tool, ["-version"], { stdio: "ignore" });
71
+ if (r.error || r.status !== 0) {
72
+ console.error(`${tool} not found on PATH. Install ffmpeg (ffplay ships with it) and retry.`);
73
+ process.exit(1);
74
+ }
75
+ }
76
+ console.log("Loading whisper-tiny + Silero VAD...");
77
+ const asrModelId = await loadModel({
78
+ modelSrc: WHISPER_TINY,
79
+ modelType: "whisper",
80
+ modelConfig: {
81
+ vadModelSrc: VAD_SILERO_5_1_2,
82
+ audio_format: "f32le",
83
+ strategy: "greedy",
84
+ n_threads: 4,
85
+ language: "en",
86
+ no_timestamps: true,
87
+ suppress_blank: true,
88
+ suppress_nst: true,
89
+ temperature: 0.0,
90
+ vad_params: VAD_PARAMS,
91
+ },
92
+ });
93
+ console.log("Loading Llama 3.2 1B...");
94
+ const llmModelId = await loadModel({
95
+ modelSrc: LLAMA_3_2_1B_INST_Q4_0,
96
+ modelType: "llm",
97
+ modelConfig: {
98
+ ctx_size: 4096,
99
+ },
100
+ });
101
+ console.log("Loading Supertonic TTS...");
102
+ const ttsModelId = await loadModel({
103
+ modelSrc: TTS_SUPERTONIC2_OFFICIAL_TEXT_ENCODER_SUPERTONE_FP32.src,
104
+ modelType: "tts",
105
+ modelConfig: {
106
+ ttsEngine: "supertonic",
107
+ language: "en",
108
+ ttsSpeed: 1.05,
109
+ ttsNumInferenceSteps: 5,
110
+ ttsSupertonicMultilingual: false,
111
+ ttsTextEncoderSrc: TTS_SUPERTONIC2_OFFICIAL_TEXT_ENCODER_SUPERTONE_FP32.src,
112
+ ttsDurationPredictorSrc: TTS_SUPERTONIC2_OFFICIAL_DURATION_PREDICTOR_SUPERTONE_FP32.src,
113
+ ttsVectorEstimatorSrc: TTS_SUPERTONIC2_OFFICIAL_VECTOR_ESTIMATOR_SUPERTONE_FP32.src,
114
+ ttsVocoderSrc: TTS_SUPERTONIC2_OFFICIAL_VOCODER_SUPERTONE_FP32.src,
115
+ ttsUnicodeIndexerSrc: TTS_SUPERTONIC2_OFFICIAL_UNICODE_INDEXER_SUPERTONE_FP32.src,
116
+ ttsTtsConfigSrc: TTS_SUPERTONIC2_OFFICIAL_TTS_CONFIG_SUPERTONE.src,
117
+ ttsVoiceStyleSrc: TTS_SUPERTONIC2_OFFICIAL_VOICE_STYLE_SUPERTONE.src,
118
+ },
119
+ });
120
+ console.log("All models loaded.\n");
121
+ const ffmpeg = startMicrophone({
122
+ sampleRate: MIC_SAMPLE_RATE,
123
+ format: "f32le",
124
+ });
125
+ const session = await transcribeStream({ modelId: asrModelId });
126
+ const history = [{ role: "system", content: SYSTEM_PROMPT }];
127
+ // Dropped-chunk gate: while the assistant is speaking we stop feeding the mic
128
+ // stream into the ASR session. Using a flag (rather than pausing the ffmpeg
129
+ // pipe) keeps the pipe drained so we never accumulate stale audio, and the
130
+ // VAD starts fresh on the next user turn.
131
+ let isSpeaking = false;
132
+ ffmpeg.stdout.on("data", (chunk) => {
133
+ if (isSpeaking)
134
+ return;
135
+ session.write(chunk);
136
+ });
137
+ let shuttingDown = false;
138
+ async function cleanup() {
139
+ if (shuttingDown)
140
+ return;
141
+ shuttingDown = true;
142
+ console.log("\n\nStopping...");
143
+ ffmpeg.kill();
144
+ try {
145
+ session.end();
146
+ }
147
+ catch {
148
+ // session may already be closed
149
+ }
150
+ await unloadModel({ modelId: ttsModelId }).catch(() => { });
151
+ await unloadModel({ modelId: llmModelId }).catch(() => { });
152
+ await unloadModel({ modelId: asrModelId }).catch(() => { });
153
+ console.log("Done.");
154
+ process.exit(0);
155
+ }
156
+ process.on("SIGINT", () => void cleanup());
157
+ process.on("SIGTERM", () => void cleanup());
158
+ console.log("🎙️ Listening. Speak a question and pause. Ctrl+C to quit.\n");
159
+ for await (const rawText of session) {
160
+ if (!isMeaningfulTranscript(rawText))
161
+ continue;
162
+ const userText = rawText.trim();
163
+ console.log(`🗣️ You: ${userText}`);
164
+ history.push({ role: "user", content: userText });
165
+ isSpeaking = true;
166
+ try {
167
+ process.stdout.write("🤖 Assistant: ");
168
+ const llmResult = completion({
169
+ modelId: llmModelId,
170
+ history,
171
+ stream: true,
172
+ });
173
+ let assistantText = "";
174
+ for await (const token of llmResult.tokenStream) {
175
+ process.stdout.write(token);
176
+ assistantText += token;
177
+ }
178
+ process.stdout.write("\n");
179
+ history.push({ role: "assistant", content: assistantText });
180
+ const spoken = assistantText.trim();
181
+ if (spoken.length > 0) {
182
+ const ttsResult = textToSpeech({
183
+ modelId: ttsModelId,
184
+ text: spoken,
185
+ inputType: "text",
186
+ stream: false,
187
+ });
188
+ const samples = await ttsResult.buffer;
189
+ const audioData = int16ArrayToBuffer(samples);
190
+ const wavBuffer = Buffer.concat([
191
+ createWavHeader(audioData.length, TTS_SAMPLE_RATE),
192
+ audioData,
193
+ ]);
194
+ playAudio(wavBuffer);
195
+ // Cooldown keeps the mic gated briefly so speaker tail / room reverb
196
+ // doesn't feed into the next VAD segment.
197
+ await sleep(POST_PLAYBACK_COOLDOWN_MS);
198
+ }
199
+ }
200
+ catch (turnError) {
201
+ console.error("\n⚠️ Turn failed:", turnError instanceof Error ? turnError.message : turnError);
202
+ }
203
+ finally {
204
+ isSpeaking = false;
205
+ console.log("\n🎙️ Listening...\n");
206
+ }
207
+ }
@@ -74,7 +74,7 @@ function findConfigFile(projectRoot) {
74
74
  * falls back to npx for convenience when CLI is not installed.
75
75
  */
76
76
  function resolveCliCommand(projectRoot) {
77
- const cliPath = path.join(projectRoot, "node_modules", "@qvac", "cli", "src", "index.js");
77
+ const cliPath = path.join(projectRoot, "node_modules", "@qvac", "cli", "dist", "index.js");
78
78
  if (fs.existsSync(cliPath)) {
79
79
  return `node "${cliPath}"`;
80
80
  }
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import "#polyfill-bare-globals";
2
- export { completion, deleteCache, loadModel, downloadAsset, heartbeat, startQVACProvider, stopQVACProvider, unloadModel, transcribe, transcribeStream, embed, finetune, translate, cancel, ragChunk, ragIngest, ragSaveEmbeddings, ragSearch, ragDeleteEmbeddings, ragReindex, ragListWorkspaces, ragCloseWorkspace, ragDeleteWorkspace, textToSpeech, getModelInfo, loggingStream, ocr, invokePlugin, invokePluginStream, diffusion, type DiffusionProgressTick, modelRegistryList, modelRegistrySearch, modelRegistryGetModel, type ModelRegistrySearchParams, suspend, resume, type FinetuneHandle, } from "./client/api/index";
2
+ export { completion, deleteCache, loadModel, downloadAsset, heartbeat, startQVACProvider, stopQVACProvider, unloadModel, transcribe, transcribeStream, embed, finetune, translate, cancel, ragChunk, ragIngest, ragSaveEmbeddings, ragSearch, ragDeleteEmbeddings, ragReindex, ragListWorkspaces, ragCloseWorkspace, ragDeleteWorkspace, textToSpeech, textToSpeechStream, getModelInfo, getLoadedModelInfo, loggingStream, ocr, invokePlugin, invokePluginStream, diffusion, type DiffusionProgressTick, modelRegistryList, modelRegistrySearch, modelRegistryGetModel, type ModelRegistrySearchParams, suspend, resume, state, type FinetuneHandle, } from "./client/api/index";
3
3
  export { close } from "./client/index";
4
- export { type ModelProgressUpdate, type LoadModelOptions, type DownloadAssetOptions, type Tool, type ToolCall, type ToolCallWithCall, type ToolCallError, type ToolCallEvent, type CompletionStats, type EmbedStats, VERBOSITY, type Attachment, type TranscribeStreamSession, type CompletionParams, type RagSearchResult, type RagSaveEmbeddingsResult, type RagReindexResult, type RagEmbeddedDoc, type RagDoc, type RagWorkspaceInfo, type RagCloseWorkspaceParams, type RagDeleteWorkspaceParams, type RagIngestStage, type RagReindexStage, type RagSaveStage, SDK_CLIENT_ERROR_CODES, SDK_SERVER_ERROR_CODES, type QvacConfig, type ModelInfo, type GetModelInfoParams, type LoadedInstance, type CacheFileInfo, toolSchema, type McpClient, type McpClientInput, type OCRClientParams, type OCRTextBlock, type OCROptions, type DiffusionClientParams, type DiffusionStreamResponse, type DiffusionStats, definePlugin, defineHandler, defineDuplexHandler, type QvacPlugin, type CreateModelParams, type PluginModelResult, type ModelRegistryEntry, type ModelRegistryEntryAddon, PLUGIN_LLM, PLUGIN_EMBEDDING, PLUGIN_WHISPER, PLUGIN_NMT, PLUGIN_TTS, PLUGIN_OCR, PLUGIN_DIFFUSION, SDK_DEFAULT_PLUGINS, type BuiltinPlugin, type ProfilerMode, type FinetuneValidation, type FinetuneRunParams, type FinetuneGetStateParams, type FinetuneStopParams, type FinetuneParams, type FinetuneStatus, type FinetuneProgress, type FinetuneStats, type FinetuneResult, } from "./schemas/index";
4
+ export { type LifecycleState, type ModelProgressUpdate, type LoadModelOptions, type LoadCustomPluginModelOptions, type DownloadAssetOptions, type Tool, type ToolCall, type ToolCallWithCall, type ToolCallError, type ToolCallEvent, type CompletionEvent, type CompletionFinal, type CompletionRun, type CompletionStats, type EmbedStats, VERBOSITY, type Attachment, type TranscribeStreamSession, type TranscribeStreamMetadataSession, type TranscribeSegment, type TextToSpeechStreamSession, type TextToSpeechStreamResponse, type TextToSpeechStreamClientParams, type CompletionParams, type ToolDialect, type RagSearchResult, type RagSaveEmbeddingsResult, type RagReindexResult, type RagEmbeddedDoc, type RagDoc, type RagWorkspaceInfo, type RagCloseWorkspaceParams, type RagDeleteWorkspaceParams, type RagIngestStage, type RagReindexStage, type RagSaveStage, SDK_CLIENT_ERROR_CODES, SDK_SERVER_ERROR_CODES, type QvacConfig, type ModelInfo, type GetModelInfoParams, type GetLoadedModelInfoParams, type LoadedModelInfo, type LoadedInstance, type CacheFileInfo, toolSchema, TOOLS_MODE, type ToolsMode, type McpClient, type McpClientInput, type OCRClientParams, type OCRTextBlock, type OCROptions, type DiffusionClientParams, type DiffusionStreamResponse, type DiffusionStats, definePlugin, defineHandler, defineDuplexHandler, type QvacPlugin, type CreateModelParams, type PluginModelResult, type ModelRegistryEntry, type ModelRegistryEntryAddon, PLUGIN_LLM, PLUGIN_EMBEDDING, PLUGIN_WHISPER, PLUGIN_NMT, PLUGIN_TTS, PLUGIN_OCR, PLUGIN_DIFFUSION, SDK_DEFAULT_PLUGINS, type BuiltinPlugin, type ProfilerMode, type FinetuneValidation, type FinetuneRunParams, type FinetuneGetStateParams, type FinetuneStopParams, type FinetuneParams, type FinetuneStatus, type FinetuneProgress, type FinetuneStats, type FinetuneResult, } from "./schemas/index";
5
5
  export { type ToolInput, type ToolHandler } from "./utils/tool-helpers";
6
6
  export { MODEL_TYPES, ModelType } from "./schemas/index";
7
7
  export * from "./models/registry/index";
package/dist/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import "#polyfill-bare-globals";
2
2
  // Public API exports only
3
- export { completion, deleteCache, loadModel, downloadAsset, heartbeat, startQVACProvider, stopQVACProvider, unloadModel, transcribe, transcribeStream, embed, finetune, translate, cancel, ragChunk, ragIngest, ragSaveEmbeddings, ragSearch, ragDeleteEmbeddings, ragReindex, ragListWorkspaces, ragCloseWorkspace, ragDeleteWorkspace, textToSpeech, getModelInfo, loggingStream, ocr, invokePlugin, invokePluginStream, diffusion, modelRegistryList, modelRegistrySearch, modelRegistryGetModel, suspend, resume, } from "./client/api/index.js";
3
+ export { completion, deleteCache, loadModel, downloadAsset, heartbeat, startQVACProvider, stopQVACProvider, unloadModel, transcribe, transcribeStream, embed, finetune, translate, cancel, ragChunk, ragIngest, ragSaveEmbeddings, ragSearch, ragDeleteEmbeddings, ragReindex, ragListWorkspaces, ragCloseWorkspace, ragDeleteWorkspace, textToSpeech, textToSpeechStream, getModelInfo, getLoadedModelInfo, loggingStream, ocr, invokePlugin, invokePluginStream, diffusion, modelRegistryList, modelRegistrySearch, modelRegistryGetModel, suspend, resume, state, } from "./client/api/index.js";
4
4
  export { close } from "./client/index.js";
5
- export { VERBOSITY, SDK_CLIENT_ERROR_CODES, SDK_SERVER_ERROR_CODES, toolSchema, definePlugin, defineHandler, defineDuplexHandler, PLUGIN_LLM, PLUGIN_EMBEDDING, PLUGIN_WHISPER, PLUGIN_NMT, PLUGIN_TTS, PLUGIN_OCR, PLUGIN_DIFFUSION, SDK_DEFAULT_PLUGINS, } from "./schemas/index.js";
5
+ export { VERBOSITY, SDK_CLIENT_ERROR_CODES, SDK_SERVER_ERROR_CODES, toolSchema, TOOLS_MODE, definePlugin, defineHandler, defineDuplexHandler, PLUGIN_LLM, PLUGIN_EMBEDDING, PLUGIN_WHISPER, PLUGIN_NMT, PLUGIN_TTS, PLUGIN_OCR, PLUGIN_DIFFUSION, SDK_DEFAULT_PLUGINS, } from "./schemas/index.js";
6
6
  export {} from "./utils/tool-helpers.js";
7
7
  // Model types - canonical naming with backward-compatible aliases
8
8
  export { MODEL_TYPES, ModelType } from "./schemas/index.js";
@@ -1,3 +1,14 @@
1
1
  import type { Logger, LoggerOptions } from "./types";
2
+ /**
3
+ * Creates or retrieves a namespaced logger instance.
4
+ *
5
+ * Loggers are cached per namespace when `options` is omitted, so repeated
6
+ * calls with the same namespace return the same instance. When `options` is
7
+ * supplied, a fresh logger is returned and the cache is bypassed.
8
+ *
9
+ * @param namespace - Namespace used to prefix log messages from this logger (e.g. `"my-app"`, `"@qvac/sdk:embed"`).
10
+ * @param options - Optional logger configuration (custom transports, log level, etc.). When provided, a new logger is always constructed.
11
+ * @returns A `Logger` instance scoped to `namespace`.
12
+ */
2
13
  export declare function getLogger(namespace: string, options?: LoggerOptions): Logger;
3
14
  //# sourceMappingURL=logger.d.ts.map
@@ -17,6 +17,17 @@ function createLogger(namespace, options) {
17
17
  : undefined;
18
18
  return createBaseLogger(namespace, safeOptions);
19
19
  }
20
+ /**
21
+ * Creates or retrieves a namespaced logger instance.
22
+ *
23
+ * Loggers are cached per namespace when `options` is omitted, so repeated
24
+ * calls with the same namespace return the same instance. When `options` is
25
+ * supplied, a fresh logger is returned and the cache is bypassed.
26
+ *
27
+ * @param namespace - Namespace used to prefix log messages from this logger (e.g. `"my-app"`, `"@qvac/sdk:embed"`).
28
+ * @param options - Optional logger configuration (custom transports, log level, etc.). When provided, a new logger is always constructed.
29
+ * @returns A `Logger` instance scoped to `namespace`.
30
+ */
20
31
  export function getLogger(namespace, options) {
21
32
  const cache = getLoggerCache();
22
33
  if (!options) {
@@ -1,20 +1,38 @@
1
1
  import type { LogLevel } from "@qvac/logging";
2
+ /**
3
+ * Log transport callback signature. Receives the log `level`, namespace
4
+ * scoping the message, and the formatted `message`. May return a promise to
5
+ * allow async backends (e.g., network sinks).
6
+ */
2
7
  export type LogTransport = (level: LogLevel, namespace: string, message: string) => void | Promise<void>;
3
8
  export interface LoggerOptions {
9
+ /** Minimum log level that will be emitted. */
4
10
  level?: LogLevel;
11
+ /** Namespace prefix applied to every message emitted by this logger. */
5
12
  namespace?: string;
13
+ /** Additional log transports to receive every emitted message. */
6
14
  transports?: LogTransport[];
15
+ /** When `false`, disables the default console transport. */
7
16
  enableConsole?: boolean;
8
17
  }
9
18
  export interface Logger {
19
+ /** Emits a message at the `error` level. */
10
20
  error: (...args: unknown[]) => void;
21
+ /** Emits a message at the `warn` level. */
11
22
  warn: (...args: unknown[]) => void;
23
+ /** Emits a message at the `info` level. */
12
24
  info: (...args: unknown[]) => void;
25
+ /** Emits a message at the `debug` level. */
13
26
  debug: (...args: unknown[]) => void;
27
+ /** Emits a message at the `trace` level. */
14
28
  trace: (...args: unknown[]) => void;
29
+ /** Sets the logger's minimum log level. */
15
30
  setLevel: (level: LogLevel) => void;
31
+ /** Returns the logger's current minimum log level. */
16
32
  getLevel: () => LogLevel;
33
+ /** Registers an additional log transport with this logger. */
17
34
  addTransport: (transport: LogTransport) => void;
35
+ /** Enables or disables this logger's default console transport. */
18
36
  setConsoleOutput: (enabled: boolean) => void;
19
37
  }
20
38
  //# sourceMappingURL=types.d.ts.map