@onlive.ai/common-121 0.2.163 → 0.2.184

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 (447) hide show
  1. package/audi-dark.theme-B8g9SRrd.d.cts +11 -0
  2. package/audi-dark.theme-B8g9SRrd.d.ts +11 -0
  3. package/audi.theme-CbqEkKLD.d.cts +11 -0
  4. package/audi.theme-CbqEkKLD.d.ts +11 -0
  5. package/australia.theme-Cs0cygOQ.d.cts +11 -0
  6. package/australia.theme-Cs0cygOQ.d.ts +11 -0
  7. package/chunk-UTOVVCSU.js +2 -0
  8. package/components/asset/asset-modal-portal.cjs +1 -1
  9. package/components/asset/asset-modal-portal.d.cts +1 -1
  10. package/components/asset/asset-modal-portal.d.ts +1 -1
  11. package/components/asset/asset-modal-portal.js +1 -1
  12. package/components/asset/asset.cjs +4 -4
  13. package/components/asset/asset.d.cts +1 -1
  14. package/components/asset/asset.d.ts +1 -1
  15. package/components/asset/asset.js +13 -13
  16. package/components/asset/asset.loaders.cjs +1 -1
  17. package/components/asset/asset.loaders.d.cts +1 -1
  18. package/components/asset/asset.loaders.d.ts +1 -1
  19. package/components/asset/asset.loaders.js +1 -1
  20. package/components/asset/asset.renderer.cjs +4 -4
  21. package/components/asset/asset.renderer.d.cts +1 -1
  22. package/components/asset/asset.renderer.d.ts +1 -1
  23. package/components/asset/asset.renderer.js +10 -10
  24. package/components/asset/asset.styles.cjs +1 -1
  25. package/components/asset/asset.styles.d.cts +1 -1
  26. package/components/asset/asset.styles.d.ts +1 -1
  27. package/components/asset/asset.styles.js +1 -1
  28. package/components/asset/asset.types.cjs +1 -1
  29. package/components/asset/asset.types.d.cts +1 -1
  30. package/components/asset/asset.types.d.ts +1 -1
  31. package/components/asset/asset.types.js +1 -1
  32. package/components/asset/index.cjs +4 -4
  33. package/components/asset/index.d.cts +1 -1
  34. package/components/asset/index.d.ts +1 -1
  35. package/components/asset/index.js +13 -13
  36. package/components/player/player.cjs +1 -1
  37. package/components/player/player.d.cts +1 -1
  38. package/components/player/player.d.ts +1 -1
  39. package/components/player/player.js +1 -1
  40. package/components/player/player.styles.cjs +1 -1
  41. package/components/player/player.styles.d.cts +1 -1
  42. package/components/player/player.styles.d.ts +1 -1
  43. package/components/player/player.styles.js +1 -1
  44. package/components/side-bar/index.cjs +1 -1
  45. package/components/side-bar/index.d.cts +1 -1
  46. package/components/side-bar/index.d.ts +1 -1
  47. package/components/side-bar/index.js +1 -1
  48. package/components/side-bar/side-bar.cjs +1 -1
  49. package/components/side-bar/side-bar.d.cts +1 -1
  50. package/components/side-bar/side-bar.d.ts +1 -1
  51. package/components/side-bar/side-bar.js +1 -1
  52. package/components/side-bar/side-bar.styles.cjs +1 -1
  53. package/components/side-bar/side-bar.styles.d.cts +1 -1
  54. package/components/side-bar/side-bar.styles.d.ts +1 -1
  55. package/components/side-bar/side-bar.styles.js +1 -1
  56. package/components/side-bar/side-bar.types.cjs +1 -1
  57. package/components/side-bar/side-bar.types.d.cts +1 -1
  58. package/components/side-bar/side-bar.types.d.ts +1 -1
  59. package/components/side-bar/side-bar.types.js +1 -1
  60. package/components/upload/index.cjs +1 -1
  61. package/components/upload/index.d.cts +1 -1
  62. package/components/upload/index.d.ts +1 -1
  63. package/components/upload/index.js +1 -1
  64. package/components/upload/upload.cjs +1 -1
  65. package/components/upload/upload.d.cts +1 -1
  66. package/components/upload/upload.d.ts +1 -1
  67. package/components/upload/upload.js +1 -1
  68. package/components/upload/upload.styles.cjs +1 -1
  69. package/components/upload/upload.styles.d.cts +1 -1
  70. package/components/upload/upload.styles.d.ts +1 -1
  71. package/components/upload/upload.styles.js +1 -1
  72. package/components/upload/upload.types.cjs +1 -1
  73. package/components/upload/upload.types.d.cts +1 -1
  74. package/components/upload/upload.types.d.ts +1 -1
  75. package/components/upload/upload.types.js +1 -1
  76. package/cuernavaca.theme-0UFX1MeG.d.cts +11 -0
  77. package/cuernavaca.theme-0UFX1MeG.d.ts +11 -0
  78. package/cupra-diagonal.theme-DVrQr2iv.d.cts +11 -0
  79. package/cupra-diagonal.theme-DVrQr2iv.d.ts +11 -0
  80. package/cupra-events.theme-D2xJeafa.d.cts +11 -0
  81. package/cupra-events.theme-D2xJeafa.d.ts +11 -0
  82. package/cupra.theme-CqgKWLYE.d.cts +11 -0
  83. package/cupra.theme-CqgKWLYE.d.ts +11 -0
  84. package/germany.theme-CnwD309P.d.cts +11 -0
  85. package/germany.theme-CnwD309P.d.ts +11 -0
  86. package/hyundai.theme-E2ZiyZmJ.d.cts +11 -0
  87. package/hyundai.theme-E2ZiyZmJ.d.ts +11 -0
  88. package/index.cjs +276 -276
  89. package/index.d.cts +4134 -3
  90. package/index.d.ts +4134 -3
  91. package/index.js +280 -280
  92. package/italy.theme-BjfPp7rU.d.cts +11 -0
  93. package/italy.theme-BjfPp7rU.d.ts +11 -0
  94. package/magimix.theme-7cd19P1X.d.cts +11 -0
  95. package/magimix.theme-7cd19P1X.d.ts +11 -0
  96. package/media-SB4RDT6E.js +2 -0
  97. package/onlive-ai.theme-CASPoRHr.d.cts +11 -0
  98. package/onlive-ai.theme-CASPoRHr.d.ts +11 -0
  99. package/onlive.theme-nKZQHG1I.d.cts +11 -0
  100. package/onlive.theme-nKZQHG1I.d.ts +11 -0
  101. package/package.json +13 -9
  102. package/react/components/asset/Asset.cjs +1 -1
  103. package/react/components/asset/Asset.jsx +1 -1
  104. package/react/components/side-bar/SideBar.cjs +1 -1
  105. package/react/components/side-bar/SideBar.jsx +1 -1
  106. package/react/components/upload/Upload.cjs +1 -1
  107. package/react/components/upload/Upload.jsx +1 -1
  108. package/seat-cupra.theme-B4ylEjOZ.d.cts +11 -0
  109. package/seat-cupra.theme-B4ylEjOZ.d.ts +11 -0
  110. package/services/audio.service.cjs +1 -1
  111. package/services/audio.service.d.cts +1 -1
  112. package/services/audio.service.d.ts +1 -1
  113. package/services/audio.service.js +1 -1
  114. package/services/conversation/conversation.service.cjs +2 -2
  115. package/services/conversation/conversation.service.d.cts +26 -3
  116. package/services/conversation/conversation.service.d.ts +26 -3
  117. package/services/conversation/conversation.service.js +2 -2
  118. package/services/conversation/conversation.types.cjs +2 -2
  119. package/services/conversation/conversation.types.d.cts +120 -4
  120. package/services/conversation/conversation.types.d.ts +120 -4
  121. package/services/conversation/conversation.types.js +2 -2
  122. package/services/conversation/index.cjs +2 -2
  123. package/services/conversation/index.d.cts +19 -2
  124. package/services/conversation/index.d.ts +19 -2
  125. package/services/conversation/index.js +2 -2
  126. package/services/conversation/mock/actor/agent.cjs +2 -0
  127. package/services/conversation/mock/actor/agent.d.cts +202 -0
  128. package/services/conversation/mock/actor/agent.d.ts +202 -0
  129. package/services/conversation/mock/actor/agent.js +2 -0
  130. package/services/conversation/mock/actor/index.cjs +2 -0
  131. package/services/conversation/mock/actor/index.d.cts +4 -0
  132. package/services/conversation/mock/actor/index.d.ts +4 -0
  133. package/services/conversation/mock/actor/index.js +2 -0
  134. package/services/conversation/mock/actor/strategies.cjs +2 -0
  135. package/services/conversation/mock/actor/strategies.d.cts +31 -0
  136. package/services/conversation/mock/actor/strategies.d.ts +31 -0
  137. package/services/conversation/mock/actor/strategies.js +2 -0
  138. package/services/conversation/mock/errors.cjs +2 -0
  139. package/services/conversation/mock/errors.d.cts +125 -0
  140. package/services/conversation/mock/errors.d.ts +125 -0
  141. package/services/conversation/mock/errors.js +2 -0
  142. package/services/conversation/mock/events.cjs +2 -0
  143. package/services/conversation/mock/events.d.cts +253 -0
  144. package/services/conversation/mock/events.d.ts +253 -0
  145. package/services/conversation/mock/events.js +2 -0
  146. package/services/conversation/mock/factory.cjs +2 -0
  147. package/services/conversation/mock/factory.d.cts +134 -0
  148. package/services/conversation/mock/factory.d.ts +134 -0
  149. package/services/conversation/mock/factory.js +2 -0
  150. package/services/conversation/mock/fixtures.cjs +2 -0
  151. package/services/conversation/mock/fixtures.d.cts +191 -0
  152. package/services/conversation/mock/fixtures.d.ts +191 -0
  153. package/services/conversation/mock/fixtures.js +2 -0
  154. package/services/conversation/mock/generators.cjs +2 -0
  155. package/services/conversation/mock/generators.d.cts +123 -0
  156. package/services/conversation/mock/generators.d.ts +123 -0
  157. package/services/conversation/mock/generators.js +2 -0
  158. package/services/conversation/mock/index.cjs +2 -0
  159. package/services/conversation/mock/index.d.cts +24 -0
  160. package/services/conversation/mock/index.d.ts +24 -0
  161. package/services/conversation/mock/index.js +2 -0
  162. package/services/conversation/mock/livekit/index.cjs +2 -0
  163. package/services/conversation/mock/livekit/index.d.cts +7 -0
  164. package/services/conversation/mock/livekit/index.d.ts +7 -0
  165. package/services/conversation/mock/livekit/index.js +2 -0
  166. package/services/conversation/mock/livekit/local-participant.cjs +2 -0
  167. package/services/conversation/mock/livekit/local-participant.d.cts +204 -0
  168. package/services/conversation/mock/livekit/local-participant.d.ts +204 -0
  169. package/services/conversation/mock/livekit/local-participant.js +2 -0
  170. package/services/conversation/mock/livekit/participant.cjs +2 -0
  171. package/services/conversation/mock/livekit/participant.d.cts +171 -0
  172. package/services/conversation/mock/livekit/participant.d.ts +171 -0
  173. package/services/conversation/mock/livekit/participant.js +2 -0
  174. package/services/conversation/mock/livekit/room.cjs +2 -0
  175. package/services/conversation/mock/livekit/room.d.cts +292 -0
  176. package/services/conversation/mock/livekit/room.d.ts +292 -0
  177. package/services/conversation/mock/livekit/room.js +2 -0
  178. package/services/conversation/mock/livekit/streams.cjs +2 -0
  179. package/services/conversation/mock/livekit/streams.d.cts +190 -0
  180. package/services/conversation/mock/livekit/streams.d.ts +190 -0
  181. package/services/conversation/mock/livekit/streams.js +2 -0
  182. package/services/conversation/mock/livekit/tracks.cjs +2 -0
  183. package/services/conversation/mock/livekit/tracks.d.cts +149 -0
  184. package/services/conversation/mock/livekit/tracks.d.ts +149 -0
  185. package/services/conversation/mock/livekit/tracks.js +2 -0
  186. package/services/conversation/mock/media.cjs +2 -0
  187. package/services/conversation/mock/media.d.cts +174 -0
  188. package/services/conversation/mock/media.d.ts +174 -0
  189. package/services/conversation/mock/media.js +2 -0
  190. package/services/conversation/mock/service.cjs +2 -0
  191. package/services/conversation/mock/service.d.cts +305 -0
  192. package/services/conversation/mock/service.d.ts +305 -0
  193. package/services/conversation/mock/service.js +2 -0
  194. package/services/conversation/mock/service.test.cjs +2 -0
  195. package/services/conversation/mock/service.test.d.cts +1 -0
  196. package/services/conversation/mock/service.test.d.ts +1 -0
  197. package/services/conversation/mock/service.test.js +2 -0
  198. package/services/conversation/mock/state.cjs +2 -0
  199. package/services/conversation/mock/state.d.cts +296 -0
  200. package/services/conversation/mock/state.d.ts +296 -0
  201. package/services/conversation/mock/state.js +2 -0
  202. package/services/conversation/mock/storybook.cjs +2 -0
  203. package/services/conversation/mock/storybook.d.cts +197 -0
  204. package/services/conversation/mock/storybook.d.ts +197 -0
  205. package/services/conversation/mock/storybook.js +2 -0
  206. package/services/conversation/mock/types.cjs +2 -0
  207. package/services/conversation/mock/types.d.cts +442 -0
  208. package/services/conversation/mock/types.d.ts +442 -0
  209. package/services/conversation/mock/types.js +1 -0
  210. package/services/faqs/faqs.service.cjs +1 -1
  211. package/services/faqs/faqs.service.d.cts +1 -1
  212. package/services/faqs/faqs.service.d.ts +1 -1
  213. package/services/faqs/faqs.service.js +1 -1
  214. package/services/faqs/faqs.types.cjs +1 -1
  215. package/services/faqs/faqs.types.d.cts +1 -1
  216. package/services/faqs/faqs.types.d.ts +1 -1
  217. package/services/faqs/faqs.types.js +1 -1
  218. package/services/faqs/index.cjs +1 -1
  219. package/services/faqs/index.d.cts +1 -1
  220. package/services/faqs/index.d.ts +1 -1
  221. package/services/faqs/index.js +1 -1
  222. package/services/file/file.service.cjs +1 -1
  223. package/services/file/file.service.d.cts +1 -1
  224. package/services/file/file.service.d.ts +1 -1
  225. package/services/file/file.service.js +1 -1
  226. package/services/file/file.types.cjs +1 -1
  227. package/services/file/file.types.d.cts +1 -1
  228. package/services/file/file.types.d.ts +1 -1
  229. package/services/file/file.types.js +1 -1
  230. package/services/file/index.cjs +1 -1
  231. package/services/file/index.d.cts +1 -1
  232. package/services/file/index.d.ts +1 -1
  233. package/services/file/index.js +1 -1
  234. package/services/firebase/firebase-api.cjs +1 -1
  235. package/services/firebase/firebase-api.d.cts +1 -1
  236. package/services/firebase/firebase-api.d.ts +1 -1
  237. package/services/firebase/firebase-api.js +1 -1
  238. package/services/multimedia/config.example.cjs +1 -1
  239. package/services/multimedia/config.example.d.cts +1 -1
  240. package/services/multimedia/config.example.d.ts +1 -1
  241. package/services/multimedia/config.example.js +1 -1
  242. package/services/multimedia/index.cjs +1 -1
  243. package/services/multimedia/index.d.cts +1 -1
  244. package/services/multimedia/index.d.ts +1 -1
  245. package/services/multimedia/index.js +1 -1
  246. package/services/multimedia/multimedia.service.cjs +1 -1
  247. package/services/multimedia/multimedia.service.d.cts +1 -1
  248. package/services/multimedia/multimedia.service.d.ts +1 -1
  249. package/services/multimedia/multimedia.service.js +1 -1
  250. package/services/multimedia/multimedia.types.cjs +1 -1
  251. package/services/multimedia/multimedia.types.d.cts +1 -1
  252. package/services/multimedia/multimedia.types.d.ts +1 -1
  253. package/services/multimedia/multimedia.types.js +1 -1
  254. package/services/product/index.cjs +1 -1
  255. package/services/product/index.d.cts +1 -1
  256. package/services/product/index.d.ts +1 -1
  257. package/services/product/index.js +1 -1
  258. package/services/product/product.service.cjs +1 -1
  259. package/services/product/product.service.d.cts +1 -1
  260. package/services/product/product.service.d.ts +1 -1
  261. package/services/product/product.service.js +1 -1
  262. package/services/product/product.types.cjs +1 -1
  263. package/services/product/product.types.d.cts +1 -1
  264. package/services/product/product.types.d.ts +1 -1
  265. package/services/product/product.types.js +1 -1
  266. package/services/request.provider.cjs +1 -1
  267. package/services/request.provider.d.cts +1 -1
  268. package/services/request.provider.d.ts +1 -1
  269. package/services/request.provider.js +1 -1
  270. package/services/session.service.cjs +2 -2
  271. package/services/session.service.d.cts +1 -1
  272. package/services/session.service.d.ts +1 -1
  273. package/services/session.service.js +2 -2
  274. package/services/upload/index.cjs +1 -1
  275. package/services/upload/index.d.cts +1 -1
  276. package/services/upload/index.d.ts +1 -1
  277. package/services/upload/index.js +1 -1
  278. package/services/upload/upload.service.cjs +1 -1
  279. package/services/upload/upload.service.d.cts +1 -1
  280. package/services/upload/upload.service.d.ts +1 -1
  281. package/services/upload/upload.service.js +1 -1
  282. package/themes/custom/audi-dark.theme.cjs +920 -0
  283. package/themes/custom/audi-dark.theme.d.cts +3 -0
  284. package/themes/custom/audi-dark.theme.d.ts +3 -0
  285. package/themes/custom/audi-dark.theme.js +920 -0
  286. package/themes/custom/audi.theme.cjs +777 -0
  287. package/themes/custom/audi.theme.d.cts +3 -0
  288. package/themes/custom/audi.theme.d.ts +3 -0
  289. package/themes/custom/audi.theme.js +777 -0
  290. package/themes/custom/australia.theme.cjs +386 -0
  291. package/themes/custom/australia.theme.d.cts +3 -0
  292. package/themes/custom/australia.theme.d.ts +3 -0
  293. package/themes/custom/australia.theme.js +386 -0
  294. package/themes/custom/cuernavaca.theme.cjs +196 -0
  295. package/themes/custom/cuernavaca.theme.d.cts +3 -0
  296. package/themes/custom/cuernavaca.theme.d.ts +3 -0
  297. package/themes/custom/cuernavaca.theme.js +196 -0
  298. package/themes/custom/cupra-diagonal.theme.cjs +1029 -0
  299. package/themes/custom/cupra-diagonal.theme.d.cts +3 -0
  300. package/themes/custom/cupra-diagonal.theme.d.ts +3 -0
  301. package/themes/custom/cupra-diagonal.theme.js +1029 -0
  302. package/themes/custom/cupra-events.theme.cjs +555 -0
  303. package/themes/custom/cupra-events.theme.d.cts +3 -0
  304. package/themes/custom/cupra-events.theme.d.ts +3 -0
  305. package/themes/custom/cupra-events.theme.js +555 -0
  306. package/themes/custom/cupra.theme.cjs +147 -0
  307. package/themes/custom/cupra.theme.d.cts +3 -0
  308. package/themes/custom/cupra.theme.d.ts +3 -0
  309. package/themes/custom/cupra.theme.js +147 -0
  310. package/themes/custom/germany.theme.cjs +716 -0
  311. package/themes/custom/germany.theme.d.cts +3 -0
  312. package/themes/custom/germany.theme.d.ts +3 -0
  313. package/themes/custom/germany.theme.js +716 -0
  314. package/themes/custom/hyundai.theme.cjs +294 -0
  315. package/themes/custom/hyundai.theme.d.cts +3 -0
  316. package/themes/custom/hyundai.theme.d.ts +3 -0
  317. package/themes/custom/hyundai.theme.js +294 -0
  318. package/themes/custom/italy.theme.cjs +850 -0
  319. package/themes/custom/italy.theme.d.cts +3 -0
  320. package/themes/custom/italy.theme.d.ts +3 -0
  321. package/themes/custom/italy.theme.js +850 -0
  322. package/themes/custom/magimix.theme.cjs +119 -0
  323. package/themes/custom/magimix.theme.d.cts +3 -0
  324. package/themes/custom/magimix.theme.d.ts +3 -0
  325. package/themes/custom/magimix.theme.js +119 -0
  326. package/themes/custom/onlive-ai.theme.cjs +74 -0
  327. package/themes/custom/onlive-ai.theme.d.cts +3 -0
  328. package/themes/custom/onlive-ai.theme.d.ts +3 -0
  329. package/themes/custom/onlive-ai.theme.js +74 -0
  330. package/themes/custom/onlive.theme.cjs +33 -0
  331. package/themes/custom/onlive.theme.d.cts +3 -0
  332. package/themes/custom/onlive.theme.d.ts +3 -0
  333. package/themes/custom/onlive.theme.js +33 -0
  334. package/themes/custom/seat-cupra.theme.cjs +478 -0
  335. package/themes/custom/seat-cupra.theme.d.cts +3 -0
  336. package/themes/custom/seat-cupra.theme.d.ts +3 -0
  337. package/themes/custom/seat-cupra.theme.js +478 -0
  338. package/themes/dark.cjs +13 -2
  339. package/themes/dark.d.cts +1 -1
  340. package/themes/dark.d.ts +1 -1
  341. package/themes/dark.js +12 -1
  342. package/themes/light.cjs +13 -2
  343. package/themes/light.d.cts +1 -1
  344. package/themes/light.d.ts +1 -1
  345. package/themes/light.js +12 -1
  346. package/types/globals.cjs +1 -1
  347. package/types/globals.d.cts +1 -1
  348. package/types/globals.d.ts +1 -1
  349. package/types/globals.js +1 -1
  350. package/types/tracking-options.cjs +1 -1
  351. package/types/tracking-options.d.cts +1 -1
  352. package/types/tracking-options.d.ts +1 -1
  353. package/types/tracking-options.js +1 -1
  354. package/utils/adopt-styles.cjs +1 -1
  355. package/utils/adopt-styles.d.cts +1 -1
  356. package/utils/adopt-styles.d.ts +1 -1
  357. package/utils/adopt-styles.js +1 -1
  358. package/utils/apply-optional-styles.cjs +6548 -0
  359. package/utils/apply-optional-styles.d.cts +47 -0
  360. package/utils/apply-optional-styles.d.ts +47 -0
  361. package/utils/apply-optional-styles.js +6548 -0
  362. package/utils/browser-preferences.cjs +1 -1
  363. package/utils/browser-preferences.d.cts +1 -1
  364. package/utils/browser-preferences.d.ts +1 -1
  365. package/utils/browser-preferences.js +1 -1
  366. package/utils/classify-media.cjs +1 -1
  367. package/utils/classify-media.d.cts +1 -1
  368. package/utils/classify-media.d.ts +1 -1
  369. package/utils/classify-media.js +1 -1
  370. package/utils/decorators.cjs +1 -1
  371. package/utils/decorators.d.cts +1 -1
  372. package/utils/decorators.d.ts +1 -1
  373. package/utils/decorators.js +1 -1
  374. package/utils/detected-lang.cjs +1 -1
  375. package/utils/detected-lang.d.cts +1 -1
  376. package/utils/detected-lang.d.ts +1 -1
  377. package/utils/detected-lang.js +1 -1
  378. package/utils/fullscreen.cjs +1 -1
  379. package/utils/fullscreen.d.cts +1 -1
  380. package/utils/fullscreen.d.ts +1 -1
  381. package/utils/fullscreen.js +1 -1
  382. package/utils/insert-script.cjs +1 -1
  383. package/utils/insert-script.d.cts +1 -1
  384. package/utils/insert-script.d.ts +1 -1
  385. package/utils/insert-script.js +1 -1
  386. package/utils/is-map-compatible.cjs +1 -1
  387. package/utils/is-map-compatible.d.cts +1 -1
  388. package/utils/is-map-compatible.d.ts +1 -1
  389. package/utils/is-map-compatible.js +1 -1
  390. package/utils/markdown.cjs +1 -1
  391. package/utils/markdown.d.cts +1 -1
  392. package/utils/markdown.d.ts +1 -1
  393. package/utils/markdown.js +1 -1
  394. package/utils/merge.cjs +1 -1
  395. package/utils/merge.d.cts +1 -1
  396. package/utils/merge.d.ts +1 -1
  397. package/utils/merge.js +1 -1
  398. package/utils/multiband-track-volume.cjs +1 -1
  399. package/utils/multiband-track-volume.d.cts +1 -1
  400. package/utils/multiband-track-volume.d.ts +1 -1
  401. package/utils/multiband-track-volume.js +1 -1
  402. package/utils/onlive-url-params.cjs +1 -1
  403. package/utils/onlive-url-params.d.cts +1 -1
  404. package/utils/onlive-url-params.d.ts +1 -1
  405. package/utils/onlive-url-params.js +1 -1
  406. package/utils/pretty-distance.cjs +1 -1
  407. package/utils/pretty-distance.d.cts +1 -1
  408. package/utils/pretty-distance.d.ts +1 -1
  409. package/utils/pretty-distance.js +1 -1
  410. package/utils/pretty-time.cjs +1 -1
  411. package/utils/pretty-time.d.cts +1 -1
  412. package/utils/pretty-time.d.ts +1 -1
  413. package/utils/pretty-time.js +1 -1
  414. package/utils/random-string.cjs +1 -1
  415. package/utils/random-string.d.cts +1 -1
  416. package/utils/random-string.d.ts +1 -1
  417. package/utils/random-string.js +1 -1
  418. package/utils/resource-type.cjs +1 -1
  419. package/utils/resource-type.d.cts +1 -1
  420. package/utils/resource-type.d.ts +1 -1
  421. package/utils/resource-type.js +1 -1
  422. package/utils/round-number.cjs +1 -1
  423. package/utils/round-number.d.cts +1 -1
  424. package/utils/round-number.d.ts +1 -1
  425. package/utils/round-number.js +1 -1
  426. package/utils/safe-html.cjs +2 -2
  427. package/utils/safe-html.d.cts +9 -2
  428. package/utils/safe-html.d.ts +9 -2
  429. package/utils/safe-html.js +2 -2
  430. package/utils/sanitize.cjs +1 -1
  431. package/utils/sanitize.d.cts +1 -1
  432. package/utils/sanitize.d.ts +1 -1
  433. package/utils/sanitize.js +1 -1
  434. package/utils/spread.cjs +1 -1
  435. package/utils/spread.d.cts +1 -1
  436. package/utils/spread.d.ts +1 -1
  437. package/utils/spread.js +1 -1
  438. package/utils/watch.cjs +1 -1
  439. package/utils/watch.d.cts +1 -1
  440. package/utils/watch.d.ts +1 -1
  441. package/utils/watch.js +1 -1
  442. package/react/components/asset/Asset.d.cts +0 -33
  443. package/react/components/asset/Asset.d.ts +0 -33
  444. package/react/components/side-bar/SideBar.d.cts +0 -37
  445. package/react/components/side-bar/SideBar.d.ts +0 -37
  446. package/react/components/upload/Upload.d.cts +0 -23
  447. package/react/components/upload/Upload.d.ts +0 -23
package/index.d.ts CHANGED
@@ -1,10 +1,12 @@
1
- /*! @onlive.ai/common-121 v0.2.163 | © 2026 Onlive.ai */
1
+ /*! @onlive.ai/common-121 v0.2.184 | © 2026 Onlive.ai */
2
2
  import * as lit from 'lit';
3
3
  import { LitElement, TemplateResult } from 'lit';
4
4
  import * as _lit_react from '@lit/react';
5
5
  import { EventName } from '@lit/react';
6
+ import { Room as Room$1, Participant } from 'livekit-client';
7
+ import { ReceivedChatMessage } from '@livekit/components-core';
6
8
 
7
- /*! @onlive.ai/common-121 v0.2.163 | © 2026 Onlive.ai */
9
+ /*! @onlive.ai/common-121 v0.2.184 | © 2026 Onlive.ai */
8
10
 
9
11
 
10
12
  type AssetType = "product" | "multimedia" | "faq" | "file";
@@ -335,4 +337,4133 @@ declare const Upload: _lit_react.ReactWebComponent<OSBUpload, {
335
337
  }>>;
336
338
  }>;
337
339
 
338
- export { Asset, type AssetDisplayOptions, type AssetItemDisplayOptions, OSBAsset, OSBSideBar, OSBUpload, SideBar, Upload, type UploadConfig };
340
+ /**
341
+ * @summary Type definitions for the mock LiveKit/Conversation service.
342
+ *
343
+ * @description Contains all type definitions needed for the mock implementation
344
+ * including room state, participant state, track state, agent state, and configuration options.
345
+ */
346
+ /**
347
+ * Represents the state of a mock room.
348
+ *
349
+ * @property {string} id - Unique room identifier.
350
+ * @property {string} name - Display name of the room.
351
+ * @property {string} groupId - Group identifier for room categorization.
352
+ * @property {string} createdAt - ISO timestamp of room creation.
353
+ * @property {string} [endedAt] - ISO timestamp when room ended, undefined if active.
354
+ * @property {Record<string, unknown>} [metadata] - Additional room metadata.
355
+ * @property {boolean} isActive - Whether the room is currently active.
356
+ * @property {string[]} participantIds - Array of participant identities in the room.
357
+ * @property {MockConnectionState} connectionState - Current connection state of the room.
358
+ */
359
+ interface MockRoomState {
360
+ id: string;
361
+ name: string;
362
+ groupId: string;
363
+ createdAt: string;
364
+ endedAt?: string;
365
+ metadata?: Record<string, unknown>;
366
+ isActive: boolean;
367
+ participantIds: string[];
368
+ connectionState: MockConnectionState$1;
369
+ wsURL: string;
370
+ token: string;
371
+ }
372
+ /**
373
+ * Connection states that mirror LiveKit's ConnectionState enum.
374
+ */
375
+ type MockConnectionState$1 = "disconnected" | "connecting" | "connected" | "reconnecting";
376
+ /**
377
+ * Represents the state of a mock participant.
378
+ *
379
+ * @property {string} identity - Unique participant identity.
380
+ * @property {string} [name] - Display name of the participant.
381
+ * @property {string} roomId - ID of the room the participant is in.
382
+ * @property {string} joinedAt - ISO timestamp when participant joined.
383
+ * @property {boolean} isConnected - Whether the participant is currently connected.
384
+ * @property {string[]} trackIds - Array of track IDs published by this participant.
385
+ * @property {MockParticipantRole} role - Role of the participant.
386
+ * @property {Record<string, string>} attributes - Participant attributes.
387
+ * @property {MockParticipantKind} kind - Kind of participant (standard, ingress, egress, sip, agent).
388
+ */
389
+ interface MockParticipantState {
390
+ identity: string;
391
+ name?: string;
392
+ roomId: string;
393
+ joinedAt: string;
394
+ isConnected: boolean;
395
+ trackIds: string[];
396
+ role: MockParticipantRole;
397
+ attributes: Record<string, string>;
398
+ kind: MockParticipantKind$1;
399
+ isLocal: boolean;
400
+ }
401
+ /**
402
+ * Participant roles in the conversation.
403
+ */
404
+ type MockParticipantRole = "user" | "agent" | "assistant";
405
+ /**
406
+ * Participant kinds matching LiveKit's participant types.
407
+ */
408
+ type MockParticipantKind$1 = "standard" | "ingress" | "egress" | "sip" | "agent";
409
+ /**
410
+ * Represents the state of a mock track.
411
+ *
412
+ * @property {string} id - Unique track identifier.
413
+ * @property {MockTrackKind} kind - Type of track (audio, video, data).
414
+ * @property {MockTrackSource} source - Source of the track.
415
+ * @property {string} participantIdentity - Identity of the participant who published this track.
416
+ * @property {string} roomId - ID of the room this track belongs to.
417
+ * @property {string} publishedAt - ISO timestamp when track was published.
418
+ * @property {boolean} muted - Whether the track is currently muted.
419
+ * @property {Record<string, unknown>} [metadata] - Additional track metadata.
420
+ */
421
+ interface MockTrackState {
422
+ id: string;
423
+ kind: MockTrackKind;
424
+ source: MockTrackSource;
425
+ participantIdentity: string;
426
+ roomId: string;
427
+ publishedAt: string;
428
+ muted: boolean;
429
+ metadata?: Record<string, unknown>;
430
+ }
431
+ /**
432
+ * Types of tracks that can be published.
433
+ */
434
+ type MockTrackKind = "audio" | "video" | "data";
435
+ /**
436
+ * Track source types matching LiveKit's track sources.
437
+ */
438
+ type MockTrackSource = "camera" | "microphone" | "screen_share" | "screen_share_audio" | "unknown";
439
+ /**
440
+ * Represents the state of a mock agent.
441
+ *
442
+ * @property {string} id - Unique agent identifier.
443
+ * @property {string} roomId - ID of the room the agent is in.
444
+ * @property {string} name - Display name of the agent.
445
+ * @property {MockAgentStatus} status - Current status of the agent.
446
+ * @property {string} startedAt - ISO timestamp when agent started.
447
+ * @property {string} [stoppedAt] - ISO timestamp when agent stopped.
448
+ * @property {MockAgentConfig} config - Agent configuration.
449
+ * @property {MockAgentMessage[]} messageHistory - History of messages exchanged with agent.
450
+ */
451
+ interface MockAgentState {
452
+ id: string;
453
+ roomId: string;
454
+ name: string;
455
+ status: MockAgentStatus;
456
+ startedAt: string;
457
+ stoppedAt?: string;
458
+ config: MockAgentConfig;
459
+ messageHistory: MockAgentMessage[];
460
+ }
461
+ /**
462
+ * Agent status values.
463
+ */
464
+ type MockAgentStatus = "idle" | "starting" | "running" | "stopping" | "stopped" | "error";
465
+ /**
466
+ * Configuration for a mock agent.
467
+ *
468
+ * @property {string} [type] - Type of agent (e.g., 'chat', 'voice').
469
+ * @property {string} [nature] - Nature of agent ('ai' or 'real').
470
+ * @property {MockAgentResponseStrategy} responseStrategy - How the agent should respond.
471
+ * @property {number} [responseDelayMs] - Delay before responding in milliseconds.
472
+ * @property {string[]} [cannedResponses] - Predefined responses for deterministic testing.
473
+ * @property {number} [maxMessages] - Maximum messages before stopping.
474
+ * @property {boolean} [simulateTyping] - Whether to simulate typing indicator.
475
+ * @property {number} [typingDelayPerChar] - Typing delay per character (ms).
476
+ * @property {string} [name] - Agent display name.
477
+ */
478
+ interface MockAgentConfig {
479
+ type?: string | string[];
480
+ nature?: "ai" | "real";
481
+ name?: string;
482
+ responseStrategy: MockAgentResponseStrategy;
483
+ responseDelayMs?: number;
484
+ cannedResponses?: string[];
485
+ maxMessages?: number;
486
+ simulateTyping?: boolean;
487
+ typingDelayPerChar?: number;
488
+ }
489
+ /**
490
+ * Strategies for how mock agents should respond.
491
+ */
492
+ type MockAgentResponseStrategy = "echo" | "canned" | "random" | "sequential" | "silent" | "error" | "custom";
493
+ /**
494
+ * Message exchanged with a mock agent.
495
+ */
496
+ interface MockAgentMessage {
497
+ id: string;
498
+ content: string;
499
+ role: "user" | "agent";
500
+ /** Timestamp - ISO string or number */
501
+ timestamp: string | number;
502
+ }
503
+ /**
504
+ * Represents a mock message in a room.
505
+ *
506
+ * @property {string} id - Unique message identifier.
507
+ * @property {string} roomId - ID of the room this message belongs to.
508
+ * @property {string} content - Text content of the message.
509
+ * @property {string} participantIdentity - Identity of the sender.
510
+ * @property {string} createdAt - ISO timestamp of message creation.
511
+ * @property {"standard" | "system"} [type] - Message type classification.
512
+ * @property {Record<string, unknown>} [attributes] - Message attributes.
513
+ */
514
+ interface MockMessageState {
515
+ id: string;
516
+ roomId: string;
517
+ content: string;
518
+ participantIdentity: string;
519
+ createdAt: string;
520
+ type?: "standard" | "system";
521
+ attributes?: Record<string, unknown>;
522
+ }
523
+ /**
524
+ * All possible mock event types.
525
+ */
526
+ type MockEventType = "roomCreated" | "roomEnded" | "roomConnectionStateChanged" | "participantJoined" | "participantLeft" | "participantAttributesChanged" | "trackPublished" | "trackUnpublished" | "trackMuted" | "trackUnmuted" | "messageReceived" | "messageSent" | "typingIndicator" | "agentStarted" | "agentStopped" | "agentMessage" | "dataReceived" | "error";
527
+ /**
528
+ * Base event structure for all mock events.
529
+ */
530
+ interface MockEventBase {
531
+ type: MockEventType;
532
+ timestamp: string;
533
+ roomId?: string;
534
+ }
535
+ /**
536
+ * Room created event.
537
+ */
538
+ interface MockRoomCreatedEvent extends MockEventBase {
539
+ type: "roomCreated";
540
+ roomId: string;
541
+ room: MockRoomState;
542
+ }
543
+ /**
544
+ * Room ended event.
545
+ */
546
+ interface MockRoomEndedEvent extends MockEventBase {
547
+ type: "roomEnded";
548
+ roomId: string;
549
+ }
550
+ /**
551
+ * Room connection state changed event.
552
+ */
553
+ interface MockRoomConnectionStateChangedEvent extends MockEventBase {
554
+ type: "roomConnectionStateChanged";
555
+ roomId: string;
556
+ state: MockConnectionState$1;
557
+ previousState: MockConnectionState$1;
558
+ }
559
+ /**
560
+ * Participant joined event.
561
+ */
562
+ interface MockParticipantJoinedEvent extends MockEventBase {
563
+ type: "participantJoined";
564
+ roomId: string;
565
+ participant: MockParticipantState;
566
+ }
567
+ /**
568
+ * Participant left event.
569
+ */
570
+ interface MockParticipantLeftEvent extends MockEventBase {
571
+ type: "participantLeft";
572
+ roomId: string;
573
+ participantIdentity: string;
574
+ }
575
+ /**
576
+ * Participant attributes changed event.
577
+ */
578
+ interface MockParticipantAttributesChangedEvent extends MockEventBase {
579
+ type: "participantAttributesChanged";
580
+ roomId: string;
581
+ participantIdentity: string;
582
+ attributes: Record<string, string>;
583
+ previousAttributes: Record<string, string>;
584
+ }
585
+ /**
586
+ * Track published event.
587
+ */
588
+ interface MockTrackPublishedEvent extends MockEventBase {
589
+ type: "trackPublished";
590
+ roomId: string;
591
+ participantIdentity: string;
592
+ track: MockTrackState;
593
+ }
594
+ /**
595
+ * Track unpublished event.
596
+ */
597
+ interface MockTrackUnpublishedEvent extends MockEventBase {
598
+ type: "trackUnpublished";
599
+ roomId: string;
600
+ participantIdentity: string;
601
+ trackId: string;
602
+ }
603
+ /**
604
+ * Track muted event.
605
+ */
606
+ interface MockTrackMutedEvent extends MockEventBase {
607
+ type: "trackMuted";
608
+ roomId: string;
609
+ trackId: string;
610
+ }
611
+ /**
612
+ * Track unmuted event.
613
+ */
614
+ interface MockTrackUnmutedEvent extends MockEventBase {
615
+ type: "trackUnmuted";
616
+ roomId: string;
617
+ trackId: string;
618
+ }
619
+ /**
620
+ * Message received event.
621
+ */
622
+ interface MockMessageReceivedEvent extends MockEventBase {
623
+ type: "messageReceived";
624
+ roomId: string;
625
+ message: MockMessageState;
626
+ }
627
+ /**
628
+ * Message sent event.
629
+ */
630
+ interface MockMessageSentEvent extends MockEventBase {
631
+ type: "messageSent";
632
+ roomId: string;
633
+ message: MockMessageState;
634
+ }
635
+ /**
636
+ * Typing indicator event.
637
+ */
638
+ interface MockTypingIndicatorEvent extends MockEventBase {
639
+ type: "typingIndicator";
640
+ roomId: string;
641
+ participantIdentity: string;
642
+ isTyping: boolean;
643
+ }
644
+ /**
645
+ * Agent started event.
646
+ */
647
+ interface MockAgentStartedEvent extends MockEventBase {
648
+ type: "agentStarted";
649
+ roomId: string;
650
+ agent: MockAgentState;
651
+ }
652
+ /**
653
+ * Agent stopped event.
654
+ */
655
+ interface MockAgentStoppedEvent extends MockEventBase {
656
+ type: "agentStopped";
657
+ roomId: string;
658
+ agentId: string;
659
+ }
660
+ /**
661
+ * Agent message event.
662
+ */
663
+ interface MockAgentMessageEvent extends MockEventBase {
664
+ type: "agentMessage";
665
+ roomId: string;
666
+ agentId: string;
667
+ message: MockAgentMessage;
668
+ }
669
+ /**
670
+ * Data received event.
671
+ */
672
+ interface MockDataReceivedEvent extends MockEventBase {
673
+ type: "dataReceived";
674
+ roomId: string;
675
+ participantIdentity: string;
676
+ data: Uint8Array;
677
+ topic?: string;
678
+ }
679
+ /**
680
+ * Error event.
681
+ */
682
+ interface MockErrorEvent extends MockEventBase {
683
+ type: "error";
684
+ error: MockError;
685
+ }
686
+ /**
687
+ * Union type for all mock events.
688
+ */
689
+ type MockEvent = MockRoomCreatedEvent | MockRoomEndedEvent | MockRoomConnectionStateChangedEvent | MockParticipantJoinedEvent | MockParticipantLeftEvent | MockParticipantAttributesChangedEvent | MockTrackPublishedEvent | MockTrackUnpublishedEvent | MockTrackMutedEvent | MockTrackUnmutedEvent | MockMessageReceivedEvent | MockMessageSentEvent | MockTypingIndicatorEvent | MockAgentStartedEvent | MockAgentStoppedEvent | MockAgentMessageEvent | MockDataReceivedEvent | MockErrorEvent;
690
+ /**
691
+ * Configuration options for the mock service.
692
+ *
693
+ * @property {number} [latencyMs] - Artificial latency in milliseconds.
694
+ * @property {boolean} [strictMode] - Throw errors for invalid operations.
695
+ * @property {number} [seed] - Random seed for deterministic behavior.
696
+ * @property {MockScenario} [scenario] - Predefined scenario to simulate.
697
+ * @property {MockErrorConfig} [errorConfig] - Configuration for forced errors.
698
+ * @property {boolean} [autoEmitEvents] - Automatically emit events on state changes.
699
+ */
700
+ interface MockServiceConfig {
701
+ latencyMs?: number;
702
+ strictMode?: boolean;
703
+ seed?: number;
704
+ scenario?: MockScenario;
705
+ errorConfig?: MockErrorConfig;
706
+ autoEmitEvents?: boolean;
707
+ organizationId?: string;
708
+ apiUrl?: string;
709
+ }
710
+ /**
711
+ * Predefined test scenarios.
712
+ */
713
+ type MockScenario = "happy_path" | "room_disconnect" | "agent_timeout" | "participant_leave" | "track_failure" | "network_unstable" | "slow_network" | "unreliable";
714
+ /**
715
+ * Configuration for forced errors.
716
+ *
717
+ * @property {boolean} [roomNotFound] - Force "room not found" errors.
718
+ * @property {boolean} [participantAlreadyJoined] - Force "already joined" errors.
719
+ * @property {boolean} [trackNotFound] - Force "track not found" errors.
720
+ * @property {boolean} [unauthorized] - Force authentication errors.
721
+ * @property {boolean} [networkError] - Force network errors.
722
+ * @property {number} [errorRate] - Percentage of operations that should fail (0-100).
723
+ */
724
+ interface MockErrorConfig {
725
+ roomNotFound?: boolean;
726
+ participantAlreadyJoined?: boolean;
727
+ trackNotFound?: boolean;
728
+ unauthorized?: boolean;
729
+ networkError?: boolean;
730
+ errorRate?: number;
731
+ }
732
+ /**
733
+ * Mock error codes.
734
+ */
735
+ type MockErrorCode = "ROOM_NOT_FOUND" | "ROOM_ENDED" | "PARTICIPANT_ALREADY_JOINED" | "PARTICIPANT_NOT_FOUND" | "TRACK_NOT_FOUND" | "AGENT_NOT_FOUND" | "UNAUTHORIZED" | "NETWORK_ERROR" | "INVALID_OPERATION" | "TIMEOUT";
736
+ /**
737
+ * Mock error structure.
738
+ */
739
+ interface MockError {
740
+ code: MockErrorCode;
741
+ message: string;
742
+ details?: Record<string, unknown>;
743
+ }
744
+ /**
745
+ * Event listener callback type.
746
+ */
747
+ type MockEventListener<T extends MockEvent = MockEvent> = (event: T) => void;
748
+ /**
749
+ * Event listener for specific event types.
750
+ */
751
+ type MockEventListenerMap = {
752
+ [K in MockEventType]?: Set<MockEventListener>;
753
+ };
754
+ /**
755
+ * Complete snapshot of the mock service state.
756
+ */
757
+ interface MockStateSnapshot {
758
+ rooms: Map<string, MockRoomState>;
759
+ participants: Map<string, MockParticipantState>;
760
+ tracks: Map<string, MockTrackState>;
761
+ agents: Map<string, MockAgentState>;
762
+ messages: Map<string, MockMessageState[]>;
763
+ config: MockServiceConfig;
764
+ eventHistory: MockEvent[];
765
+ }
766
+ /**
767
+ * Serializable version of the snapshot for JSON export.
768
+ */
769
+ interface MockStateSnapshotJSON {
770
+ rooms: Record<string, MockRoomState>;
771
+ participants: Record<string, MockParticipantState>;
772
+ tracks: Record<string, MockTrackState>;
773
+ agents: Record<string, MockAgentState>;
774
+ messages: Record<string, MockMessageState[]>;
775
+ config: MockServiceConfig;
776
+ eventHistory: MockEvent[];
777
+ exportedAt: string;
778
+ }
779
+
780
+ /**
781
+ * @summary Custom error classes for the mock LiveKit service.
782
+ *
783
+ * @description Provides typed error classes that match LiveKit error patterns
784
+ * for consistent error handling in tests.
785
+ */
786
+
787
+ /**
788
+ * @summary Base error class for mock LiveKit errors.
789
+ *
790
+ * @description Extends the standard Error class with mock-specific properties.
791
+ */
792
+ declare class MockLiveKitError extends Error {
793
+ /** Error code for programmatic handling */
794
+ readonly code: MockErrorCode;
795
+ /** Additional error details */
796
+ readonly details?: Record<string, unknown>;
797
+ /**
798
+ * Creates a new MockLiveKitError.
799
+ *
800
+ * @param {MockErrorCode} code - Error code.
801
+ * @param {string} message - Error message.
802
+ * @param {Record<string, unknown>} [details] - Additional details.
803
+ */
804
+ constructor(code: MockErrorCode, message: string, details?: Record<string, unknown>);
805
+ /**
806
+ * Converts the error to a MockError object.
807
+ *
808
+ * @returns {MockError} Plain error object.
809
+ */
810
+ toMockError(): MockError;
811
+ /**
812
+ * Creates a MockLiveKitError from a MockError object.
813
+ *
814
+ * @param {MockError} error - Error object.
815
+ * @returns {MockLiveKitError} Error instance.
816
+ */
817
+ static fromMockError(error: MockError): MockLiveKitError;
818
+ }
819
+ /**
820
+ * Room not found error.
821
+ */
822
+ declare class RoomNotFoundError extends MockLiveKitError {
823
+ constructor(roomId: string);
824
+ }
825
+ /**
826
+ * Room ended error.
827
+ */
828
+ declare class RoomEndedError extends MockLiveKitError {
829
+ constructor(roomId: string);
830
+ }
831
+ /**
832
+ * Participant already joined error.
833
+ */
834
+ declare class ParticipantAlreadyJoinedError extends MockLiveKitError {
835
+ constructor(identity: string, roomId: string);
836
+ }
837
+ /**
838
+ * Participant not found error.
839
+ */
840
+ declare class ParticipantNotFoundError extends MockLiveKitError {
841
+ constructor(identity: string);
842
+ }
843
+ /**
844
+ * Track not found error.
845
+ */
846
+ declare class TrackNotFoundError extends MockLiveKitError {
847
+ constructor(trackId: string);
848
+ }
849
+ /**
850
+ * Agent not found error.
851
+ */
852
+ declare class AgentNotFoundError extends MockLiveKitError {
853
+ constructor(agentId: string);
854
+ }
855
+ /**
856
+ * Unauthorized error.
857
+ */
858
+ declare class UnauthorizedError extends MockLiveKitError {
859
+ constructor(message?: string);
860
+ }
861
+ /**
862
+ * Network error.
863
+ */
864
+ declare class NetworkError extends MockLiveKitError {
865
+ constructor(message?: string);
866
+ }
867
+ /**
868
+ * Invalid operation error.
869
+ */
870
+ declare class InvalidOperationError extends MockLiveKitError {
871
+ constructor(message: string, details?: Record<string, unknown>);
872
+ }
873
+ /**
874
+ * Timeout error.
875
+ */
876
+ declare class TimeoutError extends MockLiveKitError {
877
+ constructor(operation: string, timeoutMs: number);
878
+ }
879
+ /**
880
+ * Creates an appropriate error instance from a MockError object.
881
+ *
882
+ * @param {MockError} error - Error object.
883
+ * @returns {MockLiveKitError} Typed error instance.
884
+ */
885
+ declare function createErrorFromMockError(error: MockError): MockLiveKitError;
886
+ /**
887
+ * Type guard to check if a value is a MockError.
888
+ *
889
+ * @param {unknown} value - Value to check.
890
+ * @returns {boolean} True if value is a MockError.
891
+ */
892
+ declare function isMockError(value: unknown): value is MockError;
893
+ /**
894
+ * Type guard to check if a value is a MockLiveKitError.
895
+ *
896
+ * @param {unknown} value - Value to check.
897
+ * @returns {boolean} True if value is a MockLiveKitError.
898
+ */
899
+ declare function isMockLiveKitError(value: unknown): value is MockLiveKitError;
900
+
901
+ /**
902
+ * @summary Event emitter for mock LiveKit events.
903
+ *
904
+ * @description Provides an event system that mimics LiveKit's event handling,
905
+ * allowing subscription to various room, participant, and track events.
906
+ */
907
+
908
+ /**
909
+ * @summary Event emitter for mock LiveKit service.
910
+ *
911
+ * @description Manages event subscriptions and emissions for the mock service.
912
+ * Supports both typed event listeners and wildcard listeners.
913
+ */
914
+ declare class MockEventEmitter {
915
+ /** Map of event type to set of listeners */
916
+ private listeners;
917
+ /** Set of wildcard listeners that receive all events */
918
+ private wildcardListeners;
919
+ /** History of all emitted events for testing/debugging */
920
+ private eventHistory;
921
+ /** Maximum number of events to keep in history */
922
+ private maxHistorySize;
923
+ /** Whether to store events in history */
924
+ private recordHistory;
925
+ /**
926
+ * Sets the maximum history size.
927
+ *
928
+ * @param {number} size - Maximum number of events to keep.
929
+ */
930
+ setMaxHistorySize(size: number): void;
931
+ /**
932
+ * Enables or disables event history recording.
933
+ *
934
+ * @param {boolean} enabled - Whether to record history.
935
+ */
936
+ setRecordHistory(enabled: boolean): void;
937
+ /**
938
+ * Subscribes to a specific event type.
939
+ *
940
+ * @param {T} type - Event type to listen for.
941
+ * @param {MockEventListener} listener - Callback function.
942
+ * @returns {() => void} Unsubscribe function.
943
+ */
944
+ on<T extends MockEventType>(type: T, listener: MockEventListener): () => void;
945
+ /**
946
+ * Subscribes to a specific event type for a single emission.
947
+ *
948
+ * @param {T} type - Event type to listen for.
949
+ * @param {MockEventListener} listener - Callback function.
950
+ * @returns {() => void} Unsubscribe function.
951
+ */
952
+ once<T extends MockEventType>(type: T, listener: MockEventListener): () => void;
953
+ /**
954
+ * Unsubscribes from a specific event type.
955
+ *
956
+ * @param {T} type - Event type.
957
+ * @param {MockEventListener} listener - Listener to remove.
958
+ */
959
+ off<T extends MockEventType>(type: T, listener: MockEventListener): void;
960
+ /**
961
+ * Subscribes to all events.
962
+ *
963
+ * @param {MockEventListener} listener - Callback function.
964
+ * @returns {() => void} Unsubscribe function.
965
+ */
966
+ onAny(listener: MockEventListener): () => void;
967
+ /**
968
+ * Removes a wildcard listener.
969
+ *
970
+ * @param {MockEventListener} listener - Listener to remove.
971
+ */
972
+ offAny(listener: MockEventListener): void;
973
+ /**
974
+ * Removes all listeners for a specific event type or all events.
975
+ *
976
+ * @param {MockEventType} [type] - Event type (optional, removes all if not specified).
977
+ */
978
+ removeAllListeners(type?: MockEventType): void;
979
+ /**
980
+ * Emits an event to all relevant listeners.
981
+ *
982
+ * @param {MockEvent} event - Event to emit.
983
+ */
984
+ emit(event: MockEvent): void;
985
+ /**
986
+ * Trims event history to maximum size.
987
+ */
988
+ private trimHistory;
989
+ /**
990
+ * Emits a room created event.
991
+ *
992
+ * @param {MockRoomState} room - Created room.
993
+ */
994
+ emitRoomCreated(room: MockRoomState): void;
995
+ /**
996
+ * Emits a room ended event.
997
+ *
998
+ * @param {string} roomId - Room identifier.
999
+ */
1000
+ emitRoomEnded(roomId: string): void;
1001
+ /**
1002
+ * Emits a room connection state changed event.
1003
+ *
1004
+ * @param {string} roomId - Room identifier.
1005
+ * @param {MockConnectionState} state - New state.
1006
+ * @param {MockConnectionState} previousState - Previous state.
1007
+ */
1008
+ emitRoomConnectionStateChanged(roomId: string, state: MockConnectionState$1, previousState: MockConnectionState$1): void;
1009
+ /**
1010
+ * Emits a participant joined event.
1011
+ *
1012
+ * @param {string} roomId - Room identifier.
1013
+ * @param {MockParticipantState} participant - Joined participant.
1014
+ */
1015
+ emitParticipantJoined(roomId: string, participant: MockParticipantState): void;
1016
+ /**
1017
+ * Emits a participant left event.
1018
+ *
1019
+ * @param {string} roomId - Room identifier.
1020
+ * @param {string} participantIdentity - Participant identity.
1021
+ */
1022
+ emitParticipantLeft(roomId: string, participantIdentity: string): void;
1023
+ /**
1024
+ * Emits a participant attributes changed event.
1025
+ *
1026
+ * @param {string} roomId - Room identifier.
1027
+ * @param {string} participantIdentity - Participant identity.
1028
+ * @param {Record<string, string>} attributes - New attributes.
1029
+ * @param {Record<string, string>} previousAttributes - Previous attributes.
1030
+ */
1031
+ emitParticipantAttributesChanged(roomId: string, participantIdentity: string, attributes: Record<string, string>, previousAttributes: Record<string, string>): void;
1032
+ /**
1033
+ * Emits a track published event.
1034
+ *
1035
+ * @param {string} roomId - Room identifier.
1036
+ * @param {string} participantIdentity - Participant identity.
1037
+ * @param {MockTrackState} track - Published track.
1038
+ */
1039
+ emitTrackPublished(roomId: string, participantIdentity: string, track: MockTrackState): void;
1040
+ /**
1041
+ * Emits a track unpublished event.
1042
+ *
1043
+ * @param {string} roomId - Room identifier.
1044
+ * @param {string} participantIdentity - Participant identity.
1045
+ * @param {string} trackId - Track identifier.
1046
+ */
1047
+ emitTrackUnpublished(roomId: string, participantIdentity: string, trackId: string): void;
1048
+ /**
1049
+ * Emits a track muted event.
1050
+ *
1051
+ * @param {string} roomId - Room identifier.
1052
+ * @param {string} trackId - Track identifier.
1053
+ */
1054
+ emitTrackMuted(roomId: string, trackId: string): void;
1055
+ /**
1056
+ * Emits a track unmuted event.
1057
+ *
1058
+ * @param {string} roomId - Room identifier.
1059
+ * @param {string} trackId - Track identifier.
1060
+ */
1061
+ emitTrackUnmuted(roomId: string, trackId: string): void;
1062
+ /**
1063
+ * Emits a message received event.
1064
+ *
1065
+ * @param {string} roomId - Room identifier.
1066
+ * @param {MockMessageState} message - Received message.
1067
+ */
1068
+ emitMessageReceived(roomId: string, message: MockMessageState): void;
1069
+ /**
1070
+ * Emits a message sent event.
1071
+ *
1072
+ * @param {string} roomId - Room identifier.
1073
+ * @param {MockMessageState} message - Sent message.
1074
+ */
1075
+ emitMessageSent(roomId: string, message: MockMessageState): void;
1076
+ /**
1077
+ * Emits a typing indicator event.
1078
+ *
1079
+ * @param {string} roomId - Room identifier.
1080
+ * @param {string} participantIdentity - Participant identity.
1081
+ * @param {boolean} isTyping - Whether typing.
1082
+ */
1083
+ emitTypingIndicator(roomId: string, participantIdentity: string, isTyping: boolean): void;
1084
+ /**
1085
+ * Emits an agent started event.
1086
+ *
1087
+ * @param {string} roomId - Room identifier.
1088
+ * @param {MockAgentState} agent - Started agent.
1089
+ */
1090
+ emitAgentStarted(roomId: string, agent: MockAgentState): void;
1091
+ /**
1092
+ * Emits an agent stopped event.
1093
+ *
1094
+ * @param {string} roomId - Room identifier.
1095
+ * @param {string} agentId - Agent identifier.
1096
+ */
1097
+ emitAgentStopped(roomId: string, agentId: string): void;
1098
+ /**
1099
+ * Emits an agent message event.
1100
+ *
1101
+ * @param {string} roomId - Room identifier.
1102
+ * @param {string} agentId - Agent identifier.
1103
+ * @param {MockAgentMessage} message - Agent message.
1104
+ */
1105
+ emitAgentMessage(roomId: string, agentId: string, message: MockAgentMessage): void;
1106
+ /**
1107
+ * Emits a data received event.
1108
+ *
1109
+ * @param {string} roomId - Room identifier.
1110
+ * @param {string} participantIdentity - Participant identity.
1111
+ * @param {Uint8Array} data - Received data.
1112
+ * @param {string} [topic] - Data topic.
1113
+ */
1114
+ emitDataReceived(roomId: string, participantIdentity: string, data: Uint8Array, topic?: string): void;
1115
+ /**
1116
+ * Emits an error event.
1117
+ *
1118
+ * @param {MockError} error - Error details.
1119
+ * @param {string} [roomId] - Optional room identifier.
1120
+ */
1121
+ emitError(error: MockError, roomId?: string): void;
1122
+ /**
1123
+ * Gets the event history.
1124
+ *
1125
+ * @param {MockEventType} [filterType] - Optional filter by event type.
1126
+ * @returns {MockEvent[]} Array of events.
1127
+ */
1128
+ getHistory(filterType?: MockEventType): MockEvent[];
1129
+ /**
1130
+ * Gets the last N events.
1131
+ *
1132
+ * @param {number} count - Number of events to get.
1133
+ * @param {MockEventType} [filterType] - Optional filter by event type.
1134
+ * @returns {MockEvent[]} Array of events.
1135
+ */
1136
+ getLastEvents(count: number, filterType?: MockEventType): MockEvent[];
1137
+ /**
1138
+ * Clears the event history.
1139
+ */
1140
+ clearHistory(): void;
1141
+ /**
1142
+ * Gets the count of listeners for a specific event type.
1143
+ *
1144
+ * @param {MockEventType} type - Event type.
1145
+ * @returns {number} Number of listeners.
1146
+ */
1147
+ listenerCount(type: MockEventType): number;
1148
+ }
1149
+
1150
+ type FirebaseConfig = {
1151
+ apiKey: string;
1152
+ authDomain: string;
1153
+ databaseURL: string;
1154
+ projectId: string;
1155
+ storageBucket: string;
1156
+ messagingSenderId: string;
1157
+ appId: string;
1158
+ measurementId?: string;
1159
+ };
1160
+
1161
+ /**
1162
+ * Room API response structure from the backend.
1163
+ *
1164
+ * @property {string} id - Room unique identifier.
1165
+ * @property {string} groupId - Group identifier for room categorization.
1166
+ * @property {string} token - Authentication token for room access.
1167
+ * @property {string} wsURL - WebSocket URL for real-time connection.
1168
+ * @property {string} createdAt - ISO timestamp of room creation.
1169
+ * @property {Record<string, unknown>} [affinity] - Affinity data echoed back from the server.
1170
+ */
1171
+ type RoomApiResponse = {
1172
+ id: string;
1173
+ groupId: string;
1174
+ token: string;
1175
+ wsURL: string;
1176
+ createdAt: string;
1177
+ affinity?: Record<string, unknown>;
1178
+ };
1179
+ /**
1180
+ * Room list item structure for room listings.
1181
+ *
1182
+ * @property {string} id - Room unique identifier.
1183
+ * @property {string} [name] - Optional room display name.
1184
+ * @property {string} [groupId] - Group identifier.
1185
+ * @property {string} [organizationId] - Organization that owns the room.
1186
+ * @property {string | null} [endedAt] - Timestamp when room ended, null if active.
1187
+ * @property {string} createdAt - Room creation timestamp.
1188
+ * @property {string} updatedAt - Last update timestamp.
1189
+ * @property {ApiMessage[]} [messages] - Array of messages in the room.
1190
+ * @property {Record<string, unknown>} [metadata] - Additional room metadata.
1191
+ * @property {"active" | "ended" | "pending"} [status] - Current room status.
1192
+ * @property {number} [messageCount] - Total number of messages.
1193
+ * @property {Array<ParticipantInfo>} participants - Room participants.
1194
+ * @property {Array<EvaluationInfo>} evaluations - Room evaluations/ratings.
1195
+ * @property {number} [participantCount] - Total participant count.
1196
+ * @property {number} [evaluationCount] - Total evaluation count.
1197
+ * @property {CountInfo} [_count] - Aggregated counts.
1198
+ */
1199
+ type RoomListItem = {
1200
+ id: string;
1201
+ name?: string;
1202
+ groupId?: string;
1203
+ organizationId?: string;
1204
+ endedAt?: string | null;
1205
+ createdAt: string;
1206
+ updatedAt: string;
1207
+ messages?: ApiMessage[];
1208
+ metadata?: Record<string, unknown>;
1209
+ status?: "active" | "ended" | "pending";
1210
+ messageCount?: number;
1211
+ participants: Array<{
1212
+ id: string;
1213
+ name: string;
1214
+ role: "user" | "agent" | "assistant";
1215
+ externalId?: string;
1216
+ image?: string;
1217
+ isAgent?: boolean;
1218
+ isLocal?: boolean;
1219
+ }>;
1220
+ evaluations: Array<{
1221
+ id: string;
1222
+ rating: number;
1223
+ comment?: string;
1224
+ createdAt: string;
1225
+ }>;
1226
+ participantCount?: number;
1227
+ evaluationCount?: number;
1228
+ _count?: {
1229
+ messages?: number;
1230
+ participants?: number;
1231
+ evaluations?: number;
1232
+ };
1233
+ };
1234
+ /**
1235
+ * Paginated response for room listings.
1236
+ *
1237
+ * @property {RoomListItem[]} items - Array of room items.
1238
+ * @property {number} count - Total number of items.
1239
+ * @property {number} limit - Maximum items per page.
1240
+ * @property {number} offset - Current page offset.
1241
+ */
1242
+ type RoomsApiResponse = {
1243
+ items: RoomListItem[];
1244
+ count: number;
1245
+ limit: number;
1246
+ offset: number;
1247
+ };
1248
+ /**
1249
+ * Participant information with extended user details.
1250
+ *
1251
+ * @property {string} id - User unique identifier.
1252
+ * @property {"user" | "agent" | "assistant"} role - User's role in the conversation.
1253
+ * @property {string} [avatar] - URL to user's avatar image.
1254
+ * @property {string} [name] - Display name of the user.
1255
+ */
1256
+ interface UserFrom extends Participant {
1257
+ id: string;
1258
+ role: "user" | "agent" | "assistant";
1259
+ avatar?: string;
1260
+ name?: string;
1261
+ }
1262
+ /**
1263
+ * User API response after registration.
1264
+ *
1265
+ * @property {string} id - User unique identifier.
1266
+ * @property {string} externalId - External system identifier.
1267
+ * @property {string} organizationId - Associated organization ID.
1268
+ * @property {string} role - User's assigned role.
1269
+ * @property {string} token - Authentication token.
1270
+ */
1271
+ type UserApiResponse = {
1272
+ id: string;
1273
+ externalId: string;
1274
+ organizationId: string;
1275
+ role: string;
1276
+ token: string;
1277
+ };
1278
+ /**
1279
+ * Agent data for registration.
1280
+ *
1281
+ * @property {string} name - Agent display name.
1282
+ * @property {string} [avatar] - URL to agent's avatar.
1283
+ * @property {string} [email] - Agent email address.
1284
+ */
1285
+ interface AgentData {
1286
+ name: string;
1287
+ avatar?: string;
1288
+ email?: string;
1289
+ }
1290
+ /**
1291
+ * Asset attached to a message.
1292
+ *
1293
+ * @property {string} assetType - Type of asset (product, multimedia, faq, file).
1294
+ * @property {string} assetExternalId - External identifier for the asset.
1295
+ */
1296
+ interface Assets {
1297
+ assetType: string;
1298
+ assetExternalId: string;
1299
+ }
1300
+ /**
1301
+ * Media attachment structure.
1302
+ *
1303
+ * @property {string} url - URL of the media file.
1304
+ * @property {string} ext - File extension.
1305
+ * @property {string} [name] - Optional name of the file.
1306
+ * @property {string} [type] - Optional media type.
1307
+ */
1308
+ interface MediaAttachment {
1309
+ name?: string;
1310
+ url: string;
1311
+ ext: string;
1312
+ type?: string;
1313
+ }
1314
+ /**
1315
+ * Report information for a message.
1316
+ *
1317
+ * @property {string} id - Unique identifier of the report.
1318
+ * @property {string} createdAt - ISO timestamp of report creation.
1319
+ */
1320
+ interface ReportInfo {
1321
+ id: string;
1322
+ createdAt: string;
1323
+ }
1324
+ /**
1325
+ * API message structure extending LiveKit's received chat message.
1326
+ *
1327
+ * @property {"standard" | "system"} [type] - Message type classification.
1328
+ * @property {string} content - Text content of the message.
1329
+ * @property {string} createdAt - ISO timestamp of message creation.
1330
+ * @property {UserFrom} [from] - Sender information.
1331
+ * @property {Array<MediaAttachment>} [media] - Attached media files.
1332
+ * @property {Array<Assets>} [assets] - Attached assets.
1333
+ * @property {Array<ReportInfo>} [reports] - Message reports/flags.
1334
+ * @property {Record<string, unknown>} [metadata] - Additional custom metadata.
1335
+ */
1336
+ type ApiMessage = Omit<ReceivedChatMessage, "type"> & {
1337
+ type?: "standard" | "system";
1338
+ content: string;
1339
+ createdAt: string;
1340
+ from?: UserFrom;
1341
+ media?: MediaAttachment[];
1342
+ assets?: Assets[];
1343
+ reports?: ReportInfo[];
1344
+ metadata?: Record<string, unknown>;
1345
+ };
1346
+ /**
1347
+ * Paginated response for messages.
1348
+ *
1349
+ * @property {ApiMessage[]} items - Array of messages.
1350
+ * @property {number} count - Total message count.
1351
+ * @property {number} limit - Maximum items per page.
1352
+ * @property {number} offset - Current page offset.
1353
+ */
1354
+ type MessagesApiResponse = {
1355
+ items: ApiMessage[];
1356
+ count: number;
1357
+ limit: number;
1358
+ offset: number;
1359
+ };
1360
+ /**
1361
+ * Typing indicator event structure.
1362
+ *
1363
+ * @property {"typing"} type - Event type identifier.
1364
+ * @property {boolean} isTyping - Whether the participant is currently typing.
1365
+ * @property {number} timestamp - Unix timestamp of the event.
1366
+ * @property {string} participantId - Identifier of the typing participant.
1367
+ */
1368
+ interface TypingIndicator {
1369
+ type: "typing";
1370
+ isTyping: boolean;
1371
+ timestamp: number;
1372
+ participantId: string;
1373
+ }
1374
+ /**
1375
+ * Available contextual event names.
1376
+ */
1377
+ type ContextualEventNames = "call_ended" | "interrupt";
1378
+ /**
1379
+ * Contextual event structure for signaling state changes.
1380
+ *
1381
+ * @property {ContextualEventNames} eventName - Name of the event.
1382
+ * @property {Record<string, unknown>} [eventData] - Additional event data.
1383
+ * @property {boolean} [generateResponse] - Whether to trigger AI response.
1384
+ */
1385
+ interface ContextualEvent {
1386
+ eventName: ContextualEventNames;
1387
+ eventData?: Record<string, unknown>;
1388
+ generateResponse?: boolean;
1389
+ }
1390
+ /**
1391
+ * Request status for call/room requests.
1392
+ */
1393
+ type RequestStatus = "pending" | "accepted" | "cancelled" | "not_response" | "disconnected" | "failed";
1394
+ /**
1395
+ * Call request structure for real-time request handling.
1396
+ *
1397
+ * @property {string} guestId - Identifier of the requesting guest.
1398
+ * @property {string} [name] - Display name of the guest.
1399
+ * @property {string} createdAt - ISO timestamp of request creation.
1400
+ * @property {string} [roomId] - Associated room identifier.
1401
+ * @property {RequestStatus} status - Current request status.
1402
+ * @property {string | null} assignedAgentId - ID of assigned agent, null if unassigned.
1403
+ * @property {string} id - Unique request identifier.
1404
+ */
1405
+ interface CallRequest {
1406
+ guestId: string;
1407
+ name?: string;
1408
+ createdAt: string;
1409
+ roomId?: string;
1410
+ status: RequestStatus;
1411
+ assignedAgentId?: string;
1412
+ id: string;
1413
+ userGroupId?: string;
1414
+ }
1415
+ /**
1416
+ * Room sync notification data structure.
1417
+ *
1418
+ * @property {boolean} needsSync - Whether the room needs synchronization.
1419
+ * @property {string} [reason] - Reason for the sync request.
1420
+ * @property {number} [timestamp] - Unix timestamp of the sync event.
1421
+ */
1422
+ interface RoomSyncData {
1423
+ needsSync: boolean;
1424
+ reason?: string;
1425
+ timestamp?: number;
1426
+ }
1427
+ /**
1428
+ * New room request notification data.
1429
+ *
1430
+ * @property {Object} requestingUser - Information about the requesting user.
1431
+ * @property {string} requestingUser.id - User identifier.
1432
+ * @property {string} requestingUser.name - User display name.
1433
+ * @property {string} requestingUser.role - User role.
1434
+ * @property {number} timestamp - Request timestamp.
1435
+ * @property {string} [status] - Current request status.
1436
+ */
1437
+ interface NewRoomRequestData {
1438
+ requestingUser: {
1439
+ id: string;
1440
+ name: string;
1441
+ role: string;
1442
+ };
1443
+ timestamp: number;
1444
+ status?: string;
1445
+ }
1446
+ /**
1447
+ * Options for creating a new room.
1448
+ *
1449
+ * @property {string} language - Preferred language code (e.g., "en", "es").
1450
+ * @property {string} timezone - IANA timezone identifier.
1451
+ * @property {Record<string, unknown>} [affinity] - Agent affinity preferences.
1452
+ * @property {boolean} [disablePersistence] - Disable message persistence.
1453
+ * @property {Record<string, unknown>} [metadata] - Additional room metadata.
1454
+ * @property {ContextualEvent[]} [contextualEvents] - Initial contextual events.
1455
+ * @property {string} [initialMessage] - Initial message to send when room is created.
1456
+ */
1457
+ type CreateRoomOptions = {
1458
+ language: string;
1459
+ timezone: string;
1460
+ affinity?: Record<string, unknown>;
1461
+ disablePersistence?: boolean;
1462
+ metadata?: Record<string, unknown>;
1463
+ contextualEvents?: ContextualEvent[];
1464
+ userGroupId?: string;
1465
+ initialMessage?: string;
1466
+ };
1467
+ /**
1468
+ * Options for the unified quick-start endpoint that combines user registration
1469
+ * and room creation in a single HTTP call.
1470
+ *
1471
+ * @property {Object} user - User registration data.
1472
+ * @property {string} user.externalId - External user identifier.
1473
+ * @property {string} user.secret - User authentication secret.
1474
+ * @property {string} [user.name] - User display name.
1475
+ * @property {string} [user.email] - User email address.
1476
+ * @property {string} [user.phone] - User phone number.
1477
+ * @property {string} [user.avatar] - URL of the user's avatar.
1478
+ * @property {Record<string, unknown>} [user.metadata] - Additional user metadata.
1479
+ * @property {string | null} [user.userGroupId] - User group identifier.
1480
+ * @property {string} [user.sessionId] - External session identifier.
1481
+ * @property {Object} room - Room creation data.
1482
+ * @property {string} room.language - Preferred language code (e.g., "en", "es").
1483
+ * @property {string} room.timezone - IANA timezone identifier.
1484
+ * @property {Record<string, unknown>} [room.affinity] - Agent affinity preferences.
1485
+ * @property {string} [room.name] - Room display name.
1486
+ * @property {string} [room.platformType] - Platform type (default: "web").
1487
+ * @property {Record<string, unknown>} [room.metadata] - Additional room metadata.
1488
+ * @property {string | null} [room.userGroupId] - Room user group identifier.
1489
+ * @property {boolean} [room.disablePersistence] - Disable message persistence.
1490
+ * @property {ContextualEvent[]} [room.contextualEvents] - Initial contextual events.
1491
+ * @property {{ content: string; assets?: unknown[] }} [room.initialMessage] - Initial message to include in the room.
1492
+ */
1493
+ type QuickStartOptions = {
1494
+ user: {
1495
+ externalId: string;
1496
+ secret: string;
1497
+ name?: string;
1498
+ email?: string;
1499
+ phone?: string;
1500
+ avatar?: string;
1501
+ metadata?: Record<string, unknown>;
1502
+ userGroupId?: string | null;
1503
+ sessionId?: string;
1504
+ };
1505
+ room: {
1506
+ language: string;
1507
+ timezone: string;
1508
+ affinity?: Record<string, unknown>;
1509
+ name?: string;
1510
+ platformType?: string;
1511
+ metadata?: Record<string, unknown>;
1512
+ userGroupId?: string | null;
1513
+ disablePersistence?: boolean;
1514
+ contextualEvents?: ContextualEvent[];
1515
+ initialMessage?: {
1516
+ content: string;
1517
+ assets?: unknown[];
1518
+ };
1519
+ };
1520
+ };
1521
+ /**
1522
+ * Options for fetching messages.
1523
+ *
1524
+ * @property {string} [roomId] - Filter by room ID.
1525
+ * @property {number} [limit] - Maximum messages to return.
1526
+ * @property {string} [orderBy] - Field to order by.
1527
+ * @property {"asc" | "desc"} [orderDir] - Sort direction.
1528
+ * @property {string} [groupId] - Filter by group ID.
1529
+ * @property {Object} [affinity] - Agent affinity filters.
1530
+ * @property {string[]} [with] - Related entities to include.
1531
+ * @property {boolean} [impersonate] - Enable impersonation mode.
1532
+ */
1533
+ type GetMessagesOptions = {
1534
+ roomId?: string;
1535
+ limit?: number;
1536
+ orderBy?: string;
1537
+ orderDir?: "asc" | "desc";
1538
+ groupId?: string;
1539
+ affinity?: {
1540
+ agentId?: string;
1541
+ agentType?: string;
1542
+ };
1543
+ with?: string[];
1544
+ impersonate?: boolean;
1545
+ };
1546
+ /**
1547
+ * Options for persisting a message.
1548
+ *
1549
+ * @property {string} [externalId] - External message identifier.
1550
+ * @property {string} roomId - Room to persist message in.
1551
+ * @property {string} content - Message content.
1552
+ * @property {string} [identity] - Sender identity.
1553
+ * @property {number} [kind] - Participant kind.
1554
+ */
1555
+ type PersistMessageOptions = {
1556
+ externalId?: string;
1557
+ roomId: string;
1558
+ content: string;
1559
+ identity?: string;
1560
+ kind?: number;
1561
+ };
1562
+ /**
1563
+ * Options for room evaluation/rating.
1564
+ *
1565
+ * @property {number} rating - Numeric rating value.
1566
+ * @property {string} [comment] - Optional feedback comment.
1567
+ * @property {string} [roomId] - Optional room identifier.
1568
+ */
1569
+ type EvaluateRoomOptions = {
1570
+ rating: number;
1571
+ comment?: string;
1572
+ roomId?: string;
1573
+ };
1574
+ /**
1575
+ * Options for message reporting.
1576
+ *
1577
+ * @property {string} messageId - ID of message to report.
1578
+ */
1579
+ type MessageReportOptions = {
1580
+ messageId: string;
1581
+ };
1582
+ /**
1583
+ * Options for updating message reactions.
1584
+ *
1585
+ * @property {string} messageId - ID of message to update.
1586
+ * @property {string[]} [add] - Reactions to add.
1587
+ * @property {string[]} [remove] - Reactions to remove.
1588
+ */
1589
+ type MessageReactionOptions = {
1590
+ messageId: string;
1591
+ add?: string[];
1592
+ remove?: string[];
1593
+ };
1594
+ /**
1595
+ * Options for fetching room listings.
1596
+ *
1597
+ * @property {number} [limit] - Maximum rooms per page.
1598
+ * @property {number} [page] - Page number (1-indexed).
1599
+ * @property {number} [offset] - Offset for pagination.
1600
+ * @property {"createdAt" | "updatedAt" | "lastMessageAt"} [orderBy] - Sort field.
1601
+ * @property {"asc" | "desc"} [orderDir] - Sort direction.
1602
+ * @property {string[]} [ids] - Filter by specific room IDs.
1603
+ * @property {string[]} [with] - Related entities to include.
1604
+ * @property {string[]} [count] - Fields to count.
1605
+ * @property {string[]} [participantIds] - Filter by participant IDs.
1606
+ * @property {string[]} [participantExternalIds] - Filter by external participant IDs.
1607
+ * @property {string} [groupId] - Filter by group ID.
1608
+ * @property {boolean} [hasMessages] - Filter rooms with messages.
1609
+ * @property {boolean} [latestOnly] - Return only latest room per group.
1610
+ * @property {boolean} [includeUnread] - Include unread message count.
1611
+ * @property {"active" | "closed"} [roomStatus] - Filter by room status.
1612
+ * @property {boolean} [archived] - Include archived rooms.
1613
+ */
1614
+ type GetRoomsOptions = {
1615
+ limit?: number;
1616
+ page?: number;
1617
+ offset?: number;
1618
+ orderBy?: "createdAt" | "updatedAt" | "lastMessageAt";
1619
+ orderDir?: "asc" | "desc";
1620
+ ids?: string[];
1621
+ with?: string[];
1622
+ count?: string[];
1623
+ participantIds?: string[];
1624
+ participantExternalIds?: string[];
1625
+ groupId?: string;
1626
+ hasMessages?: boolean;
1627
+ latestOnly?: boolean;
1628
+ includeUnread?: boolean;
1629
+ roomStatus?: "active" | "closed";
1630
+ archived?: boolean;
1631
+ };
1632
+ /**
1633
+ * Options for requesting a new room (call transfer).
1634
+ *
1635
+ * @property {string} originRoom - Source room ID.
1636
+ * @property {string} language - Preferred language.
1637
+ * @property {string} timezone - User's timezone.
1638
+ * @property {Object} [affinity] - Agent preferences.
1639
+ * @property {string} [name] - Display name.
1640
+ */
1641
+ type RequestNewRoomOptions = {
1642
+ originRoom: string;
1643
+ language: string;
1644
+ timezone: string;
1645
+ affinity?: {
1646
+ agentType?: string;
1647
+ target?: string;
1648
+ };
1649
+ name?: string;
1650
+ userGroupId?: string;
1651
+ };
1652
+ /**
1653
+ * Configuration options for the ConversationService.
1654
+ *
1655
+ * @property {string} organizationId - Organization identifier.
1656
+ * @property {string} apiUrl - Base URL for the conversation API.
1657
+ * @property {string} [authUrl] - Optional separate auth service URL.
1658
+ * @property {string} [channelTopic] - Custom LiveKit chat topic.
1659
+ * @property {string} [transcriptionTopic] - Custom transcription topic.
1660
+ * @property {string} [eventsTopic] - Custom events topic.
1661
+ * @property {"disabled" | "server" | "client"} [messagePersistence] - Message persistence mode.
1662
+ * @property {FirebaseConfig} [firebaseConfig] - Optional Firebase configuration for real-time features.
1663
+ */
1664
+ type ConversationServiceOptions = {
1665
+ organizationId: string;
1666
+ apiUrl: string;
1667
+ authUrl?: string;
1668
+ channelTopic?: string;
1669
+ transcriptionTopic?: string;
1670
+ eventsTopic?: string;
1671
+ messagePersistence?: "disabled" | "server" | "client";
1672
+ firebaseConfig?: FirebaseConfig;
1673
+ };
1674
+ /**
1675
+ * Callback type for message listeners.
1676
+ */
1677
+ type MessageListener<M = ApiMessage> = (messages: M[]) => void;
1678
+ /**
1679
+ * Callback type for typing indicator listeners.
1680
+ */
1681
+ type TypingListener = (indicator: TypingIndicator) => void;
1682
+ /**
1683
+ * Callback type for call request listeners.
1684
+ */
1685
+ type CallRequestListener = (id: string, request: CallRequest) => void;
1686
+
1687
+ /**
1688
+ * Extended Room class with persistent metadata.
1689
+ *
1690
+ * @description Extends LiveKit Room with additional properties for
1691
+ * tracking room lifecycle and metadata.
1692
+ */
1693
+ declare class Room extends Room$1 {
1694
+ /** Unique room identifier */
1695
+ id: string;
1696
+ /** Group identifier for room categorization */
1697
+ groupId: string;
1698
+ /** ISO timestamp of room creation */
1699
+ createdAt: string;
1700
+ /** ISO timestamp when user connected */
1701
+ connectedAt: string;
1702
+ /** Affinity data echoed back from the server */
1703
+ affinity?: Record<string, unknown>;
1704
+ }
1705
+ /**
1706
+ * @summary Unified service for conversation management.
1707
+ *
1708
+ * @description A comprehensive service that combines real-time communication (LiveKit)
1709
+ * with presence and request management (Firebase) for handling conversations.
1710
+ * This service manages room lifecycle, messaging, typing indicators, call requests,
1711
+ * and agent presence in a unified API.
1712
+ *
1713
+ * @example
1714
+ * ```typescript
1715
+ * const service = new ConversationService({
1716
+ * organizationId: 'org-123',
1717
+ * apiUrl: 'https://api.example.com',
1718
+ * firebaseConfig: { ... }
1719
+ * });
1720
+ *
1721
+ * // Register user and create room
1722
+ * await service.registerUser('user-123', 'secret');
1723
+ * const room = await service.createRoom({
1724
+ * language: 'en',
1725
+ * timezone: 'America/New_York'
1726
+ * });
1727
+ *
1728
+ * // Subscribe to messages
1729
+ * service.subscribeMessages((messages) => {
1730
+ * console.log('New messages:', messages);
1731
+ * });
1732
+ * ```
1733
+ */
1734
+ declare class ConversationService {
1735
+ /** Message event listeners */
1736
+ private listeners;
1737
+ /** Typing indicator listeners */
1738
+ private typingListeners;
1739
+ /** Map for deduplicating transcription segments */
1740
+ private transcriptionMap;
1741
+ /** Base API URL */
1742
+ private apiUrl;
1743
+ /** Authentication service URL */
1744
+ private authUrl?;
1745
+ /** Organization identifier */
1746
+ private organizationId;
1747
+ /** LiveKit chat topic */
1748
+ private channelTopic;
1749
+ /** LiveKit transcription topic */
1750
+ private transcriptionTopic;
1751
+ /** LiveKit events topic */
1752
+ private eventsTopic;
1753
+ /** Message persistence mode */
1754
+ private messagePersistence;
1755
+ /** Abort controllers for cancellable requests */
1756
+ private abortControllers;
1757
+ /** Current authentication token */
1758
+ private authToken;
1759
+ /** Firebase API instance (optional) */
1760
+ private firebaseApi?;
1761
+ /** Firebase presence path */
1762
+ private presencePath?;
1763
+ /** Firebase calls path */
1764
+ private callsPath?;
1765
+ /** Active Firebase unsubscribers */
1766
+ private firebaseUnsubscribers;
1767
+ /** Set of seen request IDs for deduplication */
1768
+ private seenRequestIds;
1769
+ /** Map for content-based deduplication */
1770
+ private lastSnapshotById;
1771
+ /** Current LiveKit room instance */
1772
+ room: Room;
1773
+ /**
1774
+ * Initializes a new instance of the ConversationService.
1775
+ *
1776
+ * @param {ConversationServiceOptions} options - Service configuration options.
1777
+ */
1778
+ constructor(options: ConversationServiceOptions);
1779
+ /**
1780
+ * Creates a new LiveKit Room instance with default settings.
1781
+ *
1782
+ * @private
1783
+ * @returns {Room} New Room instance.
1784
+ */
1785
+ private createRoomInstance;
1786
+ /**
1787
+ * Ensures a room instance exists, creating one if necessary.
1788
+ *
1789
+ * @returns {Room} Current or new Room instance.
1790
+ */
1791
+ ensureRoom(): Room;
1792
+ /**
1793
+ * Initializes Firebase services for presence and request management.
1794
+ *
1795
+ * @private
1796
+ * @param {FirebaseConfig} config - Firebase configuration.
1797
+ */
1798
+ private initializeFirebase;
1799
+ /**
1800
+ * Sets up LiveKit room event handlers for messaging and typing.
1801
+ *
1802
+ * @private
1803
+ */
1804
+ private initializeRoomHandlers;
1805
+ /**
1806
+ * Registers a user for conversation access.
1807
+ *
1808
+ * @async
1809
+ * @param {string} externalId - External user identifier.
1810
+ * @param {string} secret - User authentication secret.
1811
+ * @param {Record<string, unknown>} [userData] - Additional user data.
1812
+ * @param {Record<string, unknown>} [metadata] - User metadata.
1813
+ * @returns {Promise<UserApiResponse>} User registration response with token.
1814
+ */
1815
+ registerUser(externalId: string, secret: string, userData?: Record<string, unknown>, metadata?: Record<string, unknown>): Promise<UserApiResponse>;
1816
+ /**
1817
+ * Registers an agent for handling conversations.
1818
+ *
1819
+ * @async
1820
+ * @param {string} externalId - External agent identifier.
1821
+ * @param {AgentData} agentData - Agent profile data.
1822
+ * @returns {Promise<string>} Authentication token.
1823
+ */
1824
+ registerAgent(externalId: string, agentData: AgentData): Promise<string>;
1825
+ /**
1826
+ * Decodes a JWT token payload without verification.
1827
+ *
1828
+ * @private
1829
+ * @param {string} token - JWT token string.
1830
+ * @returns {{ username?: string; sub?: string; iat?: number; exp?: number } | null} Decoded payload or null if invalid.
1831
+ */
1832
+ private decodeJwtPayload;
1833
+ /**
1834
+ * Performs a unified user registration and room creation in a single HTTP call.
1835
+ *
1836
+ * This method combines the `registerUser` and `createRoom` steps into one request,
1837
+ * reducing latency by eliminating the intermediate round-trip and JWT authentication overhead.
1838
+ * It does not require a prior authentication token — only the organization header.
1839
+ *
1840
+ * @async
1841
+ * @param {QuickStartOptions} options - Combined user and room options.
1842
+ * @returns {Promise<Room>} Connected room instance ready for messaging.
1843
+ * @throws {Error} If the quick-start request fails or returns invalid data.
1844
+ */
1845
+ quickStart(options: QuickStartOptions): Promise<Room>;
1846
+ /**
1847
+ * Creates a new conversation room.
1848
+ *
1849
+ * @async
1850
+ * @param {CreateRoomOptions} options - Room creation options.
1851
+ * @param {Record<string, string>} [userData] - User attributes to set.
1852
+ * @returns {Promise<Room>} Connected room instance.
1853
+ */
1854
+ createRoom(options: CreateRoomOptions): Promise<Room>;
1855
+ /**
1856
+ * Joins an existing conversation room.
1857
+ *
1858
+ * @async
1859
+ * @param {string} roomId - Room identifier to join.
1860
+ * @param {string} timezone - User's timezone.
1861
+ * @param {string} language - Preferred language.
1862
+ * @param {Record<string, unknown>} [attributes] - Additional attributes.
1863
+ * @returns {Promise<Room>} Connected room instance.
1864
+ */
1865
+ joinRoom(roomId: string, timezone: string, language: string, attributes?: Record<string, unknown>): Promise<Room>;
1866
+ /**
1867
+ * Sets room metadata from API response.
1868
+ *
1869
+ * @private
1870
+ * @param {RoomApiResponse} response - Room API response.
1871
+ */
1872
+ private setRoomMetadata;
1873
+ /**
1874
+ * Sets up handler for participant attribute changes.
1875
+ *
1876
+ * @private
1877
+ */
1878
+ private setupParticipantAttributesHandler;
1879
+ /**
1880
+ * Evaluates/rates the current room.
1881
+ *
1882
+ * @async
1883
+ * @param {EvaluateRoomOptions} options - Evaluation options.
1884
+ * @returns {Promise<void>}
1885
+ */
1886
+ evaluateRoom(options: EvaluateRoomOptions): Promise<void>;
1887
+ /**
1888
+ * Closes the current room on the server.
1889
+ *
1890
+ * @async
1891
+ * @returns {Promise<void>}
1892
+ */
1893
+ closeRoom(): Promise<void>;
1894
+ /**
1895
+ * Disconnects from the current room.
1896
+ *
1897
+ * @async
1898
+ * @returns {Promise<void>}
1899
+ */
1900
+ disconnect(): Promise<void>;
1901
+ /**
1902
+ * Stops and unpublishes all currently published local tracks.
1903
+ *
1904
+ * @async
1905
+ * @private
1906
+ * @returns {Promise<void>}
1907
+ */
1908
+ private stopAndUnpublishLocalTracks;
1909
+ /**
1910
+ * Closes the room on server and disconnects locally.
1911
+ *
1912
+ * @async
1913
+ * @returns {Promise<void>}
1914
+ */
1915
+ disconnectAndCloseRoom(): Promise<void>;
1916
+ /**
1917
+ * Marks a room as read.
1918
+ *
1919
+ * @async
1920
+ * @param {string} roomId - Room identifier.
1921
+ * @returns {Promise<void>}
1922
+ */
1923
+ readRoom(roomId: string): Promise<void>;
1924
+ /**
1925
+ * Fetches a list of rooms based on options.
1926
+ *
1927
+ * @async
1928
+ * @param {GetRoomsOptions} options - Room listing options.
1929
+ * @returns {Promise<RoomsApiResponse>} Paginated room list.
1930
+ */
1931
+ getRooms(options: GetRoomsOptions): Promise<RoomsApiResponse>;
1932
+ /**
1933
+ * Handles incoming messages from LiveKit.
1934
+ *
1935
+ * @private
1936
+ */
1937
+ private handleIncomingMessage;
1938
+ /**
1939
+ * Emits a message to all subscribed listeners.
1940
+ *
1941
+ * @private
1942
+ * @param {ApiMessage} message - Message to emit.
1943
+ */
1944
+ private emitMessage;
1945
+ /**
1946
+ * Sends a message in the current room.
1947
+ *
1948
+ * @async
1949
+ * @param {string} message - Message content.
1950
+ * @param {Record<string, string>} [attributes] - Message attributes.
1951
+ * @returns {Promise<void>}
1952
+ */
1953
+ sendMessage(message: string, attributes?: Record<string, string>): Promise<void>;
1954
+ /**
1955
+ * Persists a message to the server.
1956
+ *
1957
+ * @async
1958
+ * @param {PersistMessageOptions} options - Persistence options.
1959
+ * @returns {Promise<MessagesApiResponse>}
1960
+ */
1961
+ persistMessage(options: PersistMessageOptions): Promise<MessagesApiResponse>;
1962
+ /**
1963
+ * Fetches messages based on options.
1964
+ *
1965
+ * @async
1966
+ * @param {GetMessagesOptions} options - Message fetching options.
1967
+ * @returns {Promise<ApiMessage[]>} Array of messages.
1968
+ */
1969
+ getMessages(options: GetMessagesOptions): Promise<ApiMessage[]>;
1970
+ /**
1971
+ * Reports a message for moderation.
1972
+ *
1973
+ * @async
1974
+ * @param {MessageReportOptions} options - Report options.
1975
+ * @returns {Promise<void>}
1976
+ */
1977
+ sendMessageReport(options: MessageReportOptions): Promise<void>;
1978
+ /**
1979
+ * Deletes a message report.
1980
+ *
1981
+ * @async
1982
+ * @param {MessageReportOptions} options - Report options.
1983
+ * @returns {Promise<void>}
1984
+ */
1985
+ deleteMessageReport(options: MessageReportOptions): Promise<void>;
1986
+ /**
1987
+ * Updates reactions on a message.
1988
+ *
1989
+ * @async
1990
+ * @param {MessageReactionOptions} options - Reaction options.
1991
+ * @returns {Promise<void>}
1992
+ */
1993
+ updateMessageReactions(options: MessageReactionOptions): Promise<void>;
1994
+ /**
1995
+ * Subscribes to incoming messages.
1996
+ *
1997
+ * @param {MessageListener<M>} callback - Message listener callback.
1998
+ * @returns {() => void} Unsubscribe function.
1999
+ */
2000
+ subscribeMessages<M extends ApiMessage = ApiMessage>(callback: MessageListener<M>): () => void;
2001
+ /**
2002
+ * Handles data received events for typing indicators.
2003
+ *
2004
+ * @private
2005
+ */
2006
+ private handleDataReceived;
2007
+ /**
2008
+ * Emits a typing indicator to all listeners.
2009
+ *
2010
+ * @private
2011
+ * @param {TypingIndicator} indicator - Typing indicator data.
2012
+ */
2013
+ private emitTypingIndicator;
2014
+ /**
2015
+ * Sends a typing indicator to other participants.
2016
+ *
2017
+ * @async
2018
+ * @param {boolean} isTyping - Whether the user is currently typing.
2019
+ * @returns {Promise<void>}
2020
+ */
2021
+ sendTypingIndicator(isTyping: boolean): Promise<void>;
2022
+ /**
2023
+ * Subscribes to typing indicators from other participants.
2024
+ *
2025
+ * @param {TypingListener} listener - Typing indicator listener.
2026
+ * @returns {() => void} Unsubscribe function.
2027
+ */
2028
+ subscribeTypingIndicators(listener: TypingListener): () => void;
2029
+ /**
2030
+ * Unsubscribes a typing indicator listener.
2031
+ *
2032
+ * @param {TypingListener} listener - Listener to remove.
2033
+ */
2034
+ unsubscribeTypingIndicators(listener: TypingListener): void;
2035
+ /**
2036
+ * Sends a contextual event to the room.
2037
+ *
2038
+ * @async
2039
+ * @param {ContextualEvent} event - Event to send.
2040
+ * @returns {Promise<void>}
2041
+ */
2042
+ sendContextualEvent(event: ContextualEvent): Promise<void>;
2043
+ /**
2044
+ * Requests a new room (call transfer).
2045
+ *
2046
+ * @async
2047
+ * @param {RequestNewRoomOptions} options - Request options.
2048
+ * @returns {Promise<RoomApiResponse>} New room details.
2049
+ */
2050
+ requestNewRoom(options: RequestNewRoomOptions): Promise<RoomApiResponse>;
2051
+ /**
2052
+ * Confirms an active room request.
2053
+ *
2054
+ * @async
2055
+ * @param {string} roomId - Room identifier.
2056
+ * @returns {Promise<{ success: boolean; message: string; roomId: string }>}
2057
+ */
2058
+ confirmRoomRequest(roomId: string): Promise<{
2059
+ success: boolean;
2060
+ message: string;
2061
+ roomId: string;
2062
+ }>;
2063
+ /**
2064
+ * Cancels an active room request.
2065
+ *
2066
+ * @async
2067
+ * @param {string} roomId - Room identifier.
2068
+ * @returns {Promise<{ success: boolean; message: string; roomId: string }>}
2069
+ */
2070
+ cancelRoomRequest(roomId: string): Promise<{
2071
+ success: boolean;
2072
+ message: string;
2073
+ roomId: string;
2074
+ }>;
2075
+ /**
2076
+ * Finishes an active call.
2077
+ *
2078
+ * @async
2079
+ * @returns {Promise<void>}
2080
+ */
2081
+ finishCall(): Promise<void>;
2082
+ /**
2083
+ * Checks if Firebase is initialized.
2084
+ *
2085
+ * @returns {boolean} True if Firebase features are available.
2086
+ */
2087
+ isFirebaseEnabled(): boolean;
2088
+ /**
2089
+ * Gets Firebase API and paths, throwing if not initialized.
2090
+ *
2091
+ * @private
2092
+ * @throws {Error} If Firebase is not initialized.
2093
+ * @returns {{ api: FirebaseApi; presencePath: string; callsPath: string }}
2094
+ */
2095
+ private getFirebase;
2096
+ /**
2097
+ * Gets the presence path for an agent.
2098
+ *
2099
+ * @private
2100
+ * @param {string} agentId - Agent identifier.
2101
+ * @returns {string} Firebase path.
2102
+ */
2103
+ private buildAgentPresencePath;
2104
+ /**
2105
+ * Subscribes to presence changes for all agents.
2106
+ *
2107
+ * @param {(agentId: string, data: object | null) => void} callback - Change handler.
2108
+ * @returns {() => void} Unsubscribe function.
2109
+ */
2110
+ onPresenceChange(callback: (agentId: string, data: object | null) => void): () => void;
2111
+ /**
2112
+ * Subscribes to presence changes for a specific agent.
2113
+ *
2114
+ * @param {string} agentId - Agent identifier.
2115
+ * @param {(agentId: string, data: object | null) => void} callback - Change handler.
2116
+ * @returns {() => void} Unsubscribe function.
2117
+ */
2118
+ onPresenceAgentChange(agentId: string, callback: (agentId: string, data: object | null) => void): () => void;
2119
+ /**
2120
+ * Creates a new call request via API.
2121
+ *
2122
+ * @async
2123
+ * @param {Omit<CallRequest, "status" | "createdAt">} requestData - Request data.
2124
+ * @returns {Promise<string>} Request identifier.
2125
+ */
2126
+ createCallRequest(requestData: Omit<CallRequest, "status" | "createdAt" | "id">): Promise<string>;
2127
+ /**
2128
+ * Subscribes to new call requests.
2129
+ *
2130
+ * @param {CallRequestListener} callback - Request handler.
2131
+ * @returns {() => void} Unsubscribe function.
2132
+ */
2133
+ onNewCallRequest(callback: CallRequestListener): () => void;
2134
+ /**
2135
+ * Subscribes to call request changes.
2136
+ *
2137
+ * @param {CallRequestListener} callback - Change handler.
2138
+ * @returns {() => void} Unsubscribe function.
2139
+ */
2140
+ onCallRequestChange(callback: CallRequestListener): () => void;
2141
+ /**
2142
+ * Subscribes to call request removals.
2143
+ *
2144
+ * @param {(id: string) => void} callback - Removal handler.
2145
+ * @returns {() => void} Unsubscribe function.
2146
+ */
2147
+ onCallRequestRemoved(callback: (id: string) => void): () => void;
2148
+ /**
2149
+ * Accepts a call request.
2150
+ *
2151
+ * @async
2152
+ * @param {string} requestId - Request identifier.
2153
+ * @returns {Promise<void>}
2154
+ */
2155
+ acceptCallRequest(requestId: string): Promise<void>;
2156
+ /**
2157
+ * Cancels a call request via API.
2158
+ *
2159
+ * @async
2160
+ * @param {string} requestId - Request identifier.
2161
+ * @returns {Promise<void>}
2162
+ */
2163
+ cancelCallRequest(requestId: string): Promise<void>;
2164
+ /**
2165
+ * Cancels onDisconnect behavior for a request.
2166
+ *
2167
+ * @async
2168
+ * @param {string} requestId - Request identifier.
2169
+ * @returns {Promise<void>}
2170
+ */
2171
+ cancelOnDisconnect(requestId: string): Promise<void>;
2172
+ /**
2173
+ * Subscribes to pending call requests with deduplication.
2174
+ *
2175
+ * @param {CallRequestListener} callback - Request handler.
2176
+ * @param {{ resetSeen?: boolean }} [options] - Subscription options.
2177
+ * @returns {() => void} Unsubscribe function.
2178
+ */
2179
+ subscribePendingRequests(callback: CallRequestListener, options?: {
2180
+ resetSeen?: boolean;
2181
+ }): () => void;
2182
+ /**
2183
+ * Subscribes to request changes with content deduplication.
2184
+ *
2185
+ * @param {CallRequestListener} callback - Change handler.
2186
+ * @returns {() => void} Unsubscribe function.
2187
+ */
2188
+ subscribeRequestChanges(callback: CallRequestListener): () => void;
2189
+ /**
2190
+ * Attempts to safely accept a request if still pending.
2191
+ *
2192
+ * @async
2193
+ * @param {string} requestId - Request identifier.
2194
+ * @returns {Promise<boolean>} True if successfully accepted.
2195
+ */
2196
+ tryAcceptRequest(requestId: string): Promise<boolean>;
2197
+ /**
2198
+ * Subscribes to room sync notifications.
2199
+ *
2200
+ * @param {string} roomId - Room identifier.
2201
+ * @param {(data: RoomSyncData | null) => void} callback - Sync handler.
2202
+ * @returns {() => void} Unsubscribe function.
2203
+ */
2204
+ onRoomSync(roomId: string, callback: (data: RoomSyncData | null) => void): () => void;
2205
+ /**
2206
+ * Clears the sync flag for a room.
2207
+ *
2208
+ * @async
2209
+ * @param {string} roomId - Room identifier.
2210
+ * @param {string} [reason] - Reason for clearing.
2211
+ * @returns {Promise<void>}
2212
+ */
2213
+ clearRoomSync(roomId: string, reason?: string): Promise<void>;
2214
+ /**
2215
+ * Subscribes to new room request notifications.
2216
+ *
2217
+ * @param {string} roomId - Origin room identifier.
2218
+ * @param {(data: NewRoomRequestData | null) => void} callback - Request handler.
2219
+ * @returns {() => void} Unsubscribe function.
2220
+ */
2221
+ onNewRoomRequest(roomId: string, callback: (data: NewRoomRequestData | null) => void): () => void;
2222
+ /**
2223
+ * Removes all Firebase listeners.
2224
+ */
2225
+ unsubscribeAllFirebase(): void;
2226
+ /**
2227
+ * Cleans up all resources and connections.
2228
+ *
2229
+ * @async
2230
+ * @returns {Promise<void>}
2231
+ */
2232
+ destroy(): Promise<void>;
2233
+ }
2234
+
2235
+ /**
2236
+ * @file Mock LiveKit Track implementations.
2237
+ *
2238
+ * @description Provides mock implementations of LiveKit Track and TrackPublication
2239
+ * classes for testing audio/video functionality without real media streams.
2240
+ */
2241
+
2242
+ /**
2243
+ * Mock track that can attach to HTML media elements.
2244
+ *
2245
+ * @description Simulates LiveKit's Track class with support for synthetic media streams.
2246
+ * Tracks can be attached to DOM elements for visual testing.
2247
+ *
2248
+ * @example
2249
+ * ```typescript
2250
+ * const track = new MockTrack("video", "camera", mediaStreamTrack);
2251
+ * const videoElement = track.attach();
2252
+ * document.body.appendChild(videoElement);
2253
+ * ```
2254
+ */
2255
+ declare class MockTrack {
2256
+ /** Track kind (audio, video, data) */
2257
+ kind: MockTrackKind;
2258
+ /** Track source (camera, microphone, screen_share, etc.) */
2259
+ source: string;
2260
+ /** Track SID */
2261
+ sid: string;
2262
+ /** Whether track is muted */
2263
+ muted: boolean;
2264
+ /** Whether track is enabled */
2265
+ enabled: boolean;
2266
+ /** Attached elements */
2267
+ private attachedElements;
2268
+ /** MediaStream track if using synthetic media */
2269
+ private mediaStreamTrack?;
2270
+ /** Cleanup function for synthetic media */
2271
+ private mediaCleanup?;
2272
+ /**
2273
+ * Creates a new MockTrack.
2274
+ *
2275
+ * @param kind - Track kind (audio, video, data).
2276
+ * @param source - Track source identifier.
2277
+ * @param mediaStreamTrack - Optional real MediaStreamTrack for synthetic media.
2278
+ * @param mediaCleanup - Optional cleanup function for synthetic media.
2279
+ */
2280
+ constructor(kind: MockTrackKind, source: string, mediaStreamTrack?: MediaStreamTrack, mediaCleanup?: () => void);
2281
+ /**
2282
+ * Gets the underlying MediaStreamTrack if available.
2283
+ */
2284
+ get mediaTrack(): MediaStreamTrack | undefined;
2285
+ /**
2286
+ * Attaches the track to an HTML element.
2287
+ *
2288
+ * @param element - Optional element to attach to. Creates one if not provided.
2289
+ * @returns The attached HTML media element.
2290
+ */
2291
+ attach(element?: HTMLMediaElement): HTMLMediaElement;
2292
+ /**
2293
+ * Detaches the track from an element or all elements.
2294
+ *
2295
+ * @param element - Optional specific element to detach from.
2296
+ * @returns Array of detached elements.
2297
+ */
2298
+ detach(element?: HTMLMediaElement): HTMLMediaElement[];
2299
+ /**
2300
+ * Stops the track and releases resources.
2301
+ */
2302
+ stop(): void;
2303
+ /**
2304
+ * Sets track mute state.
2305
+ *
2306
+ * @param muted - Whether the track should be muted.
2307
+ */
2308
+ setMuted(muted: boolean): void;
2309
+ /**
2310
+ * Sets track enabled state.
2311
+ *
2312
+ * @param enabled - Whether the track should be enabled.
2313
+ */
2314
+ setEnabled(enabled: boolean): void;
2315
+ }
2316
+ /**
2317
+ * Mock track publication that wraps a track.
2318
+ *
2319
+ * @description Simulates LiveKit's TrackPublication class which represents
2320
+ * a published track in a room.
2321
+ *
2322
+ * @example
2323
+ * ```typescript
2324
+ * const track = new MockTrack("video", "camera");
2325
+ * const publication = new MockTrackPublication(track);
2326
+ * publication.setSubscribed(true);
2327
+ * ```
2328
+ */
2329
+ declare class MockTrackPublication {
2330
+ /** Track SID */
2331
+ trackSid: string;
2332
+ /** Track name */
2333
+ trackName: string;
2334
+ /** Track source */
2335
+ source: string;
2336
+ /** Track kind */
2337
+ kind: MockTrackKind;
2338
+ /** Whether subscribed to this track */
2339
+ subscribed: boolean;
2340
+ /** Whether the publication is enabled */
2341
+ isEnabled: boolean;
2342
+ /** The track itself (may be undefined if not subscribed) */
2343
+ track: MockTrack | null;
2344
+ /**
2345
+ * Gets whether the track is muted.
2346
+ */
2347
+ get isMuted(): boolean;
2348
+ /**
2349
+ * Gets whether the track is subscribed.
2350
+ */
2351
+ get isSubscribed(): boolean;
2352
+ /**
2353
+ * Creates a new MockTrackPublication.
2354
+ *
2355
+ * @param track - The track to wrap.
2356
+ * @param name - Optional publication name.
2357
+ */
2358
+ constructor(track: MockTrack, name?: string);
2359
+ /**
2360
+ * Sets subscription state.
2361
+ *
2362
+ * @param subscribed - Whether to subscribe to the track.
2363
+ */
2364
+ setSubscribed(subscribed: boolean): void;
2365
+ /**
2366
+ * Sets track enabled state.
2367
+ *
2368
+ * @param enabled - Whether the track should be enabled.
2369
+ */
2370
+ setEnabled(enabled: boolean): void;
2371
+ /**
2372
+ * Mutes or unmutes the track.
2373
+ *
2374
+ * @param muted - Whether the track should be muted.
2375
+ */
2376
+ setMuted(muted: boolean): void;
2377
+ }
2378
+
2379
+ /**
2380
+ * @file Mock LiveKit LocalParticipant implementation.
2381
+ *
2382
+ * @description Provides a mock implementation of LiveKit's LocalParticipant class
2383
+ * with full track management for camera, microphone, and screen sharing.
2384
+ */
2385
+
2386
+ /**
2387
+ * Room interface to avoid circular dependency with MockRoom.
2388
+ */
2389
+ interface RoomLike {
2390
+ /** Emit an event on the room */
2391
+ emit: (event: string, ...args: unknown[]) => void;
2392
+ }
2393
+ /**
2394
+ * Options for publishing a track.
2395
+ */
2396
+ interface MockPublishOptions {
2397
+ /** Track name */
2398
+ name?: string;
2399
+ /** Video encoding settings */
2400
+ videoEncoding?: {
2401
+ maxBitrate?: number;
2402
+ maxFramerate?: number;
2403
+ };
2404
+ /** Audio encoding settings */
2405
+ audioEncoding?: {
2406
+ maxBitrate?: number;
2407
+ };
2408
+ /** Whether to simulcast video */
2409
+ simulcast?: boolean;
2410
+ /** Track source override */
2411
+ source?: string;
2412
+ }
2413
+ /**
2414
+ * Mock local participant with full track management support.
2415
+ *
2416
+ * @description Represents the local user in a LiveKit room. Handles publishing
2417
+ * and unpublishing of local media tracks (camera, microphone, screen share).
2418
+ *
2419
+ * @example
2420
+ * ```typescript
2421
+ * const localParticipant = room.localParticipant;
2422
+ * await localParticipant.setCameraEnabled(true);
2423
+ * await localParticipant.setMicrophoneEnabled(true);
2424
+ * console.log(localParticipant.isCameraEnabled); // true
2425
+ * ```
2426
+ */
2427
+ declare class MockLocalParticipant {
2428
+ /** Participant identity */
2429
+ identity: string;
2430
+ /** Server-assigned SID */
2431
+ sid: string;
2432
+ /** Display name */
2433
+ name: string;
2434
+ /** Custom attributes */
2435
+ attributes: Record<string, string>;
2436
+ /** Participant kind */
2437
+ kind: string;
2438
+ /** When the participant joined */
2439
+ joinedAt?: Date;
2440
+ /** Track publications by source */
2441
+ private trackPublications;
2442
+ /** Audio track publications by SID */
2443
+ audioTrackPublications: Map<string, MockTrackPublication>;
2444
+ /** Video track publications by SID */
2445
+ videoTrackPublications: Map<string, MockTrackPublication>;
2446
+ /** Camera enabled state */
2447
+ private _cameraEnabled;
2448
+ /** Microphone enabled state */
2449
+ private _microphoneEnabled;
2450
+ /** Screen share enabled state */
2451
+ private _screenShareEnabled;
2452
+ /** Reference to the parent room */
2453
+ private room;
2454
+ /**
2455
+ * Creates a new MockLocalParticipant.
2456
+ *
2457
+ * @param room - The parent room instance.
2458
+ */
2459
+ constructor(room: RoomLike);
2460
+ /**
2461
+ * Gets whether camera is enabled.
2462
+ */
2463
+ get isCameraEnabled(): boolean;
2464
+ /**
2465
+ * Gets whether microphone is enabled.
2466
+ */
2467
+ get isMicrophoneEnabled(): boolean;
2468
+ /**
2469
+ * Gets whether screen share is enabled.
2470
+ */
2471
+ get isScreenShareEnabled(): boolean;
2472
+ /**
2473
+ * Gets all track publications.
2474
+ *
2475
+ * @returns Array of all track publications.
2476
+ */
2477
+ getTrackPublications(): MockTrackPublication[];
2478
+ /**
2479
+ * Gets a track publication by source.
2480
+ *
2481
+ * @param source - Track source (camera, microphone, screen_share).
2482
+ * @returns The track publication or undefined.
2483
+ */
2484
+ getTrackPublication(source: string): MockTrackPublication | undefined;
2485
+ /**
2486
+ * Gets a track publication by SID.
2487
+ *
2488
+ * @param trackSid - Track SID.
2489
+ * @returns The track publication or undefined.
2490
+ */
2491
+ getTrackPublicationBySid(trackSid: string): MockTrackPublication | undefined;
2492
+ /**
2493
+ * Sets participant attributes.
2494
+ *
2495
+ * @param attributes - Attributes to merge.
2496
+ */
2497
+ setAttributes(attributes: Record<string, string>): void;
2498
+ /**
2499
+ * Enables or disables camera.
2500
+ *
2501
+ * @param enabled - Whether to enable camera.
2502
+ * @param options - Optional publish options.
2503
+ * @returns The track publication or undefined.
2504
+ */
2505
+ setCameraEnabled(enabled: boolean, options?: MockPublishOptions): Promise<MockTrackPublication | undefined>;
2506
+ /**
2507
+ * Enables or disables microphone.
2508
+ *
2509
+ * @param enabled - Whether to enable microphone.
2510
+ * @param options - Optional publish options.
2511
+ * @returns The track publication or undefined.
2512
+ */
2513
+ setMicrophoneEnabled(enabled: boolean, options?: MockPublishOptions): Promise<MockTrackPublication | undefined>;
2514
+ /**
2515
+ * Enables or disables screen sharing.
2516
+ *
2517
+ * @param enabled - Whether to enable screen share.
2518
+ * @param options - Optional publish options.
2519
+ * @returns The track publication or undefined.
2520
+ */
2521
+ setScreenShareEnabled(enabled: boolean, options?: MockPublishOptions): Promise<MockTrackPublication | undefined>;
2522
+ /**
2523
+ * Publishes a custom track.
2524
+ *
2525
+ * @param track - The track to publish.
2526
+ * @param options - Publish options.
2527
+ * @returns The track publication.
2528
+ */
2529
+ publishTrack(track: MockTrack, options?: MockPublishOptions): Promise<MockTrackPublication>;
2530
+ /**
2531
+ * Unpublishes a track.
2532
+ *
2533
+ * @param track - The track to unpublish.
2534
+ */
2535
+ unpublishTrack(track: MockTrack): Promise<void>;
2536
+ /**
2537
+ * Sends text message via data channel.
2538
+ *
2539
+ * @param message - Message content.
2540
+ * @param options - Send options.
2541
+ * @returns Object with message ID.
2542
+ */
2543
+ sendText(_message: string, _options?: {
2544
+ topic?: string;
2545
+ attributes?: Record<string, string>;
2546
+ }): Promise<{
2547
+ id: string;
2548
+ }>;
2549
+ /**
2550
+ * Publishes data to the room.
2551
+ *
2552
+ * @param data - Data to publish.
2553
+ * @param options - Publish options.
2554
+ */
2555
+ publishData(_data: Uint8Array, _options?: {
2556
+ reliable?: boolean;
2557
+ topic?: string;
2558
+ destinationIdentities?: string[];
2559
+ }): Promise<void>;
2560
+ /**
2561
+ * Sets metadata on the participant.
2562
+ *
2563
+ * @param metadata - Metadata string.
2564
+ */
2565
+ setMetadata(metadata: string): Promise<void>;
2566
+ /**
2567
+ * Sets the participant name.
2568
+ *
2569
+ * @param name - Display name.
2570
+ */
2571
+ setName(name: string): Promise<void>;
2572
+ /**
2573
+ * Cleans up all tracks.
2574
+ */
2575
+ cleanup(): void;
2576
+ }
2577
+
2578
+ /**
2579
+ * @file Mock LiveKit Participant implementations.
2580
+ *
2581
+ * @description Provides mock implementations of LiveKit Participant classes
2582
+ * for simulating remote participants in a room.
2583
+ */
2584
+
2585
+ /**
2586
+ * Participant connection quality.
2587
+ */
2588
+ type MockConnectionQuality = "excellent" | "good" | "poor" | "lost" | "unknown";
2589
+ /**
2590
+ * Participant kind string type (for configuration).
2591
+ */
2592
+ type MockParticipantKind = "standard" | "ingress" | "egress" | "sip" | "agent";
2593
+ /**
2594
+ * Participant kind enum matching LiveKit's ParticipantKind values.
2595
+ * These numeric values must match livekit-protocol's ParticipantInfo_Kind enum.
2596
+ */
2597
+ declare enum ParticipantKindValue {
2598
+ STANDARD = 0,
2599
+ INGRESS = 1,
2600
+ EGRESS = 2,
2601
+ SIP = 3,
2602
+ AGENT = 4
2603
+ }
2604
+ /**
2605
+ * Mock participant representing a remote user in the room.
2606
+ *
2607
+ * @description Simulates a LiveKit RemoteParticipant with track publications
2608
+ * and attribute management.
2609
+ *
2610
+ * @example
2611
+ * ```typescript
2612
+ * const participant = new MockParticipant("user_123", "John Doe");
2613
+ * participant.addTrackPublication(videoPublication);
2614
+ * console.log(participant.getTrackPublications());
2615
+ * ```
2616
+ */
2617
+ declare class MockParticipant {
2618
+ /** Participant identity (unique in room) */
2619
+ identity: string;
2620
+ /** Server-assigned SID */
2621
+ sid: string;
2622
+ /** Display name */
2623
+ name?: string;
2624
+ /** Custom attributes */
2625
+ attributes: Record<string, string>;
2626
+ /**
2627
+ * Participant kind as numeric value.
2628
+ * This matches LiveKit's ParticipantKind enum values.
2629
+ */
2630
+ kind: ParticipantKindValue;
2631
+ /** String representation of kind for convenience */
2632
+ private _kindString;
2633
+ /** Connection quality */
2634
+ connectionQuality: MockConnectionQuality;
2635
+ /** Whether participant is speaking */
2636
+ isSpeaking: boolean;
2637
+ /** Audio level (0-1) */
2638
+ audioLevel: number;
2639
+ /** When the participant joined */
2640
+ joinedAt?: Date;
2641
+ /** Track publications */
2642
+ private trackPublications;
2643
+ /**
2644
+ * Creates a new MockParticipant.
2645
+ *
2646
+ * @param identity - Unique participant identity.
2647
+ * @param name - Optional display name.
2648
+ * @param attributes - Optional custom attributes.
2649
+ * @param kind - Participant kind (default: "standard").
2650
+ */
2651
+ constructor(identity: string, name?: string, attributes?: Record<string, string>, kind?: MockParticipantKind);
2652
+ /**
2653
+ * Checks if this is an agent participant.
2654
+ */
2655
+ get isAgent(): boolean;
2656
+ /**
2657
+ * Gets the string representation of kind.
2658
+ */
2659
+ get kindString(): MockParticipantKind;
2660
+ /**
2661
+ * Checks if camera is enabled (has an unmuted camera track).
2662
+ */
2663
+ get isCameraEnabled(): boolean;
2664
+ /**
2665
+ * Checks if microphone is enabled (has an unmuted microphone track).
2666
+ */
2667
+ get isMicrophoneEnabled(): boolean;
2668
+ /**
2669
+ * Gets a track publication by source.
2670
+ *
2671
+ * @param source - Track source (camera, microphone, etc.).
2672
+ * @returns The track publication or undefined.
2673
+ */
2674
+ getTrackPublication(source: string): MockTrackPublication | undefined;
2675
+ /**
2676
+ * Gets a track publication by SID.
2677
+ *
2678
+ * @param trackSid - Track SID.
2679
+ * @returns The track publication or undefined.
2680
+ */
2681
+ getTrackPublicationBySid(trackSid: string): MockTrackPublication | undefined;
2682
+ /**
2683
+ * Gets all track publications.
2684
+ *
2685
+ * @returns Array of all track publications.
2686
+ */
2687
+ getTrackPublications(): MockTrackPublication[];
2688
+ /**
2689
+ * Gets only audio track publications.
2690
+ */
2691
+ getAudioTracks(): MockTrackPublication[];
2692
+ /**
2693
+ * Gets only video track publications.
2694
+ */
2695
+ getVideoTracks(): MockTrackPublication[];
2696
+ /**
2697
+ * Adds a track publication.
2698
+ *
2699
+ * @param pub - Track publication to add.
2700
+ */
2701
+ addTrackPublication(pub: MockTrackPublication): void;
2702
+ /**
2703
+ * Removes a track publication.
2704
+ *
2705
+ * @param trackSid - Track SID to remove.
2706
+ * @returns The removed publication or undefined.
2707
+ */
2708
+ removeTrackPublication(trackSid: string): MockTrackPublication | undefined;
2709
+ /**
2710
+ * Updates participant attributes.
2711
+ *
2712
+ * @param attributes - Attributes to merge.
2713
+ */
2714
+ setAttributes(attributes: Record<string, string>): void;
2715
+ /**
2716
+ * Gets a specific attribute.
2717
+ *
2718
+ * @param key - Attribute key.
2719
+ * @returns The attribute value or undefined.
2720
+ */
2721
+ getAttribute(key: string): string | undefined;
2722
+ /**
2723
+ * Simulates the participant starting to speak.
2724
+ *
2725
+ * @param audioLevel - Audio level (0-1).
2726
+ */
2727
+ startSpeaking(audioLevel?: number): void;
2728
+ /**
2729
+ * Simulates the participant stopping speaking.
2730
+ */
2731
+ stopSpeaking(): void;
2732
+ /**
2733
+ * Sets connection quality.
2734
+ *
2735
+ * @param quality - Connection quality.
2736
+ */
2737
+ setConnectionQuality(quality: MockConnectionQuality): void;
2738
+ /**
2739
+ * Cleans up all tracks.
2740
+ */
2741
+ cleanup(): void;
2742
+ }
2743
+
2744
+ /**
2745
+ * @file Mock LiveKit data streams.
2746
+ *
2747
+ * @description Provides mock implementations for LiveKit's text and data streaming
2748
+ * capabilities used for real-time message delivery.
2749
+ */
2750
+ /**
2751
+ * Text stream info.
2752
+ */
2753
+ interface MockTextStreamInfo {
2754
+ /** Stream ID */
2755
+ id: string;
2756
+ /** Stream topic */
2757
+ topic?: string;
2758
+ /** Stream attributes */
2759
+ attributes?: Record<string, string>;
2760
+ /** Timestamp */
2761
+ timestamp?: number;
2762
+ /** Total size if known */
2763
+ totalSize?: number;
2764
+ }
2765
+ /**
2766
+ * Mock text stream reader for simulating message streams.
2767
+ *
2768
+ * @description Simulates LiveKit's TextStreamReader for receiving streamed text content.
2769
+ * Supports async iteration for consuming stream chunks.
2770
+ *
2771
+ * @example
2772
+ * ```typescript
2773
+ * const reader = new MockTextStreamReader("msg_1", "agent", "Hello, world!");
2774
+ * for await (const chunk of reader) {
2775
+ * console.log(chunk); // "Hello, world!"
2776
+ * }
2777
+ * ```
2778
+ */
2779
+ declare class MockTextStreamReader {
2780
+ /** Stream info */
2781
+ info: MockTextStreamInfo;
2782
+ /** Sender participant identity */
2783
+ participantIdentity: string;
2784
+ /** Stream topic */
2785
+ topic?: string;
2786
+ /** Content chunks */
2787
+ private chunks;
2788
+ /** Current read index */
2789
+ private index;
2790
+ /** Whether stream is complete */
2791
+ private _complete;
2792
+ /**
2793
+ * Creates a new MockTextStreamReader.
2794
+ *
2795
+ * @param id - Stream ID.
2796
+ * @param participantIdentity - Sender identity.
2797
+ * @param content - Full content or array of chunks.
2798
+ * @param attributes - Optional stream attributes.
2799
+ * @param topic - Optional stream topic.
2800
+ */
2801
+ constructor(id: string, participantIdentity: string, content: string | string[], attributes?: Record<string, string>, topic?: string);
2802
+ /**
2803
+ * Gets whether the stream is complete.
2804
+ */
2805
+ get isComplete(): boolean;
2806
+ /**
2807
+ * Async iterator for stream chunks.
2808
+ */
2809
+ [Symbol.asyncIterator](): AsyncIterableIterator<string>;
2810
+ /**
2811
+ * Reads the next chunk.
2812
+ *
2813
+ * @returns The next chunk or null if complete.
2814
+ */
2815
+ read(): Promise<string | null>;
2816
+ /**
2817
+ * Reads all remaining content.
2818
+ *
2819
+ * @returns The complete remaining content.
2820
+ */
2821
+ readAll(): Promise<string>;
2822
+ /**
2823
+ * Cancels the stream.
2824
+ */
2825
+ cancel(): void;
2826
+ }
2827
+
2828
+ /**
2829
+ * @file Mock LiveKit Room implementation.
2830
+ *
2831
+ * @description Provides a mock implementation of LiveKit's Room class that simulates
2832
+ * room connections, events, and participant management without real infrastructure.
2833
+ */
2834
+
2835
+ /**
2836
+ * Room connection state.
2837
+ */
2838
+ type MockConnectionState = "disconnected" | "connecting" | "connected" | "reconnecting";
2839
+ /**
2840
+ * RPC method handler type.
2841
+ */
2842
+ type MockRpcHandler = (data: {
2843
+ callerIdentity: string;
2844
+ payload: string;
2845
+ responseTimeout: number;
2846
+ }) => Promise<string> | string;
2847
+ /**
2848
+ * Text stream handler type.
2849
+ */
2850
+ type MockTextStreamHandler = (reader: MockTextStreamReader, participant: {
2851
+ identity: string;
2852
+ }) => void;
2853
+ /**
2854
+ * Event handler type.
2855
+ */
2856
+ type MockEventHandler = (...args: unknown[]) => void;
2857
+ /**
2858
+ * Options for simulating participant join.
2859
+ */
2860
+ interface SimulateParticipantOptions {
2861
+ /** Participant display name */
2862
+ name?: string;
2863
+ /** Participant kind */
2864
+ kind?: MockParticipantKind;
2865
+ /** Custom attributes */
2866
+ attributes?: Record<string, string>;
2867
+ /** Whether to add camera track */
2868
+ withCamera?: boolean;
2869
+ /** Whether to add microphone track */
2870
+ withMicrophone?: boolean;
2871
+ }
2872
+ /**
2873
+ * Mock Room class that mimics LiveKit's Room behavior.
2874
+ *
2875
+ * @description Simulates a LiveKit room with connection management, participant tracking,
2876
+ * event emission, and RPC/stream handling. Core component for testing real-time features.
2877
+ *
2878
+ * @example
2879
+ * ```typescript
2880
+ * const room = new MockRoom(mockService);
2881
+ * await room.connect("wss://mock.local", "token");
2882
+ *
2883
+ * room.on("ParticipantConnected", (participant) => {
2884
+ * console.log(`${participant.name} joined`);
2885
+ * });
2886
+ *
2887
+ * await room.simulateAgentJoin("agent_1", "AI Assistant");
2888
+ * ```
2889
+ */
2890
+ declare class MockRoom {
2891
+ /** Room ID */
2892
+ id: string;
2893
+ /** Server-assigned SID */
2894
+ sid: string;
2895
+ /** Room group ID */
2896
+ groupId: string;
2897
+ /** Room name */
2898
+ name: string;
2899
+ /** Creation timestamp */
2900
+ createdAt: string;
2901
+ /** Connection timestamp */
2902
+ connectedAt: string;
2903
+ /** Room metadata */
2904
+ metadata?: string;
2905
+ /** Local participant reference */
2906
+ localParticipant: MockLocalParticipant;
2907
+ /** Remote participants by identity */
2908
+ remoteParticipants: Map<string, MockParticipant>;
2909
+ /** Connection state */
2910
+ private _state;
2911
+ /** Event handlers by event name */
2912
+ private eventHandlers;
2913
+ /** Text stream handlers by topic */
2914
+ private textStreamHandlers;
2915
+ /** RPC method handlers */
2916
+ private rpcHandlers;
2917
+ /** Reference to parent service for simulation */
2918
+ private mockService;
2919
+ /**
2920
+ * Creates a new MockRoom.
2921
+ *
2922
+ * @param mockService - Parent mock service for coordination.
2923
+ */
2924
+ constructor(mockService: {
2925
+ simulateLatency(): Promise<void>;
2926
+ getState(): any;
2927
+ });
2928
+ /**
2929
+ * Gets the current connection state.
2930
+ */
2931
+ get state(): MockConnectionState;
2932
+ /**
2933
+ * Sets the connection state.
2934
+ */
2935
+ set state(value: MockConnectionState);
2936
+ /**
2937
+ * Gets the number of participants (including local).
2938
+ */
2939
+ get numParticipants(): number;
2940
+ /**
2941
+ * Gets whether the room is connected.
2942
+ */
2943
+ get isConnected(): boolean;
2944
+ /**
2945
+ * Connects to the room.
2946
+ *
2947
+ * @param wsURL - WebSocket URL.
2948
+ * @param token - Authentication token.
2949
+ */
2950
+ connect(_wsURL: string, _token: string): Promise<void>;
2951
+ /**
2952
+ * Disconnects from the room.
2953
+ */
2954
+ disconnect(): Promise<void>;
2955
+ /**
2956
+ * Simulates reconnection.
2957
+ */
2958
+ reconnect(): Promise<void>;
2959
+ /**
2960
+ * Registers an event handler.
2961
+ *
2962
+ * @param event - Event name.
2963
+ * @param handler - Event handler function.
2964
+ */
2965
+ on(event: string, handler: MockEventHandler): this;
2966
+ /**
2967
+ * Registers a one-time event handler.
2968
+ *
2969
+ * @param event - Event name.
2970
+ * @param handler - Event handler function.
2971
+ */
2972
+ once(event: string, handler: MockEventHandler): this;
2973
+ /**
2974
+ * Removes an event handler.
2975
+ *
2976
+ * @param event - Event name.
2977
+ * @param handler - Handler to remove.
2978
+ */
2979
+ off(event: string, handler: MockEventHandler): this;
2980
+ /**
2981
+ * Removes all event handlers.
2982
+ */
2983
+ removeAllListeners(): void;
2984
+ /**
2985
+ * Emits an event to all registered handlers.
2986
+ *
2987
+ * @param event - Event name.
2988
+ * @param args - Event arguments.
2989
+ */
2990
+ emit(event: string, ...args: unknown[]): void;
2991
+ /**
2992
+ * Registers an RPC method handler.
2993
+ *
2994
+ * @param method - Method name.
2995
+ * @param handler - Method handler.
2996
+ */
2997
+ registerRpcMethod(method: string, handler: MockRpcHandler): void;
2998
+ /**
2999
+ * Unregisters an RPC method handler.
3000
+ *
3001
+ * @param method - Method name.
3002
+ */
3003
+ unregisterRpcMethod(method: string): void;
3004
+ /**
3005
+ * Calls an RPC method (simulates receiving a call).
3006
+ *
3007
+ * @param method - Method name.
3008
+ * @param callerIdentity - Caller identity.
3009
+ * @param payload - Method payload.
3010
+ * @param responseTimeout - Timeout in ms.
3011
+ */
3012
+ callRpc(method: string, callerIdentity: string, payload: string, responseTimeout?: number): Promise<string>;
3013
+ /**
3014
+ * Registers a text stream handler.
3015
+ *
3016
+ * @param topic - Stream topic.
3017
+ * @param handler - Stream handler.
3018
+ */
3019
+ registerTextStreamHandler(topic: string, handler: MockTextStreamHandler): void;
3020
+ /**
3021
+ * Unregisters a text stream handler.
3022
+ *
3023
+ * @param topic - Stream topic.
3024
+ */
3025
+ unregisterTextStreamHandler(topic: string): void;
3026
+ /**
3027
+ * Simulates receiving a text stream.
3028
+ *
3029
+ * @param topic - Stream topic.
3030
+ * @param reader - Text stream reader.
3031
+ */
3032
+ simulateTextStream(topic: string, reader: MockTextStreamReader): void;
3033
+ /**
3034
+ * Gets a participant by identity.
3035
+ *
3036
+ * @param identity - Participant identity.
3037
+ */
3038
+ getParticipantByIdentity(identity: string): MockParticipant | undefined;
3039
+ /**
3040
+ * Gets a participant by SID.
3041
+ *
3042
+ * @param sid - Participant SID.
3043
+ */
3044
+ getParticipantBySid(sid: string): MockParticipant | undefined;
3045
+ /**
3046
+ * Simulates a remote participant joining.
3047
+ *
3048
+ * @param identity - Participant identity.
3049
+ * @param options - Join options.
3050
+ */
3051
+ simulateParticipantJoin(identity: string, options?: SimulateParticipantOptions): Promise<MockParticipant>;
3052
+ /**
3053
+ * Simulates a remote participant leaving.
3054
+ *
3055
+ * @param identity - Participant identity.
3056
+ */
3057
+ simulateParticipantLeave(identity: string): void;
3058
+ /**
3059
+ * Simulates a remote track being published.
3060
+ *
3061
+ * @param participantIdentity - Participant identity.
3062
+ * @param kind - Track kind.
3063
+ * @param source - Track source.
3064
+ */
3065
+ simulateRemoteTrack(participantIdentity: string, kind: "audio" | "video", source: string): Promise<MockTrack | undefined>;
3066
+ /**
3067
+ * Simulates a track being unpublished.
3068
+ *
3069
+ * @param participantIdentity - Participant identity.
3070
+ * @param source - Track source.
3071
+ */
3072
+ simulateTrackUnpublished(participantIdentity: string, source: string): void;
3073
+ /**
3074
+ * Simulates an agent joining with camera and microphone.
3075
+ *
3076
+ * @param identity - Agent identity.
3077
+ * @param name - Agent display name.
3078
+ */
3079
+ simulateAgentJoin(identity: string, name?: string): Promise<MockParticipant>;
3080
+ /**
3081
+ * Simulates a participant's attribute change.
3082
+ *
3083
+ * @param identity - Participant identity.
3084
+ * @param attributes - New attributes.
3085
+ */
3086
+ simulateAttributeChange(identity: string, attributes: Record<string, string>): void;
3087
+ /**
3088
+ * Simulates a track mute/unmute.
3089
+ *
3090
+ * @param participantIdentity - Participant identity.
3091
+ * @param source - Track source.
3092
+ * @param muted - Whether muted.
3093
+ */
3094
+ simulateTrackMuted(participantIdentity: string, source: string, muted: boolean): void;
3095
+ /**
3096
+ * Simulates an active speaker change.
3097
+ *
3098
+ * @param speakerIdentities - Identities of active speakers.
3099
+ */
3100
+ simulateActiveSpeakersChanged(speakerIdentities: string[]): void;
3101
+ /**
3102
+ * Simulates data received event.
3103
+ *
3104
+ * @param data - Binary data.
3105
+ * @param participantIdentity - Sender identity.
3106
+ * @param kind - Data kind.
3107
+ * @param topic - Data topic.
3108
+ */
3109
+ simulateDataReceived(data: Uint8Array, participantIdentity: string, kind?: string, topic?: string): void;
3110
+ }
3111
+
3112
+ /**
3113
+ * @summary In-memory state management for the mock LiveKit service.
3114
+ *
3115
+ * @description Manages all mock state including rooms, participants, tracks, agents,
3116
+ * and messages. Provides methods for state manipulation and queries.
3117
+ */
3118
+
3119
+ /**
3120
+ * @summary Manages in-memory state for the mock service.
3121
+ *
3122
+ * @description Provides a centralized store for all mock LiveKit entities
3123
+ * with methods for CRUD operations and state queries.
3124
+ */
3125
+ declare class MockState {
3126
+ /** Map of room ID to room state */
3127
+ private rooms;
3128
+ /** Map of participant identity to participant state */
3129
+ private participants;
3130
+ /** Map of track ID to track state */
3131
+ private tracks;
3132
+ /** Map of agent ID to agent state */
3133
+ private agents;
3134
+ /** Map of room ID to array of messages */
3135
+ private messages;
3136
+ /** Current service configuration */
3137
+ private config;
3138
+ /** Random number generator state for deterministic behavior */
3139
+ private randomState;
3140
+ /**
3141
+ * Initializes a new instance of MockState.
3142
+ *
3143
+ * @param {MockServiceConfig} config - Service configuration.
3144
+ */
3145
+ constructor(config?: MockServiceConfig);
3146
+ /**
3147
+ * Updates the service configuration.
3148
+ *
3149
+ * @param {Partial<MockServiceConfig>} config - Configuration updates.
3150
+ */
3151
+ updateConfig(config: Partial<MockServiceConfig>): void;
3152
+ /**
3153
+ * Gets the current service configuration.
3154
+ *
3155
+ * @returns {MockServiceConfig} Current configuration.
3156
+ */
3157
+ getConfig(): MockServiceConfig;
3158
+ /**
3159
+ * Generates a seeded random number for deterministic behavior.
3160
+ *
3161
+ * @returns {number} Random number between 0 and 1.
3162
+ */
3163
+ random(): number;
3164
+ /**
3165
+ * Creates a new room.
3166
+ *
3167
+ * @param {string} name - Room name.
3168
+ * @param {string} [groupId] - Group identifier.
3169
+ * @param {Record<string, unknown>} [metadata] - Room metadata.
3170
+ * @returns {MockRoomState} Created room state.
3171
+ */
3172
+ createRoom(name: string, groupId?: string, metadata?: Record<string, unknown>): MockRoomState;
3173
+ /**
3174
+ * Gets a room by ID.
3175
+ *
3176
+ * @param {string} roomId - Room identifier.
3177
+ * @returns {MockRoomState | undefined} Room state if found.
3178
+ */
3179
+ getRoom(roomId: string): MockRoomState | undefined;
3180
+ /**
3181
+ * Gets a room by name.
3182
+ *
3183
+ * @param {string} name - Room name.
3184
+ * @returns {MockRoomState | undefined} Room state if found.
3185
+ */
3186
+ getRoomByName(name: string): MockRoomState | undefined;
3187
+ /**
3188
+ * Lists all rooms.
3189
+ *
3190
+ * @param {boolean} [activeOnly] - Only return active rooms.
3191
+ * @returns {MockRoomState[]} Array of room states.
3192
+ */
3193
+ listRooms(activeOnly?: boolean): MockRoomState[];
3194
+ /**
3195
+ * Updates room connection state.
3196
+ *
3197
+ * @param {string} roomId - Room identifier.
3198
+ * @param {MockConnectionState} state - New connection state.
3199
+ * @returns {MockConnectionState | undefined} Previous state if room exists.
3200
+ */
3201
+ updateRoomConnectionState(roomId: string, state: MockConnectionState$1): MockConnectionState$1 | undefined;
3202
+ /**
3203
+ * Ends a room.
3204
+ *
3205
+ * @param {string} roomId - Room identifier.
3206
+ * @returns {boolean} True if room was ended successfully.
3207
+ */
3208
+ endRoom(roomId: string): boolean;
3209
+ /**
3210
+ * Deletes a room and all associated data.
3211
+ *
3212
+ * @param {string} roomId - Room identifier.
3213
+ * @returns {boolean} True if room was deleted.
3214
+ */
3215
+ deleteRoom(roomId: string): boolean;
3216
+ /**
3217
+ * Adds a participant to a room.
3218
+ *
3219
+ * @param {string} roomId - Room identifier.
3220
+ * @param {string} identity - Participant identity.
3221
+ * @param {string} [name] - Display name.
3222
+ * @param {MockParticipantRole} [role] - Participant role.
3223
+ * @param {MockParticipantKind} [kind] - Participant kind.
3224
+ * @param {boolean} [isLocal] - Whether this is the local participant.
3225
+ * @returns {MockParticipantState | MockError} Participant state or error.
3226
+ */
3227
+ addParticipant(roomId: string, identity: string, name?: string, role?: MockParticipantRole, kind?: MockParticipantKind$1, isLocal?: boolean): MockParticipantState | MockError;
3228
+ /**
3229
+ * Gets a participant by identity.
3230
+ *
3231
+ * @param {string} identity - Participant identity.
3232
+ * @returns {MockParticipantState | undefined} Participant state if found.
3233
+ */
3234
+ getParticipant(identity: string): MockParticipantState | undefined;
3235
+ /**
3236
+ * Lists participants in a room.
3237
+ *
3238
+ * @param {string} roomId - Room identifier.
3239
+ * @param {boolean} [connectedOnly] - Only return connected participants.
3240
+ * @returns {MockParticipantState[]} Array of participant states.
3241
+ */
3242
+ listParticipants(roomId: string, connectedOnly?: boolean): MockParticipantState[];
3243
+ /**
3244
+ * Updates participant attributes.
3245
+ *
3246
+ * @param {string} identity - Participant identity.
3247
+ * @param {Record<string, string>} attributes - New attributes.
3248
+ * @returns {Record<string, string> | undefined} Previous attributes if participant exists.
3249
+ */
3250
+ updateParticipantAttributes(identity: string, attributes: Record<string, string>): Record<string, string> | undefined;
3251
+ /**
3252
+ * Removes a participant from a room.
3253
+ *
3254
+ * @param {string} identity - Participant identity.
3255
+ * @returns {MockParticipantState | undefined} Removed participant if found.
3256
+ */
3257
+ removeParticipant(identity: string): MockParticipantState | undefined;
3258
+ /**
3259
+ * Publishes a track for a participant.
3260
+ *
3261
+ * @param {string} participantIdentity - Participant identity.
3262
+ * @param {MockTrackKind} kind - Track kind.
3263
+ * @param {MockTrackSource} source - Track source.
3264
+ * @param {Record<string, unknown>} [metadata] - Track metadata.
3265
+ * @returns {MockTrackState | MockError} Track state or error.
3266
+ */
3267
+ publishTrack(participantIdentity: string, kind: MockTrackKind, source?: MockTrackSource, metadata?: Record<string, unknown>): MockTrackState | MockError;
3268
+ /**
3269
+ * Gets a track by ID.
3270
+ *
3271
+ * @param {string} trackId - Track identifier.
3272
+ * @returns {MockTrackState | undefined} Track state if found.
3273
+ */
3274
+ getTrack(trackId: string): MockTrackState | undefined;
3275
+ /**
3276
+ * Lists tracks for a participant or room.
3277
+ *
3278
+ * @param {string} [roomId] - Filter by room ID.
3279
+ * @param {string} [participantIdentity] - Filter by participant identity.
3280
+ * @returns {MockTrackState[]} Array of track states.
3281
+ */
3282
+ listTracks(roomId?: string, participantIdentity?: string): MockTrackState[];
3283
+ /**
3284
+ * Unpublishes a track.
3285
+ *
3286
+ * @param {string} trackId - Track identifier.
3287
+ * @returns {MockTrackState | undefined} Unpublished track if found.
3288
+ */
3289
+ unpublishTrack(trackId: string): MockTrackState | undefined;
3290
+ /**
3291
+ * Mutes or unmutes a track.
3292
+ *
3293
+ * @param {string} trackId - Track identifier.
3294
+ * @param {boolean} muted - Whether to mute the track.
3295
+ * @returns {boolean} True if track was updated.
3296
+ */
3297
+ setTrackMuted(trackId: string, muted: boolean): boolean;
3298
+ /**
3299
+ * Starts an agent in a room.
3300
+ *
3301
+ * @param {string} roomId - Room identifier.
3302
+ * @param {string} name - Agent name.
3303
+ * @param {Partial<MockAgentConfig>} [config] - Agent configuration.
3304
+ * @returns {MockAgentState | MockError} Agent state or error.
3305
+ */
3306
+ startAgent(roomId: string, name: string, config?: Partial<MockAgentConfig>): MockAgentState | MockError;
3307
+ /**
3308
+ * Gets an agent by ID.
3309
+ *
3310
+ * @param {string} agentId - Agent identifier.
3311
+ * @returns {MockAgentState | undefined} Agent state if found.
3312
+ */
3313
+ getAgent(agentId: string): MockAgentState | undefined;
3314
+ /**
3315
+ * Lists agents in a room.
3316
+ *
3317
+ * @param {string} roomId - Room identifier.
3318
+ * @returns {MockAgentState[]} Array of agent states.
3319
+ */
3320
+ listAgents(roomId: string): MockAgentState[];
3321
+ /**
3322
+ * Stops an agent.
3323
+ *
3324
+ * @param {string} agentId - Agent identifier.
3325
+ * @returns {MockAgentState | undefined} Stopped agent if found.
3326
+ */
3327
+ stopAgent(agentId: string): MockAgentState | undefined;
3328
+ /**
3329
+ * Updates agent status.
3330
+ *
3331
+ * @param {string} agentId - Agent identifier.
3332
+ * @param {MockAgentStatus} status - New status.
3333
+ * @returns {boolean} True if agent was updated.
3334
+ */
3335
+ updateAgentStatus(agentId: string, status: MockAgentStatus): boolean;
3336
+ /**
3337
+ * Adds a message to agent's history.
3338
+ *
3339
+ * @param {string} agentId - Agent identifier.
3340
+ * @param {string} content - Message content.
3341
+ * @param {"user" | "agent"} role - Message role.
3342
+ * @returns {MockAgentMessage | undefined} Created message if agent exists.
3343
+ */
3344
+ addAgentMessage(agentId: string, content: string, role: "user" | "agent"): MockAgentMessage | undefined;
3345
+ /**
3346
+ * Adds a message to a room.
3347
+ *
3348
+ * @param {string} roomId - Room identifier.
3349
+ * @param {string} participantIdentity - Sender identity.
3350
+ * @param {string} content - Message content.
3351
+ * @param {"standard" | "system"} [type] - Message type.
3352
+ * @param {Record<string, unknown>} [attributes] - Message attributes.
3353
+ * @returns {MockMessageState | MockError} Message state or error.
3354
+ */
3355
+ addMessage(roomId: string, participantIdentity: string, content: string, type?: "standard" | "system", attributes?: Record<string, unknown>): MockMessageState | MockError;
3356
+ /**
3357
+ * Gets messages for a room.
3358
+ *
3359
+ * @param {string} roomId - Room identifier.
3360
+ * @param {number} [limit] - Maximum messages to return.
3361
+ * @returns {MockMessageState[]} Array of messages.
3362
+ */
3363
+ getMessages(roomId: string, limit?: number): MockMessageState[];
3364
+ /**
3365
+ * Creates a mock error.
3366
+ *
3367
+ * @param {MockErrorCode} code - Error code.
3368
+ * @param {string} message - Error message.
3369
+ * @param {Record<string, unknown>} [details] - Additional details.
3370
+ * @returns {MockError} Mock error object.
3371
+ */
3372
+ createError(code: MockErrorCode, message: string, details?: Record<string, unknown>): MockError;
3373
+ /**
3374
+ * Checks if a value is a MockError.
3375
+ *
3376
+ * @param {unknown} value - Value to check.
3377
+ * @returns {boolean} True if value is a MockError.
3378
+ */
3379
+ isError(value: unknown): value is MockError;
3380
+ /**
3381
+ * Resets all state.
3382
+ */
3383
+ reset(): void;
3384
+ /**
3385
+ * Gets a complete snapshot of the current state.
3386
+ *
3387
+ * @returns {MockStateSnapshot} Current state snapshot.
3388
+ */
3389
+ getSnapshot(): MockStateSnapshot;
3390
+ /**
3391
+ * Exports state to JSON.
3392
+ *
3393
+ * @returns {MockStateSnapshotJSON} JSON-serializable snapshot.
3394
+ */
3395
+ toJSON(): MockStateSnapshotJSON;
3396
+ /**
3397
+ * Imports state from JSON.
3398
+ *
3399
+ * @param {MockStateSnapshotJSON} json - State to import.
3400
+ */
3401
+ fromJSON(json: MockStateSnapshotJSON): void;
3402
+ }
3403
+
3404
+ /**
3405
+ * @file Mock Conversation Service implementation.
3406
+ *
3407
+ * @summary Drop-in replacement for ConversationService that operates entirely
3408
+ * in memory without real network calls or LiveKit infrastructure.
3409
+ *
3410
+ * @description Provides a complete mock implementation of ConversationService
3411
+ * using the modular livekit/ and actor/ subsystems. Designed for unit testing,
3412
+ * integration testing, and Storybook demonstrations.
3413
+ *
3414
+ * @example
3415
+ * ```typescript
3416
+ * const service = new MockConversationService({
3417
+ * organizationId: 'test_org',
3418
+ * latencyMs: 50,
3419
+ * });
3420
+ *
3421
+ * await service.registerUser('user_1', 'secret', { name: 'John' });
3422
+ * const room = await service.createRoom({ language: 'en', timezone: 'UTC' });
3423
+ *
3424
+ * // Send a message
3425
+ * await service.sendMessage("Hello!");
3426
+ * ```
3427
+ */
3428
+
3429
+ /**
3430
+ * Mock implementation of ConversationService.
3431
+ *
3432
+ * @description Provides the same API as ConversationService but operates entirely
3433
+ * in memory. Supports deterministic testing, latency simulation, and event tracking.
3434
+ */
3435
+ declare class MockConversationService {
3436
+ /** In-memory state manager */
3437
+ private state;
3438
+ /** Event emitter */
3439
+ private events;
3440
+ /** Message listeners */
3441
+ private messageListeners;
3442
+ /** Typing listeners */
3443
+ private typingListeners;
3444
+ /** Call request listeners */
3445
+ private callRequestListeners;
3446
+ /** Current auth token */
3447
+ private _authToken;
3448
+ /** Registered user data */
3449
+ private _registeredUser;
3450
+ /** Service configuration */
3451
+ private config;
3452
+ /** Active agents by ID */
3453
+ private agents;
3454
+ /** Custom agent response handler */
3455
+ private customAgentHandler?;
3456
+ /** Current mock room instance */
3457
+ room: MockRoom;
3458
+ /**
3459
+ * Gets the current auth token.
3460
+ */
3461
+ get authToken(): string | null;
3462
+ /**
3463
+ * Gets the registered user data.
3464
+ */
3465
+ get registeredUser(): UserApiResponse | null;
3466
+ /**
3467
+ * Creates a new MockConversationService.
3468
+ *
3469
+ * @param options - Service configuration options.
3470
+ */
3471
+ constructor(options?: Partial<ConversationServiceOptions> & Partial<MockServiceConfig>);
3472
+ /**
3473
+ * Gets the internal state manager for testing.
3474
+ */
3475
+ getState(): MockState;
3476
+ /**
3477
+ * Gets the event emitter for subscriptions.
3478
+ */
3479
+ getEvents(): MockEventEmitter;
3480
+ /**
3481
+ * Updates mock configuration.
3482
+ */
3483
+ updateConfig(config: Partial<MockServiceConfig>): void;
3484
+ /**
3485
+ * Gets current configuration.
3486
+ */
3487
+ getConfig(): MockServiceConfig;
3488
+ /**
3489
+ * Simulates network latency.
3490
+ */
3491
+ simulateLatency(): Promise<void>;
3492
+ private applyScenario;
3493
+ private shouldThrowError;
3494
+ /**
3495
+ * Ensures a room instance exists.
3496
+ */
3497
+ ensureRoom(): MockRoom;
3498
+ /**
3499
+ * Registers a user for conversation access.
3500
+ */
3501
+ registerUser(externalId: string, _secret: string, userData?: Record<string, unknown>, _metadata?: Record<string, unknown>): Promise<UserApiResponse>;
3502
+ /**
3503
+ * Registers an agent for handling conversations.
3504
+ */
3505
+ registerAgent(externalId: string, agentData: AgentData): Promise<string>;
3506
+ /**
3507
+ * Mock implementation of the unified quick-start endpoint.
3508
+ * Combines registerUser and createRoom into a single call.
3509
+ */
3510
+ quickStart(options: QuickStartOptions): Promise<MockRoom>;
3511
+ /**
3512
+ * Creates a new conversation room.
3513
+ */
3514
+ createRoom(options: CreateRoomOptions, userData?: Record<string, string>): Promise<MockRoom>;
3515
+ /**
3516
+ * Joins an existing conversation room.
3517
+ */
3518
+ joinRoom(roomId: string, _timezone: string, _language: string, attributes?: Record<string, unknown>): Promise<MockRoom>;
3519
+ /**
3520
+ * Evaluates/rates the current room.
3521
+ */
3522
+ evaluateRoom(options: EvaluateRoomOptions): Promise<void>;
3523
+ /**
3524
+ * Closes the current room on the server.
3525
+ */
3526
+ closeRoom(): Promise<void>;
3527
+ /**
3528
+ * Disconnects from the current room.
3529
+ */
3530
+ disconnect(): Promise<void>;
3531
+ /**
3532
+ * Stops all published local tracks in the current room.
3533
+ */
3534
+ private stopLocalTracks;
3535
+ /**
3536
+ * Closes the room and disconnects.
3537
+ */
3538
+ disconnectAndCloseRoom(): Promise<void>;
3539
+ /**
3540
+ * Marks a room as read.
3541
+ */
3542
+ readRoom(roomId: string): Promise<void>;
3543
+ /**
3544
+ * Fetches a list of rooms.
3545
+ */
3546
+ getRooms(options: GetRoomsOptions): Promise<RoomsApiResponse>;
3547
+ /**
3548
+ * Sends a message in the current room.
3549
+ */
3550
+ sendMessage(message: string, attributes?: Record<string, string>): Promise<void>;
3551
+ /**
3552
+ * Persists a message to storage.
3553
+ */
3554
+ persistMessage(options: PersistMessageOptions): Promise<MessagesApiResponse>;
3555
+ /**
3556
+ * Fetches messages.
3557
+ */
3558
+ getMessages(options: GetMessagesOptions): Promise<ApiMessage[]>;
3559
+ /**
3560
+ * Reports a message.
3561
+ */
3562
+ sendMessageReport(_options: MessageReportOptions): Promise<void>;
3563
+ /**
3564
+ * Deletes a message report.
3565
+ */
3566
+ deleteMessageReport(_options: MessageReportOptions): Promise<void>;
3567
+ /**
3568
+ * Updates message reactions.
3569
+ */
3570
+ updateMessageReactions(_options: MessageReactionOptions): Promise<void>;
3571
+ /**
3572
+ * Subscribes to incoming messages.
3573
+ */
3574
+ subscribeMessages<M extends ApiMessage = ApiMessage>(callback: MessageListener<M>): () => void;
3575
+ /**
3576
+ * Sends a typing indicator.
3577
+ */
3578
+ sendTypingIndicator(isTyping: boolean): Promise<void>;
3579
+ /**
3580
+ * Subscribes to typing indicators.
3581
+ */
3582
+ subscribeTypingIndicators(listener: TypingListener): () => void;
3583
+ /**
3584
+ * Unsubscribes a typing listener.
3585
+ */
3586
+ unsubscribeTypingIndicators(listener: TypingListener): void;
3587
+ /**
3588
+ * Sends a contextual event.
3589
+ */
3590
+ sendContextualEvent(_event: ContextualEvent): Promise<void>;
3591
+ /**
3592
+ * Requests a new room (call transfer).
3593
+ */
3594
+ requestNewRoom(options: RequestNewRoomOptions): Promise<RoomApiResponse>;
3595
+ /**
3596
+ * Confirms a room request.
3597
+ */
3598
+ confirmRoomRequest(roomId: string): Promise<{
3599
+ success: boolean;
3600
+ message: string;
3601
+ roomId: string;
3602
+ }>;
3603
+ /**
3604
+ * Cancels a room request.
3605
+ */
3606
+ cancelRoomRequest(roomId: string): Promise<{
3607
+ success: boolean;
3608
+ message: string;
3609
+ roomId: string;
3610
+ }>;
3611
+ /**
3612
+ * Finishes an active call.
3613
+ */
3614
+ finishCall(): Promise<void>;
3615
+ isFirebaseEnabled(): boolean;
3616
+ onPresenceChange(_callback: (agentId: string, data: object | null) => void): () => void;
3617
+ onPresenceAgentChange(_agentId: string, _callback: (agentId: string, data: object | null) => void): () => void;
3618
+ createCallRequest(_requestData: Omit<CallRequest, "status" | "createdAt" | "id">): Promise<string>;
3619
+ onNewCallRequest(callback: CallRequestListener): () => void;
3620
+ onCallRequestChange(callback: CallRequestListener): () => void;
3621
+ onCallRequestRemoved(_callback: (id: string) => void): () => void;
3622
+ acceptCallRequest(_requestId: string): Promise<void>;
3623
+ cancelCallRequest(_requestId: string): Promise<void>;
3624
+ cancelOnDisconnect(_requestId: string): Promise<void>;
3625
+ subscribePendingRequests(_callback: CallRequestListener, _options?: {
3626
+ resetSeen?: boolean;
3627
+ }): () => void;
3628
+ subscribeRequestChanges(_callback: CallRequestListener): () => void;
3629
+ tryAcceptRequest(_requestId: string): Promise<boolean>;
3630
+ onRoomSync(_roomId: string, _callback: (data: RoomSyncData | null) => void): () => void;
3631
+ clearRoomSync(_roomId: string, _reason?: string): Promise<void>;
3632
+ onNewRoomRequest(_roomId: string, _callback: (data: NewRoomRequestData | null) => void): () => void;
3633
+ unsubscribeAllFirebase(): void;
3634
+ destroy(): Promise<void>;
3635
+ /**
3636
+ * Starts a mock agent in a room.
3637
+ *
3638
+ * If the agent type includes "video" or "voice", the agent will also join
3639
+ * the room as a participant with the appropriate media tracks.
3640
+ */
3641
+ startMockAgent(roomId: string, config?: Partial<MockAgentConfig>): Promise<string>;
3642
+ /**
3643
+ * Stops a mock agent.
3644
+ */
3645
+ stopMockAgent(agentId: string): Promise<void>;
3646
+ /**
3647
+ * Sets a custom agent response handler.
3648
+ */
3649
+ setAgentResponseHandler(handler: (agentId: string, message: string) => string | Promise<string>): void;
3650
+ private triggerAgentResponse;
3651
+ /**
3652
+ * Simulates a call request being received.
3653
+ */
3654
+ simulateCallRequest(requestData: Partial<CallRequest>): void;
3655
+ /**
3656
+ * Simulates a participant joining.
3657
+ */
3658
+ simulateParticipantJoin(identity: string, name?: string, role?: "user" | "agent"): void;
3659
+ /**
3660
+ * Simulates a participant leaving.
3661
+ */
3662
+ simulateParticipantLeave(identity: string): void;
3663
+ /**
3664
+ * Simulates receiving a message.
3665
+ */
3666
+ simulateIncomingMessage(participantIdentity: string, content: string): void;
3667
+ /**
3668
+ * Simulates room disconnection.
3669
+ */
3670
+ simulateDisconnect(): Promise<void>;
3671
+ /**
3672
+ * Resets the mock service.
3673
+ */
3674
+ reset(): void;
3675
+ /**
3676
+ * Seeds the random number generator.
3677
+ */
3678
+ seed(seed: number): void;
3679
+ /**
3680
+ * Sets a predefined scenario.
3681
+ */
3682
+ setScenario(scenario: MockScenario): void;
3683
+ /**
3684
+ * Exports current state to JSON.
3685
+ */
3686
+ exportState(): object;
3687
+ /**
3688
+ * Gets event history.
3689
+ */
3690
+ getEventHistory(filterType?: string): any[];
3691
+ }
3692
+
3693
+ /**
3694
+ * @summary Factory for creating conversation services (real or mock).
3695
+ *
3696
+ * @description Provides a unified factory for creating ConversationService instances.
3697
+ * Automatically selects between real and mock implementations based on environment
3698
+ * configuration or explicit mode parameter.
3699
+ */
3700
+
3701
+ /**
3702
+ * LiveKit/Conversation service mode.
3703
+ */
3704
+ type LiveKitMode = "real" | "mock";
3705
+ /**
3706
+ * Factory configuration options.
3707
+ */
3708
+ interface ConversationServiceFactoryOptions extends Partial<ConversationServiceOptions> {
3709
+ /**
3710
+ * Mode to use: 'real' for actual LiveKit, 'mock' for testing.
3711
+ * If not specified, determined from environment.
3712
+ */
3713
+ mode?: LiveKitMode;
3714
+ /**
3715
+ * Mock-specific configuration (only used when mode is 'mock').
3716
+ */
3717
+ mockConfig?: MockServiceConfig;
3718
+ }
3719
+ /**
3720
+ * @summary Factory for creating conversation services.
3721
+ *
3722
+ * @description Creates either a real ConversationService or MockConversationService
3723
+ * based on configuration. Supports automatic mode detection from environment variables.
3724
+ *
3725
+ * @example
3726
+ * ```typescript
3727
+ * // Auto-detect mode from environment
3728
+ * const service = ConversationServiceFactory.createFromEnv();
3729
+ *
3730
+ * // Explicit mock mode
3731
+ * const mockService = ConversationServiceFactory.create({
3732
+ * mode: 'mock',
3733
+ * organizationId: 'test_org',
3734
+ * apiUrl: 'https://api.example.com',
3735
+ * });
3736
+ *
3737
+ * // Explicit real mode
3738
+ * const realService = ConversationServiceFactory.create({
3739
+ * mode: 'real',
3740
+ * organizationId: 'org_123',
3741
+ * apiUrl: 'https://api.livekit.io',
3742
+ * });
3743
+ * ```
3744
+ */
3745
+ declare class ConversationServiceFactory {
3746
+ /**
3747
+ * Creates a service instance with explicit configuration.
3748
+ *
3749
+ * @param {ConversationServiceFactoryOptions} options - Factory options.
3750
+ * @returns {ConversationService | MockConversationService} Service instance.
3751
+ */
3752
+ static create(options: ConversationServiceFactoryOptions): ConversationService | MockConversationService;
3753
+ /**
3754
+ * Creates a service instance from environment configuration.
3755
+ *
3756
+ * @param {Partial<ConversationServiceFactoryOptions>} [overrides] - Optional overrides.
3757
+ * @returns {ConversationService | MockConversationService} Service instance.
3758
+ */
3759
+ static createFromEnv(overrides?: Partial<ConversationServiceFactoryOptions>): ConversationService | MockConversationService;
3760
+ /**
3761
+ * Creates a mock service for testing.
3762
+ *
3763
+ * @param {MockServiceConfig} [config] - Mock configuration.
3764
+ * @returns {MockConversationService} Mock service instance.
3765
+ */
3766
+ static createMock(config?: MockServiceConfig): MockConversationService;
3767
+ /**
3768
+ * Creates a mock service with deterministic behavior for tests.
3769
+ *
3770
+ * @param {number} [seed] - Random seed for deterministic behavior.
3771
+ * @returns {MockConversationService} Deterministic mock service.
3772
+ */
3773
+ static createDeterministicMock(seed?: number): MockConversationService;
3774
+ /**
3775
+ * Gets the current mode from environment.
3776
+ *
3777
+ * @returns {LiveKitMode} Current mode.
3778
+ */
3779
+ static getCurrentMode(): LiveKitMode;
3780
+ /**
3781
+ * Checks if currently in mock mode.
3782
+ *
3783
+ * @returns {boolean} True if in mock mode.
3784
+ */
3785
+ static isMockMode(): boolean;
3786
+ /**
3787
+ * Type guard to check if a service is a mock.
3788
+ *
3789
+ * @param {ConversationService | MockConversationService} service - Service to check.
3790
+ * @returns {boolean} True if service is a mock.
3791
+ */
3792
+ static isMockService(service: ConversationService | MockConversationService): service is MockConversationService;
3793
+ }
3794
+ /**
3795
+ * Convenience function to create a service from environment.
3796
+ *
3797
+ * @param {Partial<ConversationServiceFactoryOptions>} [overrides] - Optional overrides.
3798
+ * @returns {ConversationService | MockConversationService} Service instance.
3799
+ */
3800
+ declare function createConversationService(overrides?: Partial<ConversationServiceFactoryOptions>): ConversationService | MockConversationService;
3801
+ /**
3802
+ * Convenience function to create a mock service.
3803
+ *
3804
+ * @param {MockServiceConfig} [config] - Mock configuration.
3805
+ * @returns {MockConversationService} Mock service instance.
3806
+ */
3807
+ declare function createMockConversationService(config?: MockServiceConfig): MockConversationService;
3808
+
3809
+ /**
3810
+ * @summary Test fixtures for the mock LiveKit service.
3811
+ *
3812
+ * @description Provides pre-configured room, participant, and agent fixtures
3813
+ * for common testing scenarios.
3814
+ */
3815
+
3816
+ /**
3817
+ * Creates a default room fixture.
3818
+ *
3819
+ * @param {Partial<MockRoomState>} [overrides] - Optional overrides.
3820
+ * @returns {MockRoomState} Room fixture.
3821
+ */
3822
+ declare function createDefaultRoomFixture(overrides?: Partial<MockRoomState>): MockRoomState;
3823
+ /**
3824
+ * Creates a room with a local participant.
3825
+ *
3826
+ * @param {string} [localIdentity] - Local participant identity.
3827
+ * @param {Partial<MockRoomState>} [overrides] - Optional room overrides.
3828
+ * @returns {{ room: MockRoomState; localParticipant: MockParticipantState }} Room and participant.
3829
+ */
3830
+ declare function createRoomWithLocalParticipant(localIdentity?: string, overrides?: Partial<MockRoomState>): {
3831
+ room: MockRoomState;
3832
+ localParticipant: MockParticipantState;
3833
+ };
3834
+ /**
3835
+ * Creates a room with two participants.
3836
+ *
3837
+ * @param {Partial<MockRoomState>} [roomOverrides] - Optional room overrides.
3838
+ * @returns {{ room: MockRoomState; participant1: MockParticipantState; participant2: MockParticipantState }} Room and participants.
3839
+ */
3840
+ declare function createRoomWithTwoParticipants(roomOverrides?: Partial<MockRoomState>): {
3841
+ room: MockRoomState;
3842
+ participant1: MockParticipantState;
3843
+ participant2: MockParticipantState;
3844
+ };
3845
+ /**
3846
+ * Creates a room with an agent.
3847
+ *
3848
+ * @param {Partial<MockAgentConfig>} [agentConfig] - Agent configuration.
3849
+ * @param {Partial<MockRoomState>} [roomOverrides] - Optional room overrides.
3850
+ * @returns {{ room: MockRoomState; localParticipant: MockParticipantState; agent: MockAgentState; agentParticipant: MockParticipantState }} Room, participant, and agent.
3851
+ */
3852
+ declare function createRoomWithAgent(agentConfig?: Partial<MockAgentConfig>, roomOverrides?: Partial<MockRoomState>): {
3853
+ room: MockRoomState;
3854
+ localParticipant: MockParticipantState;
3855
+ agent: MockAgentState;
3856
+ agentParticipant: MockParticipantState;
3857
+ };
3858
+ /**
3859
+ * Creates a room with agent and data track.
3860
+ *
3861
+ * @param {Partial<MockRoomState>} [roomOverrides] - Optional room overrides.
3862
+ * @returns {{ room: MockRoomState; localParticipant: MockParticipantState; agent: MockAgentState; dataTrack: MockTrackState }} Complete fixture.
3863
+ */
3864
+ declare function createRoomWithAgentAndDataTrack(roomOverrides?: Partial<MockRoomState>): {
3865
+ room: MockRoomState;
3866
+ localParticipant: MockParticipantState;
3867
+ agent: MockAgentState;
3868
+ dataTrack: MockTrackState;
3869
+ };
3870
+ /**
3871
+ * Creates a room with audio/video tracks.
3872
+ *
3873
+ * @param {Partial<MockRoomState>} [roomOverrides] - Optional room overrides.
3874
+ * @returns {{ room: MockRoomState; participant: MockParticipantState; audioTrack: MockTrackState; videoTrack: MockTrackState }} Complete fixture.
3875
+ */
3876
+ declare function createRoomWithMediaTracks(roomOverrides?: Partial<MockRoomState>): {
3877
+ room: MockRoomState;
3878
+ participant: MockParticipantState;
3879
+ audioTrack: MockTrackState;
3880
+ videoTrack: MockTrackState;
3881
+ };
3882
+ /**
3883
+ * Creates a default participant fixture.
3884
+ *
3885
+ * @param {string} roomId - Room identifier.
3886
+ * @param {Partial<MockParticipantState>} [overrides] - Optional overrides.
3887
+ * @returns {MockParticipantState} Participant fixture.
3888
+ */
3889
+ declare function createParticipantFixture(roomId: string, overrides?: Partial<MockParticipantState>): MockParticipantState;
3890
+ /**
3891
+ * Creates a batch of participant fixtures.
3892
+ *
3893
+ * @param {string} roomId - Room identifier.
3894
+ * @param {number} count - Number of participants to create.
3895
+ * @returns {MockParticipantState[]} Array of participant fixtures.
3896
+ */
3897
+ declare function createParticipantBatch(roomId: string, count: number): MockParticipantState[];
3898
+ /**
3899
+ * Creates a default agent fixture.
3900
+ *
3901
+ * @param {string} roomId - Room identifier.
3902
+ * @param {Partial<MockAgentState>} [overrides] - Optional overrides.
3903
+ * @returns {MockAgentState} Agent fixture.
3904
+ */
3905
+ declare function createAgentFixture(roomId: string, overrides?: Partial<MockAgentState>): MockAgentState;
3906
+ /**
3907
+ * Creates an agent with canned responses.
3908
+ *
3909
+ * @param {string} roomId - Room identifier.
3910
+ * @param {string[]} responses - Canned responses.
3911
+ * @returns {MockAgentState} Agent fixture.
3912
+ */
3913
+ declare function createAgentWithCannedResponses(roomId: string, responses: string[]): MockAgentState;
3914
+ /**
3915
+ * Creates an agent configured for sequential responses.
3916
+ *
3917
+ * @param {string} roomId - Room identifier.
3918
+ * @param {string[]} responses - Responses in order.
3919
+ * @returns {MockAgentState} Agent fixture.
3920
+ */
3921
+ declare function createSequentialAgent(roomId: string, responses: string[]): MockAgentState;
3922
+ /**
3923
+ * Creates a default message fixture.
3924
+ *
3925
+ * @param {string} roomId - Room identifier.
3926
+ * @param {string} participantIdentity - Sender identity.
3927
+ * @param {Partial<MockMessageState>} [overrides] - Optional overrides.
3928
+ * @returns {MockMessageState} Message fixture.
3929
+ */
3930
+ declare function createMessageFixture(roomId: string, participantIdentity: string, overrides?: Partial<MockMessageState>): MockMessageState;
3931
+ /**
3932
+ * Creates a conversation fixture with multiple messages.
3933
+ *
3934
+ * @param {string} roomId - Room identifier.
3935
+ * @param {Array<{ identity: string; content: string }>} messages - Messages to create.
3936
+ * @returns {MockMessageState[]} Array of message fixtures.
3937
+ */
3938
+ declare function createConversationFixture(roomId: string, messages: Array<{
3939
+ identity: string;
3940
+ content: string;
3941
+ }>): MockMessageState[];
3942
+ /**
3943
+ * Creates a default service configuration.
3944
+ *
3945
+ * @param {Partial<MockServiceConfig>} [overrides] - Optional overrides.
3946
+ * @returns {MockServiceConfig} Configuration fixture.
3947
+ */
3948
+ declare function createDefaultConfig(overrides?: Partial<MockServiceConfig>): MockServiceConfig;
3949
+ /**
3950
+ * Creates a strict mode configuration.
3951
+ *
3952
+ * @param {Partial<MockServiceConfig>} [overrides] - Optional overrides.
3953
+ * @returns {MockServiceConfig} Configuration fixture.
3954
+ */
3955
+ declare function createStrictConfig(overrides?: Partial<MockServiceConfig>): MockServiceConfig;
3956
+ /**
3957
+ * Creates a configuration with artificial latency.
3958
+ *
3959
+ * @param {number} latencyMs - Latency in milliseconds.
3960
+ * @param {Partial<MockServiceConfig>} [overrides] - Optional overrides.
3961
+ * @returns {MockServiceConfig} Configuration fixture.
3962
+ */
3963
+ declare function createLatencyConfig(latencyMs: number, overrides?: Partial<MockServiceConfig>): MockServiceConfig;
3964
+ /**
3965
+ * Creates a deterministic configuration with seed.
3966
+ *
3967
+ * @param {number} seed - Random seed.
3968
+ * @param {Partial<MockServiceConfig>} [overrides] - Optional overrides.
3969
+ * @returns {MockServiceConfig} Configuration fixture.
3970
+ */
3971
+ declare function createDeterministicConfig(seed: number, overrides?: Partial<MockServiceConfig>): MockServiceConfig;
3972
+ /**
3973
+ * Creates a complete chat scenario with room, participants, and messages.
3974
+ *
3975
+ * @returns {Object} Complete chat scenario fixture.
3976
+ */
3977
+ declare function createChatScenario(): {
3978
+ room: MockRoomState;
3979
+ user: MockParticipantState;
3980
+ agent: MockAgentState;
3981
+ agentParticipant: MockParticipantState;
3982
+ messages: MockMessageState[];
3983
+ };
3984
+ /**
3985
+ * Creates a video call scenario with room, participants, and tracks.
3986
+ *
3987
+ * @returns {Object} Complete video call scenario fixture.
3988
+ */
3989
+ declare function createVideoCallScenario(): {
3990
+ room: MockRoomState;
3991
+ participant1: MockParticipantState;
3992
+ participant2: MockParticipantState;
3993
+ tracks: MockTrackState[];
3994
+ };
3995
+
3996
+ /**
3997
+ * @summary Generator functions for mock IDs, tokens, and URLs.
3998
+ *
3999
+ * @description Provides utility functions for generating deterministic
4000
+ * mock identifiers, tokens, and URLs for testing purposes.
4001
+ */
4002
+ /**
4003
+ * Resets the ID counter for deterministic testing.
4004
+ */
4005
+ declare function resetIdCounter(): void;
4006
+ /**
4007
+ * Sets the ID counter to a specific value.
4008
+ *
4009
+ * @param {number} value - New counter value.
4010
+ */
4011
+ declare function setIdCounter(value: number): void;
4012
+ /**
4013
+ * Generates a mock ID with a prefix.
4014
+ *
4015
+ * @param {string} prefix - ID prefix (e.g., 'room', 'track', 'agent').
4016
+ * @returns {string} Generated mock ID.
4017
+ *
4018
+ * @example
4019
+ * ```typescript
4020
+ * const roomId = generateMockId('room'); // 'mock_room_1'
4021
+ * const trackId = generateMockId('track'); // 'mock_track_2'
4022
+ * ```
4023
+ */
4024
+ declare function generateMockId(prefix: string): string;
4025
+ /**
4026
+ * Generates a deterministic mock ID based on seed.
4027
+ *
4028
+ * @param {string} prefix - ID prefix.
4029
+ * @param {number} seed - Seed for deterministic generation.
4030
+ * @returns {string} Generated mock ID.
4031
+ */
4032
+ declare function generateSeededMockId(prefix: string, seed: number): string;
4033
+ /**
4034
+ * Generates a mock token.
4035
+ *
4036
+ * @param {string} roomId - Room identifier.
4037
+ * @param {string} identity - Participant identity.
4038
+ * @param {string} [timestamp] - Optional timestamp (defaults to now).
4039
+ * @returns {string} Generated mock token.
4040
+ *
4041
+ * @example
4042
+ * ```typescript
4043
+ * const token = generateMockToken('room_1', 'user_123');
4044
+ * // 'mock_token_room_1_user_123_1705692000000'
4045
+ * ```
4046
+ */
4047
+ declare function generateMockToken(roomId: string, identity: string, timestamp?: string): string;
4048
+ /**
4049
+ * Decodes a mock token to extract its components.
4050
+ *
4051
+ * @param {string} token - Mock token to decode.
4052
+ * @returns {{ roomId: string; identity: string; timestamp: string } | null} Decoded token or null if invalid.
4053
+ */
4054
+ declare function decodeMockToken(token: string): {
4055
+ roomId: string;
4056
+ identity: string;
4057
+ timestamp: string;
4058
+ } | null;
4059
+ /**
4060
+ * Generates a mock WebSocket URL.
4061
+ *
4062
+ * @param {string} roomId - Room identifier.
4063
+ * @returns {string} Generated mock WebSocket URL.
4064
+ */
4065
+ declare function generateMockWsUrl(roomId: string): string;
4066
+ /**
4067
+ * Generates a mock participant identity.
4068
+ *
4069
+ * @param {string} [prefix] - Optional prefix.
4070
+ * @param {number} [index] - Optional index for deterministic generation.
4071
+ * @returns {string} Generated participant identity.
4072
+ */
4073
+ declare function generateMockParticipantIdentity(prefix?: string, index?: number): string;
4074
+ /**
4075
+ * Generates a mock room name.
4076
+ *
4077
+ * @param {string} [prefix] - Optional prefix.
4078
+ * @returns {string} Generated room name.
4079
+ */
4080
+ declare function generateMockRoomName(prefix?: string): string;
4081
+ /**
4082
+ * Generates a mock track SID (Session ID).
4083
+ *
4084
+ * @param {string} kind - Track kind (audio, video, data).
4085
+ * @param {string} participantIdentity - Participant identity.
4086
+ * @returns {string} Generated track SID.
4087
+ */
4088
+ declare function generateMockTrackSid(kind: string, participantIdentity: string): string;
4089
+ /**
4090
+ * Generates a unique message ID.
4091
+ *
4092
+ * @returns {string} Generated message ID.
4093
+ */
4094
+ declare function generateMockMessageId(): string;
4095
+ /**
4096
+ * Generates a mock API response ID.
4097
+ *
4098
+ * @param {string} type - Response type (e.g., 'user', 'room').
4099
+ * @returns {string} Generated response ID.
4100
+ */
4101
+ declare function generateMockApiResponseId(type: string): string;
4102
+ /**
4103
+ * Generates a mock external ID (UUID-like).
4104
+ *
4105
+ * @returns {string} Generated external ID.
4106
+ */
4107
+ declare function generateMockExternalId(): string;
4108
+ /**
4109
+ * Generates a sequence of mock IDs for batch operations.
4110
+ *
4111
+ * @param {string} prefix - ID prefix.
4112
+ * @param {number} count - Number of IDs to generate.
4113
+ * @returns {string[]} Array of generated IDs.
4114
+ */
4115
+ declare function generateMockIdBatch(prefix: string, count: number): string[];
4116
+
4117
+ /**
4118
+ * @file Synthetic media generators for mock LiveKit tracks.
4119
+ * @description Generates fake video and audio MediaStreams for visual demos
4120
+ * in Storybook without requiring real camera/microphone access.
4121
+ */
4122
+ /**
4123
+ * Configuration for synthetic video generation.
4124
+ */
4125
+ interface SyntheticVideoConfig {
4126
+ /** Video width in pixels. Default: 640 */
4127
+ width?: number;
4128
+ /** Video height in pixels. Default: 480 */
4129
+ height?: number;
4130
+ /** Frames per second. Default: 30 */
4131
+ fps?: number;
4132
+ /** Background color. Default: '#1a1a2e' */
4133
+ backgroundColor?: string;
4134
+ /** Foreground/animation color. Default: '#4361ee' */
4135
+ foregroundColor?: string;
4136
+ /** Label to display on video. Default: 'Mock Video' */
4137
+ label?: string;
4138
+ /** Animation type. Default: 'wave' */
4139
+ animation?: "wave" | "pulse" | "bars" | "avatar" | "none";
4140
+ }
4141
+ /**
4142
+ * Configuration for synthetic audio generation.
4143
+ */
4144
+ interface SyntheticAudioConfig {
4145
+ /** Base frequency in Hz. Default: 440 */
4146
+ frequency?: number;
4147
+ /** Volume (0-1). Default: 0.1 */
4148
+ volume?: number;
4149
+ /** Waveform type. Default: 'sine' */
4150
+ waveType?: OscillatorType;
4151
+ /** Whether to add variation. Default: true */
4152
+ addVariation?: boolean;
4153
+ /** Enable audio (false = silent track). Default: false */
4154
+ enabled?: boolean;
4155
+ }
4156
+ /**
4157
+ * Creates a synthetic video MediaStreamTrack using canvas.
4158
+ *
4159
+ * @param config - Video configuration options.
4160
+ * @returns Object with track and cleanup function.
4161
+ *
4162
+ * @example
4163
+ * ```typescript
4164
+ * const { track, cleanup } = createSyntheticVideoTrack({
4165
+ * width: 1280,
4166
+ * height: 720,
4167
+ * animation: 'avatar',
4168
+ * label: 'Agent Camera',
4169
+ * });
4170
+ *
4171
+ * videoElement.srcObject = new MediaStream([track]);
4172
+ *
4173
+ * // When done:
4174
+ * cleanup();
4175
+ * ```
4176
+ */
4177
+ declare function createSyntheticVideoTrack(config?: SyntheticVideoConfig): {
4178
+ track: MediaStreamTrack;
4179
+ stream: MediaStream;
4180
+ cleanup: () => void;
4181
+ };
4182
+ /**
4183
+ * Creates a synthetic audio MediaStreamTrack using Web Audio API.
4184
+ *
4185
+ * @param config - Audio configuration options.
4186
+ * @returns Object with track and cleanup function.
4187
+ *
4188
+ * @example
4189
+ * ```typescript
4190
+ * const { track, cleanup } = createSyntheticAudioTrack({
4191
+ * frequency: 440,
4192
+ * volume: 0.1,
4193
+ * enabled: true, // Set to false for silent track
4194
+ * });
4195
+ *
4196
+ * audioElement.srcObject = new MediaStream([track]);
4197
+ *
4198
+ * // When done:
4199
+ * cleanup();
4200
+ * ```
4201
+ */
4202
+ declare function createSyntheticAudioTrack(config?: SyntheticAudioConfig): {
4203
+ track: MediaStreamTrack;
4204
+ stream: MediaStream;
4205
+ cleanup: () => void;
4206
+ setVolume: (volume: number) => void;
4207
+ setEnabled: (enabled: boolean) => void;
4208
+ };
4209
+ /**
4210
+ * Creates a complete mock media setup with both video and audio.
4211
+ *
4212
+ * @param videoConfig - Video configuration.
4213
+ * @param audioConfig - Audio configuration.
4214
+ * @returns Combined media setup.
4215
+ */
4216
+ declare function createSyntheticMedia(videoConfig?: SyntheticVideoConfig, audioConfig?: SyntheticAudioConfig): {
4217
+ videoTrack: MediaStreamTrack;
4218
+ audioTrack: MediaStreamTrack;
4219
+ combinedStream: MediaStream;
4220
+ cleanup: () => void;
4221
+ setAudioVolume: (volume: number) => void;
4222
+ setAudioEnabled: (enabled: boolean) => void;
4223
+ };
4224
+ /**
4225
+ * Preset configurations for common scenarios.
4226
+ */
4227
+ declare const SYNTHETIC_MEDIA_PRESETS: {
4228
+ /** Local user camera */
4229
+ readonly localCamera: {
4230
+ readonly video: {
4231
+ readonly width: 640;
4232
+ readonly height: 480;
4233
+ readonly animation: "avatar";
4234
+ readonly label: "You";
4235
+ readonly foregroundColor: "#4361ee";
4236
+ };
4237
+ readonly audio: {
4238
+ readonly enabled: false;
4239
+ };
4240
+ };
4241
+ /** Remote agent camera */
4242
+ readonly agentCamera: {
4243
+ readonly video: {
4244
+ readonly width: 640;
4245
+ readonly height: 480;
4246
+ readonly animation: "avatar";
4247
+ readonly label: "AI Agent";
4248
+ readonly foregroundColor: "#22c55e";
4249
+ readonly backgroundColor: "#0f172a";
4250
+ };
4251
+ readonly audio: {
4252
+ readonly enabled: false;
4253
+ readonly frequency: 300;
4254
+ };
4255
+ };
4256
+ /** Screen share simulation */
4257
+ readonly screenShare: {
4258
+ readonly video: {
4259
+ readonly width: 1920;
4260
+ readonly height: 1080;
4261
+ readonly animation: "bars";
4262
+ readonly label: "Screen Share";
4263
+ readonly backgroundColor: "#0a0a0a";
4264
+ readonly foregroundColor: "#f59e0b";
4265
+ };
4266
+ readonly audio: {
4267
+ readonly enabled: false;
4268
+ };
4269
+ };
4270
+ /** Voice-only call */
4271
+ readonly voiceOnly: {
4272
+ readonly video: {
4273
+ readonly width: 320;
4274
+ readonly height: 240;
4275
+ readonly animation: "wave";
4276
+ readonly label: "Voice Call";
4277
+ };
4278
+ readonly audio: {
4279
+ readonly enabled: false;
4280
+ readonly volume: 0.05;
4281
+ };
4282
+ };
4283
+ };
4284
+ /**
4285
+ * Creates synthetic media from a preset.
4286
+ */
4287
+ declare function createSyntheticMediaFromPreset(preset: keyof typeof SYNTHETIC_MEDIA_PRESETS): ReturnType<typeof createSyntheticMedia>;
4288
+
4289
+ /**
4290
+ * Gets or creates a global mock service instance.
4291
+ *
4292
+ * @param {Partial<MockServiceConfig>} config - Service configuration.
4293
+ * @returns {MockConversationService} The mock service instance.
4294
+ */
4295
+ declare function getStorybookMockService(config?: Partial<MockServiceConfig>): MockConversationService;
4296
+ /**
4297
+ * Resets the global mock service (useful between stories).
4298
+ */
4299
+ declare function resetStorybookMockService(): void;
4300
+ /**
4301
+ * Destroys the global mock service completely.
4302
+ */
4303
+ declare function destroyStorybookMockService(): Promise<void>;
4304
+ /**
4305
+ * Configuration for the mock service decorator.
4306
+ */
4307
+ interface MockServiceDecoratorConfig {
4308
+ /** Organization ID */
4309
+ organizationId?: string;
4310
+ /** Auto-register a user */
4311
+ autoRegisterUser?: {
4312
+ identity: string;
4313
+ secret?: string;
4314
+ name?: string;
4315
+ };
4316
+ /** Auto-create a room */
4317
+ autoCreateRoom?: {
4318
+ language?: string;
4319
+ timezone?: string;
4320
+ };
4321
+ /** Auto-start an agent */
4322
+ autoStartAgent?: Partial<MockAgentConfig>;
4323
+ /** Pre-seed messages */
4324
+ seedMessages?: Array<{
4325
+ from: string;
4326
+ content: string;
4327
+ }>;
4328
+ /** Latency simulation */
4329
+ latencyMs?: number;
4330
+ /** Scenario to apply */
4331
+ scenario?: MockScenario;
4332
+ /** Whether to simulate video (enables synthetic video tracks) */
4333
+ simulateVideo?: boolean;
4334
+ }
4335
+ /**
4336
+ * Generic decorator type for Storybook compatibility.
4337
+ * Uses `any` to be compatible with all Storybook renderer types.
4338
+ */
4339
+ type Decorator = (storyFn: () => any, context?: any) => any;
4340
+ /**
4341
+ * Creates a Storybook decorator that provides a MockConversationService.
4342
+ *
4343
+ * @param {MockServiceDecoratorConfig} config - Decorator configuration.
4344
+ * @returns {Decorator} Storybook decorator function.
4345
+ *
4346
+ * @example
4347
+ * ```typescript
4348
+ * export const Default: Story = {
4349
+ * decorators: [
4350
+ * withMockConversationService({
4351
+ * autoRegisterUser: { identity: 'user_1', name: 'Test User' },
4352
+ * autoCreateRoom: { language: 'en' },
4353
+ * autoStartAgent: { responseStrategy: 'echo' },
4354
+ * }),
4355
+ * ],
4356
+ * };
4357
+ * ```
4358
+ */
4359
+ declare function withMockConversationService(config?: MockServiceDecoratorConfig): Decorator;
4360
+ /**
4361
+ * Type guard to check if ConversationService is a mock.
4362
+ *
4363
+ * @param {unknown} service - Service to check.
4364
+ * @returns {service is MockConversationService} True if mock.
4365
+ */
4366
+ declare function isMockConversationService(service: unknown): service is MockConversationService;
4367
+ /**
4368
+ * Pre-configured scenarios for common Storybook use cases.
4369
+ */
4370
+ declare const StorybookScenarios: Record<string, MockServiceDecoratorConfig>;
4371
+ /**
4372
+ * Creates a mock service factory function for use in story args.
4373
+ *
4374
+ * This is useful when you need to pass a ConversationService as a prop.
4375
+ *
4376
+ * @param {Partial<MockServiceConfig>} config - Configuration.
4377
+ * @returns {() => MockConversationService} Factory function.
4378
+ *
4379
+ * @example
4380
+ * ```typescript
4381
+ * export const Default: Story = {
4382
+ * args: {
4383
+ * conversationService: createMockServiceFactory({
4384
+ * latencyMs: 100,
4385
+ * }),
4386
+ * },
4387
+ * };
4388
+ * ```
4389
+ */
4390
+ declare function createMockServiceFactory(config?: Partial<MockServiceConfig>): () => MockConversationService;
4391
+ /**
4392
+ * Action helpers for Storybook interactions.
4393
+ */
4394
+ declare const MockServiceActions: {
4395
+ /**
4396
+ * Simulates receiving a message.
4397
+ */
4398
+ receiveMessage(from: string, content: string): Promise<void>;
4399
+ /**
4400
+ * Simulates a participant joining.
4401
+ */
4402
+ simulateJoin(identity: string, name?: string): void;
4403
+ /**
4404
+ * Simulates a participant leaving.
4405
+ */
4406
+ simulateLeave(identity: string): void;
4407
+ /**
4408
+ * Simulates a participant joining with video and audio.
4409
+ *
4410
+ * @param identity - Participant identity.
4411
+ * @param name - Display name.
4412
+ * @param options - Additional options.
4413
+ */
4414
+ simulateVideoParticipant(identity: string, name?: string, options?: {
4415
+ withCamera?: boolean;
4416
+ withMicrophone?: boolean;
4417
+ }): Promise<void>;
4418
+ /**
4419
+ * Simulates an agent joining with video capabilities.
4420
+ *
4421
+ * @param identity - Agent identity.
4422
+ * @param name - Display name.
4423
+ */
4424
+ simulateVideoAgent(identity: string, name?: string): Promise<void>;
4425
+ /**
4426
+ * Enables the local participant's camera.
4427
+ */
4428
+ enableLocalCamera(): Promise<void>;
4429
+ /**
4430
+ * Disables the local participant's camera.
4431
+ */
4432
+ disableLocalCamera(): Promise<void>;
4433
+ /**
4434
+ * Enables the local participant's microphone.
4435
+ */
4436
+ enableLocalMicrophone(): Promise<void>;
4437
+ /**
4438
+ * Simulates multiple participants for layout testing.
4439
+ *
4440
+ * @param count - Number of participants to add.
4441
+ */
4442
+ simulateMultipleParticipants(count: number): Promise<void>;
4443
+ /**
4444
+ * Clears all remote participants (useful for reset).
4445
+ */
4446
+ clearParticipants(): void;
4447
+ /**
4448
+ * Simulates a call request.
4449
+ */
4450
+ simulateCallRequest(name: string, guestId?: string): void;
4451
+ /**
4452
+ * Simulates network disconnection.
4453
+ */
4454
+ simulateDisconnect(): Promise<void>;
4455
+ /**
4456
+ * Gets event history for debugging.
4457
+ */
4458
+ getEventHistory(): unknown[];
4459
+ /**
4460
+ * Exports current state for debugging.
4461
+ */
4462
+ exportState(): object;
4463
+ /**
4464
+ * Gets the current room instance.
4465
+ */
4466
+ getRoom(): MockRoom;
4467
+ };
4468
+
4469
+ export { AgentNotFoundError, Asset, type AssetDisplayOptions, type AssetItemDisplayOptions, ConversationServiceFactory, type ConversationServiceFactoryOptions, InvalidOperationError, type LiveKitMode, type MockAgentConfig, type MockAgentMessage, type MockAgentMessageEvent, type MockAgentResponseStrategy, type MockAgentStartedEvent, type MockAgentState, type MockAgentStatus, type MockAgentStoppedEvent, type MockConnectionState$1 as MockConnectionState, MockConversationService, type MockDataReceivedEvent, type MockError, type MockErrorCode, type MockErrorConfig, type MockErrorEvent, type MockEvent, type MockEventBase, MockEventEmitter, type MockEventListener, type MockEventListenerMap, type MockEventType, MockLiveKitError, MockLocalParticipant, type MockMessageReceivedEvent, type MockMessageSentEvent, type MockMessageState, MockParticipant, type MockParticipantAttributesChangedEvent, type MockParticipantJoinedEvent, type MockParticipantKind$1 as MockParticipantKind, type MockParticipantLeftEvent, type MockParticipantRole, type MockParticipantState, MockRoom, type MockRoomConnectionStateChangedEvent, type MockRoomCreatedEvent, type MockRoomEndedEvent, type MockRoomState, type MockScenario, MockServiceActions, type MockServiceConfig, type MockServiceDecoratorConfig, MockState, type MockStateSnapshot, type MockStateSnapshotJSON, MockTextStreamReader, MockTrack, type MockTrackKind, type MockTrackMutedEvent, MockTrackPublication, type MockTrackPublishedEvent, type MockTrackSource, type MockTrackState, type MockTrackUnmutedEvent, type MockTrackUnpublishedEvent, type MockTypingIndicatorEvent, NetworkError, OSBAsset, OSBSideBar, OSBUpload, ParticipantAlreadyJoinedError, ParticipantNotFoundError, RoomEndedError, RoomNotFoundError, SYNTHETIC_MEDIA_PRESETS, SideBar, StorybookScenarios, type SyntheticAudioConfig, type SyntheticVideoConfig, TimeoutError, TrackNotFoundError, UnauthorizedError, Upload, type UploadConfig, createAgentFixture, createAgentWithCannedResponses, createChatScenario, createConversationFixture, createConversationService, createDefaultConfig, createDefaultRoomFixture, createDeterministicConfig, createErrorFromMockError, createLatencyConfig, createMessageFixture, createMockConversationService, createMockServiceFactory, createParticipantBatch, createParticipantFixture, createRoomWithAgent, createRoomWithAgentAndDataTrack, createRoomWithLocalParticipant, createRoomWithMediaTracks, createRoomWithTwoParticipants, createSequentialAgent, createStrictConfig, createSyntheticAudioTrack, createSyntheticMedia, createSyntheticMediaFromPreset, createSyntheticVideoTrack, createVideoCallScenario, decodeMockToken, destroyStorybookMockService, generateMockApiResponseId, generateMockExternalId, generateMockId, generateMockIdBatch, generateMockMessageId, generateMockParticipantIdentity, generateMockRoomName, generateMockToken, generateMockTrackSid, generateMockWsUrl, generateSeededMockId, getStorybookMockService, isMockConversationService, isMockError, isMockLiveKitError, resetIdCounter, resetStorybookMockService, setIdCounter, withMockConversationService };