@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
@@ -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,19 @@
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
+ */
12
+ export declare const toolDialectSchema: z.ZodEnum<{
13
+ hermes: "hermes";
14
+ pythonic: "pythonic";
15
+ json: "json";
16
+ }>;
2
17
  export declare const attachmentSchema: z.ZodObject<{
3
18
  path: z.ZodString;
4
19
  }, z.core.$strip>;
@@ -12,6 +27,19 @@ export declare const generationParamsSchema: z.ZodObject<{
12
27
  presence_penalty: z.ZodOptional<z.ZodNumber>;
13
28
  repeat_penalty: z.ZodOptional<z.ZodNumber>;
14
29
  }, z.core.$strict>;
30
+ export declare const responseFormatSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
31
+ type: z.ZodLiteral<"text">;
32
+ }, z.core.$strict>, z.ZodObject<{
33
+ type: z.ZodLiteral<"json_object">;
34
+ }, z.core.$strict>, z.ZodObject<{
35
+ type: z.ZodLiteral<"json_schema">;
36
+ json_schema: z.ZodObject<{
37
+ name: z.ZodString;
38
+ description: z.ZodOptional<z.ZodString>;
39
+ schema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
40
+ strict: z.ZodOptional<z.ZodBoolean>;
41
+ }, z.core.$strict>;
42
+ }, z.core.$strict>], "type">;
15
43
  export declare const completionParamsSchema: z.ZodObject<{
16
44
  history: z.ZodArray<z.ZodObject<{
17
45
  role: z.ZodString;
@@ -65,6 +93,26 @@ export declare const completionClientParamsSchema: z.ZodObject<{
65
93
  presence_penalty: z.ZodOptional<z.ZodNumber>;
66
94
  repeat_penalty: z.ZodOptional<z.ZodNumber>;
67
95
  }, z.core.$strict>>;
96
+ captureThinking: z.ZodOptional<z.ZodBoolean>;
97
+ emitRawDeltas: z.ZodOptional<z.ZodBoolean>;
98
+ toolDialect: z.ZodOptional<z.ZodEnum<{
99
+ hermes: "hermes";
100
+ pythonic: "pythonic";
101
+ json: "json";
102
+ }>>;
103
+ responseFormat: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
104
+ type: z.ZodLiteral<"text">;
105
+ }, z.core.$strict>, z.ZodObject<{
106
+ type: z.ZodLiteral<"json_object">;
107
+ }, z.core.$strict>, z.ZodObject<{
108
+ type: z.ZodLiteral<"json_schema">;
109
+ json_schema: z.ZodObject<{
110
+ name: z.ZodString;
111
+ description: z.ZodOptional<z.ZodString>;
112
+ schema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
113
+ strict: z.ZodOptional<z.ZodBoolean>;
114
+ }, z.core.$strict>;
115
+ }, z.core.$strict>], "type">>;
68
116
  }, z.core.$strip>;
69
117
  export declare const completionStreamRequestSchema: z.ZodObject<{
70
118
  history: z.ZodArray<z.ZodObject<{
@@ -108,32 +156,46 @@ export declare const completionStreamRequestSchema: z.ZodObject<{
108
156
  presence_penalty: z.ZodOptional<z.ZodNumber>;
109
157
  repeat_penalty: z.ZodOptional<z.ZodNumber>;
110
158
  }, 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";
159
+ captureThinking: z.ZodOptional<z.ZodBoolean>;
160
+ emitRawDeltas: z.ZodOptional<z.ZodBoolean>;
161
+ toolDialect: z.ZodOptional<z.ZodEnum<{
162
+ hermes: "hermes";
163
+ pythonic: "pythonic";
164
+ json: "json";
120
165
  }>>;
166
+ responseFormat: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
167
+ type: z.ZodLiteral<"text">;
168
+ }, z.core.$strict>, z.ZodObject<{
169
+ type: z.ZodLiteral<"json_object">;
170
+ }, z.core.$strict>, z.ZodObject<{
171
+ type: z.ZodLiteral<"json_schema">;
172
+ json_schema: z.ZodObject<{
173
+ name: z.ZodString;
174
+ description: z.ZodOptional<z.ZodString>;
175
+ schema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
176
+ strict: z.ZodOptional<z.ZodBoolean>;
177
+ }, z.core.$strict>;
178
+ }, z.core.$strict>], "type">>;
179
+ type: z.ZodLiteral<"completionStream">;
121
180
  }, z.core.$strip>;
122
181
  export declare const completionStreamResponseSchema: z.ZodObject<{
123
182
  type: z.ZodLiteral<"completionStream">;
124
- token: z.ZodString;
125
183
  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<{
184
+ events: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
185
+ type: z.ZodLiteral<"contentDelta">;
186
+ seq: z.ZodNumber;
187
+ text: z.ZodString;
188
+ }, z.core.$strip>, z.ZodObject<{
189
+ type: z.ZodLiteral<"rawDelta">;
190
+ seq: z.ZodNumber;
191
+ text: z.ZodString;
192
+ }, z.core.$strip>, z.ZodObject<{
193
+ type: z.ZodLiteral<"thinkingDelta">;
194
+ seq: z.ZodNumber;
195
+ text: z.ZodString;
196
+ }, z.core.$strip>, z.ZodObject<{
136
197
  type: z.ZodLiteral<"toolCall">;
198
+ seq: z.ZodNumber;
137
199
  call: z.ZodObject<{
138
200
  id: z.ZodString;
139
201
  name: z.ZodString;
@@ -141,7 +203,8 @@ export declare const completionStreamResponseSchema: z.ZodObject<{
141
203
  raw: z.ZodOptional<z.ZodString>;
142
204
  }, z.core.$strip>;
143
205
  }, z.core.$strip>, z.ZodObject<{
144
- type: z.ZodLiteral<"toolCallError">;
206
+ type: z.ZodLiteral<"toolError">;
207
+ seq: z.ZodNumber;
145
208
  error: z.ZodObject<{
146
209
  code: z.ZodEnum<{
147
210
  PARSE_ERROR: "PARSE_ERROR";
@@ -151,20 +214,48 @@ export declare const completionStreamResponseSchema: z.ZodObject<{
151
214
  message: z.ZodString;
152
215
  raw: z.ZodOptional<z.ZodString>;
153
216
  }, 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>;
217
+ }, z.core.$strip>, z.ZodObject<{
218
+ type: z.ZodLiteral<"completionStats">;
219
+ seq: z.ZodNumber;
220
+ stats: z.ZodObject<{
221
+ timeToFirstToken: z.ZodOptional<z.ZodNumber>;
222
+ tokensPerSecond: z.ZodOptional<z.ZodNumber>;
223
+ cacheTokens: z.ZodOptional<z.ZodNumber>;
224
+ generatedTokens: z.ZodOptional<z.ZodNumber>;
225
+ backendDevice: z.ZodOptional<z.ZodEnum<{
226
+ cpu: "cpu";
227
+ gpu: "gpu";
228
+ }>>;
229
+ }, z.core.$strip>;
230
+ }, z.core.$strip>, z.ZodObject<{
231
+ type: z.ZodLiteral<"completionDone">;
232
+ seq: z.ZodNumber;
233
+ stopReason: z.ZodLiteral<"error">;
234
+ error: z.ZodObject<{
235
+ message: z.ZodString;
236
+ }, z.core.$strip>;
237
+ raw: z.ZodOptional<z.ZodObject<{
238
+ fullText: z.ZodString;
239
+ }, z.core.$strip>>;
240
+ }, z.core.$strict>, z.ZodObject<{
241
+ type: z.ZodLiteral<"completionDone">;
242
+ seq: z.ZodNumber;
243
+ stopReason: z.ZodOptional<z.ZodEnum<{
244
+ eos: "eos";
245
+ length: "length";
246
+ stopSequence: "stopSequence";
247
+ }>>;
248
+ raw: z.ZodOptional<z.ZodObject<{
249
+ fullText: z.ZodString;
250
+ }, z.core.$strip>>;
251
+ }, z.core.$strict>]>>;
252
+ }, z.core.$strict>;
163
253
  export type GenerationParams = z.infer<typeof generationParamsSchema>;
164
254
  export type CompletionParams = z.infer<typeof completionParamsSchema>;
255
+ export type ToolDialect = z.infer<typeof toolDialectSchema>;
256
+ export type ResponseFormat = z.infer<typeof responseFormatSchema>;
165
257
  export type CompletionClientParams = z.input<typeof completionClientParamsSchema>;
166
258
  export type CompletionStreamRequest = z.infer<typeof completionStreamRequestSchema>;
167
259
  export type CompletionStreamResponse = z.infer<typeof completionStreamResponseSchema>;
168
260
  export type Attachment = z.infer<typeof attachmentSchema>;
169
- export type CompletionStats = z.infer<typeof completionStatsSchema>;
170
261
  //# sourceMappingURL=completion-stream.d.ts.map