@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
@@ -12,11 +12,12 @@ import { provideRequestSchema, provideResponseSchema } from "./provide.js";
12
12
  import { stopProvideRequestSchema, stopProvideResponseSchema, } from "./stop-provide.js";
13
13
  import { translateRequestSchema, translateResponseSchema } from "./translate.js";
14
14
  import { loggingStreamRequestSchema, loggingStreamResponseSchema, } from "./logging-stream.js";
15
- import { ttsRequestSchema, ttsResponseSchema } from "./text-to-speech.js";
15
+ import { ttsRequestSchema, ttsResponseSchema, textToSpeechStreamRequestSchema, textToSpeechStreamResponseSchema, } from "./text-to-speech.js";
16
16
  import { errorResponseSchema } from "./error.js";
17
17
  import { ragRequestSchema, ragResponseSchema, ragProgressUpdateSchema, } from "./rag.js";
18
18
  import { deleteCacheRequestSchema, deleteCacheResponseSchema, } from "./delete-cache.js";
19
19
  import { getModelInfoRequestSchema, getModelInfoResponseSchema, } from "./get-model-info.js";
20
+ import { getLoadedModelInfoRequestSchema, getLoadedModelInfoResponseSchema, } from "./get-loaded-model-info.js";
20
21
  import { ocrStreamRequestSchema, ocrStreamResponseSchema } from "./ocr.js";
21
22
  import { diffusionStreamRequestSchema, diffusionStreamResponseSchema, } from "./sdcpp-config.js";
22
23
  import { finetuneRequestSchema, finetuneResponseSchema, finetuneProgressResponseSchema, } from "./finetune.js";
@@ -24,6 +25,7 @@ import { pluginInvokeRequestSchema, pluginInvokeResponseSchema, pluginInvokeStre
24
25
  import { modelRegistryListRequestSchema, modelRegistryListResponseSchema, modelRegistrySearchRequestSchema, modelRegistrySearchResponseSchema, modelRegistryGetModelRequestSchema, modelRegistryGetModelResponseSchema, } from "./registry.js";
25
26
  import { suspendRequestSchema, suspendResponseSchema } from "./suspend.js";
26
27
  import { resumeRequestSchema, resumeResponseSchema } from "./resume.js";
28
+ import { stateRequestSchema, stateResponseSchema } from "./state.js";
27
29
  export const requestSchema = z.union([
28
30
  heartbeatRequestSchema,
29
31
  loadModelRequestSchema,
@@ -36,12 +38,14 @@ export const requestSchema = z.union([
36
38
  embedRequestSchema,
37
39
  translateRequestSchema,
38
40
  ttsRequestSchema,
41
+ textToSpeechStreamRequestSchema,
39
42
  cancelRequestSchema,
40
43
  provideRequestSchema,
41
44
  stopProvideRequestSchema,
42
45
  ragRequestSchema,
43
46
  deleteCacheRequestSchema,
44
47
  getModelInfoRequestSchema,
48
+ getLoadedModelInfoRequestSchema,
45
49
  ocrStreamRequestSchema,
46
50
  diffusionStreamRequestSchema,
47
51
  finetuneRequestSchema,
@@ -52,6 +56,7 @@ export const requestSchema = z.union([
52
56
  modelRegistryGetModelRequestSchema,
53
57
  suspendRequestSchema,
54
58
  resumeRequestSchema,
59
+ stateRequestSchema,
55
60
  ]);
56
61
  export const responseSchema = z.discriminatedUnion("type", [
57
62
  heartbeatResponseSchema,
@@ -66,6 +71,7 @@ export const responseSchema = z.discriminatedUnion("type", [
66
71
  embedResponseSchema,
67
72
  translateResponseSchema,
68
73
  ttsResponseSchema,
74
+ textToSpeechStreamResponseSchema,
69
75
  cancelResponseSchema,
70
76
  provideResponseSchema,
71
77
  stopProvideResponseSchema,
@@ -74,6 +80,7 @@ export const responseSchema = z.discriminatedUnion("type", [
74
80
  ragProgressUpdateSchema,
75
81
  deleteCacheResponseSchema,
76
82
  getModelInfoResponseSchema,
83
+ getLoadedModelInfoResponseSchema,
77
84
  ocrStreamResponseSchema,
78
85
  diffusionStreamResponseSchema,
79
86
  finetuneResponseSchema,
@@ -85,10 +92,24 @@ export const responseSchema = z.discriminatedUnion("type", [
85
92
  modelRegistryGetModelResponseSchema,
86
93
  suspendResponseSchema,
87
94
  resumeResponseSchema,
95
+ stateResponseSchema,
88
96
  ]);
89
97
  export const rpcOptionsSchema = z.object({
90
- timeout: z.number().min(100).optional(),
91
- healthCheckTimeout: z.number().min(100).optional(),
92
- forceNewConnection: z.boolean().optional(),
93
- profiling: perCallProfilingSchema.optional(),
98
+ timeout: z
99
+ .number()
100
+ .min(100)
101
+ .optional()
102
+ .describe("Per-call RPC timeout in milliseconds; overrides the SDK-level default for this request only."),
103
+ healthCheckTimeout: z
104
+ .number()
105
+ .min(100)
106
+ .optional()
107
+ .describe("Timeout in milliseconds for the health-check probe that precedes the RPC call."),
108
+ forceNewConnection: z
109
+ .boolean()
110
+ .optional()
111
+ .describe("When `true`, skip any cached RPC connection and open a fresh one for this call."),
112
+ profiling: perCallProfilingSchema
113
+ .optional()
114
+ .describe("Per-call profiler configuration; when present, overrides the SDK's global profiler settings for this request."),
94
115
  });
@@ -0,0 +1,225 @@
1
+ import { z } from "zod";
2
+ import { type Tool, type ToolCallWithCall } from "./tools";
3
+ import type { ToolDialect } from "./completion-stream";
4
+ export declare const completionStatsSchema: z.ZodObject<{
5
+ timeToFirstToken: z.ZodOptional<z.ZodNumber>;
6
+ tokensPerSecond: z.ZodOptional<z.ZodNumber>;
7
+ cacheTokens: z.ZodOptional<z.ZodNumber>;
8
+ generatedTokens: z.ZodOptional<z.ZodNumber>;
9
+ backendDevice: z.ZodOptional<z.ZodEnum<{
10
+ cpu: "cpu";
11
+ gpu: "gpu";
12
+ }>>;
13
+ }, z.core.$strip>;
14
+ export type CompletionStats = z.infer<typeof completionStatsSchema>;
15
+ export declare const seqSchema: z.ZodNumber;
16
+ export declare const contentDeltaEventSchema: z.ZodObject<{
17
+ type: z.ZodLiteral<"contentDelta">;
18
+ seq: z.ZodNumber;
19
+ text: z.ZodString;
20
+ }, z.core.$strip>;
21
+ export declare const rawDeltaEventSchema: z.ZodObject<{
22
+ type: z.ZodLiteral<"rawDelta">;
23
+ seq: z.ZodNumber;
24
+ text: z.ZodString;
25
+ }, z.core.$strip>;
26
+ export declare const thinkingDeltaEventSchema: z.ZodObject<{
27
+ type: z.ZodLiteral<"thinkingDelta">;
28
+ seq: z.ZodNumber;
29
+ text: z.ZodString;
30
+ }, z.core.$strip>;
31
+ export declare const toolCallEventSchema: z.ZodObject<{
32
+ type: z.ZodLiteral<"toolCall">;
33
+ seq: z.ZodNumber;
34
+ call: z.ZodObject<{
35
+ id: z.ZodString;
36
+ name: z.ZodString;
37
+ arguments: z.ZodRecord<z.ZodString, z.ZodUnknown>;
38
+ raw: z.ZodOptional<z.ZodString>;
39
+ }, z.core.$strip>;
40
+ }, z.core.$strip>;
41
+ export declare const toolErrorEventSchema: z.ZodObject<{
42
+ type: z.ZodLiteral<"toolError">;
43
+ seq: z.ZodNumber;
44
+ error: z.ZodObject<{
45
+ code: z.ZodEnum<{
46
+ PARSE_ERROR: "PARSE_ERROR";
47
+ VALIDATION_ERROR: "VALIDATION_ERROR";
48
+ UNKNOWN_TOOL: "UNKNOWN_TOOL";
49
+ }>;
50
+ message: z.ZodString;
51
+ raw: z.ZodOptional<z.ZodString>;
52
+ }, z.core.$strip>;
53
+ }, z.core.$strip>;
54
+ export declare const statsEventSchema: z.ZodObject<{
55
+ type: z.ZodLiteral<"completionStats">;
56
+ seq: z.ZodNumber;
57
+ stats: z.ZodObject<{
58
+ timeToFirstToken: z.ZodOptional<z.ZodNumber>;
59
+ tokensPerSecond: z.ZodOptional<z.ZodNumber>;
60
+ cacheTokens: z.ZodOptional<z.ZodNumber>;
61
+ generatedTokens: z.ZodOptional<z.ZodNumber>;
62
+ backendDevice: z.ZodOptional<z.ZodEnum<{
63
+ cpu: "cpu";
64
+ gpu: "gpu";
65
+ }>>;
66
+ }, z.core.$strip>;
67
+ }, z.core.$strip>;
68
+ export declare const completionErrorSchema: z.ZodObject<{
69
+ message: z.ZodString;
70
+ }, z.core.$strip>;
71
+ declare const stopReasonEnum: z.ZodEnum<{
72
+ eos: "eos";
73
+ length: "length";
74
+ stopSequence: "stopSequence";
75
+ }>;
76
+ export declare const doneEventSchema: z.ZodUnion<readonly [z.ZodObject<{
77
+ type: z.ZodLiteral<"completionDone">;
78
+ seq: z.ZodNumber;
79
+ stopReason: z.ZodLiteral<"error">;
80
+ error: z.ZodObject<{
81
+ message: z.ZodString;
82
+ }, z.core.$strip>;
83
+ raw: z.ZodOptional<z.ZodObject<{
84
+ fullText: z.ZodString;
85
+ }, z.core.$strip>>;
86
+ }, z.core.$strict>, z.ZodObject<{
87
+ type: z.ZodLiteral<"completionDone">;
88
+ seq: z.ZodNumber;
89
+ stopReason: z.ZodOptional<z.ZodEnum<{
90
+ eos: "eos";
91
+ length: "length";
92
+ stopSequence: "stopSequence";
93
+ }>>;
94
+ raw: z.ZodOptional<z.ZodObject<{
95
+ fullText: z.ZodString;
96
+ }, z.core.$strip>>;
97
+ }, z.core.$strict>]>;
98
+ export declare const completionEventSchema: z.ZodUnion<readonly [z.ZodObject<{
99
+ type: z.ZodLiteral<"contentDelta">;
100
+ seq: z.ZodNumber;
101
+ text: z.ZodString;
102
+ }, z.core.$strip>, z.ZodObject<{
103
+ type: z.ZodLiteral<"rawDelta">;
104
+ seq: z.ZodNumber;
105
+ text: z.ZodString;
106
+ }, z.core.$strip>, z.ZodObject<{
107
+ type: z.ZodLiteral<"thinkingDelta">;
108
+ seq: z.ZodNumber;
109
+ text: z.ZodString;
110
+ }, z.core.$strip>, z.ZodObject<{
111
+ type: z.ZodLiteral<"toolCall">;
112
+ seq: z.ZodNumber;
113
+ call: z.ZodObject<{
114
+ id: z.ZodString;
115
+ name: z.ZodString;
116
+ arguments: z.ZodRecord<z.ZodString, z.ZodUnknown>;
117
+ raw: z.ZodOptional<z.ZodString>;
118
+ }, z.core.$strip>;
119
+ }, z.core.$strip>, z.ZodObject<{
120
+ type: z.ZodLiteral<"toolError">;
121
+ seq: z.ZodNumber;
122
+ error: z.ZodObject<{
123
+ code: z.ZodEnum<{
124
+ PARSE_ERROR: "PARSE_ERROR";
125
+ VALIDATION_ERROR: "VALIDATION_ERROR";
126
+ UNKNOWN_TOOL: "UNKNOWN_TOOL";
127
+ }>;
128
+ message: z.ZodString;
129
+ raw: z.ZodOptional<z.ZodString>;
130
+ }, z.core.$strip>;
131
+ }, z.core.$strip>, z.ZodObject<{
132
+ type: z.ZodLiteral<"completionStats">;
133
+ seq: z.ZodNumber;
134
+ stats: z.ZodObject<{
135
+ timeToFirstToken: z.ZodOptional<z.ZodNumber>;
136
+ tokensPerSecond: z.ZodOptional<z.ZodNumber>;
137
+ cacheTokens: z.ZodOptional<z.ZodNumber>;
138
+ generatedTokens: z.ZodOptional<z.ZodNumber>;
139
+ backendDevice: z.ZodOptional<z.ZodEnum<{
140
+ cpu: "cpu";
141
+ gpu: "gpu";
142
+ }>>;
143
+ }, z.core.$strip>;
144
+ }, z.core.$strip>, z.ZodObject<{
145
+ type: z.ZodLiteral<"completionDone">;
146
+ seq: z.ZodNumber;
147
+ stopReason: z.ZodLiteral<"error">;
148
+ error: z.ZodObject<{
149
+ message: z.ZodString;
150
+ }, z.core.$strip>;
151
+ raw: z.ZodOptional<z.ZodObject<{
152
+ fullText: z.ZodString;
153
+ }, z.core.$strip>>;
154
+ }, z.core.$strict>, z.ZodObject<{
155
+ type: z.ZodLiteral<"completionDone">;
156
+ seq: z.ZodNumber;
157
+ stopReason: z.ZodOptional<z.ZodEnum<{
158
+ eos: "eos";
159
+ length: "length";
160
+ stopSequence: "stopSequence";
161
+ }>>;
162
+ raw: z.ZodOptional<z.ZodObject<{
163
+ fullText: z.ZodString;
164
+ }, z.core.$strip>>;
165
+ }, z.core.$strict>]>;
166
+ export type ContentDeltaEvent = z.infer<typeof contentDeltaEventSchema>;
167
+ export type RawDeltaEvent = z.infer<typeof rawDeltaEventSchema>;
168
+ export type ThinkingDeltaEvent = z.infer<typeof thinkingDeltaEventSchema>;
169
+ export type ToolCallEvent = z.infer<typeof toolCallEventSchema>;
170
+ export type ToolErrorEvent = z.infer<typeof toolErrorEventSchema>;
171
+ export type StatsEvent = z.infer<typeof statsEventSchema>;
172
+ export type CompletionError = z.infer<typeof completionErrorSchema>;
173
+ export type DoneEvent = z.infer<typeof doneEventSchema>;
174
+ export type CompletionEvent = z.infer<typeof completionEventSchema>;
175
+ export type StopReason = z.infer<typeof stopReasonEnum>;
176
+ export type CompletionFinal = {
177
+ contentText: string;
178
+ thinkingText?: string;
179
+ toolCalls: ToolCallWithCall[];
180
+ stats?: CompletionStats;
181
+ raw: {
182
+ fullText: string;
183
+ };
184
+ /**
185
+ * Canonical assistant text to push back into `history` for the next turn
186
+ * when using `kvCache: true` (auto-cache). Equals the assistant content
187
+ * the SDK persisted to the cache key on this turn, so re-using it
188
+ * verbatim guarantees a cache hit on the next call.
189
+ *
190
+ * Derived from `raw.fullText` (or `contentText` if the addon didn't
191
+ * emit raw text) by stripping `<think>` reasoning blocks and trimming
192
+ * surrounding whitespace — see `normalizeAssistantCacheContent`.
193
+ *
194
+ * Tool-call turns currently can't be auto-cached, so this
195
+ * field is omitted when `toolCalls.length > 0`.
196
+ */
197
+ cacheableAssistantContent?: string;
198
+ };
199
+ export type CompletionRun = {
200
+ /** Ordered stream of typed completion events — the canonical consumption API. */
201
+ events: AsyncIterable<CompletionEvent>;
202
+ /** Resolves when the stream ends with aggregated content, thinking, tool calls, stats, and raw output. */
203
+ final: Promise<CompletionFinal>;
204
+ tokenStream: AsyncGenerator<string>;
205
+ toolCallStream: AsyncGenerator<ToolCallEvent>;
206
+ text: Promise<string>;
207
+ toolCalls: Promise<ToolCallWithCall[]>;
208
+ stats: Promise<CompletionStats | undefined>;
209
+ };
210
+ export type ToolCallingCapability = "textParse" | "none";
211
+ export type ThinkingFramingCapability = "thinkTags" | "none";
212
+ export type PluginCapabilities = {
213
+ toolCalling: ToolCallingCapability;
214
+ thinkingFraming: ThinkingFramingCapability;
215
+ };
216
+ export declare const DEFAULT_PLUGIN_CAPABILITIES: PluginCapabilities;
217
+ export type NormalizerConfig = {
218
+ capabilities: PluginCapabilities;
219
+ tools: Tool[];
220
+ captureThinking: boolean;
221
+ emitRawDeltas: boolean;
222
+ toolDialect?: ToolDialect;
223
+ };
224
+ export {};
225
+ //# sourceMappingURL=completion-event.d.ts.map
@@ -0,0 +1,79 @@
1
+ import { z } from "zod";
2
+ import { toolCallSchema, toolCallErrorSchema, } from "./tools.js";
3
+ export const completionStatsSchema = z.object({
4
+ timeToFirstToken: z.number().optional(),
5
+ tokensPerSecond: z.number().optional(),
6
+ cacheTokens: z.number().optional(),
7
+ generatedTokens: z.number().optional(),
8
+ backendDevice: z.enum(["cpu", "gpu"]).optional(),
9
+ });
10
+ export const seqSchema = z.number().int().nonnegative();
11
+ export const contentDeltaEventSchema = z.object({
12
+ type: z.literal("contentDelta"),
13
+ seq: seqSchema,
14
+ text: z.string(),
15
+ });
16
+ export const rawDeltaEventSchema = z.object({
17
+ type: z.literal("rawDelta"),
18
+ seq: seqSchema,
19
+ text: z.string(),
20
+ });
21
+ export const thinkingDeltaEventSchema = z.object({
22
+ type: z.literal("thinkingDelta"),
23
+ seq: seqSchema,
24
+ text: z.string(),
25
+ });
26
+ export const toolCallEventSchema = z.object({
27
+ type: z.literal("toolCall"),
28
+ seq: seqSchema,
29
+ call: toolCallSchema,
30
+ });
31
+ export const toolErrorEventSchema = z.object({
32
+ type: z.literal("toolError"),
33
+ seq: seqSchema,
34
+ error: toolCallErrorSchema,
35
+ });
36
+ export const statsEventSchema = z.object({
37
+ type: z.literal("completionStats"),
38
+ seq: seqSchema,
39
+ stats: completionStatsSchema,
40
+ });
41
+ export const completionErrorSchema = z.object({
42
+ message: z.string(),
43
+ });
44
+ const rawOutputSchema = z.object({
45
+ fullText: z.string(),
46
+ });
47
+ const stopReasonEnum = z.enum(["eos", "length", "stopSequence"]);
48
+ const successDoneSchema = z
49
+ .object({
50
+ type: z.literal("completionDone"),
51
+ seq: seqSchema,
52
+ stopReason: stopReasonEnum.optional(),
53
+ raw: rawOutputSchema.optional(),
54
+ })
55
+ .strict();
56
+ const errorDoneSchema = z
57
+ .object({
58
+ type: z.literal("completionDone"),
59
+ seq: seqSchema,
60
+ stopReason: z.literal("error"),
61
+ error: completionErrorSchema,
62
+ raw: rawOutputSchema.optional(),
63
+ })
64
+ .strict();
65
+ export const doneEventSchema = z.union([errorDoneSchema, successDoneSchema]);
66
+ export const completionEventSchema = z.union([
67
+ contentDeltaEventSchema,
68
+ rawDeltaEventSchema,
69
+ thinkingDeltaEventSchema,
70
+ toolCallEventSchema,
71
+ toolErrorEventSchema,
72
+ statsEventSchema,
73
+ errorDoneSchema,
74
+ successDoneSchema,
75
+ ]);
76
+ export const DEFAULT_PLUGIN_CAPABILITIES = {
77
+ toolCalling: "none",
78
+ thinkingFraming: "none",
79
+ };
@@ -1,4 +1,21 @@
1
1
  import { z } from "zod";
2
+ export { completionStatsSchema, type CompletionStats } from "./completion-event";
3
+ /**
4
+ * Tool-call output dialect. Auto-detected from the model name; pass via
5
+ * `completion({ toolDialect })` to override.
6
+ *
7
+ * Expected raw model output per dialect:
8
+ * - `"hermes"`: `<tool_call>{"name":"get_weather","arguments":{"city":"Tokyo"}}</tool_call>`
9
+ * - `"pythonic"`: `[get_weather(city="Tokyo")]` (optionally `<|tool_call_start|>...<|tool_call_end|>`-wrapped)
10
+ * - `"json"`: `{"name":"get_weather","arguments":{"city":"Tokyo"}}` or `{"tool_calls":[{"name":"...","arguments":{...}}]}`
11
+ * - `"harmony"`: `<|channel|>commentary to=functions.get_weather <|constrain|>json<|message|>{"city":"Tokyo"}<|call|>`
12
+ */
13
+ export declare const toolDialectSchema: z.ZodEnum<{
14
+ hermes: "hermes";
15
+ pythonic: "pythonic";
16
+ json: "json";
17
+ harmony: "harmony";
18
+ }>;
2
19
  export declare const attachmentSchema: z.ZodObject<{
3
20
  path: z.ZodString;
4
21
  }, z.core.$strip>;
@@ -12,6 +29,19 @@ export declare const generationParamsSchema: z.ZodObject<{
12
29
  presence_penalty: z.ZodOptional<z.ZodNumber>;
13
30
  repeat_penalty: z.ZodOptional<z.ZodNumber>;
14
31
  }, z.core.$strict>;
32
+ export declare const responseFormatSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
33
+ type: z.ZodLiteral<"text">;
34
+ }, z.core.$strict>, z.ZodObject<{
35
+ type: z.ZodLiteral<"json_object">;
36
+ }, z.core.$strict>, z.ZodObject<{
37
+ type: z.ZodLiteral<"json_schema">;
38
+ json_schema: z.ZodObject<{
39
+ name: z.ZodString;
40
+ description: z.ZodOptional<z.ZodString>;
41
+ schema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
42
+ strict: z.ZodOptional<z.ZodBoolean>;
43
+ }, z.core.$strict>;
44
+ }, z.core.$strict>], "type">;
15
45
  export declare const completionParamsSchema: z.ZodObject<{
16
46
  history: z.ZodArray<z.ZodObject<{
17
47
  role: z.ZodString;
@@ -65,6 +95,27 @@ export declare const completionClientParamsSchema: z.ZodObject<{
65
95
  presence_penalty: z.ZodOptional<z.ZodNumber>;
66
96
  repeat_penalty: z.ZodOptional<z.ZodNumber>;
67
97
  }, z.core.$strict>>;
98
+ captureThinking: z.ZodOptional<z.ZodBoolean>;
99
+ emitRawDeltas: z.ZodOptional<z.ZodBoolean>;
100
+ toolDialect: z.ZodOptional<z.ZodEnum<{
101
+ hermes: "hermes";
102
+ pythonic: "pythonic";
103
+ json: "json";
104
+ harmony: "harmony";
105
+ }>>;
106
+ responseFormat: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
107
+ type: z.ZodLiteral<"text">;
108
+ }, z.core.$strict>, z.ZodObject<{
109
+ type: z.ZodLiteral<"json_object">;
110
+ }, z.core.$strict>, z.ZodObject<{
111
+ type: z.ZodLiteral<"json_schema">;
112
+ json_schema: z.ZodObject<{
113
+ name: z.ZodString;
114
+ description: z.ZodOptional<z.ZodString>;
115
+ schema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
116
+ strict: z.ZodOptional<z.ZodBoolean>;
117
+ }, z.core.$strict>;
118
+ }, z.core.$strict>], "type">>;
68
119
  }, z.core.$strip>;
69
120
  export declare const completionStreamRequestSchema: z.ZodObject<{
70
121
  history: z.ZodArray<z.ZodObject<{
@@ -108,32 +159,47 @@ export declare const completionStreamRequestSchema: z.ZodObject<{
108
159
  presence_penalty: z.ZodOptional<z.ZodNumber>;
109
160
  repeat_penalty: z.ZodOptional<z.ZodNumber>;
110
161
  }, z.core.$strict>>;
111
- type: z.ZodLiteral<"completionStream">;
112
- }, z.core.$strip>;
113
- export declare const completionStatsSchema: z.ZodObject<{
114
- timeToFirstToken: z.ZodOptional<z.ZodNumber>;
115
- tokensPerSecond: z.ZodOptional<z.ZodNumber>;
116
- cacheTokens: z.ZodOptional<z.ZodNumber>;
117
- backendDevice: z.ZodOptional<z.ZodEnum<{
118
- cpu: "cpu";
119
- gpu: "gpu";
162
+ captureThinking: z.ZodOptional<z.ZodBoolean>;
163
+ emitRawDeltas: z.ZodOptional<z.ZodBoolean>;
164
+ toolDialect: z.ZodOptional<z.ZodEnum<{
165
+ hermes: "hermes";
166
+ pythonic: "pythonic";
167
+ json: "json";
168
+ harmony: "harmony";
120
169
  }>>;
170
+ responseFormat: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
171
+ type: z.ZodLiteral<"text">;
172
+ }, z.core.$strict>, z.ZodObject<{
173
+ type: z.ZodLiteral<"json_object">;
174
+ }, z.core.$strict>, z.ZodObject<{
175
+ type: z.ZodLiteral<"json_schema">;
176
+ json_schema: z.ZodObject<{
177
+ name: z.ZodString;
178
+ description: z.ZodOptional<z.ZodString>;
179
+ schema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
180
+ strict: z.ZodOptional<z.ZodBoolean>;
181
+ }, z.core.$strict>;
182
+ }, z.core.$strict>], "type">>;
183
+ type: z.ZodLiteral<"completionStream">;
121
184
  }, z.core.$strip>;
122
185
  export declare const completionStreamResponseSchema: z.ZodObject<{
123
186
  type: z.ZodLiteral<"completionStream">;
124
- token: z.ZodString;
125
187
  done: z.ZodOptional<z.ZodBoolean>;
126
- stats: z.ZodOptional<z.ZodObject<{
127
- timeToFirstToken: z.ZodOptional<z.ZodNumber>;
128
- tokensPerSecond: z.ZodOptional<z.ZodNumber>;
129
- cacheTokens: z.ZodOptional<z.ZodNumber>;
130
- backendDevice: z.ZodOptional<z.ZodEnum<{
131
- cpu: "cpu";
132
- gpu: "gpu";
133
- }>>;
134
- }, z.core.$strip>>;
135
- toolCallEvent: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
188
+ events: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
189
+ type: z.ZodLiteral<"contentDelta">;
190
+ seq: z.ZodNumber;
191
+ text: z.ZodString;
192
+ }, z.core.$strip>, z.ZodObject<{
193
+ type: z.ZodLiteral<"rawDelta">;
194
+ seq: z.ZodNumber;
195
+ text: z.ZodString;
196
+ }, z.core.$strip>, z.ZodObject<{
197
+ type: z.ZodLiteral<"thinkingDelta">;
198
+ seq: z.ZodNumber;
199
+ text: z.ZodString;
200
+ }, z.core.$strip>, z.ZodObject<{
136
201
  type: z.ZodLiteral<"toolCall">;
202
+ seq: z.ZodNumber;
137
203
  call: z.ZodObject<{
138
204
  id: z.ZodString;
139
205
  name: z.ZodString;
@@ -141,7 +207,8 @@ export declare const completionStreamResponseSchema: z.ZodObject<{
141
207
  raw: z.ZodOptional<z.ZodString>;
142
208
  }, z.core.$strip>;
143
209
  }, z.core.$strip>, z.ZodObject<{
144
- type: z.ZodLiteral<"toolCallError">;
210
+ type: z.ZodLiteral<"toolError">;
211
+ seq: z.ZodNumber;
145
212
  error: z.ZodObject<{
146
213
  code: z.ZodEnum<{
147
214
  PARSE_ERROR: "PARSE_ERROR";
@@ -151,20 +218,48 @@ export declare const completionStreamResponseSchema: z.ZodObject<{
151
218
  message: z.ZodString;
152
219
  raw: z.ZodOptional<z.ZodString>;
153
220
  }, z.core.$strip>;
154
- }, z.core.$strip>]>>;
155
- toolCalls: z.ZodOptional<z.ZodArray<z.ZodObject<{
156
- id: z.ZodString;
157
- name: z.ZodString;
158
- arguments: z.ZodRecord<z.ZodString, z.ZodUnknown>;
159
- raw: z.ZodOptional<z.ZodString>;
160
- }, z.core.$strip>>>;
161
- error: z.ZodOptional<z.ZodString>;
162
- }, z.core.$strip>;
221
+ }, z.core.$strip>, z.ZodObject<{
222
+ type: z.ZodLiteral<"completionStats">;
223
+ seq: z.ZodNumber;
224
+ stats: z.ZodObject<{
225
+ timeToFirstToken: z.ZodOptional<z.ZodNumber>;
226
+ tokensPerSecond: z.ZodOptional<z.ZodNumber>;
227
+ cacheTokens: z.ZodOptional<z.ZodNumber>;
228
+ generatedTokens: z.ZodOptional<z.ZodNumber>;
229
+ backendDevice: z.ZodOptional<z.ZodEnum<{
230
+ cpu: "cpu";
231
+ gpu: "gpu";
232
+ }>>;
233
+ }, z.core.$strip>;
234
+ }, z.core.$strip>, z.ZodObject<{
235
+ type: z.ZodLiteral<"completionDone">;
236
+ seq: z.ZodNumber;
237
+ stopReason: z.ZodLiteral<"error">;
238
+ error: z.ZodObject<{
239
+ message: z.ZodString;
240
+ }, z.core.$strip>;
241
+ raw: z.ZodOptional<z.ZodObject<{
242
+ fullText: z.ZodString;
243
+ }, z.core.$strip>>;
244
+ }, z.core.$strict>, z.ZodObject<{
245
+ type: z.ZodLiteral<"completionDone">;
246
+ seq: z.ZodNumber;
247
+ stopReason: z.ZodOptional<z.ZodEnum<{
248
+ eos: "eos";
249
+ length: "length";
250
+ stopSequence: "stopSequence";
251
+ }>>;
252
+ raw: z.ZodOptional<z.ZodObject<{
253
+ fullText: z.ZodString;
254
+ }, z.core.$strip>>;
255
+ }, z.core.$strict>]>>;
256
+ }, z.core.$strict>;
163
257
  export type GenerationParams = z.infer<typeof generationParamsSchema>;
164
258
  export type CompletionParams = z.infer<typeof completionParamsSchema>;
259
+ export type ToolDialect = z.infer<typeof toolDialectSchema>;
260
+ export type ResponseFormat = z.infer<typeof responseFormatSchema>;
165
261
  export type CompletionClientParams = z.input<typeof completionClientParamsSchema>;
166
262
  export type CompletionStreamRequest = z.infer<typeof completionStreamRequestSchema>;
167
263
  export type CompletionStreamResponse = z.infer<typeof completionStreamResponseSchema>;
168
264
  export type Attachment = z.infer<typeof attachmentSchema>;
169
- export type CompletionStats = z.infer<typeof completionStatsSchema>;
170
265
  //# sourceMappingURL=completion-stream.d.ts.map