@pipedog/core 0.0.0 → 0.2.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 (736) hide show
  1. package/LICENSE +25 -0
  2. package/NOTICE +9 -0
  3. package/dist/adapters/base_llm_adapter.d.ts +266 -0
  4. package/dist/adapters/base_llm_adapter.js +489 -0
  5. package/dist/adapters/index.d.ts +2 -0
  6. package/dist/adapters/index.js +8 -0
  7. package/dist/adapters/schemas/direct_function.d.ts +202 -0
  8. package/dist/adapters/schemas/direct_function.js +302 -0
  9. package/dist/adapters/schemas/function_schema.d.ts +67 -0
  10. package/dist/adapters/schemas/function_schema.js +72 -0
  11. package/dist/adapters/schemas/index.d.ts +2 -0
  12. package/dist/adapters/schemas/index.js +8 -0
  13. package/dist/adapters/schemas/tools_schema.d.ts +57 -0
  14. package/dist/adapters/schemas/tools_schema.js +79 -0
  15. package/dist/adapters/services/index.d.ts +2 -0
  16. package/dist/adapters/services/index.js +8 -0
  17. package/dist/adapters/services/open_ai_adapter.d.ts +147 -0
  18. package/dist/adapters/services/open_ai_adapter.js +250 -0
  19. package/dist/audio/dtmf/dtmf_data.d.ts +3 -0
  20. package/dist/audio/dtmf/dtmf_data.js +22 -0
  21. package/dist/audio/dtmf/index.d.ts +2 -0
  22. package/dist/audio/dtmf/index.js +8 -0
  23. package/dist/audio/dtmf/types.d.ts +31 -0
  24. package/dist/audio/dtmf/types.js +35 -0
  25. package/dist/audio/dtmf/utils.d.ts +13 -0
  26. package/dist/audio/dtmf/utils.js +62 -0
  27. package/dist/audio/filters/base_audio_filter.d.ts +51 -0
  28. package/dist/audio/filters/base_audio_filter.js +17 -0
  29. package/dist/audio/filters/index.d.ts +2 -0
  30. package/dist/audio/filters/index.js +8 -0
  31. package/dist/audio/index.d.ts +2 -0
  32. package/dist/audio/index.js +8 -0
  33. package/dist/audio/krisp_instance.d.ts +95 -0
  34. package/dist/audio/krisp_instance.js +229 -0
  35. package/dist/audio/mixers/base_audio_mixer.d.ts +56 -0
  36. package/dist/audio/mixers/base_audio_mixer.js +16 -0
  37. package/dist/audio/mixers/index.d.ts +2 -0
  38. package/dist/audio/mixers/index.js +8 -0
  39. package/dist/audio/resamplers/base_audio_resampler.d.ts +46 -0
  40. package/dist/audio/resamplers/base_audio_resampler.js +35 -0
  41. package/dist/audio/resamplers/engine.d.ts +60 -0
  42. package/dist/audio/resamplers/engine.js +89 -0
  43. package/dist/audio/resamplers/index.d.ts +2 -0
  44. package/dist/audio/resamplers/index.js +8 -0
  45. package/dist/audio/resamplers/resampy_resampler.d.ts +10 -0
  46. package/dist/audio/resamplers/resampy_resampler.js +15 -0
  47. package/dist/audio/resamplers/sinc_engine.d.ts +10 -0
  48. package/dist/audio/resamplers/sinc_engine.js +235 -0
  49. package/dist/audio/resamplers/soxr_resampler.d.ts +58 -0
  50. package/dist/audio/resamplers/soxr_resampler.js +79 -0
  51. package/dist/audio/resamplers/soxr_stream_resampler.d.ts +78 -0
  52. package/dist/audio/resamplers/soxr_stream_resampler.js +159 -0
  53. package/dist/audio/turn/base_turn_analyzer.d.ts +84 -0
  54. package/dist/audio/turn/base_turn_analyzer.js +61 -0
  55. package/dist/audio/turn/index.d.ts +2 -0
  56. package/dist/audio/turn/index.js +8 -0
  57. package/dist/audio/turn/smart_turn/_whisper_features.d.ts +30 -0
  58. package/dist/audio/turn/smart_turn/_whisper_features.js +225 -0
  59. package/dist/audio/turn/smart_turn/base_smart_turn.d.ts +94 -0
  60. package/dist/audio/turn/smart_turn/base_smart_turn.js +239 -0
  61. package/dist/audio/turn/smart_turn/local_smart_turn_v3.d.ts +76 -0
  62. package/dist/audio/turn/smart_turn/local_smart_turn_v3.js +151 -0
  63. package/dist/audio/utils.d.ts +224 -0
  64. package/dist/audio/utils.js +634 -0
  65. package/dist/audio/vad/data/index.d.ts +2 -0
  66. package/dist/audio/vad/data/index.js +8 -0
  67. package/dist/audio/vad/index.d.ts +2 -0
  68. package/dist/audio/vad/index.js +8 -0
  69. package/dist/audio/vad/vad_analyzer.d.ts +134 -0
  70. package/dist/audio/vad/vad_analyzer.js +249 -0
  71. package/dist/audio/vad/vad_controller.d.ts +143 -0
  72. package/dist/audio/vad/vad_controller.js +228 -0
  73. package/dist/audio/volume.d.ts +38 -0
  74. package/dist/audio/volume.js +75 -0
  75. package/dist/bus/adapters/base.d.ts +35 -0
  76. package/dist/bus/adapters/base.js +19 -0
  77. package/dist/bus/adapters/index.d.ts +10 -0
  78. package/dist/bus/adapters/index.js +15 -0
  79. package/dist/bus/adapters/llm_context_adapter.d.ts +36 -0
  80. package/dist/bus/adapters/llm_context_adapter.js +82 -0
  81. package/dist/bus/adapters/tools_schema_adapter.d.ts +25 -0
  82. package/dist/bus/adapters/tools_schema_adapter.js +70 -0
  83. package/dist/bus/bridge_processor.d.ts +111 -0
  84. package/dist/bus/bridge_processor.js +166 -0
  85. package/dist/bus/bus.d.ts +110 -0
  86. package/dist/bus/bus.js +200 -0
  87. package/dist/bus/index.d.ts +22 -0
  88. package/dist/bus/index.js +27 -0
  89. package/dist/bus/local/async_queue.d.ts +12 -0
  90. package/dist/bus/local/async_queue.js +21 -0
  91. package/dist/bus/local/index.d.ts +3 -0
  92. package/dist/bus/local/index.js +8 -0
  93. package/dist/bus/messages.d.ts +378 -0
  94. package/dist/bus/messages.js +357 -0
  95. package/dist/bus/network/index.d.ts +16 -0
  96. package/dist/bus/network/index.js +21 -0
  97. package/dist/bus/queue.d.ts +27 -0
  98. package/dist/bus/queue.js +51 -0
  99. package/dist/bus/serializers/base.d.ts +25 -0
  100. package/dist/bus/serializers/base.js +14 -0
  101. package/dist/bus/serializers/index.d.ts +9 -0
  102. package/dist/bus/serializers/index.js +14 -0
  103. package/dist/bus/serializers/json.d.ts +77 -0
  104. package/dist/bus/serializers/json.js +367 -0
  105. package/dist/bus/subscriber.d.ts +46 -0
  106. package/dist/bus/subscriber.js +27 -0
  107. package/dist/bus/ui/index.d.ts +3 -0
  108. package/dist/bus/ui/index.js +8 -0
  109. package/dist/bus/ui/messages.d.ts +186 -0
  110. package/dist/bus/ui/messages.js +171 -0
  111. package/dist/classifiers/base_classifier.d.ts +263 -0
  112. package/dist/classifiers/base_classifier.js +346 -0
  113. package/dist/classifiers/cloudflare/clef/classifier.d.ts +70 -0
  114. package/dist/classifiers/cloudflare/clef/classifier.js +204 -0
  115. package/dist/classifiers/cloudflare/clef/client.d.ts +104 -0
  116. package/dist/classifiers/cloudflare/clef/client.js +234 -0
  117. package/dist/classifiers/cloudflare/clef/index.d.ts +2 -0
  118. package/dist/classifiers/cloudflare/clef/index.js +8 -0
  119. package/dist/classifiers/cloudflare/index.d.ts +2 -0
  120. package/dist/classifiers/cloudflare/index.js +8 -0
  121. package/dist/classifiers/http_client.d.ts +70 -0
  122. package/dist/classifiers/http_client.js +161 -0
  123. package/dist/classifiers/index.d.ts +2 -0
  124. package/dist/classifiers/index.js +8 -0
  125. package/dist/classifiers/jev/classifier.d.ts +8 -0
  126. package/dist/classifiers/jev/classifier.js +13 -0
  127. package/dist/classifiers/jev/client.d.ts +8 -0
  128. package/dist/classifiers/jev/client.js +13 -0
  129. package/dist/classifiers/jev/index.d.ts +2 -0
  130. package/dist/classifiers/jev/index.js +8 -0
  131. package/dist/classifiers/llm/classifier.d.ts +72 -0
  132. package/dist/classifiers/llm/classifier.js +304 -0
  133. package/dist/classifiers/llm/index.d.ts +2 -0
  134. package/dist/classifiers/llm/index.js +8 -0
  135. package/dist/classifiers/openai/decisions/classifier.d.ts +77 -0
  136. package/dist/classifiers/openai/decisions/classifier.js +241 -0
  137. package/dist/classifiers/openai/decisions/client.d.ts +108 -0
  138. package/dist/classifiers/openai/decisions/client.js +234 -0
  139. package/dist/classifiers/openai/decisions/index.d.ts +2 -0
  140. package/dist/classifiers/openai/decisions/index.js +8 -0
  141. package/dist/classifiers/openai/index.d.ts +2 -0
  142. package/dist/classifiers/openai/index.js +8 -0
  143. package/dist/classifiers/typesafe/index.d.ts +2 -0
  144. package/dist/classifiers/typesafe/index.js +8 -0
  145. package/dist/classifiers/typesafe/jev/classifier.d.ts +70 -0
  146. package/dist/classifiers/typesafe/jev/classifier.js +220 -0
  147. package/dist/classifiers/typesafe/jev/client.d.ts +105 -0
  148. package/dist/classifiers/typesafe/jev/client.js +233 -0
  149. package/dist/classifiers/typesafe/jev/index.d.ts +2 -0
  150. package/dist/classifiers/typesafe/jev/index.js +8 -0
  151. package/dist/clocks/base_clock.d.ts +13 -0
  152. package/dist/clocks/base_clock.js +14 -0
  153. package/dist/clocks/index.d.ts +2 -0
  154. package/dist/clocks/index.js +8 -0
  155. package/dist/clocks/system_clock.d.ts +15 -0
  156. package/dist/clocks/system_clock.js +25 -0
  157. package/dist/frames/frames.d.ts +2533 -0
  158. package/dist/frames/frames.js +2485 -0
  159. package/dist/frames/index.d.ts +2 -0
  160. package/dist/frames/index.js +8 -0
  161. package/dist/frames/protobufs/frames_pb2.d.ts +229 -0
  162. package/dist/frames/protobufs/frames_pb2.js +466 -0
  163. package/dist/index.d.ts +11 -0
  164. package/dist/index.js +56 -0
  165. package/dist/metrics/index.d.ts +2 -0
  166. package/dist/metrics/index.js +8 -0
  167. package/dist/metrics/metrics.d.ts +276 -0
  168. package/dist/metrics/metrics.js +254 -0
  169. package/dist/observers/base_observer.d.ts +173 -0
  170. package/dist/observers/base_observer.js +151 -0
  171. package/dist/observers/error_observer.d.ts +75 -0
  172. package/dist/observers/error_observer.js +87 -0
  173. package/dist/observers/function_call_observer.d.ts +157 -0
  174. package/dist/observers/function_call_observer.js +222 -0
  175. package/dist/observers/index.d.ts +2 -0
  176. package/dist/observers/index.js +8 -0
  177. package/dist/observers/loggers/debug_log_observer.d.ts +91 -0
  178. package/dist/observers/loggers/debug_log_observer.js +228 -0
  179. package/dist/observers/loggers/index.d.ts +2 -0
  180. package/dist/observers/loggers/index.js +8 -0
  181. package/dist/observers/loggers/llm_log_observer.d.ts +24 -0
  182. package/dist/observers/loggers/llm_log_observer.js +110 -0
  183. package/dist/observers/loggers/metrics_log_observer.d.ts +85 -0
  184. package/dist/observers/loggers/metrics_log_observer.js +186 -0
  185. package/dist/observers/loggers/transcription_log_observer.d.ts +23 -0
  186. package/dist/observers/loggers/transcription_log_observer.js +74 -0
  187. package/dist/observers/service_metrics_observer.d.ts +168 -0
  188. package/dist/observers/service_metrics_observer.js +236 -0
  189. package/dist/observers/speaking_observer.d.ts +104 -0
  190. package/dist/observers/speaking_observer.js +150 -0
  191. package/dist/observers/startup_timing_observer.d.ts +221 -0
  192. package/dist/observers/startup_timing_observer.js +365 -0
  193. package/dist/observers/turn_tracking_observer.d.ts +78 -0
  194. package/dist/observers/turn_tracking_observer.js +189 -0
  195. package/dist/observers/user_bot_latency_observer.d.ts +411 -0
  196. package/dist/observers/user_bot_latency_observer.js +974 -0
  197. package/dist/pipeline/base_pipeline.d.ts +49 -0
  198. package/dist/pipeline/base_pipeline.js +101 -0
  199. package/dist/pipeline/capabilities.d.ts +76 -0
  200. package/dist/pipeline/capabilities.js +97 -0
  201. package/dist/pipeline/index.d.ts +2 -0
  202. package/dist/pipeline/index.js +8 -0
  203. package/dist/pipeline/job_context.d.ts +317 -0
  204. package/dist/pipeline/job_context.js +450 -0
  205. package/dist/pipeline/job_decorator.d.ts +54 -0
  206. package/dist/pipeline/job_decorator.js +92 -0
  207. package/dist/pipeline/llm_switcher.d.ts +84 -0
  208. package/dist/pipeline/llm_switcher.js +107 -0
  209. package/dist/pipeline/llm_with_backend.d.ts +435 -0
  210. package/dist/pipeline/llm_with_backend.js +806 -0
  211. package/dist/pipeline/parallel_pipeline.d.ts +83 -0
  212. package/dist/pipeline/parallel_pipeline.js +200 -0
  213. package/dist/pipeline/pipeline.d.ts +126 -0
  214. package/dist/pipeline/pipeline.js +196 -0
  215. package/dist/pipeline/service_switcher.d.ts +287 -0
  216. package/dist/pipeline/service_switcher.js +509 -0
  217. package/dist/pipeline/sync_parallel_pipeline.d.ts +192 -0
  218. package/dist/pipeline/sync_parallel_pipeline.js +387 -0
  219. package/dist/pipeline/worker.d.ts +821 -0
  220. package/dist/pipeline/worker.js +1656 -0
  221. package/dist/pipeline/worker_observer.d.ts +131 -0
  222. package/dist/pipeline/worker_observer.js +274 -0
  223. package/dist/pipeline/worker_ready_decorator.d.ts +45 -0
  224. package/dist/pipeline/worker_ready_decorator.js +76 -0
  225. package/dist/processors/aggregators/async_tool_messages.d.ts +146 -0
  226. package/dist/processors/aggregators/async_tool_messages.js +291 -0
  227. package/dist/processors/aggregators/dtmf_aggregator.d.ts +61 -0
  228. package/dist/processors/aggregators/dtmf_aggregator.js +144 -0
  229. package/dist/processors/aggregators/gated.d.ts +43 -0
  230. package/dist/processors/aggregators/gated.js +86 -0
  231. package/dist/processors/aggregators/gated_llm_context.d.ts +42 -0
  232. package/dist/processors/aggregators/gated_llm_context.js +86 -0
  233. package/dist/processors/aggregators/index.d.ts +2 -0
  234. package/dist/processors/aggregators/index.js +8 -0
  235. package/dist/processors/aggregators/llm_context.d.ts +370 -0
  236. package/dist/processors/aggregators/llm_context.js +580 -0
  237. package/dist/processors/aggregators/llm_context_summarizer.d.ts +219 -0
  238. package/dist/processors/aggregators/llm_context_summarizer.js +447 -0
  239. package/dist/processors/aggregators/llm_response.d.ts +37 -0
  240. package/dist/processors/aggregators/llm_response.js +71 -0
  241. package/dist/processors/aggregators/llm_response_universal.d.ts +966 -0
  242. package/dist/processors/aggregators/llm_response_universal.js +2394 -0
  243. package/dist/processors/aggregators/llm_text_processor.d.ts +53 -0
  244. package/dist/processors/aggregators/llm_text_processor.js +102 -0
  245. package/dist/processors/aggregators/sentence.d.ts +39 -0
  246. package/dist/processors/aggregators/sentence.js +69 -0
  247. package/dist/processors/async_generator.d.ts +42 -0
  248. package/dist/processors/async_generator.js +76 -0
  249. package/dist/processors/audio/audio_buffer_processor.d.ts +241 -0
  250. package/dist/processors/audio/audio_buffer_processor.js +565 -0
  251. package/dist/processors/audio/index.d.ts +2 -0
  252. package/dist/processors/audio/index.js +8 -0
  253. package/dist/processors/audio/vad_processor.d.ts +67 -0
  254. package/dist/processors/audio/vad_processor.js +103 -0
  255. package/dist/processors/consumer_processor.d.ts +49 -0
  256. package/dist/processors/consumer_processor.js +85 -0
  257. package/dist/processors/filters/frame_filter.d.ts +39 -0
  258. package/dist/processors/filters/frame_filter.js +52 -0
  259. package/dist/processors/filters/function_filter.d.ts +59 -0
  260. package/dist/processors/filters/function_filter.js +78 -0
  261. package/dist/processors/filters/identity_filter.d.ts +33 -0
  262. package/dist/processors/filters/identity_filter.js +37 -0
  263. package/dist/processors/filters/index.d.ts +2 -0
  264. package/dist/processors/filters/index.js +8 -0
  265. package/dist/processors/filters/null_filter.d.ts +34 -0
  266. package/dist/processors/filters/null_filter.js +47 -0
  267. package/dist/processors/filters/wake_notifier_filter.d.ts +48 -0
  268. package/dist/processors/filters/wake_notifier_filter.js +49 -0
  269. package/dist/processors/frame_processor.d.ts +360 -0
  270. package/dist/processors/frame_processor.js +932 -0
  271. package/dist/processors/frameworks/index.d.ts +2 -0
  272. package/dist/processors/frameworks/index.js +8 -0
  273. package/dist/processors/frameworks/rtvi/frames.d.ts +241 -0
  274. package/dist/processors/frameworks/rtvi/frames.js +259 -0
  275. package/dist/processors/frameworks/rtvi/index.d.ts +6 -0
  276. package/dist/processors/frameworks/rtvi/index.js +11 -0
  277. package/dist/processors/frameworks/rtvi/models.d.ts +1741 -0
  278. package/dist/processors/frameworks/rtvi/models.js +1807 -0
  279. package/dist/processors/frameworks/rtvi/observer.d.ts +340 -0
  280. package/dist/processors/frameworks/rtvi/observer.js +1113 -0
  281. package/dist/processors/frameworks/rtvi/processor.d.ts +182 -0
  282. package/dist/processors/frameworks/rtvi/processor.js +676 -0
  283. package/dist/processors/idle_frame_processor.d.ts +44 -0
  284. package/dist/processors/idle_frame_processor.js +86 -0
  285. package/dist/processors/index.d.ts +2 -0
  286. package/dist/processors/index.js +8 -0
  287. package/dist/processors/logger.d.ts +42 -0
  288. package/dist/processors/logger.js +87 -0
  289. package/dist/processors/metrics/frame_processor_metrics.d.ts +172 -0
  290. package/dist/processors/metrics/frame_processor_metrics.js +372 -0
  291. package/dist/processors/metrics/index.d.ts +2 -0
  292. package/dist/processors/metrics/index.js +8 -0
  293. package/dist/processors/producer_processor.d.ts +68 -0
  294. package/dist/processors/producer_processor.js +78 -0
  295. package/dist/processors/text_transformer.d.ts +30 -0
  296. package/dist/processors/text_transformer.js +48 -0
  297. package/dist/registry/index.d.ts +3 -0
  298. package/dist/registry/index.js +8 -0
  299. package/dist/registry/registry.d.ts +69 -0
  300. package/dist/registry/registry.js +149 -0
  301. package/dist/registry/types.d.ts +47 -0
  302. package/dist/registry/types.js +39 -0
  303. package/dist/serializers/base_serializer.d.ts +94 -0
  304. package/dist/serializers/base_serializer.js +82 -0
  305. package/dist/serializers/index.d.ts +2 -0
  306. package/dist/serializers/index.js +8 -0
  307. package/dist/services/ai_service.d.ts +145 -0
  308. package/dist/services/ai_service.js +262 -0
  309. package/dist/services/anthropic/index.d.ts +2 -0
  310. package/dist/services/anthropic/index.js +7 -0
  311. package/dist/services/assemblyai/index.d.ts +2 -0
  312. package/dist/services/assemblyai/index.js +7 -0
  313. package/dist/services/asyncai/index.d.ts +2 -0
  314. package/dist/services/asyncai/index.js +7 -0
  315. package/dist/services/aws/index.d.ts +2 -0
  316. package/dist/services/aws/index.js +7 -0
  317. package/dist/services/azure/index.d.ts +2 -0
  318. package/dist/services/azure/index.js +7 -0
  319. package/dist/services/baseten/index.d.ts +2 -0
  320. package/dist/services/baseten/index.js +7 -0
  321. package/dist/services/bland/index.d.ts +2 -0
  322. package/dist/services/bland/index.js +7 -0
  323. package/dist/services/camb/index.d.ts +2 -0
  324. package/dist/services/camb/index.js +7 -0
  325. package/dist/services/cartesia/index.d.ts +2 -0
  326. package/dist/services/cartesia/index.js +7 -0
  327. package/dist/services/cerebras/index.d.ts +2 -0
  328. package/dist/services/cerebras/index.js +7 -0
  329. package/dist/services/crusoe/index.d.ts +2 -0
  330. package/dist/services/crusoe/index.js +7 -0
  331. package/dist/services/deepgram/index.d.ts +2 -0
  332. package/dist/services/deepgram/index.js +7 -0
  333. package/dist/services/deepseek/index.d.ts +2 -0
  334. package/dist/services/deepseek/index.js +7 -0
  335. package/dist/services/elevenlabs/index.d.ts +2 -0
  336. package/dist/services/elevenlabs/index.js +7 -0
  337. package/dist/services/fal/index.d.ts +2 -0
  338. package/dist/services/fal/index.js +7 -0
  339. package/dist/services/fireworks/index.d.ts +2 -0
  340. package/dist/services/fireworks/index.js +7 -0
  341. package/dist/services/fish/index.d.ts +2 -0
  342. package/dist/services/fish/index.js +7 -0
  343. package/dist/services/funasr/index.d.ts +3 -0
  344. package/dist/services/funasr/index.js +8 -0
  345. package/dist/services/gladia/index.d.ts +2 -0
  346. package/dist/services/gladia/index.js +7 -0
  347. package/dist/services/google/index.d.ts +2 -0
  348. package/dist/services/google/index.js +7 -0
  349. package/dist/services/gradium/index.d.ts +2 -0
  350. package/dist/services/gradium/index.js +7 -0
  351. package/dist/services/grok/index.d.ts +2 -0
  352. package/dist/services/grok/index.js +7 -0
  353. package/dist/services/groq/index.d.ts +2 -0
  354. package/dist/services/groq/index.js +7 -0
  355. package/dist/services/heygen/index.d.ts +2 -0
  356. package/dist/services/heygen/index.js +7 -0
  357. package/dist/services/hume/index.d.ts +2 -0
  358. package/dist/services/hume/index.js +7 -0
  359. package/dist/services/image_service.d.ts +52 -0
  360. package/dist/services/image_service.js +60 -0
  361. package/dist/services/inception/index.d.ts +2 -0
  362. package/dist/services/inception/index.js +7 -0
  363. package/dist/services/index.d.ts +2 -0
  364. package/dist/services/index.js +8 -0
  365. package/dist/services/inworld/index.d.ts +2 -0
  366. package/dist/services/inworld/index.js +7 -0
  367. package/dist/services/keenable/index.d.ts +2 -0
  368. package/dist/services/keenable/index.js +7 -0
  369. package/dist/services/kokoro/index.d.ts +2 -0
  370. package/dist/services/kokoro/index.js +7 -0
  371. package/dist/services/llm_service.d.ts +1106 -0
  372. package/dist/services/llm_service.js +2231 -0
  373. package/dist/services/mem0/index.d.ts +2 -0
  374. package/dist/services/mem0/index.js +7 -0
  375. package/dist/services/meta/index.d.ts +2 -0
  376. package/dist/services/meta/index.js +7 -0
  377. package/dist/services/minimax/index.d.ts +2 -0
  378. package/dist/services/minimax/index.js +7 -0
  379. package/dist/services/mistral/index.d.ts +2 -0
  380. package/dist/services/mistral/index.js +7 -0
  381. package/dist/services/moondream/index.d.ts +2 -0
  382. package/dist/services/moondream/index.js +7 -0
  383. package/dist/services/moonshine/index.d.ts +2 -0
  384. package/dist/services/moonshine/index.js +7 -0
  385. package/dist/services/nebius/index.d.ts +2 -0
  386. package/dist/services/nebius/index.js +7 -0
  387. package/dist/services/neuphonic/index.d.ts +2 -0
  388. package/dist/services/neuphonic/index.js +7 -0
  389. package/dist/services/novita/index.d.ts +2 -0
  390. package/dist/services/novita/index.js +7 -0
  391. package/dist/services/nvidia/index.d.ts +2 -0
  392. package/dist/services/nvidia/index.js +11 -0
  393. package/dist/services/ollama/index.d.ts +2 -0
  394. package/dist/services/ollama/index.js +7 -0
  395. package/dist/services/openai/index.d.ts +2 -0
  396. package/dist/services/openai/index.js +7 -0
  397. package/dist/services/openclaw/index.d.ts +14 -0
  398. package/dist/services/openclaw/index.js +19 -0
  399. package/dist/services/openrouter/index.d.ts +2 -0
  400. package/dist/services/openrouter/index.js +7 -0
  401. package/dist/services/perplexity/index.d.ts +2 -0
  402. package/dist/services/perplexity/index.js +7 -0
  403. package/dist/services/piper/index.d.ts +2 -0
  404. package/dist/services/piper/index.js +7 -0
  405. package/dist/services/pocket_tts/index.d.ts +2 -0
  406. package/dist/services/pocket_tts/index.js +7 -0
  407. package/dist/services/qwen/index.d.ts +2 -0
  408. package/dist/services/qwen/index.js +7 -0
  409. package/dist/services/resembleai/index.d.ts +2 -0
  410. package/dist/services/resembleai/index.js +7 -0
  411. package/dist/services/rime/index.d.ts +2 -0
  412. package/dist/services/rime/index.js +7 -0
  413. package/dist/services/sambanova/index.d.ts +2 -0
  414. package/dist/services/sambanova/index.js +7 -0
  415. package/dist/services/sarvam/index.d.ts +2 -0
  416. package/dist/services/sarvam/index.js +7 -0
  417. package/dist/services/settings.d.ts +356 -0
  418. package/dist/services/settings.js +437 -0
  419. package/dist/services/simli/index.d.ts +2 -0
  420. package/dist/services/simli/index.js +7 -0
  421. package/dist/services/smallest/index.d.ts +2 -0
  422. package/dist/services/smallest/index.js +7 -0
  423. package/dist/services/soniox/index.d.ts +2 -0
  424. package/dist/services/soniox/index.js +7 -0
  425. package/dist/services/speechify/index.d.ts +2 -0
  426. package/dist/services/speechify/index.js +7 -0
  427. package/dist/services/speechmatics/index.d.ts +2 -0
  428. package/dist/services/speechmatics/index.js +7 -0
  429. package/dist/services/stt_latency.d.ts +62 -0
  430. package/dist/services/stt_latency.js +71 -0
  431. package/dist/services/stt_service.d.ts +601 -0
  432. package/dist/services/stt_service.js +1044 -0
  433. package/dist/services/tavus/index.d.ts +2 -0
  434. package/dist/services/tavus/index.js +7 -0
  435. package/dist/services/together/index.d.ts +2 -0
  436. package/dist/services/together/index.js +7 -0
  437. package/dist/services/tts_service.d.ts +909 -0
  438. package/dist/services/tts_service.js +2018 -0
  439. package/dist/services/ultravox/index.d.ts +2 -0
  440. package/dist/services/ultravox/index.js +9 -0
  441. package/dist/services/vision_service.d.ts +56 -0
  442. package/dist/services/vision_service.js +62 -0
  443. package/dist/services/websocket_service.d.ts +213 -0
  444. package/dist/services/websocket_service.js +654 -0
  445. package/dist/services/whisper/index.d.ts +2 -0
  446. package/dist/services/whisper/index.js +9 -0
  447. package/dist/services/xai/index.d.ts +2 -0
  448. package/dist/services/xai/index.js +9 -0
  449. package/dist/services/xtts/index.d.ts +2 -0
  450. package/dist/services/xtts/index.js +9 -0
  451. package/dist/tests/index.d.ts +2 -0
  452. package/dist/tests/index.js +8 -0
  453. package/dist/tests/utils.d.ts +123 -0
  454. package/dist/tests/utils.js +212 -0
  455. package/dist/transcriptions/index.d.ts +2 -0
  456. package/dist/transcriptions/index.js +8 -0
  457. package/dist/transcriptions/language.d.ts +376 -0
  458. package/dist/transcriptions/language.js +543 -0
  459. package/dist/transports/base_input.d.ts +149 -0
  460. package/dist/transports/base_input.js +338 -0
  461. package/dist/transports/base_output.d.ts +432 -0
  462. package/dist/transports/base_output.js +1231 -0
  463. package/dist/transports/base_transport.d.ts +223 -0
  464. package/dist/transports/base_transport.js +167 -0
  465. package/dist/transports/daily/index.d.ts +2 -0
  466. package/dist/transports/daily/index.js +9 -0
  467. package/dist/transports/heygen/index.d.ts +2 -0
  468. package/dist/transports/heygen/index.js +9 -0
  469. package/dist/transports/index.d.ts +2 -0
  470. package/dist/transports/index.js +8 -0
  471. package/dist/transports/lemonslice/index.d.ts +2 -0
  472. package/dist/transports/lemonslice/index.js +9 -0
  473. package/dist/transports/livekit/index.d.ts +2 -0
  474. package/dist/transports/livekit/index.js +9 -0
  475. package/dist/transports/local/index.d.ts +2 -0
  476. package/dist/transports/local/index.js +9 -0
  477. package/dist/transports/moq/index.d.ts +2 -0
  478. package/dist/transports/moq/index.js +9 -0
  479. package/dist/transports/smallwebrtc/index.d.ts +2 -0
  480. package/dist/transports/smallwebrtc/index.js +9 -0
  481. package/dist/transports/tavus/index.d.ts +2 -0
  482. package/dist/transports/tavus/index.js +9 -0
  483. package/dist/transports/video_in_sampler.d.ts +157 -0
  484. package/dist/transports/video_in_sampler.js +258 -0
  485. package/dist/transports/vonage/index.d.ts +2 -0
  486. package/dist/transports/vonage/index.js +9 -0
  487. package/dist/transports/websocket/index.d.ts +2 -0
  488. package/dist/transports/websocket/index.js +9 -0
  489. package/dist/transports/whatsapp/index.d.ts +2 -0
  490. package/dist/transports/whatsapp/index.js +9 -0
  491. package/dist/turns/eager_end_of_turn_mixin.d.ts +70 -0
  492. package/dist/turns/eager_end_of_turn_mixin.js +122 -0
  493. package/dist/turns/empty_user_turn.d.ts +55 -0
  494. package/dist/turns/empty_user_turn.js +53 -0
  495. package/dist/turns/index.d.ts +2 -0
  496. package/dist/turns/index.js +8 -0
  497. package/dist/turns/speculation_gate.d.ts +169 -0
  498. package/dist/turns/speculation_gate.js +294 -0
  499. package/dist/turns/types.d.ts +33 -0
  500. package/dist/turns/types.js +35 -0
  501. package/dist/turns/user_idle_controller.d.ts +94 -0
  502. package/dist/turns/user_idle_controller.js +187 -0
  503. package/dist/turns/user_mute/always_user_mute_strategy.d.ts +15 -0
  504. package/dist/turns/user_mute/always_user_mute_strategy.js +29 -0
  505. package/dist/turns/user_mute/base_user_mute_strategy.d.ts +39 -0
  506. package/dist/turns/user_mute/base_user_mute_strategy.js +45 -0
  507. package/dist/turns/user_mute/first_speech_user_mute_strategy.d.ts +28 -0
  508. package/dist/turns/user_mute/first_speech_user_mute_strategy.js +52 -0
  509. package/dist/turns/user_mute/function_call_user_mute_strategy.d.ts +25 -0
  510. package/dist/turns/user_mute/function_call_user_mute_strategy.js +50 -0
  511. package/dist/turns/user_mute/index.d.ts +6 -0
  512. package/dist/turns/user_mute/index.js +11 -0
  513. package/dist/turns/user_mute/mute_until_first_bot_complete_user_mute_strategy.d.ts +43 -0
  514. package/dist/turns/user_mute/mute_until_first_bot_complete_user_mute_strategy.js +76 -0
  515. package/dist/turns/user_start/base_user_turn_start_strategy.d.ts +135 -0
  516. package/dist/turns/user_start/base_user_turn_start_strategy.js +134 -0
  517. package/dist/turns/user_start/external_user_turn_start_strategy.d.ts +45 -0
  518. package/dist/turns/user_start/external_user_turn_start_strategy.js +64 -0
  519. package/dist/turns/user_start/index.d.ts +8 -0
  520. package/dist/turns/user_start/index.js +16 -0
  521. package/dist/turns/user_start/krisp_viva_ip_user_turn_start_strategy.d.ts +133 -0
  522. package/dist/turns/user_start/krisp_viva_ip_user_turn_start_strategy.js +243 -0
  523. package/dist/turns/user_start/min_words_user_turn_start_strategy.d.ts +60 -0
  524. package/dist/turns/user_start/min_words_user_turn_start_strategy.js +102 -0
  525. package/dist/turns/user_start/transcription_user_turn_start_strategy.d.ts +29 -0
  526. package/dist/turns/user_start/transcription_user_turn_start_strategy.js +43 -0
  527. package/dist/turns/user_start/vad_user_turn_start_strategy.d.ts +20 -0
  528. package/dist/turns/user_start/vad_user_turn_start_strategy.js +31 -0
  529. package/dist/turns/user_start/wake_phrase_user_turn_start_strategy.d.ts +141 -0
  530. package/dist/turns/user_start/wake_phrase_user_turn_start_strategy.js +238 -0
  531. package/dist/turns/user_stop/base_user_turn_stop_strategy.d.ts +174 -0
  532. package/dist/turns/user_stop/base_user_turn_stop_strategy.js +170 -0
  533. package/dist/turns/user_stop/deferred_user_turn_stop_strategy.d.ts +81 -0
  534. package/dist/turns/user_stop/deferred_user_turn_stop_strategy.js +107 -0
  535. package/dist/turns/user_stop/eager_match_policy.d.ts +36 -0
  536. package/dist/turns/user_stop/eager_match_policy.js +50 -0
  537. package/dist/turns/user_stop/eager_user_turn_stop_strategy.d.ts +84 -0
  538. package/dist/turns/user_stop/eager_user_turn_stop_strategy.js +154 -0
  539. package/dist/turns/user_stop/external_user_turn_completion_stop_strategy.d.ts +45 -0
  540. package/dist/turns/user_stop/external_user_turn_completion_stop_strategy.js +55 -0
  541. package/dist/turns/user_stop/external_user_turn_stop_strategy.d.ts +115 -0
  542. package/dist/turns/user_stop/external_user_turn_stop_strategy.js +205 -0
  543. package/dist/turns/user_stop/index.d.ts +10 -0
  544. package/dist/turns/user_stop/index.js +15 -0
  545. package/dist/turns/user_stop/llm_turn_completion_user_turn_stop_strategy.d.ts +44 -0
  546. package/dist/turns/user_stop/llm_turn_completion_user_turn_stop_strategy.js +59 -0
  547. package/dist/turns/user_stop/speech_timeout_user_turn_stop_strategy.d.ts +140 -0
  548. package/dist/turns/user_stop/speech_timeout_user_turn_stop_strategy.js +303 -0
  549. package/dist/turns/user_stop/turn_analyzer_user_turn_stop_strategy.d.ts +135 -0
  550. package/dist/turns/user_stop/turn_analyzer_user_turn_stop_strategy.js +332 -0
  551. package/dist/turns/user_turn_completion_mixin.d.ts +147 -0
  552. package/dist/turns/user_turn_completion_mixin.js +591 -0
  553. package/dist/turns/user_turn_controller.d.ts +134 -0
  554. package/dist/turns/user_turn_controller.js +335 -0
  555. package/dist/turns/user_turn_processor.d.ts +87 -0
  556. package/dist/turns/user_turn_processor.js +180 -0
  557. package/dist/turns/user_turn_strategies.d.ts +187 -0
  558. package/dist/turns/user_turn_strategies.js +222 -0
  559. package/dist/utils/async_tool_cancellation.d.ts +35 -0
  560. package/dist/utils/async_tool_cancellation.js +78 -0
  561. package/dist/utils/asyncio/index.d.ts +2 -0
  562. package/dist/utils/asyncio/index.js +7 -0
  563. package/dist/utils/asyncio/task_manager.d.ts +49 -0
  564. package/dist/utils/asyncio/task_manager.js +105 -0
  565. package/dist/utils/base_object.d.ts +76 -0
  566. package/dist/utils/base_object.js +154 -0
  567. package/dist/utils/context/aggregated_frame_sequencer.d.ts +491 -0
  568. package/dist/utils/context/aggregated_frame_sequencer.js +803 -0
  569. package/dist/utils/context/audio_context_manager.d.ts +131 -0
  570. package/dist/utils/context/audio_context_manager.js +233 -0
  571. package/dist/utils/context/index.d.ts +2 -0
  572. package/dist/utils/context/index.js +7 -0
  573. package/dist/utils/context/llm_context_summarization.d.ts +258 -0
  574. package/dist/utils/context/llm_context_summarization.js +511 -0
  575. package/dist/utils/context/text_segment_map.d.ts +611 -0
  576. package/dist/utils/context/text_segment_map.js +1132 -0
  577. package/dist/utils/context/word_completion_tracker.d.ts +273 -0
  578. package/dist/utils/context/word_completion_tracker.js +441 -0
  579. package/dist/utils/context/word_timestamp_tracker.d.ts +72 -0
  580. package/dist/utils/context/word_timestamp_tracker.js +98 -0
  581. package/dist/utils/deprecation.d.ts +28 -0
  582. package/dist/utils/deprecation.js +75 -0
  583. package/dist/utils/env.d.ts +38 -0
  584. package/dist/utils/env.js +62 -0
  585. package/dist/utils/errors.d.ts +75 -0
  586. package/dist/utils/errors.js +202 -0
  587. package/dist/utils/file_resolver.d.ts +126 -0
  588. package/dist/utils/file_resolver.js +314 -0
  589. package/dist/utils/file_storage.d.ts +115 -0
  590. package/dist/utils/file_storage.js +178 -0
  591. package/dist/utils/frame_queue.d.ts +36 -0
  592. package/dist/utils/frame_queue.js +66 -0
  593. package/dist/utils/http.d.ts +39 -0
  594. package/dist/utils/http.js +53 -0
  595. package/dist/utils/image.d.ts +14 -0
  596. package/dist/utils/image.js +63 -0
  597. package/dist/utils/index.d.ts +2 -0
  598. package/dist/utils/index.js +8 -0
  599. package/dist/utils/jpeg_encoder.d.ts +14 -0
  600. package/dist/utils/jpeg_encoder.js +315 -0
  601. package/dist/utils/log_config.d.ts +34 -0
  602. package/dist/utils/log_config.js +76 -0
  603. package/dist/utils/logger.d.ts +40 -0
  604. package/dist/utils/logger.js +91 -0
  605. package/dist/utils/mixin.d.ts +14 -0
  606. package/dist/utils/mixin.js +63 -0
  607. package/dist/utils/network.d.ts +73 -0
  608. package/dist/utils/network.js +90 -0
  609. package/dist/utils/security/allowed_origins.d.ts +16 -0
  610. package/dist/utils/security/allowed_origins.js +34 -0
  611. package/dist/utils/security/index.d.ts +2 -0
  612. package/dist/utils/security/index.js +7 -0
  613. package/dist/utils/security/redaction.d.ts +27 -0
  614. package/dist/utils/security/redaction.js +123 -0
  615. package/dist/utils/security/ssrf.d.ts +79 -0
  616. package/dist/utils/security/ssrf.js +327 -0
  617. package/dist/utils/shared.d.ts +35 -0
  618. package/dist/utils/shared.js +136 -0
  619. package/dist/utils/startup.d.ts +17 -0
  620. package/dist/utils/startup.js +130 -0
  621. package/dist/utils/string.d.ts +116 -0
  622. package/dist/utils/string.js +460 -0
  623. package/dist/utils/sync/base_notifier.d.ts +25 -0
  624. package/dist/utils/sync/base_notifier.js +16 -0
  625. package/dist/utils/sync/event_notifier.d.ts +38 -0
  626. package/dist/utils/sync/event_notifier.js +51 -0
  627. package/dist/utils/sync/index.d.ts +2 -0
  628. package/dist/utils/sync/index.js +7 -0
  629. package/dist/utils/text/alnum_utils.d.ts +109 -0
  630. package/dist/utils/text/alnum_utils.js +262 -0
  631. package/dist/utils/text/base_text_aggregator.d.ts +146 -0
  632. package/dist/utils/text/base_text_aggregator.js +102 -0
  633. package/dist/utils/text/base_text_filter.d.ts +54 -0
  634. package/dist/utils/text/base_text_filter.js +50 -0
  635. package/dist/utils/text/index.d.ts +2 -0
  636. package/dist/utils/text/index.js +7 -0
  637. package/dist/utils/text/markdown_text_filter.d.ts +147 -0
  638. package/dist/utils/text/markdown_text_filter.js +522 -0
  639. package/dist/utils/text/markup_utils.d.ts +54 -0
  640. package/dist/utils/text/markup_utils.js +156 -0
  641. package/dist/utils/text/pattern_pair_aggregator.d.ts +251 -0
  642. package/dist/utils/text/pattern_pair_aggregator.js +478 -0
  643. package/dist/utils/text/phonemes.d.ts +60 -0
  644. package/dist/utils/text/phonemes.js +172 -0
  645. package/dist/utils/text/simple_text_aggregator.d.ts +135 -0
  646. package/dist/utils/text/simple_text_aggregator.js +254 -0
  647. package/dist/utils/text/skip_tags_aggregator.d.ts +85 -0
  648. package/dist/utils/text/skip_tags_aggregator.js +147 -0
  649. package/dist/utils/text/transforms/acronyms.d.ts +21 -0
  650. package/dist/utils/text/transforms/acronyms.js +31 -0
  651. package/dist/utils/text/transforms/currency.d.ts +16 -0
  652. package/dist/utils/text/transforms/currency.js +56 -0
  653. package/dist/utils/text/transforms/dates.d.ts +18 -0
  654. package/dist/utils/text/transforms/dates.js +102 -0
  655. package/dist/utils/text/transforms/email.d.ts +17 -0
  656. package/dist/utils/text/transforms/email.js +35 -0
  657. package/dist/utils/text/transforms/index.d.ts +37 -0
  658. package/dist/utils/text/transforms/index.js +42 -0
  659. package/dist/utils/text/transforms/numbers.d.ts +25 -0
  660. package/dist/utils/text/transforms/numbers.js +59 -0
  661. package/dist/utils/text/transforms/percentages.d.ts +16 -0
  662. package/dist/utils/text/transforms/percentages.js +32 -0
  663. package/dist/utils/text/transforms/phone.d.ts +21 -0
  664. package/dist/utils/text/transforms/phone.js +39 -0
  665. package/dist/utils/text/transforms/pronunciations.d.ts +65 -0
  666. package/dist/utils/text/transforms/pronunciations.js +112 -0
  667. package/dist/utils/text/transforms/replacements.d.ts +39 -0
  668. package/dist/utils/text/transforms/replacements.js +46 -0
  669. package/dist/utils/text/transforms/strip_markdown.d.ts +25 -0
  670. package/dist/utils/text/transforms/strip_markdown.js +60 -0
  671. package/dist/utils/text/transforms/units.d.ts +22 -0
  672. package/dist/utils/text/transforms/units.js +81 -0
  673. package/dist/utils/text/transforms/voice_formatter.d.ts +86 -0
  674. package/dist/utils/text/transforms/voice_formatter.js +98 -0
  675. package/dist/utils/text/unicode_digits.d.ts +3 -0
  676. package/dist/utils/text/unicode_digits.js +34 -0
  677. package/dist/utils/text/word_timestamp_utils.d.ts +26 -0
  678. package/dist/utils/text/word_timestamp_utils.js +52 -0
  679. package/dist/utils/time.d.ts +13 -0
  680. package/dist/utils/time.js +31 -0
  681. package/dist/utils/tracing/index.d.ts +3 -0
  682. package/dist/utils/tracing/index.js +8 -0
  683. package/dist/utils/tracing/service_attributes.d.ts +198 -0
  684. package/dist/utils/tracing/service_attributes.js +434 -0
  685. package/dist/utils/tracing/service_decorators.d.ts +214 -0
  686. package/dist/utils/tracing/service_decorators.js +1662 -0
  687. package/dist/utils/tracing/setup.d.ts +107 -0
  688. package/dist/utils/tracing/setup.js +160 -0
  689. package/dist/utils/tracing/tracing_context.d.ts +55 -0
  690. package/dist/utils/tracing/tracing_context.js +97 -0
  691. package/dist/utils/tracing/turn_trace_observer.d.ts +95 -0
  692. package/dist/utils/tracing/turn_trace_observer.js +233 -0
  693. package/dist/utils/types.d.ts +80 -0
  694. package/dist/utils/types.js +108 -0
  695. package/dist/utils/utils.d.ts +5 -0
  696. package/dist/utils/utils.js +22 -0
  697. package/dist/utils/yaml.d.ts +179 -0
  698. package/dist/utils/yaml.js +556 -0
  699. package/dist/version.d.ts +3 -0
  700. package/dist/version.js +7 -0
  701. package/dist/workers/base_worker.d.ts +772 -0
  702. package/dist/workers/base_worker.js +1298 -0
  703. package/dist/workers/index.d.ts +2 -0
  704. package/dist/workers/index.js +8 -0
  705. package/dist/workers/llm/backend_llm_worker.d.ts +552 -0
  706. package/dist/workers/llm/backend_llm_worker.js +1055 -0
  707. package/dist/workers/llm/index.d.ts +6 -0
  708. package/dist/workers/llm/index.js +11 -0
  709. package/dist/workers/llm/llm_context_worker.d.ts +66 -0
  710. package/dist/workers/llm/llm_context_worker.js +72 -0
  711. package/dist/workers/llm/llm_worker.d.ts +180 -0
  712. package/dist/workers/llm/llm_worker.js +323 -0
  713. package/dist/workers/llm/tool_decorator.d.ts +68 -0
  714. package/dist/workers/llm/tool_decorator.js +60 -0
  715. package/dist/workers/proxy/index.d.ts +3 -0
  716. package/dist/workers/proxy/index.js +9 -0
  717. package/dist/workers/proxy/websocket/client.d.ts +110 -0
  718. package/dist/workers/proxy/websocket/client.js +196 -0
  719. package/dist/workers/proxy/websocket/index.d.ts +3 -0
  720. package/dist/workers/proxy/websocket/index.js +10 -0
  721. package/dist/workers/runner.d.ts +268 -0
  722. package/dist/workers/runner.js +489 -0
  723. package/dist/workers/ui/index.d.ts +22 -0
  724. package/dist/workers/ui/index.js +27 -0
  725. package/dist/workers/ui/ui_event_decorator.d.ts +43 -0
  726. package/dist/workers/ui/ui_event_decorator.js +75 -0
  727. package/dist/workers/ui/ui_job_context.d.ts +12 -0
  728. package/dist/workers/ui/ui_job_context.js +17 -0
  729. package/dist/workers/ui/ui_prompts.d.ts +21 -0
  730. package/dist/workers/ui/ui_prompts.js +41 -0
  731. package/dist/workers/ui/ui_tools.d.ts +32 -0
  732. package/dist/workers/ui/ui_tools.js +112 -0
  733. package/dist/workers/ui/ui_worker.d.ts +571 -0
  734. package/dist/workers/ui/ui_worker.js +1156 -0
  735. package/package.json +61 -3
  736. package/README.md +0 -5
@@ -0,0 +1,1807 @@
1
+ // Copyright (c) 2024-2026, Daily
2
+ // Copyright (c) 2026, pipedog contributors
3
+ // SPDX-License-Identifier: BSD-2-Clause
4
+ //
5
+ // Ported from pipecat: src/pipecat/processors/frameworks/rtvi/models.py
6
+ import { KeypadEntry as KeypadEntryValues } from "../../../audio/dtmf/types.js";
7
+ import { BotCapabilities } from "../../../pipeline/capabilities.js";
8
+ // -- Constants --
9
+ export const PROTOCOL_VERSION = "2.2.0";
10
+ // -- Version compatibility --
11
+ // Any 1.x client is deprecated but still supported with the old bot-output format.
12
+ export const LEGACY_SUPPORTED_MAJOR = 1;
13
+ export const MESSAGE_LABEL = "rtvi-ai";
14
+ /** Raised when data does not match a model, like pydantic's `ValidationError`. */
15
+ // `Error` is shadowed in this module by the RTVI `Error` model below.
16
+ const BuiltinError = globalThis.Error;
17
+ export class ValidationError extends BuiltinError {
18
+ name = "ValidationError";
19
+ title;
20
+ details;
21
+ constructor(title, details) {
22
+ const lines = details.map((d) => `${d.loc.join(".")}\n ${d.msg}`);
23
+ super(`${details.length} validation error${details.length === 1 ? "" : "s"} for ${title}\n${lines.join("\n")}`);
24
+ this.title = title;
25
+ this.details = details;
26
+ }
27
+ /** The list of problems (pydantic `ValidationError.errors()`). */
28
+ errors() {
29
+ return this.details;
30
+ }
31
+ }
32
+ class FieldError extends BuiltinError {
33
+ detail;
34
+ constructor(detail) {
35
+ super(detail.map((d) => d.msg).join("; "));
36
+ this.detail = detail;
37
+ }
38
+ }
39
+ function fail(msg, loc = []) {
40
+ throw new FieldError([{ loc, msg }]);
41
+ }
42
+ function field(parse, defaultValue, key) {
43
+ const spec = { parse };
44
+ if (defaultValue)
45
+ spec.default = defaultValue;
46
+ if (key)
47
+ spec.key = key;
48
+ return spec;
49
+ }
50
+ function wireKey(name, spec) {
51
+ return spec.key ?? name.replace(/[A-Z]/g, (c) => `_${c.toLowerCase()}`);
52
+ }
53
+ function isPlainObject(value) {
54
+ return typeof value === "object" && value !== null && !Array.isArray(value);
55
+ }
56
+ const P = {
57
+ any: () => (v) => v,
58
+ str: () => (v) => typeof v === "string" ? v : fail("Input should be a valid string"),
59
+ int: () => (v) => typeof v === "number" && Number.isInteger(v) ? v : fail("Input should be a valid integer"),
60
+ float: () => (v) => typeof v === "number" && Number.isFinite(v) ? v : fail("Input should be a valid number"),
61
+ bool: () => (v) => typeof v === "boolean" ? v : fail("Input should be a valid boolean"),
62
+ dict: () => (v) => isPlainObject(v) ? v : fail("Input should be a valid dictionary"),
63
+ literal: (...values) => (v) => values.includes(v)
64
+ ? v
65
+ : fail(`Input should be ${values.map((x) => JSON.stringify(x)).join(" or ")}`),
66
+ optional: (parse) => (v, wire) => v === null || v === undefined ? null : parse(v, wire),
67
+ list: (parse, options = {}) => (v, wire) => {
68
+ if (!Array.isArray(v))
69
+ fail("Input should be a valid list");
70
+ if (options.minLength !== undefined && v.length < options.minLength) {
71
+ fail(`List should have at least ${options.minLength} item after validation, not ${v.length}`);
72
+ }
73
+ const details = [];
74
+ const out = v.map((item, i) => {
75
+ try {
76
+ return parse(item, wire);
77
+ }
78
+ catch (e) {
79
+ if (!(e instanceof FieldError))
80
+ throw e;
81
+ for (const d of e.detail)
82
+ details.push({ loc: [i, ...d.loc], msg: d.msg });
83
+ return undefined;
84
+ }
85
+ });
86
+ if (details.length > 0)
87
+ throw new FieldError(details);
88
+ return out;
89
+ },
90
+ union: (...parsers) => (v, wire) => {
91
+ const details = [];
92
+ for (const parse of parsers) {
93
+ try {
94
+ return parse(v, wire);
95
+ }
96
+ catch (e) {
97
+ if (!(e instanceof FieldError))
98
+ throw e;
99
+ details.push(...e.detail);
100
+ }
101
+ }
102
+ throw new FieldError(details);
103
+ },
104
+ model: (cls) => (v, wire) => {
105
+ const c = cls();
106
+ if (v instanceof c)
107
+ return v;
108
+ if (!isPlainObject(v))
109
+ fail(`Input should be a valid dictionary or instance of ${c.name}`);
110
+ try {
111
+ return (wire ? c.modelValidate(v) : new c(v));
112
+ }
113
+ catch (e) {
114
+ if (e instanceof ValidationError)
115
+ throw new FieldError(e.details);
116
+ throw e;
117
+ }
118
+ },
119
+ };
120
+ const EXTRA = Symbol("pipecat.rtvi.extra");
121
+ const WIRE = Symbol("pipecat.rtvi.wire");
122
+ function dumpValue(value, options) {
123
+ if (value instanceof BaseModel)
124
+ return value.modelDump(options);
125
+ if (typeof value === "object" &&
126
+ value !== null &&
127
+ typeof value.modelDump === "function") {
128
+ return value.modelDump(options);
129
+ }
130
+ if (Array.isArray(value))
131
+ return value.map((v) => dumpValue(v, options));
132
+ if (isPlainObject(value)) {
133
+ return Object.fromEntries(Object.entries(value).map(([k, v]) => [k, dumpValue(v, options)]));
134
+ }
135
+ return value;
136
+ }
137
+ /**
138
+ * Base class of the RTVI models (pydantic `BaseModel`).
139
+ *
140
+ * Subclasses declare their fields with `declare` and describe them in the
141
+ * static `fields` table. The constructor validates camelCase options;
142
+ * `modelValidate()` validates wire (snake_case) data; `modelDump()` produces
143
+ * wire data.
144
+ */
145
+ export class BaseModel {
146
+ /** Field table: name, parser, default and wire key. */
147
+ static fields = {};
148
+ /** What to do with unknown wire keys: drop them, or keep them in `modelExtra`. */
149
+ static extra = "ignore";
150
+ /** Unknown keys kept by models created with `extra = "allow"` (pydantic `model_extra`). */
151
+ modelExtra = null;
152
+ constructor(options = {}) {
153
+ const cls = new.target;
154
+ const input = cls._beforeValidate({ ...options });
155
+ const details = [];
156
+ const self = this;
157
+ const wire = options[WIRE] === true;
158
+ for (const [name, spec] of Object.entries(cls.fields)) {
159
+ const raw = input[name];
160
+ const key = wireKey(name, spec);
161
+ if (raw === undefined) {
162
+ if (spec.default) {
163
+ self[name] = spec.default();
164
+ }
165
+ else {
166
+ details.push({ loc: [key], msg: "Field required" });
167
+ }
168
+ continue;
169
+ }
170
+ try {
171
+ self[name] = spec.parse(raw, wire);
172
+ }
173
+ catch (e) {
174
+ if (!(e instanceof FieldError))
175
+ throw e;
176
+ for (const d of e.detail)
177
+ details.push({ loc: [key, ...d.loc], msg: d.msg });
178
+ }
179
+ }
180
+ if (details.length > 0) {
181
+ throw new ValidationError(cls.name, details);
182
+ }
183
+ if (cls.extra === "allow") {
184
+ const extra = {
185
+ ...(options[EXTRA] ?? {}),
186
+ };
187
+ for (const [k, v] of Object.entries(options)) {
188
+ if (!(k in cls.fields))
189
+ extra[k] = v;
190
+ }
191
+ this.modelExtra = extra;
192
+ }
193
+ }
194
+ /**
195
+ * Hook run on the (camelCase) input before the fields are validated, like
196
+ * pydantic's `@model_validator(mode="before")`.
197
+ */
198
+ static _beforeValidate(data) {
199
+ return data;
200
+ }
201
+ /**
202
+ * Validate wire data (snake_case keys) into a model (pydantic `model_validate`).
203
+ *
204
+ * @throws ValidationError If the data does not match the model.
205
+ */
206
+ static modelValidate(data) {
207
+ // `this` is the subclass modelValidate() is called on, as with a classmethod.
208
+ // biome-ignore lint/complexity/noThisInStatic: polymorphic static.
209
+ const cls = this;
210
+ // biome-ignore lint/complexity/noThisInStatic: polymorphic static.
211
+ const ctor = this;
212
+ if (data instanceof cls)
213
+ return data;
214
+ if (!isPlainObject(data)) {
215
+ throw new ValidationError(cls.name, [
216
+ { loc: [], msg: `Input should be a valid dictionary or instance of ${cls.name}` },
217
+ ]);
218
+ }
219
+ const options = {};
220
+ const known = new Set();
221
+ for (const [name, spec] of Object.entries(cls.fields)) {
222
+ const key = wireKey(name, spec);
223
+ known.add(key);
224
+ if (key in data)
225
+ options[name] = data[key];
226
+ }
227
+ if (cls.extra === "allow") {
228
+ const extra = {};
229
+ for (const [k, v] of Object.entries(data)) {
230
+ if (!known.has(k))
231
+ extra[k] = v;
232
+ }
233
+ options[EXTRA] = extra;
234
+ }
235
+ options[WIRE] = true;
236
+ return new ctor(options);
237
+ }
238
+ /**
239
+ * The wire form of the model, with upstream's snake_case keys (pydantic
240
+ * `model_dump`). Nested models are dumped too.
241
+ */
242
+ modelDump(options = {}) {
243
+ const cls = this.constructor;
244
+ const self = this;
245
+ const dump = {};
246
+ for (const [name, spec] of Object.entries(cls.fields)) {
247
+ const value = self[name];
248
+ if (options.excludeNone && (value === null || value === undefined))
249
+ continue;
250
+ dump[wireKey(name, spec)] = dumpValue(value, options);
251
+ }
252
+ if (this.modelExtra) {
253
+ for (const [k, v] of Object.entries(this.modelExtra)) {
254
+ if (options.excludeNone && (v === null || v === undefined))
255
+ continue;
256
+ dump[k] = dumpValue(v, options);
257
+ }
258
+ }
259
+ return dump;
260
+ }
261
+ /** Serialize with the wire keys, as pydantic does. */
262
+ toJSON() {
263
+ return this.modelDump();
264
+ }
265
+ }
266
+ const LABEL_FIELD = field(P.literal(MESSAGE_LABEL), () => MESSAGE_LABEL);
267
+ function typeField(type) {
268
+ return field(P.literal(type), () => type);
269
+ }
270
+ /**
271
+ * Base RTVI message structure.
272
+ *
273
+ * Represents the standard format for RTVI protocol messages.
274
+ */
275
+ export class Message extends BaseModel {
276
+ static fields = {
277
+ label: LABEL_FIELD,
278
+ type: field(P.str()),
279
+ id: field(P.str()),
280
+ data: field(P.optional(P.dict()), () => null),
281
+ };
282
+ constructor(options) {
283
+ super(options);
284
+ }
285
+ }
286
+ /** Data structure expected from client messages sent to the RTVI server. */
287
+ export class RawClientMessageData extends BaseModel {
288
+ static fields = {
289
+ t: field(P.str()),
290
+ d: field(P.optional(P.any()), () => null),
291
+ };
292
+ constructor(options) {
293
+ super(options);
294
+ }
295
+ }
296
+ /** Cleansed data structure for client messages for handling. */
297
+ export class ClientMessage extends BaseModel {
298
+ static fields = {
299
+ msgId: field(P.str()),
300
+ type: field(P.str()),
301
+ data: field(P.optional(P.any()), () => null),
302
+ };
303
+ constructor(options) {
304
+ super(options);
305
+ }
306
+ }
307
+ /** Data structure for server responses to client messages. */
308
+ export class RawServerResponseData extends BaseModel {
309
+ static fields = {
310
+ t: field(P.str()),
311
+ d: field(P.optional(P.any()), () => null),
312
+ };
313
+ constructor(options) {
314
+ super(options);
315
+ }
316
+ }
317
+ /**
318
+ * The RTVI-formatted message response from the server to the client.
319
+ *
320
+ * This message is used to respond to custom messages sent by the client.
321
+ */
322
+ export class ServerResponse extends BaseModel {
323
+ static fields = {
324
+ label: LABEL_FIELD,
325
+ type: typeField("server-response"),
326
+ id: field(P.str()),
327
+ data: field(P.model(() => RawServerResponseData)),
328
+ };
329
+ constructor(options) {
330
+ super(options);
331
+ }
332
+ }
333
+ /**
334
+ * Data about the RTVI client.
335
+ *
336
+ * Contains information about the client, including which RTVI library it is
337
+ * using, what platform it is on and any additional details, if available.
338
+ */
339
+ export class AboutClientData extends BaseModel {
340
+ static fields = {
341
+ library: field(P.str()),
342
+ libraryVersion: field(P.optional(P.str()), () => null),
343
+ platform: field(P.optional(P.str()), () => null),
344
+ platformVersion: field(P.optional(P.str()), () => null),
345
+ platformDetails: field(P.optional(P.any()), () => null),
346
+ };
347
+ constructor(options) {
348
+ super(options);
349
+ }
350
+ }
351
+ /**
352
+ * Data format of client ready messages.
353
+ *
354
+ * Contains the RTVI protocol version and client information.
355
+ */
356
+ export class ClientReadyData extends BaseModel {
357
+ static fields = {
358
+ version: field(P.str()),
359
+ about: field(P.model(() => AboutClientData)),
360
+ };
361
+ constructor(options) {
362
+ super(options);
363
+ }
364
+ }
365
+ /**
366
+ * Data for an RTVI error response.
367
+ *
368
+ * Contains the error message to send back to the client.
369
+ */
370
+ export class ErrorResponseData extends BaseModel {
371
+ static fields = {
372
+ error: field(P.str()),
373
+ };
374
+ constructor(options) {
375
+ super(options);
376
+ }
377
+ }
378
+ /**
379
+ * RTVI error response message.
380
+ *
381
+ * RTVI formatted error response message for relaying failed client requests.
382
+ */
383
+ export class ErrorResponse extends BaseModel {
384
+ static fields = {
385
+ label: LABEL_FIELD,
386
+ type: typeField("error-response"),
387
+ id: field(P.str()),
388
+ data: field(P.model(() => ErrorResponseData)),
389
+ };
390
+ constructor(options) {
391
+ super(options);
392
+ }
393
+ }
394
+ /**
395
+ * Data for an RTVI error event.
396
+ *
397
+ * Contains error information including whether it's fatal.
398
+ */
399
+ export class ErrorData extends BaseModel {
400
+ static fields = {
401
+ error: field(P.str()),
402
+ fatal: field(P.bool()),
403
+ };
404
+ constructor(options) {
405
+ super(options);
406
+ }
407
+ }
408
+ /**
409
+ * RTVI error event message.
410
+ *
411
+ * RTVI formatted error message for relaying errors in the pipeline.
412
+ */
413
+ // biome-ignore lint/suspicious/noShadowRestrictedNames: upstream name (RTVI.Error).
414
+ export class Error extends BaseModel {
415
+ static fields = {
416
+ label: LABEL_FIELD,
417
+ type: typeField("error"),
418
+ data: field(P.model(() => ErrorData)),
419
+ };
420
+ constructor(options) {
421
+ super(options);
422
+ }
423
+ }
424
+ const botCapabilitiesParser = (v, wire) => {
425
+ if (v instanceof BotCapabilities)
426
+ return v;
427
+ if (!isPlainObject(v))
428
+ fail("Input should be a valid dictionary or instance of BotCapabilities");
429
+ if (!wire)
430
+ return new BotCapabilities(v);
431
+ const optBool = (key) => {
432
+ const x = v[key];
433
+ if (x === undefined || x === null)
434
+ return null;
435
+ if (typeof x !== "boolean")
436
+ fail("Input should be a valid boolean", [key]);
437
+ return x;
438
+ };
439
+ return new BotCapabilities({
440
+ audioIn: optBool("audio_in"),
441
+ audioOut: optBool("audio_out"),
442
+ videoIn: optBool("video_in"),
443
+ screenIn: optBool("screen_in"),
444
+ videoOut: optBool("video_out"),
445
+ metrics: optBool("metrics"),
446
+ });
447
+ };
448
+ /**
449
+ * Data for bot ready notification.
450
+ *
451
+ * Contains protocol version and initial configuration.
452
+ *
453
+ * - `version`: the RTVI protocol version the bot speaks with this client.
454
+ * - `about`: information about the bot, such as the Pipecat library and version.
455
+ * - `capabilities`: what the bot does in this session (media sent and
456
+ * received, metrics), so the client can show only the UI that applies.
457
+ * Added in protocol 2.2.0.
458
+ */
459
+ export class BotReadyData extends BaseModel {
460
+ static fields = {
461
+ version: field(P.str()),
462
+ about: field(P.optional(P.dict()), () => null),
463
+ capabilities: field(P.optional(botCapabilitiesParser), () => null),
464
+ };
465
+ constructor(options) {
466
+ super(options);
467
+ }
468
+ }
469
+ /**
470
+ * Message indicating bot is ready for interaction.
471
+ *
472
+ * Sent after bot initialization is complete.
473
+ */
474
+ export class BotReady extends BaseModel {
475
+ static fields = {
476
+ label: LABEL_FIELD,
477
+ type: typeField("bot-ready"),
478
+ id: field(P.str()),
479
+ data: field(P.model(() => BotReadyData)),
480
+ };
481
+ constructor(options) {
482
+ super(options);
483
+ }
484
+ }
485
+ /**
486
+ * Options for sending text input to the LLM.
487
+ *
488
+ * Contains options for how the pipeline should process the text input.
489
+ */
490
+ export class SendTextOptions extends BaseModel {
491
+ static fields = {
492
+ runImmediately: field(P.bool(), () => true),
493
+ audioResponse: field(P.bool(), () => true),
494
+ };
495
+ constructor(options = {}) {
496
+ super(options);
497
+ }
498
+ }
499
+ /**
500
+ * Data format for sending text input to the LLM.
501
+ *
502
+ * Contains the text content to send and any options for how the pipeline
503
+ * should process it.
504
+ */
505
+ export class SendTextData extends BaseModel {
506
+ static fields = {
507
+ content: field(P.str()),
508
+ options: field(P.optional(P.model(() => SendTextOptions)), () => null),
509
+ };
510
+ constructor(options) {
511
+ super(options);
512
+ }
513
+ }
514
+ const fileSourceTypeParser = P.literal("bytes", "url");
515
+ /** Base class for RTVI file sources. */
516
+ export class FileSource extends BaseModel {
517
+ static fields = {
518
+ type: field(fileSourceTypeParser),
519
+ };
520
+ constructor(options) {
521
+ super(options);
522
+ }
523
+ }
524
+ /** File source as base64-encoded bytes. */
525
+ export class FileBytes extends FileSource {
526
+ static fields = {
527
+ type: field(fileSourceTypeParser, () => "bytes"),
528
+ bytes: field(P.str()),
529
+ width: field(P.optional(P.int()), () => null),
530
+ height: field(P.optional(P.int()), () => null),
531
+ };
532
+ constructor(options) {
533
+ super(options);
534
+ }
535
+ }
536
+ /**
537
+ * File source as a URL.
538
+ *
539
+ * - `url`: the file's URL: whatever the `POST /files` upload endpoint
540
+ * returned (`pipecat:<id>` with the default local storage, or a URL minted
541
+ * by a custom storage backend), a cloud-storage URI (`s3://`, `gs://`), or a
542
+ * plain `http(s)` URL. The URL is resolved at completion time: the LLM
543
+ * provider fetches it itself when it can (public URLs, its own cloud IAM),
544
+ * and otherwise the LLM service's `FileResolver` downloads the bytes and
545
+ * inlines them.
546
+ */
547
+ export class FileUrl extends FileSource {
548
+ static fields = {
549
+ type: field(fileSourceTypeParser, () => "url"),
550
+ url: field(P.str()),
551
+ };
552
+ constructor(options) {
553
+ super(options);
554
+ }
555
+ }
556
+ /** File data structure for RTVI file sending. */
557
+ export class File extends BaseModel {
558
+ static fields = {
559
+ format: field(P.str()),
560
+ name: field(P.optional(P.str()), () => null),
561
+ source: field(P.union(P.model(() => FileBytes), P.model(() => FileUrl))),
562
+ };
563
+ constructor(options) {
564
+ super(options);
565
+ }
566
+ }
567
+ /** Options for sending a file to the LLM. */
568
+ export class SendFileOptions extends BaseModel {
569
+ static fields = {
570
+ runImmediately: field(P.bool(), () => true),
571
+ audioResponse: field(P.bool(), () => true),
572
+ customOptions: field(P.optional(P.dict()), () => null),
573
+ };
574
+ constructor(options = {}) {
575
+ super(options);
576
+ }
577
+ }
578
+ /**
579
+ * Data format for sending a file to the LLM.
580
+ *
581
+ * Contains the information of the file to send and any options for how the
582
+ * pipeline should process it.
583
+ */
584
+ export class SendFileData extends BaseModel {
585
+ static fields = {
586
+ content: field(P.str()),
587
+ file: field(P.model(() => File)),
588
+ options: field(P.optional(P.model(() => SendFileOptions)), () => null),
589
+ };
590
+ constructor(options) {
591
+ super(options);
592
+ }
593
+ }
594
+ /**
595
+ * Data format for DTMF keypresses sent from the client.
596
+ *
597
+ * Carries one or more keypad entries (`0`-`9`, `*`, `#`), delivered in order,
598
+ * so the bot's DTMF handling (e.g. a `DTMFAggregator`) sees them exactly as a
599
+ * telephony transport would deliver rapid keypresses.
600
+ *
601
+ * Protocol 2.1.0 replaced the single `button` field with `buttons`.
602
+ */
603
+ export class DTMFInputData extends BaseModel {
604
+ static fields = {
605
+ buttons: field(P.list(P.literal(...Object.values(KeypadEntryValues)), { minLength: 1 })),
606
+ };
607
+ constructor(options) {
608
+ super(options);
609
+ }
610
+ }
611
+ /**
612
+ * Data for LLM function call start notification.
613
+ *
614
+ * Contains the function name being called. Fields may be omitted based on the
615
+ * configured function_call_report_level for security.
616
+ *
617
+ * - `functionName`: name of the function called.
618
+ */
619
+ export class LLMFunctionCallStartMessageData extends BaseModel {
620
+ static fields = {
621
+ functionName: field(P.optional(P.str()), () => null),
622
+ };
623
+ constructor(options = {}) {
624
+ super(options);
625
+ }
626
+ }
627
+ /**
628
+ * Message notifying that an LLM function call has started.
629
+ *
630
+ * Sent when the LLM begins a function call.
631
+ */
632
+ export class LLMFunctionCallStartMessage extends BaseModel {
633
+ static fields = {
634
+ label: LABEL_FIELD,
635
+ type: typeField("llm-function-call-started"),
636
+ data: field(P.model(() => LLMFunctionCallStartMessageData)),
637
+ };
638
+ constructor(options) {
639
+ super(options);
640
+ }
641
+ }
642
+ /**
643
+ * Data for LLM function call result.
644
+ *
645
+ * Contains function call details and result.
646
+ */
647
+ export class LLMFunctionCallResultData extends BaseModel {
648
+ static fields = {
649
+ functionName: field(P.str()),
650
+ toolCallId: field(P.str()),
651
+ arguments: field(P.dict()),
652
+ result: field(P.union(P.dict(), P.str())),
653
+ };
654
+ constructor(options) {
655
+ super(options);
656
+ }
657
+ }
658
+ /**
659
+ * Data for LLM function call in-progress notification.
660
+ *
661
+ * Contains function call details including name, ID, and arguments. Fields
662
+ * may be omitted based on the configured function_call_report_level for
663
+ * security.
664
+ *
665
+ * - `toolCallId`: unique identifier of the call.
666
+ * - `functionName`: name of the function called.
667
+ * - `arguments`: arguments passed to the function.
668
+ */
669
+ export class LLMFunctionCallInProgressMessageData extends BaseModel {
670
+ static fields = {
671
+ toolCallId: field(P.str()),
672
+ functionName: field(P.optional(P.str()), () => null),
673
+ arguments: field(P.optional(P.dict()), () => null),
674
+ };
675
+ constructor(options) {
676
+ super(options);
677
+ }
678
+ }
679
+ /**
680
+ * Message notifying that an LLM function call is in progress.
681
+ *
682
+ * Sent when the LLM function call execution begins.
683
+ */
684
+ export class LLMFunctionCallInProgressMessage extends BaseModel {
685
+ static fields = {
686
+ label: LABEL_FIELD,
687
+ type: typeField("llm-function-call-in-progress"),
688
+ data: field(P.model(() => LLMFunctionCallInProgressMessageData)),
689
+ };
690
+ constructor(options) {
691
+ super(options);
692
+ }
693
+ }
694
+ /**
695
+ * Data for LLM function call stopped notification.
696
+ *
697
+ * Contains details about the function call that stopped, including whether
698
+ * it was cancelled or completed with a result. Fields may be omitted based on
699
+ * the configured function_call_report_level for security.
700
+ *
701
+ * - `toolCallId`: unique identifier of the call.
702
+ * - `cancelled`: whether the call was cancelled rather than completed.
703
+ * - `functionName`: name of the function called.
704
+ * - `result`: the result, when the call completed with one.
705
+ */
706
+ export class LLMFunctionCallStoppedMessageData extends BaseModel {
707
+ static fields = {
708
+ toolCallId: field(P.str()),
709
+ cancelled: field(P.bool()),
710
+ functionName: field(P.optional(P.str()), () => null),
711
+ result: field(P.optional(P.any()), () => null),
712
+ };
713
+ constructor(options) {
714
+ super(options);
715
+ }
716
+ }
717
+ /**
718
+ * Message notifying that an LLM function call has stopped.
719
+ *
720
+ * Sent when a function call completes (with result) or is cancelled.
721
+ */
722
+ export class LLMFunctionCallStoppedMessage extends BaseModel {
723
+ static fields = {
724
+ label: LABEL_FIELD,
725
+ type: typeField("llm-function-call-stopped"),
726
+ data: field(P.model(() => LLMFunctionCallStoppedMessageData)),
727
+ };
728
+ constructor(options) {
729
+ super(options);
730
+ }
731
+ }
732
+ /** Message indicating bot LLM processing has started. */
733
+ export class BotLLMStartedMessage extends BaseModel {
734
+ static fields = {
735
+ label: LABEL_FIELD,
736
+ type: typeField("bot-llm-started"),
737
+ };
738
+ constructor(options = {}) {
739
+ super(options);
740
+ }
741
+ }
742
+ /** Message indicating bot LLM processing has stopped. */
743
+ export class BotLLMStoppedMessage extends BaseModel {
744
+ static fields = {
745
+ label: LABEL_FIELD,
746
+ type: typeField("bot-llm-stopped"),
747
+ };
748
+ constructor(options = {}) {
749
+ super(options);
750
+ }
751
+ }
752
+ /** Message indicating bot TTS processing has started. */
753
+ export class BotTTSStartedMessage extends BaseModel {
754
+ static fields = {
755
+ label: LABEL_FIELD,
756
+ type: typeField("bot-tts-started"),
757
+ };
758
+ constructor(options = {}) {
759
+ super(options);
760
+ }
761
+ }
762
+ /** Message indicating bot TTS processing has stopped. */
763
+ export class BotTTSStoppedMessage extends BaseModel {
764
+ static fields = {
765
+ label: LABEL_FIELD,
766
+ type: typeField("bot-tts-stopped"),
767
+ };
768
+ constructor(options = {}) {
769
+ super(options);
770
+ }
771
+ }
772
+ /**
773
+ * Data for text-based RTVI messages.
774
+ *
775
+ * Contains text content.
776
+ */
777
+ export class TextMessageData extends BaseModel {
778
+ static fields = {
779
+ text: field(P.str()),
780
+ };
781
+ constructor(options) {
782
+ super(options);
783
+ }
784
+ }
785
+ /**
786
+ * Word-level TTS progress within a spoken segment.
787
+ *
788
+ * - `accumulatedText`: text already spoken in this segment, including the
789
+ * current word.
790
+ * - `remainingText`: text not yet spoken in this segment.
791
+ */
792
+ export class SpokenProgressData extends BaseModel {
793
+ static fields = {
794
+ accumulatedText: field(P.str()),
795
+ remainingText: field(P.str()),
796
+ };
797
+ constructor(options) {
798
+ super(options);
799
+ }
800
+ }
801
+ /**
802
+ * Return type for bot output transform functions.
803
+ *
804
+ * - `text`: the transformed full text of the segment.
805
+ * - `accumulatedText`: transformed spoken-so-far portion. Only populated when
806
+ * the transform is called from a progress context.
807
+ * - `remainingText`: transformed not-yet-spoken portion. Only populated when
808
+ * the transform is called from a progress context.
809
+ */
810
+ export class BotOutputTransformResult extends BaseModel {
811
+ static fields = {
812
+ text: field(P.str()),
813
+ accumulatedText: field(P.optional(P.str()), () => null),
814
+ remainingText: field(P.optional(P.str()), () => null),
815
+ };
816
+ constructor(options) {
817
+ super(options);
818
+ }
819
+ }
820
+ /**
821
+ * Data for bot output RTVI messages.
822
+ *
823
+ * Extends TextMessageData to include metadata about the output.
824
+ *
825
+ * This class supports both protocol v1 (1.4.x) and v2 (2.0.0+) clients. The
826
+ * observer populates different field subsets depending on the negotiated
827
+ * version; `sendRtviMessage` serialises with `excludeNone: true` so each
828
+ * client only sees the fields relevant to its version.
829
+ *
830
+ * - `textType`: what form the text is in (e.g., sentence, code, etc.).
831
+ * - `aggregatedBy`: what form the text is in, always the same as `textType`.
832
+ * Deprecated upstream since 1.13.0 (use `textType`); kept because it is
833
+ * still on the wire.
834
+ * - `segmentId`: ID of the source AggregatedTextFrame.
835
+ * - `spoken`: **(v1 only)** whether the text has been spoken by TTS.
836
+ * - `willBeSpoken`: **(v2+)** whether the text will be spoken by TTS.
837
+ * - `spokenStatus`: **(v2+)** lifecycle status of the segment: `"new"` on its
838
+ * first message, the only one for text that isn't spoken; `"in-progress"`
839
+ * as each of its words is spoken, for TTS services with word timestamps;
840
+ * `"completed"` once its last word is spoken.
841
+ * - `spokenProgress`: **(v2+)** accumulated / remaining text breakdown.
842
+ * Present when `willBeSpoken` is true.
843
+ */
844
+ export class BotOutputMessageData extends TextMessageData {
845
+ static fields = {
846
+ ...TextMessageData.fields,
847
+ textType: field(P.str()),
848
+ aggregatedBy: field(P.optional(P.str()), () => null),
849
+ segmentId: field(P.optional(P.int()), () => null),
850
+ spoken: field(P.optional(P.bool()), () => null),
851
+ willBeSpoken: field(P.optional(P.bool()), () => null),
852
+ spokenStatus: field(P.optional(P.literal("new", "in-progress", "completed")), () => null),
853
+ spokenProgress: field(P.optional(P.model(() => SpokenProgressData)), () => null),
854
+ };
855
+ constructor(options) {
856
+ super(options);
857
+ }
858
+ /** Fill whichever of `textType` and `aggregatedBy` is missing from the other. */
859
+ static _beforeValidate(data) {
860
+ if (data.textType === undefined && data.aggregatedBy !== undefined) {
861
+ return { ...data, textType: data.aggregatedBy };
862
+ }
863
+ else if (data.aggregatedBy === undefined && data.textType !== undefined) {
864
+ return { ...data, aggregatedBy: data.textType };
865
+ }
866
+ return data;
867
+ }
868
+ }
869
+ /**
870
+ * Message containing bot output text.
871
+ *
872
+ * An event meant to holistically represent what the bot is outputting, along
873
+ * with metadata about the output and if it has been spoken.
874
+ */
875
+ export class BotOutputMessage extends BaseModel {
876
+ static fields = {
877
+ label: LABEL_FIELD,
878
+ type: typeField("bot-output"),
879
+ data: field(P.model(() => BotOutputMessageData)),
880
+ };
881
+ constructor(options) {
882
+ super(options);
883
+ }
884
+ }
885
+ /**
886
+ * Message containing bot transcription text.
887
+ *
888
+ * Sent when the bot's speech is transcribed.
889
+ */
890
+ export class BotTranscriptionMessage extends BaseModel {
891
+ static fields = {
892
+ label: LABEL_FIELD,
893
+ type: typeField("bot-transcription"),
894
+ data: field(P.model(() => TextMessageData)),
895
+ };
896
+ constructor(options) {
897
+ super(options);
898
+ }
899
+ }
900
+ /**
901
+ * Message containing bot LLM text output.
902
+ *
903
+ * Sent when the bot's LLM generates text.
904
+ *
905
+ * Deprecated upstream since 1.13.0 (use `LLMRawTextMessage`); kept because
906
+ * the observer still sends it while `botLlmEnabled` is on.
907
+ */
908
+ export class BotLLMTextMessage extends BaseModel {
909
+ static fields = {
910
+ label: LABEL_FIELD,
911
+ type: typeField("bot-llm-text"),
912
+ data: field(P.model(() => TextMessageData)),
913
+ };
914
+ constructor(options) {
915
+ super(options);
916
+ }
917
+ }
918
+ /**
919
+ * Data for a bot LLM marker message.
920
+ *
921
+ * - `text`: the marker as the LLM produced it; empty when the response
922
+ * carried none.
923
+ * - `kind`: what the marker means, in the emitter's vocabulary (the
924
+ * turn-completion mixin's `complete`, `short` or `long`), or `null` when the
925
+ * emitter gave none.
926
+ * - `raw`: the response's text as the LLM produced it, markers included.
927
+ * - `markers`: every marker the emitter recognizes.
928
+ */
929
+ export class BotLLMMarkerMessageData extends BaseModel {
930
+ static fields = {
931
+ text: field(P.str()),
932
+ kind: field(P.optional(P.str()), () => null),
933
+ raw: field(P.str(), () => ""),
934
+ markers: field(P.list(P.str()), () => []),
935
+ };
936
+ constructor(options) {
937
+ super(options);
938
+ }
939
+ }
940
+ /**
941
+ * Message reporting the sideband marker the bot's LLM emitted in a response.
942
+ *
943
+ * A marker is structured assistant output kept out of the spoken text, such
944
+ * as the turn-completion markers of `filterIncompleteUserTurns`. Sent once
945
+ * per response, when it ends, and only when the observer's
946
+ * `botLlmMarkerEnabled` is on.
947
+ */
948
+ export class BotLLMMarkerMessage extends BaseModel {
949
+ static fields = {
950
+ label: LABEL_FIELD,
951
+ type: typeField("bot-llm-marker"),
952
+ data: field(P.model(() => BotLLMMarkerMessageData)),
953
+ };
954
+ constructor(options) {
955
+ super(options);
956
+ }
957
+ }
958
+ /**
959
+ * Message containing bot TTS text output.
960
+ *
961
+ * Sent when text is being processed by TTS.
962
+ *
963
+ * Deprecated upstream since 1.13.0 (use `TTSRawTextMessage`); kept because
964
+ * the observer still sends it while `botTtsEnabled` is on.
965
+ */
966
+ export class BotTTSTextMessage extends BaseModel {
967
+ static fields = {
968
+ label: LABEL_FIELD,
969
+ type: typeField("bot-tts-text"),
970
+ data: field(P.model(() => TextMessageData)),
971
+ };
972
+ constructor(options) {
973
+ super(options);
974
+ }
975
+ }
976
+ /**
977
+ * Data for audio-based RTVI messages.
978
+ *
979
+ * Contains audio data and metadata.
980
+ */
981
+ export class AudioMessageData extends BaseModel {
982
+ static fields = {
983
+ audio: field(P.str()),
984
+ sampleRate: field(P.int()),
985
+ numChannels: field(P.int()),
986
+ };
987
+ constructor(options) {
988
+ super(options);
989
+ }
990
+ }
991
+ /**
992
+ * Message containing bot TTS audio output.
993
+ *
994
+ * Sent when the bot's TTS generates audio.
995
+ */
996
+ export class BotTTSAudioMessage extends BaseModel {
997
+ static fields = {
998
+ label: LABEL_FIELD,
999
+ type: typeField("bot-tts-audio"),
1000
+ data: field(P.model(() => AudioMessageData)),
1001
+ };
1002
+ constructor(options) {
1003
+ super(options);
1004
+ }
1005
+ }
1006
+ /**
1007
+ * Data for user transcription messages.
1008
+ *
1009
+ * Contains transcription text and metadata.
1010
+ *
1011
+ * Deprecated upstream since 1.13.0 (use `STTRawTextMessageData`); kept
1012
+ * because the observer still sends `user-transcription` messages.
1013
+ */
1014
+ export class UserTranscriptionMessageData extends BaseModel {
1015
+ static fields = {
1016
+ text: field(P.str()),
1017
+ userId: field(P.str()),
1018
+ timestamp: field(P.str()),
1019
+ final: field(P.bool()),
1020
+ };
1021
+ constructor(options) {
1022
+ super(options);
1023
+ }
1024
+ }
1025
+ /**
1026
+ * Message containing user transcription.
1027
+ *
1028
+ * Sent when user speech is transcribed.
1029
+ *
1030
+ * Deprecated upstream since 1.13.0 (use `STTRawTextMessage`, or
1031
+ * `UserInputMessage` for what the user said); kept because the observer
1032
+ * still sends it.
1033
+ */
1034
+ export class UserTranscriptionMessage extends BaseModel {
1035
+ static fields = {
1036
+ label: LABEL_FIELD,
1037
+ type: typeField("user-transcription"),
1038
+ data: field(P.model(() => UserTranscriptionMessageData)),
1039
+ };
1040
+ constructor(options) {
1041
+ super(options);
1042
+ }
1043
+ }
1044
+ /**
1045
+ * Data for user input messages.
1046
+ *
1047
+ * - `text`: what the user said or typed.
1048
+ * - `inputType`: what kind of input it is: `"transcription"` for speech
1049
+ * transcribed by the STT, `"chat"` for text the client sent, or
1050
+ * `"backchannel"` for a short acknowledgment the user said while the bot
1051
+ * talks, such as "mhm".
1052
+ * - `timestamp`: when the user said or sent it.
1053
+ * - `final`: whether the text is final. Only an interim transcription isn't.
1054
+ * - `userId`: identifier for the user who spoke or typed. For chat, set only
1055
+ * when the transport knows the sender, such as Daily and LiveKit.
1056
+ * - `msgId`: for chat, the id of the client's `send-text` message.
1057
+ */
1058
+ export class UserInputMessageData extends BaseModel {
1059
+ static fields = {
1060
+ text: field(P.str()),
1061
+ inputType: field(P.literal("transcription", "chat", "backchannel")),
1062
+ timestamp: field(P.str()),
1063
+ final: field(P.bool()),
1064
+ userId: field(P.optional(P.str()), () => null),
1065
+ msgId: field(P.optional(P.str()), () => null),
1066
+ };
1067
+ constructor(options) {
1068
+ super(options);
1069
+ }
1070
+ }
1071
+ /**
1072
+ * Message containing what the user said or typed.
1073
+ *
1074
+ * The user's counterpart of `bot-output`. A backchannel doesn't interrupt the
1075
+ * bot or reach the LLM.
1076
+ */
1077
+ export class UserInputMessage extends BaseModel {
1078
+ static fields = {
1079
+ label: LABEL_FIELD,
1080
+ type: typeField("user-input"),
1081
+ data: field(P.model(() => UserInputMessageData)),
1082
+ };
1083
+ constructor(options) {
1084
+ super(options);
1085
+ }
1086
+ }
1087
+ /**
1088
+ * Message containing user text input for LLM.
1089
+ *
1090
+ * Sent when user text is processed by the LLM.
1091
+ */
1092
+ export class UserLLMTextMessage extends BaseModel {
1093
+ static fields = {
1094
+ label: LABEL_FIELD,
1095
+ type: typeField("user-llm-text"),
1096
+ data: field(P.model(() => TextMessageData)),
1097
+ };
1098
+ constructor(options) {
1099
+ super(options);
1100
+ }
1101
+ }
1102
+ /**
1103
+ * Data for STT raw text messages.
1104
+ *
1105
+ * - `text`: the transcribed text.
1106
+ * - `userId`: identifier for the user who spoke.
1107
+ * - `timestamp`: when the user said it.
1108
+ * - `final`: whether the transcription is final, as opposed to interim.
1109
+ */
1110
+ export class STTRawTextMessageData extends BaseModel {
1111
+ static fields = {
1112
+ text: field(P.str()),
1113
+ userId: field(P.str()),
1114
+ timestamp: field(P.str()),
1115
+ final: field(P.bool()),
1116
+ };
1117
+ constructor(options) {
1118
+ super(options);
1119
+ }
1120
+ }
1121
+ /** Message reporting a transcription as the STT produced it, interim ones included. */
1122
+ export class STTRawTextMessage extends BaseModel {
1123
+ static fields = {
1124
+ label: LABEL_FIELD,
1125
+ type: typeField("stt-raw-text"),
1126
+ data: field(P.model(() => STTRawTextMessageData)),
1127
+ };
1128
+ constructor(options) {
1129
+ super(options);
1130
+ }
1131
+ }
1132
+ /** Message reporting a chunk of text as the LLM streamed it. */
1133
+ export class LLMRawTextMessage extends BaseModel {
1134
+ static fields = {
1135
+ label: LABEL_FIELD,
1136
+ type: typeField("llm-raw-text"),
1137
+ data: field(P.model(() => TextMessageData)),
1138
+ };
1139
+ constructor(options) {
1140
+ super(options);
1141
+ }
1142
+ }
1143
+ /** Message reporting text the TTS speaks, as it is spoken. */
1144
+ export class TTSRawTextMessage extends BaseModel {
1145
+ static fields = {
1146
+ label: LABEL_FIELD,
1147
+ type: typeField("tts-raw-text"),
1148
+ data: field(P.model(() => TextMessageData)),
1149
+ };
1150
+ constructor(options) {
1151
+ super(options);
1152
+ }
1153
+ }
1154
+ /** Message indicating user has started speaking. */
1155
+ export class UserStartedSpeakingMessage extends BaseModel {
1156
+ static fields = {
1157
+ label: LABEL_FIELD,
1158
+ type: typeField("user-started-speaking"),
1159
+ };
1160
+ constructor(options = {}) {
1161
+ super(options);
1162
+ }
1163
+ }
1164
+ /** Message indicating user has stopped speaking. */
1165
+ export class UserStoppedSpeakingMessage extends BaseModel {
1166
+ static fields = {
1167
+ label: LABEL_FIELD,
1168
+ type: typeField("user-stopped-speaking"),
1169
+ };
1170
+ constructor(options = {}) {
1171
+ super(options);
1172
+ }
1173
+ }
1174
+ /**
1175
+ * Message indicating VAD detected the user started speaking.
1176
+ *
1177
+ * Raw VAD signal, emitted independently of turn finalization (unlike
1178
+ * `user-started-speaking`, which a turn strategy may gate or defer).
1179
+ */
1180
+ export class VADUserStartedSpeakingMessage extends BaseModel {
1181
+ static fields = {
1182
+ label: LABEL_FIELD,
1183
+ type: typeField("vad-user-started-speaking"),
1184
+ };
1185
+ constructor(options = {}) {
1186
+ super(options);
1187
+ }
1188
+ }
1189
+ /**
1190
+ * Message indicating VAD detected the user stopped speaking.
1191
+ *
1192
+ * Raw VAD signal, emitted independently of turn finalization (unlike
1193
+ * `user-stopped-speaking`, which a turn strategy may gate or defer).
1194
+ */
1195
+ export class VADUserStoppedSpeakingMessage extends BaseModel {
1196
+ static fields = {
1197
+ label: LABEL_FIELD,
1198
+ type: typeField("vad-user-stopped-speaking"),
1199
+ };
1200
+ constructor(options = {}) {
1201
+ super(options);
1202
+ }
1203
+ }
1204
+ /** Message indicating user has been muted. */
1205
+ export class UserMuteStartedMessage extends BaseModel {
1206
+ static fields = {
1207
+ label: LABEL_FIELD,
1208
+ type: typeField("user-mute-started"),
1209
+ };
1210
+ constructor(options = {}) {
1211
+ super(options);
1212
+ }
1213
+ }
1214
+ /** Message indicating user has been unmuted. */
1215
+ export class UserMuteStoppedMessage extends BaseModel {
1216
+ static fields = {
1217
+ label: LABEL_FIELD,
1218
+ type: typeField("user-mute-stopped"),
1219
+ };
1220
+ constructor(options = {}) {
1221
+ super(options);
1222
+ }
1223
+ }
1224
+ /** Message indicating bot has started speaking. */
1225
+ export class BotStartedSpeakingMessage extends BaseModel {
1226
+ static fields = {
1227
+ label: LABEL_FIELD,
1228
+ type: typeField("bot-started-speaking"),
1229
+ };
1230
+ constructor(options = {}) {
1231
+ super(options);
1232
+ }
1233
+ }
1234
+ /** Message indicating bot has stopped speaking. */
1235
+ export class BotStoppedSpeakingMessage extends BaseModel {
1236
+ static fields = {
1237
+ label: LABEL_FIELD,
1238
+ type: typeField("bot-stopped-speaking"),
1239
+ };
1240
+ constructor(options = {}) {
1241
+ super(options);
1242
+ }
1243
+ }
1244
+ /**
1245
+ * Message indicating the bot was interrupted and its in-flight output cut off.
1246
+ *
1247
+ * Fires for any pipeline interruption (a VAD-detected user barge-in or a
1248
+ * programmatic interrupt, e.g. `send-text` with `run_immediately`) so a
1249
+ * client can drop whatever the bot was mid-saying.
1250
+ */
1251
+ export class BotInterruptedMessage extends BaseModel {
1252
+ static fields = {
1253
+ label: LABEL_FIELD,
1254
+ type: typeField("bot-interrupted"),
1255
+ };
1256
+ constructor(options = {}) {
1257
+ super(options);
1258
+ }
1259
+ }
1260
+ /**
1261
+ * Message containing performance metrics.
1262
+ *
1263
+ * Sent to provide performance and usage metrics.
1264
+ */
1265
+ export class MetricsMessage extends BaseModel {
1266
+ static fields = {
1267
+ label: LABEL_FIELD,
1268
+ type: typeField("metrics"),
1269
+ data: field(P.dict()),
1270
+ };
1271
+ constructor(options) {
1272
+ super(options);
1273
+ }
1274
+ }
1275
+ /**
1276
+ * Generic server message.
1277
+ *
1278
+ * Used for custom server-to-client messages.
1279
+ */
1280
+ export class ServerMessage extends BaseModel {
1281
+ static fields = {
1282
+ label: LABEL_FIELD,
1283
+ type: typeField("server-message"),
1284
+ // `Any` without a default: the key is required, but `null` is accepted.
1285
+ data: field(P.any()),
1286
+ };
1287
+ constructor(options) {
1288
+ super(options);
1289
+ }
1290
+ }
1291
+ /** Data format for sending audio levels. */
1292
+ export class AudioLevelMessageData extends BaseModel {
1293
+ static fields = {
1294
+ value: field(P.float()),
1295
+ };
1296
+ constructor(options) {
1297
+ super(options);
1298
+ }
1299
+ }
1300
+ /** Message indicating user audio level. */
1301
+ export class UserAudioLevelMessage extends BaseModel {
1302
+ static fields = {
1303
+ label: LABEL_FIELD,
1304
+ type: typeField("user-audio-level"),
1305
+ data: field(P.model(() => AudioLevelMessageData)),
1306
+ };
1307
+ constructor(options) {
1308
+ super(options);
1309
+ }
1310
+ }
1311
+ /** Message indicating bot audio level. */
1312
+ export class BotAudioLevelMessage extends BaseModel {
1313
+ static fields = {
1314
+ label: LABEL_FIELD,
1315
+ type: typeField("bot-audio-level"),
1316
+ data: field(P.model(() => AudioLevelMessageData)),
1317
+ };
1318
+ constructor(options) {
1319
+ super(options);
1320
+ }
1321
+ }
1322
+ /** Message including a system log. */
1323
+ export class SystemLogMessage extends BaseModel {
1324
+ static fields = {
1325
+ label: LABEL_FIELD,
1326
+ type: typeField("system-log"),
1327
+ data: field(P.model(() => TextMessageData)),
1328
+ };
1329
+ constructor(options) {
1330
+ super(options);
1331
+ }
1332
+ }
1333
+ /**
1334
+ * Inner `data` for a `ui-event` message.
1335
+ *
1336
+ * - `event`: app-defined event.
1337
+ * - `payload`: app-defined payload, schemaless by design.
1338
+ */
1339
+ export class UIEventData extends BaseModel {
1340
+ static fields = {
1341
+ event: field(P.str()),
1342
+ payload: field(P.optional(P.any()), () => null),
1343
+ };
1344
+ constructor(options) {
1345
+ super(options);
1346
+ }
1347
+ }
1348
+ /**
1349
+ * Inner `data` for a `ui-command` message.
1350
+ *
1351
+ * - `command`: app-defined command.
1352
+ * - `payload`: app-defined payload (already a plain object by the time it
1353
+ * lands on the wire). The standard command payload models below produce the
1354
+ * right shape via `modelDump()`.
1355
+ */
1356
+ export class UICommandData extends BaseModel {
1357
+ static fields = {
1358
+ command: field(P.str()),
1359
+ payload: field(P.optional(P.any()), () => null),
1360
+ };
1361
+ constructor(options) {
1362
+ super(options);
1363
+ }
1364
+ }
1365
+ /**
1366
+ * One node in the UI accessibility snapshot tree.
1367
+ *
1368
+ * Mirrors the client-side `A11yNode` wire shape. Extra fields are allowed
1369
+ * (kept in `modelExtra`) so clients can add platform-specific or future
1370
+ * metadata without breaking older servers.
1371
+ *
1372
+ * - `ref`: stable client-assigned element reference.
1373
+ * - `role`: ARIA-style role for the node.
1374
+ * - `name`: optional accessible name.
1375
+ * - `value`: optional current value for inputs/progress/etc.
1376
+ * - `state`: optional short state tags (e.g. `"focused"`, `"disabled"`,
1377
+ * `"offscreen"`).
1378
+ * - `level`: optional heading level.
1379
+ * - `colcount`: optional column count for grid-like containers.
1380
+ * - `rowcount`: optional row count for grid-like containers.
1381
+ * - `children`: optional child nodes.
1382
+ */
1383
+ export class A11yNode extends BaseModel {
1384
+ static extra = "allow";
1385
+ static fields = {
1386
+ ref: field(P.str()),
1387
+ role: field(P.str()),
1388
+ name: field(P.optional(P.str()), () => null),
1389
+ value: field(P.optional(P.str()), () => null),
1390
+ state: field(P.optional(P.list(P.str())), () => null),
1391
+ level: field(P.optional(P.int()), () => null),
1392
+ colcount: field(P.optional(P.int()), () => null),
1393
+ rowcount: field(P.optional(P.int()), () => null),
1394
+ children: field(P.optional(P.list(P.model(() => A11yNode))), () => null),
1395
+ };
1396
+ constructor(options) {
1397
+ super(options);
1398
+ }
1399
+ }
1400
+ /**
1401
+ * The user's current text selection in the UI snapshot.
1402
+ *
1403
+ * Extra fields are allowed for forward compatibility with client snapshot
1404
+ * additions.
1405
+ *
1406
+ * - `ref`: ref of the element that carries the selection.
1407
+ * - `text`: selected text.
1408
+ * - `startOffset`: optional selection start offset.
1409
+ * - `endOffset`: optional selection end offset.
1410
+ */
1411
+ export class A11ySelection extends BaseModel {
1412
+ static extra = "allow";
1413
+ static fields = {
1414
+ ref: field(P.str()),
1415
+ text: field(P.str()),
1416
+ startOffset: field(P.optional(P.int()), () => null),
1417
+ endOffset: field(P.optional(P.int()), () => null),
1418
+ };
1419
+ constructor(options) {
1420
+ super(options);
1421
+ }
1422
+ }
1423
+ /**
1424
+ * Client accessibility snapshot sent in a `ui-snapshot` message.
1425
+ *
1426
+ * Mirrors the client-side `A11ySnapshot` wire shape. Extra fields are allowed
1427
+ * so clients can add compatible metadata over time.
1428
+ *
1429
+ * - `root`: root accessibility node.
1430
+ * - `capturedAt`: client-side epoch milliseconds when captured.
1431
+ * - `selection`: optional current text selection.
1432
+ */
1433
+ export class A11ySnapshot extends BaseModel {
1434
+ static extra = "allow";
1435
+ static fields = {
1436
+ root: field(P.model(() => A11yNode)),
1437
+ capturedAt: field(P.int()),
1438
+ selection: field(P.optional(P.model(() => A11ySelection)), () => null),
1439
+ };
1440
+ constructor(options) {
1441
+ super(options);
1442
+ }
1443
+ }
1444
+ /**
1445
+ * Inner `data` for a `ui-snapshot` message.
1446
+ *
1447
+ * The accessibility snapshot tree mirrors the client-side `A11ySnapshot` wire
1448
+ * shape and is kept forward-compatible by allowing extra fields on the
1449
+ * snapshot models.
1450
+ *
1451
+ * - `tree`: the serialized accessibility tree.
1452
+ */
1453
+ export class UISnapshotData extends BaseModel {
1454
+ static fields = {
1455
+ tree: field(P.model(() => A11ySnapshot)),
1456
+ };
1457
+ constructor(options) {
1458
+ super(options);
1459
+ }
1460
+ }
1461
+ /**
1462
+ * Inner `data` for a `ui-cancel-job-group` message.
1463
+ *
1464
+ * - `jobId`: the job group id the client wants cancelled.
1465
+ * - `reason`: optional human-readable reason.
1466
+ */
1467
+ export class UICancelJobGroupData extends BaseModel {
1468
+ static fields = {
1469
+ jobId: field(P.str()),
1470
+ reason: field(P.optional(P.str()), () => null),
1471
+ };
1472
+ constructor(options) {
1473
+ super(options);
1474
+ }
1475
+ }
1476
+ /**
1477
+ * `data` for a `ui-job-group` envelope with kind `group_started`.
1478
+ *
1479
+ * - `kind`: always `"group_started"`.
1480
+ * - `jobId`: shared job-group identifier for the group.
1481
+ * - `workers`: names of the workers the work was dispatched to.
1482
+ * - `label`: optional human-readable label for the group.
1483
+ * - `cancellable`: whether the client may request cancellation.
1484
+ * - `at`: epoch milliseconds when the group started.
1485
+ */
1486
+ export class UIJobGroupStartedData extends BaseModel {
1487
+ static fields = {
1488
+ kind: field(P.literal("group_started"), () => "group_started"),
1489
+ jobId: field(P.str()),
1490
+ workers: field(P.optional(P.list(P.str())), () => null),
1491
+ label: field(P.optional(P.str()), () => null),
1492
+ cancellable: field(P.bool(), () => true),
1493
+ at: field(P.int(), () => 0),
1494
+ };
1495
+ constructor(options) {
1496
+ super(options);
1497
+ }
1498
+ }
1499
+ /**
1500
+ * `data` for a `ui-job-group` envelope with kind `job_update`.
1501
+ *
1502
+ * - `kind`: always `"job_update"`.
1503
+ * - `jobId`: the shared job-group identifier.
1504
+ * - `workerName`: the worker that produced the update.
1505
+ * - `data`: the worker's update payload, forwarded verbatim.
1506
+ * - `at`: epoch milliseconds when the update was emitted.
1507
+ */
1508
+ export class UIJobUpdateData extends BaseModel {
1509
+ static fields = {
1510
+ kind: field(P.literal("job_update"), () => "job_update"),
1511
+ jobId: field(P.str()),
1512
+ workerName: field(P.str()),
1513
+ data: field(P.optional(P.any()), () => null),
1514
+ at: field(P.int(), () => 0),
1515
+ };
1516
+ constructor(options) {
1517
+ super(options);
1518
+ }
1519
+ }
1520
+ /**
1521
+ * `data` for a `ui-job-group` envelope with kind `job_completed`.
1522
+ *
1523
+ * - `kind`: always `"job_completed"`.
1524
+ * - `jobId`: the shared job-group identifier.
1525
+ * - `workerName`: the worker that produced the response.
1526
+ * - `status`: completion status string.
1527
+ * - `response`: the worker's response payload.
1528
+ * - `at`: epoch milliseconds when the response was received.
1529
+ */
1530
+ export class UIJobCompletedData extends BaseModel {
1531
+ static fields = {
1532
+ kind: field(P.literal("job_completed"), () => "job_completed"),
1533
+ jobId: field(P.str()),
1534
+ workerName: field(P.str()),
1535
+ status: field(P.str()),
1536
+ response: field(P.optional(P.any()), () => null),
1537
+ at: field(P.int(), () => 0),
1538
+ };
1539
+ constructor(options) {
1540
+ super(options);
1541
+ }
1542
+ }
1543
+ /**
1544
+ * `data` for a `ui-job-group` envelope with kind `group_completed`.
1545
+ *
1546
+ * - `kind`: always `"group_completed"`.
1547
+ * - `jobId`: the shared job-group identifier.
1548
+ * - `at`: epoch milliseconds when the group completed.
1549
+ */
1550
+ export class UIJobGroupCompletedData extends BaseModel {
1551
+ static fields = {
1552
+ kind: field(P.literal("group_completed"), () => "group_completed"),
1553
+ jobId: field(P.str()),
1554
+ at: field(P.int(), () => 0),
1555
+ };
1556
+ constructor(options) {
1557
+ super(options);
1558
+ }
1559
+ }
1560
+ const uiJobGroupDataParser = P.union(P.model(() => UIJobGroupStartedData), P.model(() => UIJobUpdateData), P.model(() => UIJobCompletedData), P.model(() => UIJobGroupCompletedData));
1561
+ /** RTVI `ui-event` message (client -> server). */
1562
+ export class UIEventMessage extends BaseModel {
1563
+ static fields = {
1564
+ label: LABEL_FIELD,
1565
+ type: typeField("ui-event"),
1566
+ id: field(P.str()),
1567
+ data: field(P.model(() => UIEventData)),
1568
+ };
1569
+ constructor(options) {
1570
+ super(options);
1571
+ }
1572
+ }
1573
+ /** RTVI `ui-command` message (server -> client). */
1574
+ export class UICommandMessage extends BaseModel {
1575
+ static fields = {
1576
+ label: LABEL_FIELD,
1577
+ type: typeField("ui-command"),
1578
+ data: field(P.model(() => UICommandData)),
1579
+ };
1580
+ constructor(options) {
1581
+ super(options);
1582
+ }
1583
+ }
1584
+ /** RTVI `ui-snapshot` message (client -> server). */
1585
+ export class UISnapshotMessage extends BaseModel {
1586
+ static fields = {
1587
+ label: LABEL_FIELD,
1588
+ type: typeField("ui-snapshot"),
1589
+ id: field(P.str()),
1590
+ data: field(P.model(() => UISnapshotData)),
1591
+ };
1592
+ constructor(options) {
1593
+ super(options);
1594
+ }
1595
+ }
1596
+ /** RTVI `ui-cancel-job-group` message (client -> server). */
1597
+ export class UICancelJobGroupMessage extends BaseModel {
1598
+ static fields = {
1599
+ label: LABEL_FIELD,
1600
+ type: typeField("ui-cancel-job-group"),
1601
+ id: field(P.str()),
1602
+ data: field(P.model(() => UICancelJobGroupData)),
1603
+ };
1604
+ constructor(options) {
1605
+ super(options);
1606
+ }
1607
+ }
1608
+ /**
1609
+ * RTVI `ui-job-group` message (server -> client).
1610
+ *
1611
+ * The `data` field is one of the four job-group lifecycle shapes,
1612
+ * discriminated by the `kind` field.
1613
+ */
1614
+ export class UIJobGroupMessage extends BaseModel {
1615
+ static fields = {
1616
+ label: LABEL_FIELD,
1617
+ type: typeField("ui-job-group"),
1618
+ data: field(uiJobGroupDataParser),
1619
+ };
1620
+ constructor(options) {
1621
+ super(options);
1622
+ }
1623
+ }
1624
+ /**
1625
+ * A transient notification surface shown on the client.
1626
+ *
1627
+ * - `title`: required headline.
1628
+ * - `subtitle`: optional second line beneath the title.
1629
+ * - `description`: optional body text.
1630
+ * - `imageUrl`: optional leading image.
1631
+ * - `durationMs`: optional dismiss timer. Client default applies when null.
1632
+ */
1633
+ export class Toast extends BaseModel {
1634
+ static fields = {
1635
+ title: field(P.str()),
1636
+ subtitle: field(P.optional(P.str()), () => null),
1637
+ description: field(P.optional(P.str()), () => null),
1638
+ imageUrl: field(P.optional(P.str()), () => null),
1639
+ durationMs: field(P.optional(P.int()), () => null),
1640
+ };
1641
+ constructor(options) {
1642
+ super(options);
1643
+ }
1644
+ }
1645
+ /**
1646
+ * Client-side navigation to a named view.
1647
+ *
1648
+ * - `view`: app-defined view name (route, screen id, tab key, etc.).
1649
+ * - `params`: optional view-specific parameters.
1650
+ */
1651
+ export class Navigate extends BaseModel {
1652
+ static fields = {
1653
+ view: field(P.str()),
1654
+ params: field(P.optional(P.dict()), () => null),
1655
+ };
1656
+ constructor(options) {
1657
+ super(options);
1658
+ }
1659
+ }
1660
+ /**
1661
+ * Scroll a target element into view.
1662
+ *
1663
+ * The client resolves the target by `ref` first (a snapshot ref like `"e42"`
1664
+ * assigned by the a11y walker), then falls back to `targetId`
1665
+ * (`document.getElementById`). Supply whichever you have; `ref` is the normal
1666
+ * choice when acting on a node from `<ui_state>`.
1667
+ *
1668
+ * - `ref`: snapshot ref from `<ui_state>`.
1669
+ * - `targetId`: element id registered on the client.
1670
+ * - `behavior`: optional scroll behavior hint. Typical values: `"smooth"` or
1671
+ * `"instant"`. Clients may ignore.
1672
+ */
1673
+ export class ScrollTo extends BaseModel {
1674
+ static fields = {
1675
+ ref: field(P.optional(P.str()), () => null),
1676
+ targetId: field(P.optional(P.str()), () => null),
1677
+ behavior: field(P.optional(P.str()), () => null),
1678
+ };
1679
+ constructor(options = {}) {
1680
+ super(options);
1681
+ }
1682
+ }
1683
+ /**
1684
+ * Briefly emphasize a target element (flash, glow, pulse).
1685
+ *
1686
+ * - `ref`: snapshot ref from `<ui_state>`.
1687
+ * - `targetId`: element id registered on the client.
1688
+ * - `durationMs`: optional highlight duration. Client default applies when
1689
+ * null.
1690
+ */
1691
+ export class Highlight extends BaseModel {
1692
+ static fields = {
1693
+ ref: field(P.optional(P.str()), () => null),
1694
+ targetId: field(P.optional(P.str()), () => null),
1695
+ durationMs: field(P.optional(P.int()), () => null),
1696
+ };
1697
+ constructor(options = {}) {
1698
+ super(options);
1699
+ }
1700
+ }
1701
+ /**
1702
+ * Move input focus to a target element.
1703
+ *
1704
+ * - `ref`: snapshot ref from `<ui_state>`.
1705
+ * - `targetId`: element id registered on the client.
1706
+ */
1707
+ export class Focus extends BaseModel {
1708
+ static fields = {
1709
+ ref: field(P.optional(P.str()), () => null),
1710
+ targetId: field(P.optional(P.str()), () => null),
1711
+ };
1712
+ constructor(options = {}) {
1713
+ super(options);
1714
+ }
1715
+ }
1716
+ /**
1717
+ * Click an element on the client.
1718
+ *
1719
+ * Closes the form-fill loop for non-text inputs (checkboxes, radios) and
1720
+ * exposes the rest of the action vocabulary (submit buttons, links,
1721
+ * app-specific clickable nodes). The standard handler silently no-ops on
1722
+ * `disabled` targets so the worker can't bypass UI affordances the user is
1723
+ * meant to control.
1724
+ *
1725
+ * For native `<select>`, prefer `SetInputValue` (clicking options doesn't
1726
+ * reliably change the selection); for custom comboboxes (ARIA listbox +
1727
+ * popup), apps wire their own command matching the library's interaction
1728
+ * model.
1729
+ *
1730
+ * - `ref`: snapshot ref from `<ui_state>`.
1731
+ * - `targetId`: element id registered on the client. Used as a fallback when
1732
+ * `ref` is not set or has gone stale.
1733
+ */
1734
+ export class Click extends BaseModel {
1735
+ static fields = {
1736
+ ref: field(P.optional(P.str()), () => null),
1737
+ targetId: field(P.optional(P.str()), () => null),
1738
+ };
1739
+ constructor(options = {}) {
1740
+ super(options);
1741
+ }
1742
+ }
1743
+ /**
1744
+ * Write a value into a text input or textarea on the client.
1745
+ *
1746
+ * Use this for form-filling: the worker has decided what should go into a
1747
+ * field (clarifying answer, tax form entry, etc.) and asks the client to
1748
+ * populate it. With `replace: true` (the default), the existing value is
1749
+ * overwritten; with `replace: false` the value is appended.
1750
+ *
1751
+ * The standard handler silently no-ops on `disabled`, `readonly`, and
1752
+ * `<input type="hidden">` targets so the worker can't write into fields the
1753
+ * user can't.
1754
+ *
1755
+ * - `value`: the text to write.
1756
+ * - `ref`: snapshot ref from `<ui_state>`. Typically the ref of an `<input>`
1757
+ * or `<textarea>`.
1758
+ * - `targetId`: element id registered on the client. Used as a fallback when
1759
+ * `ref` is not set or has gone stale.
1760
+ * - `replace`: when true (the default), overwrite the current value. When
1761
+ * false, append to it.
1762
+ */
1763
+ export class SetInputValue extends BaseModel {
1764
+ static fields = {
1765
+ value: field(P.str(), () => ""),
1766
+ ref: field(P.optional(P.str()), () => null),
1767
+ targetId: field(P.optional(P.str()), () => null),
1768
+ replace: field(P.bool(), () => true),
1769
+ };
1770
+ constructor(options = {}) {
1771
+ super(options);
1772
+ }
1773
+ }
1774
+ /**
1775
+ * Select text on the page so the user can see what the worker means.
1776
+ *
1777
+ * Mirror of the `selection` field surfaced in the snapshot. Use this to point
1778
+ * the user's attention at a specific paragraph or range after the worker has
1779
+ * decided what it's referring to.
1780
+ *
1781
+ * With `startOffset` and `endOffset` omitted, the entire target's text
1782
+ * content is selected (`Range.selectNodeContents` for document elements;
1783
+ * `el.select()` for `<input>` / `<textarea>`).
1784
+ *
1785
+ * - `ref`: snapshot ref from `<ui_state>`. Typically the ref of a paragraph
1786
+ * or input element.
1787
+ * - `targetId`: element id registered on the client. Used as a fallback when
1788
+ * `ref` is not set or has gone stale.
1789
+ * - `startOffset`: character offset within the target's text where the
1790
+ * selection should start. For `<input>` and `<textarea>` this is the value
1791
+ * offset; for document elements it is computed against the concatenation of
1792
+ * descendant text nodes in document order.
1793
+ * - `endOffset`: end character offset, exclusive. Same coordinate system as
1794
+ * `startOffset`.
1795
+ */
1796
+ export class SelectText extends BaseModel {
1797
+ static fields = {
1798
+ ref: field(P.optional(P.str()), () => null),
1799
+ targetId: field(P.optional(P.str()), () => null),
1800
+ startOffset: field(P.optional(P.int()), () => null),
1801
+ endOffset: field(P.optional(P.int()), () => null),
1802
+ };
1803
+ constructor(options = {}) {
1804
+ super(options);
1805
+ }
1806
+ }
1807
+ //# sourceMappingURL=models.js.map