@memberjunction/ng-conversations 5.40.2 → 5.42.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (391) hide show
  1. package/README.md +57 -0
  2. package/dist/__tests__/channel-optional-surface.test.d.ts +2 -0
  3. package/dist/__tests__/channel-optional-surface.test.d.ts.map +1 -0
  4. package/dist/__tests__/channel-optional-surface.test.js +53 -0
  5. package/dist/__tests__/channel-optional-surface.test.js.map +1 -0
  6. package/dist/__tests__/chat-events.test.d.ts +14 -0
  7. package/dist/__tests__/chat-events.test.d.ts.map +1 -0
  8. package/dist/__tests__/chat-events.test.js +109 -0
  9. package/dist/__tests__/chat-events.test.js.map +1 -0
  10. package/dist/__tests__/conversation-naming.test.d.ts +2 -0
  11. package/dist/__tests__/conversation-naming.test.d.ts.map +1 -0
  12. package/dist/__tests__/conversation-naming.test.js +110 -0
  13. package/dist/__tests__/conversation-naming.test.js.map +1 -0
  14. package/dist/__tests__/delegation-result-parser.test.d.ts +2 -0
  15. package/dist/__tests__/delegation-result-parser.test.d.ts.map +1 -0
  16. package/dist/__tests__/delegation-result-parser.test.js +107 -0
  17. package/dist/__tests__/delegation-result-parser.test.js.map +1 -0
  18. package/dist/__tests__/event-wiring.test.d.ts +15 -0
  19. package/dist/__tests__/event-wiring.test.d.ts.map +1 -0
  20. package/dist/__tests__/event-wiring.test.js +100 -0
  21. package/dist/__tests__/event-wiring.test.js.map +1 -0
  22. package/dist/__tests__/narration-template.test.d.ts +2 -0
  23. package/dist/__tests__/narration-template.test.d.ts.map +1 -0
  24. package/dist/__tests__/narration-template.test.js +76 -0
  25. package/dist/__tests__/narration-template.test.js.map +1 -0
  26. package/dist/__tests__/realtime-agent-picker-models.test.d.ts +2 -0
  27. package/dist/__tests__/realtime-agent-picker-models.test.d.ts.map +1 -0
  28. package/dist/__tests__/realtime-agent-picker-models.test.js +49 -0
  29. package/dist/__tests__/realtime-agent-picker-models.test.js.map +1 -0
  30. package/dist/__tests__/realtime-audio-visuals.test.d.ts +2 -0
  31. package/dist/__tests__/realtime-audio-visuals.test.d.ts.map +1 -0
  32. package/dist/__tests__/realtime-audio-visuals.test.js +123 -0
  33. package/dist/__tests__/realtime-audio-visuals.test.js.map +1 -0
  34. package/dist/__tests__/realtime-delegation-card-cancel.test.d.ts +2 -0
  35. package/dist/__tests__/realtime-delegation-card-cancel.test.d.ts.map +1 -0
  36. package/dist/__tests__/realtime-delegation-card-cancel.test.js +48 -0
  37. package/dist/__tests__/realtime-delegation-card-cancel.test.js.map +1 -0
  38. package/dist/__tests__/realtime-disclosure.test.d.ts +2 -0
  39. package/dist/__tests__/realtime-disclosure.test.d.ts.map +1 -0
  40. package/dist/__tests__/realtime-disclosure.test.js +164 -0
  41. package/dist/__tests__/realtime-disclosure.test.js.map +1 -0
  42. package/dist/__tests__/realtime-pairing.test.d.ts +2 -0
  43. package/dist/__tests__/realtime-pairing.test.d.ts.map +1 -0
  44. package/dist/__tests__/realtime-pairing.test.js +207 -0
  45. package/dist/__tests__/realtime-pairing.test.js.map +1 -0
  46. package/dist/__tests__/realtime-review-lifecycle.test.d.ts +2 -0
  47. package/dist/__tests__/realtime-review-lifecycle.test.d.ts.map +1 -0
  48. package/dist/__tests__/realtime-review-lifecycle.test.js +154 -0
  49. package/dist/__tests__/realtime-review-lifecycle.test.js.map +1 -0
  50. package/dist/__tests__/realtime-session-cancel-usage.test.d.ts +2 -0
  51. package/dist/__tests__/realtime-session-cancel-usage.test.d.ts.map +1 -0
  52. package/dist/__tests__/realtime-session-cancel-usage.test.js +230 -0
  53. package/dist/__tests__/realtime-session-cancel-usage.test.js.map +1 -0
  54. package/dist/__tests__/realtime-session-channels.test.d.ts +2 -0
  55. package/dist/__tests__/realtime-session-channels.test.d.ts.map +1 -0
  56. package/dist/__tests__/realtime-session-channels.test.js +252 -0
  57. package/dist/__tests__/realtime-session-channels.test.js.map +1 -0
  58. package/dist/__tests__/realtime-session-client-tools.test.d.ts +2 -0
  59. package/dist/__tests__/realtime-session-client-tools.test.d.ts.map +1 -0
  60. package/dist/__tests__/realtime-session-client-tools.test.js +103 -0
  61. package/dist/__tests__/realtime-session-client-tools.test.js.map +1 -0
  62. package/dist/__tests__/realtime-session-minimized.test.d.ts +2 -0
  63. package/dist/__tests__/realtime-session-minimized.test.d.ts.map +1 -0
  64. package/dist/__tests__/realtime-session-minimized.test.js +32 -0
  65. package/dist/__tests__/realtime-session-minimized.test.js.map +1 -0
  66. package/dist/__tests__/realtime-session-mint.test.d.ts +2 -0
  67. package/dist/__tests__/realtime-session-mint.test.d.ts.map +1 -0
  68. package/dist/__tests__/realtime-session-mint.test.js +69 -0
  69. package/dist/__tests__/realtime-session-mint.test.js.map +1 -0
  70. package/dist/__tests__/realtime-session-policy.test.d.ts +2 -0
  71. package/dist/__tests__/realtime-session-policy.test.d.ts.map +1 -0
  72. package/dist/__tests__/realtime-session-policy.test.js +303 -0
  73. package/dist/__tests__/realtime-session-policy.test.js.map +1 -0
  74. package/dist/__tests__/realtime-session-review.service.test.d.ts +2 -0
  75. package/dist/__tests__/realtime-session-review.service.test.d.ts.map +1 -0
  76. package/dist/__tests__/realtime-session-review.service.test.js +743 -0
  77. package/dist/__tests__/realtime-session-review.service.test.js.map +1 -0
  78. package/dist/__tests__/realtime-session-state.test.d.ts +2 -0
  79. package/dist/__tests__/realtime-session-state.test.d.ts.map +1 -0
  80. package/dist/__tests__/realtime-session-state.test.js +83 -0
  81. package/dist/__tests__/realtime-session-state.test.js.map +1 -0
  82. package/dist/__tests__/realtime-session-timeline-card.test.d.ts +2 -0
  83. package/dist/__tests__/realtime-session-timeline-card.test.d.ts.map +1 -0
  84. package/dist/__tests__/realtime-session-timeline-card.test.js +106 -0
  85. package/dist/__tests__/realtime-session-timeline-card.test.js.map +1 -0
  86. package/dist/__tests__/realtime-session-timeline.test.d.ts +2 -0
  87. package/dist/__tests__/realtime-session-timeline.test.d.ts.map +1 -0
  88. package/dist/__tests__/realtime-session-timeline.test.js +142 -0
  89. package/dist/__tests__/realtime-session-timeline.test.js.map +1 -0
  90. package/dist/__tests__/realtime-sessions-adapter.test.d.ts +19 -0
  91. package/dist/__tests__/realtime-sessions-adapter.test.d.ts.map +1 -0
  92. package/dist/__tests__/realtime-sessions-adapter.test.js +188 -0
  93. package/dist/__tests__/realtime-sessions-adapter.test.js.map +1 -0
  94. package/dist/__tests__/realtime-surface-panel-prefs.test.d.ts +2 -0
  95. package/dist/__tests__/realtime-surface-panel-prefs.test.d.ts.map +1 -0
  96. package/dist/__tests__/realtime-surface-panel-prefs.test.js +100 -0
  97. package/dist/__tests__/realtime-surface-panel-prefs.test.js.map +1 -0
  98. package/dist/__tests__/realtime-surface-tabs-model.test.d.ts +2 -0
  99. package/dist/__tests__/realtime-surface-tabs-model.test.d.ts.map +1 -0
  100. package/dist/__tests__/realtime-surface-tabs-model.test.js +193 -0
  101. package/dist/__tests__/realtime-surface-tabs-model.test.js.map +1 -0
  102. package/dist/__tests__/remote-browser-audio-player.test.d.ts +2 -0
  103. package/dist/__tests__/remote-browser-audio-player.test.d.ts.map +1 -0
  104. package/dist/__tests__/remote-browser-audio-player.test.js +137 -0
  105. package/dist/__tests__/remote-browser-audio-player.test.js.map +1 -0
  106. package/dist/__tests__/remote-browser-channel.test.d.ts +2 -0
  107. package/dist/__tests__/remote-browser-channel.test.d.ts.map +1 -0
  108. package/dist/__tests__/remote-browser-channel.test.js +585 -0
  109. package/dist/__tests__/remote-browser-channel.test.js.map +1 -0
  110. package/dist/__tests__/slot-defaults.test.d.ts +24 -0
  111. package/dist/__tests__/slot-defaults.test.d.ts.map +1 -0
  112. package/dist/__tests__/slot-defaults.test.js +63 -0
  113. package/dist/__tests__/slot-defaults.test.js.map +1 -0
  114. package/dist/__tests__/user-authorization.test.d.ts +2 -0
  115. package/dist/__tests__/user-authorization.test.d.ts.map +1 -0
  116. package/dist/__tests__/user-authorization.test.js +97 -0
  117. package/dist/__tests__/user-authorization.test.js.map +1 -0
  118. package/dist/__tests__/voice-session-narration.test.d.ts +2 -0
  119. package/dist/__tests__/voice-session-narration.test.d.ts.map +1 -0
  120. package/dist/__tests__/voice-session-narration.test.js +609 -0
  121. package/dist/__tests__/voice-session-narration.test.js.map +1 -0
  122. package/dist/__tests__/whiteboard-artifact-viewer.test.d.ts +2 -0
  123. package/dist/__tests__/whiteboard-artifact-viewer.test.d.ts.map +1 -0
  124. package/dist/__tests__/whiteboard-artifact-viewer.test.js +101 -0
  125. package/dist/__tests__/whiteboard-artifact-viewer.test.js.map +1 -0
  126. package/dist/__tests__/whiteboard-channel.test.d.ts +2 -0
  127. package/dist/__tests__/whiteboard-channel.test.d.ts.map +1 -0
  128. package/dist/__tests__/whiteboard-channel.test.js +260 -0
  129. package/dist/__tests__/whiteboard-channel.test.js.map +1 -0
  130. package/dist/__tests__/whiteboard-restore-state.test.d.ts +2 -0
  131. package/dist/__tests__/whiteboard-restore-state.test.d.ts.map +1 -0
  132. package/dist/__tests__/whiteboard-restore-state.test.js +108 -0
  133. package/dist/__tests__/whiteboard-restore-state.test.js.map +1 -0
  134. package/dist/lib/components/collection/collections-full-view.component.d.ts +105 -2
  135. package/dist/lib/components/collection/collections-full-view.component.d.ts.map +1 -1
  136. package/dist/lib/components/collection/collections-full-view.component.js +1378 -489
  137. package/dist/lib/components/collection/collections-full-view.component.js.map +1 -1
  138. package/dist/lib/components/conversation/conversation-chat-area.component.d.ts +209 -3
  139. package/dist/lib/components/conversation/conversation-chat-area.component.d.ts.map +1 -1
  140. package/dist/lib/components/conversation/conversation-chat-area.component.js +924 -350
  141. package/dist/lib/components/conversation/conversation-chat-area.component.js.map +1 -1
  142. package/dist/lib/components/conversation/conversation-list.component.d.ts +98 -5
  143. package/dist/lib/components/conversation/conversation-list.component.d.ts.map +1 -1
  144. package/dist/lib/components/conversation/conversation-list.component.js +1102 -401
  145. package/dist/lib/components/conversation/conversation-list.component.js.map +1 -1
  146. package/dist/lib/components/mention/mention-dropdown.component.js +35 -17
  147. package/dist/lib/components/mention/mention-dropdown.component.js.map +1 -1
  148. package/dist/lib/components/mention/mention-editor.component.d.ts +4 -0
  149. package/dist/lib/components/mention/mention-editor.component.d.ts.map +1 -1
  150. package/dist/lib/components/mention/mention-editor.component.js +43 -19
  151. package/dist/lib/components/mention/mention-editor.component.js.map +1 -1
  152. package/dist/lib/components/message/message-input-box.component.d.ts +17 -1
  153. package/dist/lib/components/message/message-input-box.component.d.ts.map +1 -1
  154. package/dist/lib/components/message/message-input-box.component.js +73 -15
  155. package/dist/lib/components/message/message-input-box.component.js.map +1 -1
  156. package/dist/lib/components/message/message-input.component.d.ts +142 -6
  157. package/dist/lib/components/message/message-input.component.d.ts.map +1 -1
  158. package/dist/lib/components/message/message-input.component.js +328 -82
  159. package/dist/lib/components/message/message-input.component.js.map +1 -1
  160. package/dist/lib/components/message/message-item.component.d.ts +28 -3
  161. package/dist/lib/components/message/message-item.component.d.ts.map +1 -1
  162. package/dist/lib/components/message/message-item.component.js +180 -108
  163. package/dist/lib/components/message/message-item.component.js.map +1 -1
  164. package/dist/lib/components/message/message-list.component.d.ts +81 -2
  165. package/dist/lib/components/message/message-list.component.d.ts.map +1 -1
  166. package/dist/lib/components/message/message-list.component.js +252 -87
  167. package/dist/lib/components/message/message-list.component.js.map +1 -1
  168. package/dist/lib/components/project/project-form-modal.component.d.ts +5 -1
  169. package/dist/lib/components/project/project-form-modal.component.d.ts.map +1 -1
  170. package/dist/lib/components/project/project-form-modal.component.js +104 -85
  171. package/dist/lib/components/project/project-form-modal.component.js.map +1 -1
  172. package/dist/lib/components/realtime/channels/base-realtime-channel-client.d.ts +304 -0
  173. package/dist/lib/components/realtime/channels/base-realtime-channel-client.d.ts.map +1 -0
  174. package/dist/lib/components/realtime/channels/base-realtime-channel-client.js +198 -0
  175. package/dist/lib/components/realtime/channels/base-realtime-channel-client.js.map +1 -0
  176. package/dist/lib/components/realtime/channels/channel-onboarding-panel.component.d.ts +25 -0
  177. package/dist/lib/components/realtime/channels/channel-onboarding-panel.component.d.ts.map +1 -0
  178. package/dist/lib/components/realtime/channels/channel-onboarding-panel.component.js +140 -0
  179. package/dist/lib/components/realtime/channels/channel-onboarding-panel.component.js.map +1 -0
  180. package/dist/lib/components/realtime/channels/realtime-channel-pane.component.d.ts +35 -0
  181. package/dist/lib/components/realtime/channels/realtime-channel-pane.component.d.ts.map +1 -0
  182. package/dist/lib/components/realtime/channels/realtime-channel-pane.component.js +58 -0
  183. package/dist/lib/components/realtime/channels/realtime-channel-pane.component.js.map +1 -0
  184. package/dist/lib/components/realtime/realtime-activity-rail.component.d.ts +63 -0
  185. package/dist/lib/components/realtime/realtime-activity-rail.component.d.ts.map +1 -0
  186. package/dist/lib/components/realtime/realtime-activity-rail.component.js +260 -0
  187. package/dist/lib/components/realtime/realtime-activity-rail.component.js.map +1 -0
  188. package/dist/lib/components/realtime/realtime-agent-banner.component.d.ts +117 -0
  189. package/dist/lib/components/realtime/realtime-agent-banner.component.d.ts.map +1 -0
  190. package/dist/lib/components/realtime/realtime-agent-banner.component.js +504 -0
  191. package/dist/lib/components/realtime/realtime-agent-banner.component.js.map +1 -0
  192. package/dist/lib/components/realtime/realtime-agent-picker.component.d.ts +179 -0
  193. package/dist/lib/components/realtime/realtime-agent-picker.component.d.ts.map +1 -0
  194. package/dist/lib/components/realtime/realtime-agent-picker.component.js +634 -0
  195. package/dist/lib/components/realtime/realtime-agent-picker.component.js.map +1 -0
  196. package/dist/lib/components/realtime/realtime-audio-visuals.d.ts +97 -0
  197. package/dist/lib/components/realtime/realtime-audio-visuals.d.ts.map +1 -0
  198. package/dist/lib/components/realtime/realtime-audio-visuals.js +139 -0
  199. package/dist/lib/components/realtime/realtime-audio-visuals.js.map +1 -0
  200. package/dist/lib/components/realtime/realtime-channel-strip.component.d.ts +29 -0
  201. package/dist/lib/components/realtime/realtime-channel-strip.component.d.ts.map +1 -0
  202. package/dist/lib/components/realtime/realtime-channel-strip.component.js +69 -0
  203. package/dist/lib/components/realtime/realtime-channel-strip.component.js.map +1 -0
  204. package/dist/lib/components/realtime/realtime-composer.component.d.ts +65 -0
  205. package/dist/lib/components/realtime/realtime-composer.component.d.ts.map +1 -0
  206. package/dist/lib/components/realtime/realtime-composer.component.js +256 -0
  207. package/dist/lib/components/realtime/realtime-composer.component.js.map +1 -0
  208. package/dist/lib/components/realtime/realtime-delegation-card.component.d.ts +71 -0
  209. package/dist/lib/components/realtime/realtime-delegation-card.component.d.ts.map +1 -0
  210. package/dist/lib/components/realtime/realtime-delegation-card.component.js +324 -0
  211. package/dist/lib/components/realtime/realtime-delegation-card.component.js.map +1 -0
  212. package/dist/lib/components/realtime/realtime-disclosure.d.ts +135 -0
  213. package/dist/lib/components/realtime/realtime-disclosure.d.ts.map +1 -0
  214. package/dist/lib/components/realtime/realtime-disclosure.js +188 -0
  215. package/dist/lib/components/realtime/realtime-disclosure.js.map +1 -0
  216. package/dist/lib/components/realtime/realtime-session-overlay.component.d.ts +491 -0
  217. package/dist/lib/components/realtime/realtime-session-overlay.component.d.ts.map +1 -0
  218. package/dist/lib/components/realtime/realtime-session-overlay.component.js +1274 -0
  219. package/dist/lib/components/realtime/realtime-session-overlay.component.js.map +1 -0
  220. package/dist/lib/components/realtime/realtime-session-state.d.ts +191 -0
  221. package/dist/lib/components/realtime/realtime-session-state.d.ts.map +1 -0
  222. package/dist/lib/components/realtime/realtime-session-state.js +244 -0
  223. package/dist/lib/components/realtime/realtime-session-state.js.map +1 -0
  224. package/dist/lib/components/realtime/realtime-session-thread.component.d.ts +56 -0
  225. package/dist/lib/components/realtime/realtime-session-thread.component.d.ts.map +1 -0
  226. package/dist/lib/components/realtime/realtime-session-thread.component.js +246 -0
  227. package/dist/lib/components/realtime/realtime-session-thread.component.js.map +1 -0
  228. package/dist/lib/components/realtime/realtime-session-timeline-card.component.d.ts +51 -0
  229. package/dist/lib/components/realtime/realtime-session-timeline-card.component.d.ts.map +1 -0
  230. package/dist/lib/components/realtime/realtime-session-timeline-card.component.js +193 -0
  231. package/dist/lib/components/realtime/realtime-session-timeline-card.component.js.map +1 -0
  232. package/dist/lib/components/realtime/realtime-surface-panel-prefs.d.ts +77 -0
  233. package/dist/lib/components/realtime/realtime-surface-panel-prefs.d.ts.map +1 -0
  234. package/dist/lib/components/realtime/realtime-surface-panel-prefs.js +114 -0
  235. package/dist/lib/components/realtime/realtime-surface-panel-prefs.js.map +1 -0
  236. package/dist/lib/components/realtime/realtime-surface-tabs.component.d.ts +173 -0
  237. package/dist/lib/components/realtime/realtime-surface-tabs.component.d.ts.map +1 -0
  238. package/dist/lib/components/realtime/realtime-surface-tabs.component.js +496 -0
  239. package/dist/lib/components/realtime/realtime-surface-tabs.component.js.map +1 -0
  240. package/dist/lib/components/realtime/realtime-surface-tabs.model.d.ts +181 -0
  241. package/dist/lib/components/realtime/realtime-surface-tabs.model.d.ts.map +1 -0
  242. package/dist/lib/components/realtime/realtime-surface-tabs.model.js +223 -0
  243. package/dist/lib/components/realtime/realtime-surface-tabs.model.js.map +1 -0
  244. package/dist/lib/components/realtime/remote-browser/remote-browser-audio-player.d.ts +163 -0
  245. package/dist/lib/components/realtime/remote-browser/remote-browser-audio-player.d.ts.map +1 -0
  246. package/dist/lib/components/realtime/remote-browser/remote-browser-audio-player.js +309 -0
  247. package/dist/lib/components/realtime/remote-browser/remote-browser-audio-player.js.map +1 -0
  248. package/dist/lib/components/realtime/remote-browser/remote-browser-channel.d.ts +201 -0
  249. package/dist/lib/components/realtime/remote-browser/remote-browser-channel.d.ts.map +1 -0
  250. package/dist/lib/components/realtime/remote-browser/remote-browser-channel.js +681 -0
  251. package/dist/lib/components/realtime/remote-browser/remote-browser-channel.js.map +1 -0
  252. package/dist/lib/components/realtime/remote-browser/remote-browser-surface.component.d.ts +379 -0
  253. package/dist/lib/components/realtime/remote-browser/remote-browser-surface.component.d.ts.map +1 -0
  254. package/dist/lib/components/realtime/remote-browser/remote-browser-surface.component.js +914 -0
  255. package/dist/lib/components/realtime/remote-browser/remote-browser-surface.component.js.map +1 -0
  256. package/dist/lib/components/realtime/remote-browser/remote-browser-tools.d.ts +87 -0
  257. package/dist/lib/components/realtime/remote-browser/remote-browser-tools.d.ts.map +1 -0
  258. package/dist/lib/components/realtime/remote-browser/remote-browser-tools.js +223 -0
  259. package/dist/lib/components/realtime/remote-browser/remote-browser-tools.js.map +1 -0
  260. package/dist/lib/components/realtime/whiteboard/whiteboard-artifact-viewer.component.d.ts +48 -0
  261. package/dist/lib/components/realtime/whiteboard/whiteboard-artifact-viewer.component.d.ts.map +1 -0
  262. package/dist/lib/components/realtime/whiteboard/whiteboard-artifact-viewer.component.js +180 -0
  263. package/dist/lib/components/realtime/whiteboard/whiteboard-artifact-viewer.component.js.map +1 -0
  264. package/dist/lib/components/realtime/whiteboard/whiteboard-channel.d.ts +119 -0
  265. package/dist/lib/components/realtime/whiteboard/whiteboard-channel.d.ts.map +1 -0
  266. package/dist/lib/components/realtime/whiteboard/whiteboard-channel.js +274 -0
  267. package/dist/lib/components/realtime/whiteboard/whiteboard-channel.js.map +1 -0
  268. package/dist/lib/components/slots/mj-chat-agent-presence-default.component.d.ts +11 -0
  269. package/dist/lib/components/slots/mj-chat-agent-presence-default.component.d.ts.map +1 -0
  270. package/dist/lib/components/slots/mj-chat-agent-presence-default.component.js +98 -0
  271. package/dist/lib/components/slots/mj-chat-agent-presence-default.component.js.map +1 -0
  272. package/dist/lib/components/slots/mj-chat-demonstration-surface-default.component.d.ts +9 -0
  273. package/dist/lib/components/slots/mj-chat-demonstration-surface-default.component.d.ts.map +1 -0
  274. package/dist/lib/components/slots/mj-chat-demonstration-surface-default.component.js +35 -0
  275. package/dist/lib/components/slots/mj-chat-demonstration-surface-default.component.js.map +1 -0
  276. package/dist/lib/components/slots/mj-chat-empty-state-default.component.d.ts +28 -0
  277. package/dist/lib/components/slots/mj-chat-empty-state-default.component.d.ts.map +1 -0
  278. package/dist/lib/components/slots/mj-chat-empty-state-default.component.js +104 -0
  279. package/dist/lib/components/slots/mj-chat-empty-state-default.component.js.map +1 -0
  280. package/dist/lib/components/slots/mj-chat-header-default.component.d.ts +11 -0
  281. package/dist/lib/components/slots/mj-chat-header-default.component.d.ts.map +1 -0
  282. package/dist/lib/components/slots/mj-chat-header-default.component.js +103 -0
  283. package/dist/lib/components/slots/mj-chat-header-default.component.js.map +1 -0
  284. package/dist/lib/components/slots/mj-chat-message-bubble-default.component.d.ts +15 -0
  285. package/dist/lib/components/slots/mj-chat-message-bubble-default.component.d.ts.map +1 -0
  286. package/dist/lib/components/slots/mj-chat-message-bubble-default.component.js +73 -0
  287. package/dist/lib/components/slots/mj-chat-message-bubble-default.component.js.map +1 -0
  288. package/dist/lib/components/slots/mj-chat-message-extra-default.component.d.ts +9 -0
  289. package/dist/lib/components/slots/mj-chat-message-extra-default.component.d.ts.map +1 -0
  290. package/dist/lib/components/slots/mj-chat-message-extra-default.component.js +34 -0
  291. package/dist/lib/components/slots/mj-chat-message-extra-default.component.js.map +1 -0
  292. package/dist/lib/components/slots/slot-interfaces.d.ts +95 -0
  293. package/dist/lib/components/slots/slot-interfaces.d.ts.map +1 -0
  294. package/dist/lib/components/slots/slot-interfaces.js +18 -0
  295. package/dist/lib/components/slots/slot-interfaces.js.map +1 -0
  296. package/dist/lib/components/workspace/conversation-workspace.component.d.ts +15 -0
  297. package/dist/lib/components/workspace/conversation-workspace.component.d.ts.map +1 -1
  298. package/dist/lib/components/workspace/conversation-workspace.component.js +41 -12
  299. package/dist/lib/components/workspace/conversation-workspace.component.js.map +1 -1
  300. package/dist/lib/conversations.module.d.ts +12 -1
  301. package/dist/lib/conversations.module.d.ts.map +1 -1
  302. package/dist/lib/conversations.module.js +93 -5
  303. package/dist/lib/conversations.module.js.map +1 -1
  304. package/dist/lib/directives/chat-slot.directive.d.ts +44 -0
  305. package/dist/lib/directives/chat-slot.directive.d.ts.map +1 -0
  306. package/dist/lib/directives/chat-slot.directive.js +54 -0
  307. package/dist/lib/directives/chat-slot.directive.js.map +1 -0
  308. package/dist/lib/events/chat-events.d.ts +137 -0
  309. package/dist/lib/events/chat-events.d.ts.map +1 -0
  310. package/dist/lib/events/chat-events.js +189 -0
  311. package/dist/lib/events/chat-events.js.map +1 -0
  312. package/dist/lib/models/conversation-state.model.d.ts +2 -1
  313. package/dist/lib/models/conversation-state.model.d.ts.map +1 -1
  314. package/dist/lib/models/conversation-state.model.js.map +1 -1
  315. package/dist/lib/services/artifact-state.service.d.ts +1 -1
  316. package/dist/lib/services/artifact-state.service.d.ts.map +1 -1
  317. package/dist/lib/services/artifact-state.service.js +29 -7
  318. package/dist/lib/services/artifact-state.service.js.map +1 -1
  319. package/dist/lib/services/conversation-agent.service.d.ts +60 -74
  320. package/dist/lib/services/conversation-agent.service.d.ts.map +1 -1
  321. package/dist/lib/services/conversation-agent.service.js +100 -313
  322. package/dist/lib/services/conversation-agent.service.js.map +1 -1
  323. package/dist/lib/services/conversation-bridge.service.d.ts +11 -70
  324. package/dist/lib/services/conversation-bridge.service.d.ts.map +1 -1
  325. package/dist/lib/services/conversation-bridge.service.js +51 -85
  326. package/dist/lib/services/conversation-bridge.service.js.map +1 -1
  327. package/dist/lib/services/conversation-naming.d.ts +63 -0
  328. package/dist/lib/services/conversation-naming.d.ts.map +1 -0
  329. package/dist/lib/services/conversation-naming.js +58 -0
  330. package/dist/lib/services/conversation-naming.js.map +1 -0
  331. package/dist/lib/services/conversation-streaming.service.d.ts +24 -154
  332. package/dist/lib/services/conversation-streaming.service.d.ts.map +1 -1
  333. package/dist/lib/services/conversation-streaming.service.js +39 -361
  334. package/dist/lib/services/conversation-streaming.service.js.map +1 -1
  335. package/dist/lib/services/conversations-runtime-bootstrap.service.d.ts +10 -0
  336. package/dist/lib/services/conversations-runtime-bootstrap.service.d.ts.map +1 -0
  337. package/dist/lib/services/conversations-runtime-bootstrap.service.js +104 -0
  338. package/dist/lib/services/conversations-runtime-bootstrap.service.js.map +1 -0
  339. package/dist/lib/services/delegation-result-parser.d.ts +45 -0
  340. package/dist/lib/services/delegation-result-parser.d.ts.map +1 -0
  341. package/dist/lib/services/delegation-result-parser.js +48 -0
  342. package/dist/lib/services/delegation-result-parser.js.map +1 -0
  343. package/dist/lib/services/mention-autocomplete.service.d.ts +19 -4
  344. package/dist/lib/services/mention-autocomplete.service.d.ts.map +1 -1
  345. package/dist/lib/services/mention-autocomplete.service.js +65 -4
  346. package/dist/lib/services/mention-autocomplete.service.js.map +1 -1
  347. package/dist/lib/services/mention-parser.service.d.ts +8 -53
  348. package/dist/lib/services/mention-parser.service.d.ts.map +1 -1
  349. package/dist/lib/services/mention-parser.service.js +32 -243
  350. package/dist/lib/services/mention-parser.service.js.map +1 -1
  351. package/dist/lib/services/narration-template.d.ts +42 -0
  352. package/dist/lib/services/narration-template.d.ts.map +1 -0
  353. package/dist/lib/services/narration-template.js +73 -0
  354. package/dist/lib/services/narration-template.js.map +1 -0
  355. package/dist/lib/services/realtime-pairing.d.ts +121 -0
  356. package/dist/lib/services/realtime-pairing.d.ts.map +1 -0
  357. package/dist/lib/services/realtime-pairing.js +160 -0
  358. package/dist/lib/services/realtime-pairing.js.map +1 -0
  359. package/dist/lib/services/realtime-session-review.service.d.ts +233 -0
  360. package/dist/lib/services/realtime-session-review.service.d.ts.map +1 -0
  361. package/dist/lib/services/realtime-session-review.service.js +417 -0
  362. package/dist/lib/services/realtime-session-review.service.js.map +1 -0
  363. package/dist/lib/services/realtime-session.service.d.ts +739 -0
  364. package/dist/lib/services/realtime-session.service.d.ts.map +1 -0
  365. package/dist/lib/services/realtime-session.service.js +1647 -0
  366. package/dist/lib/services/realtime-session.service.js.map +1 -0
  367. package/dist/lib/services/realtime-sessions-adapter.d.ts +54 -0
  368. package/dist/lib/services/realtime-sessions-adapter.d.ts.map +1 -0
  369. package/dist/lib/services/realtime-sessions-adapter.js +154 -0
  370. package/dist/lib/services/realtime-sessions-adapter.js.map +1 -0
  371. package/dist/lib/services/user-authorization.d.ts +67 -0
  372. package/dist/lib/services/user-authorization.d.ts.map +1 -0
  373. package/dist/lib/services/user-authorization.js +66 -0
  374. package/dist/lib/services/user-authorization.js.map +1 -0
  375. package/dist/lib/utils/realtime-session-timeline.d.ts +84 -0
  376. package/dist/lib/utils/realtime-session-timeline.d.ts.map +1 -0
  377. package/dist/lib/utils/realtime-session-timeline.js +94 -0
  378. package/dist/lib/utils/realtime-session-timeline.js.map +1 -0
  379. package/dist/public-api.d.ts +41 -0
  380. package/dist/public-api.d.ts.map +1 -1
  381. package/dist/public-api.js +50 -0
  382. package/dist/public-api.js.map +1 -1
  383. package/package.json +27 -24
  384. package/dist/__tests__/conversation-bridge.service.test.d.ts +0 -2
  385. package/dist/__tests__/conversation-bridge.service.test.d.ts.map +0 -1
  386. package/dist/__tests__/conversation-bridge.service.test.js +0 -98
  387. package/dist/__tests__/conversation-bridge.service.test.js.map +0 -1
  388. package/dist/__tests__/mention-parser.test.d.ts +0 -2
  389. package/dist/__tests__/mention-parser.test.d.ts.map +0 -1
  390. package/dist/__tests__/mention-parser.test.js +0 -154
  391. package/dist/__tests__/mention-parser.test.js.map +0 -1
@@ -0,0 +1,681 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ import { RegisterClass } from '@memberjunction/global';
8
+ import { BaseRealtimeChannelClient } from '../channels/base-realtime-channel-client';
9
+ import { RemoteBrowserSurfaceComponent } from './remote-browser-surface.component';
10
+ import { MapToolToAction, REMOTE_BROWSER_TOOL_DEFINITIONS, REMOTE_BROWSER_TOOL_NAMES, REMOTE_BROWSER_TOOL_PREFIX, RemoteBrowserToolArgError, } from './remote-browser-tools';
11
+ import { MediaSourceAudioSink, RemoteBrowserAudioPlayer } from './remote-browser-audio-player';
12
+ /**
13
+ * GraphQL mutation that drives the SERVER-hosted browser. The channel awaits it for every
14
+ * `browser_*` tool call and feeds the result back to the model.
15
+ */
16
+ const EXECUTE_REMOTE_BROWSER_ACTION_MUTATION = `
17
+ mutation ExecuteRemoteBrowserAction(
18
+ $agentSessionID: String!, $kind: String!, $url: String, $selector: String,
19
+ $x: Float, $y: Float, $text: String, $key: String,
20
+ $deltaX: Float, $deltaY: Float, $ms: Float
21
+ ) {
22
+ ExecuteRemoteBrowserAction(
23
+ agentSessionID: $agentSessionID, kind: $kind, url: $url, selector: $selector,
24
+ x: $x, y: $y, text: $text, key: $key,
25
+ deltaX: $deltaX, deltaY: $deltaY, ms: $ms
26
+ ) {
27
+ Success
28
+ CurrentUrl
29
+ Detail
30
+ }
31
+ }
32
+ `;
33
+ /**
34
+ * GOAL mutation — hands a high-level goal to the server's autonomous browser agent (computer-use loop or
35
+ * backend native AI) instead of relaying a granular action. The server plans + executes; we await the
36
+ * terminal outcome. (Live per-step narration is a server-bridged concern; over this client-direct mutation
37
+ * we get the final result.)
38
+ */
39
+ const EXECUTE_REMOTE_BROWSER_GOAL_MUTATION = `
40
+ mutation ExecuteRemoteBrowserGoal($agentSessionID: String!, $goal: String!, $startUrl: String) {
41
+ ExecuteRemoteBrowserGoal(agentSessionID: $agentSessionID, goal: $goal, startUrl: $startUrl) {
42
+ Success
43
+ GoalRunID
44
+ Strategy
45
+ CurrentUrl
46
+ Status
47
+ StepCount
48
+ Detail
49
+ }
50
+ }
51
+ `;
52
+ /**
53
+ * POLL query for the async goal run. `ExecuteRemoteBrowserGoal` STARTS the (potentially multi-minute)
54
+ * goal loop and returns a `GoalRunID` with `Status: 'Running'`; the channel polls this until the run
55
+ * reports a terminal status — so no single request is held open for the whole loop (which would die at
56
+ * a browser/proxy/janitor transport timeout and lose the result).
57
+ */
58
+ const GET_REMOTE_BROWSER_GOAL_RESULT_QUERY = `
59
+ query GetRemoteBrowserGoalResult($agentSessionID: String!, $goalRunID: String!) {
60
+ GetRemoteBrowserGoalResult(agentSessionID: $agentSessionID, goalRunID: $goalRunID) {
61
+ Success
62
+ GoalRunID
63
+ Strategy
64
+ CurrentUrl
65
+ Status
66
+ StepCount
67
+ Detail
68
+ }
69
+ }
70
+ `;
71
+ /**
72
+ * GraphQL mutation that asks the server to start PUSHING live CDP screencast frames for the session.
73
+ * Returns `Streaming: true` when the backend supports `ScreenStreaming` and the stream started; the
74
+ * channel then drives the surface's canvas. `Streaming: false` (capability absent / start failed) leaves
75
+ * the surface on its 700ms snapshot poll fallback.
76
+ */
77
+ const START_SCREENCAST_MUTATION = `
78
+ mutation StartRemoteBrowserScreencast($agentSessionID: String!) {
79
+ StartRemoteBrowserScreencast(agentSessionID: $agentSessionID) {
80
+ Streaming
81
+ }
82
+ }
83
+ `;
84
+ /** GraphQL mutation that stops the server-pushed screencast (best-effort teardown). */
85
+ const STOP_SCREENCAST_MUTATION = `
86
+ mutation StopRemoteBrowserScreencast($agentSessionID: String!) {
87
+ StopRemoteBrowserScreencast(agentSessionID: $agentSessionID)
88
+ }
89
+ `;
90
+ /**
91
+ * GraphQL mutation that asks the server to start PUSHING live tab-audio chunks for the session — so a
92
+ * co-agent demoing a video/audio site is HEARD. Returns `Streaming: true` when the backend can capture
93
+ * audio (v1 gates by backend implementation) and the stream started; `Streaming: false` means no audio
94
+ * (capability absent / start failed) and the client simply plays nothing.
95
+ */
96
+ const START_AUDIO_STREAM_MUTATION = `
97
+ mutation StartRemoteBrowserAudioStream($agentSessionID: String!) {
98
+ StartRemoteBrowserAudioStream(agentSessionID: $agentSessionID) {
99
+ Streaming
100
+ }
101
+ }
102
+ `;
103
+ /** GraphQL mutation that stops the server-pushed tab-audio stream (best-effort teardown). */
104
+ const STOP_AUDIO_STREAM_MUTATION = `
105
+ mutation StopRemoteBrowserAudioStream($agentSessionID: String!) {
106
+ StopRemoteBrowserAudioStream(agentSessionID: $agentSessionID)
107
+ }
108
+ `;
109
+ /**
110
+ * HUMAN-TAKEOVER mutation — relays ONE pointer/keyboard input the user performed on the live canvas into the
111
+ * server-hosted browser (Collaborative control). Best-effort: the server returns `false` when the backend
112
+ * lacks `HumanTakeover` or no live browser exists; the channel doesn't act on the boolean.
113
+ */
114
+ const RELAY_HUMAN_INPUT_MUTATION = `
115
+ mutation RelayRemoteBrowserHumanInput(
116
+ $agentSessionID: String!, $kind: String!, $x: Float, $y: Float, $button: String, $key: String,
117
+ $text: String, $deltaX: Float, $deltaY: Float, $modifiers: String
118
+ ) {
119
+ RelayRemoteBrowserHumanInput(
120
+ agentSessionID: $agentSessionID, kind: $kind, x: $x, y: $y, button: $button, key: $key,
121
+ text: $text, deltaX: $deltaX, deltaY: $deltaY, modifiers: $modifiers
122
+ )
123
+ }
124
+ `;
125
+ /**
126
+ * COPY-OUT query — reads the remote page's current text selection so the surface can write it to the LOCAL
127
+ * clipboard on a `copy` / Cmd+C (the mirror of the `'text'` paste-in path). Returns `''` when nothing is
128
+ * selected, no live browser exists, or the backend lacks `HumanTakeover`.
129
+ */
130
+ const GET_SELECTION_QUERY = `
131
+ query GetRemoteBrowserSelection($agentSessionID: String!) {
132
+ GetRemoteBrowserSelection(agentSessionID: $agentSessionID) {
133
+ Text
134
+ }
135
+ }
136
+ `;
137
+ /** GraphQL query the surface fetcher runs — the live screenshot + URL of the server browser. */
138
+ const REMOTE_BROWSER_SNAPSHOT_QUERY = `
139
+ query RemoteBrowserSnapshot($agentSessionID: String!) {
140
+ RemoteBrowserSnapshot(agentSessionID: $agentSessionID) {
141
+ ScreenshotBase64
142
+ CurrentUrl
143
+ }
144
+ }
145
+ `;
146
+ /**
147
+ * VISION-QUERY mutation (separate from {@link EXECUTE_REMOTE_BROWSER_ACTION_MUTATION} — this OBSERVES the page,
148
+ * it does not drive it). The server captures the live screenshot and runs a fast vision model over it, so the
149
+ * non-omnimodal voice agent can "see" the page: a text description and/or localized elements with pixel
150
+ * centroids. Backs both `browser_DescribePage` (no target) and `browser_LocateElement` (a target description).
151
+ */
152
+ const INTERPRET_PAGE_MUTATION = `
153
+ mutation InterpretRemoteBrowserPage($agentSessionID: String!, $query: String) {
154
+ InterpretRemoteBrowserPage(agentSessionID: $agentSessionID, query: $query) {
155
+ Description
156
+ Elements {
157
+ Label
158
+ X
159
+ Y
160
+ Confidence
161
+ }
162
+ Detail
163
+ }
164
+ }
165
+ `;
166
+ /**
167
+ * The REMOTE BROWSER as a pluggable interactive channel — a {@link BaseRealtimeChannelClient}
168
+ * resolved from the `MJ: AI Agent Channels` registry row whose `ClientPluginClass` is
169
+ * `'RealtimeRemoteBrowserChannel'`. One instance per session (ClassFactory-created at session
170
+ * start).
171
+ *
172
+ * Topology (CLIENT-DIRECT, like the whiteboard — the browser just happens to live on the
173
+ * server):
174
+ * - **Action**: the `browser_*` client-executed tool set ({@link REMOTE_BROWSER_TOOL_DEFINITIONS}).
175
+ * {@link ApplyAgentTool} maps a tool call → a normalized {@link RemoteBrowserAction}
176
+ * ({@link MapToolToAction}) and awaits the `ExecuteRemoteBrowserAction` GraphQL mutation
177
+ * (via {@link RealtimeChannelContext.ExecuteServerAction}) to drive the server browser,
178
+ * returning a concise JSON result for the model. Never throws — argument and transport
179
+ * failures map to a `{ success: false, error }` payload.
180
+ * - **Perception**: after a successful action, a `[browser]` context note carries the new
181
+ * page URL so the agent perceives where the page went; the surface independently polls a
182
+ * live screenshot.
183
+ * - **Surface**: {@link RemoteBrowserSurfaceComponent}, created dynamically in the channel
184
+ * tab; the plugin hands it the session's provider + id in {@link BindSurface} so it can
185
+ * poll `RemoteBrowserSnapshot`. HUMAN TAKEOVER is enabled by default (Collaborative): the
186
+ * user can click/type into the live canvas and those events relay to the server browser via
187
+ * {@link RELAY_HUMAN_INPUT_MUTATION} (server-gated on the backend's `HumanTakeover` capability).
188
+ *
189
+ * The channel keeps NO client-side state of record — the browser's state lives entirely on
190
+ * the server — so {@link SerializeState} / {@link RestoreState} use the base no-op behavior.
191
+ */
192
+ let RemoteBrowserChannel = class RemoteBrowserChannel extends BaseRealtimeChannelClient {
193
+ /** The live bound surface, when the channel tab's pane is instantiated. */
194
+ surface = null;
195
+ /** Subscription to the bound surface's `HumanInput` output, torn down on unbind/dispose. */
196
+ humanInputSub = null;
197
+ /**
198
+ * Whether the server confirmed it is PUSHING screencast frames for this session (`ScreenStreaming`
199
+ * supported). When `true` the surface renders pushed frames on its canvas and skips its poll, and
200
+ * {@link OnScreencastFrame} forwards each pushed frame to it. When `false` the surface keeps polling.
201
+ */
202
+ streaming = false;
203
+ /**
204
+ * Whether the server confirmed it is PUSHING tab-audio chunks for this session (the backend can capture
205
+ * audio). When `true` {@link OnAudioChunk} feeds each pushed chunk to {@link audioPlayer}; when `false`
206
+ * no audio plays.
207
+ */
208
+ audioStreaming = false;
209
+ /** The client-side audio player fed pushed chunks while {@link audioStreaming}; `null` until started. */
210
+ audioPlayer = null;
211
+ /** Subscription to the bound surface's `AudioMutedChange` output (the speaker toggle), torn down on unbind. */
212
+ audioMutedSub = null;
213
+ /**
214
+ * Poll cadence + deadline for {@link pollGoalResult} (the async `browser_AchieveGoal` result poll).
215
+ * Protected so tests can shrink them; production polls every 2.5s for up to 5 minutes (a goal loop
216
+ * past 5 min keeps running server-side, the model just gets a "still running" note).
217
+ */
218
+ GoalPollIntervalMs = 2500;
219
+ GoalPollTimeoutMs = 5 * 60 * 1000;
220
+ get ChannelName() {
221
+ return 'Remote Browser';
222
+ }
223
+ get ToolNamePrefix() {
224
+ return REMOTE_BROWSER_TOOL_PREFIX;
225
+ }
226
+ get TabTitle() {
227
+ return 'Browser';
228
+ }
229
+ get TabIcon() {
230
+ return 'fa-solid fa-globe';
231
+ }
232
+ GetToolDefinitions() {
233
+ return REMOTE_BROWSER_TOOL_DEFINITIONS;
234
+ }
235
+ GetSurfaceComponent() {
236
+ return RemoteBrowserSurfaceComponent;
237
+ }
238
+ /** First-run intro shown the first time the user opens the Browser tab (once per user). */
239
+ GetOnboardingDetails() {
240
+ return {
241
+ Heading: 'Remote Browser',
242
+ Description: 'The agent drives a live web browser on the server and you can watch it work right here. ' +
243
+ 'You can also grab the wheel: click and type directly on the live page and the agent picks ' +
244
+ 'up right where you left off.',
245
+ Tips: [
246
+ 'Ask the agent to look something up, open a site or fill in a form — it controls the page.',
247
+ 'Click on the live view to take over, then click and type to drive it yourself — the "You\'re driving" badge shows when takeover is active.',
248
+ 'The current page URL is shown so you always know where the agent has navigated.',
249
+ ],
250
+ IconClass: 'fa-solid fa-globe',
251
+ };
252
+ }
253
+ /**
254
+ * Wires the dynamically-created surface: hands it a snapshot fetcher closing over the
255
+ * channel context (session id + provider live there), so the surface stays transport-
256
+ * agnostic. Set BEFORE the surface's first change detection (the pane binds synchronously),
257
+ * so its `ngOnInit` poll has the fetcher.
258
+ *
259
+ * Also asks the server to start a live screencast. When the backend supports `ScreenStreaming` the
260
+ * server starts PUSHING frames and reports `Streaming: true`; we flip the surface to canvas mode (its
261
+ * poll is then skipped) and {@link OnScreencastFrame} paints each pushed frame. When the backend lacks
262
+ * the capability (`Streaming: false`) the surface keeps the snapshot poll already running — graceful
263
+ * fallback, no further action.
264
+ *
265
+ * HUMAN TAKEOVER is enabled BY DEFAULT (Collaborative): the surface is flipped `Interactive = true` and
266
+ * its `HumanInput` output subscribed, forwarding each pointer/keyboard event to the server via
267
+ * {@link RELAY_HUMAN_INPUT_MUTATION}. Takeover only takes effect on the canvas (screencast) path; the
268
+ * `<img>` poll fallback stays view-only. The server gates the actual routing on the backend's
269
+ * `HumanTakeover` capability, so this is safe to enable unconditionally.
270
+ */
271
+ BindSurface(instance) {
272
+ this.surface = instance;
273
+ instance.Fetch = () => this.fetchSnapshot();
274
+ // Copy-out: the surface reads the remote selection through this on a local `copy` and writes it locally.
275
+ instance.FetchSelection = () => this.fetchSelection();
276
+ instance.Interactive = true;
277
+ this.humanInputSub = instance.HumanInput.subscribe((input) => this.relayHumanInput(input));
278
+ this.audioMutedSub = instance.AudioMutedChange.subscribe((muted) => this.audioPlayer?.SetMuted(muted));
279
+ void this.startScreencast(instance);
280
+ void this.startAudioStream(instance);
281
+ }
282
+ UnbindSurface() {
283
+ this.humanInputSub?.unsubscribe();
284
+ this.humanInputSub = null;
285
+ this.audioMutedSub?.unsubscribe();
286
+ this.audioMutedSub = null;
287
+ void this.stopScreencast();
288
+ void this.stopAudioStream();
289
+ this.surface = null;
290
+ }
291
+ Dispose() {
292
+ this.humanInputSub?.unsubscribe();
293
+ this.humanInputSub = null;
294
+ this.audioMutedSub?.unsubscribe();
295
+ this.audioMutedSub = null;
296
+ void this.stopScreencast();
297
+ void this.stopAudioStream();
298
+ super.Dispose();
299
+ }
300
+ /**
301
+ * Forwards one PUSHED screencast frame to the bound surface's canvas. Called by the session service
302
+ * when a `RemoteBrowserScreencastFrame` arrives on the push-status stream for THIS session. No-op when
303
+ * the channel isn't streaming or has no bound surface (e.g. the tab pane is collapsed).
304
+ *
305
+ * @param dataBase64 The frame image as raw base64 JPEG (no `data:` prefix).
306
+ */
307
+ OnScreencastFrame(dataBase64) {
308
+ if (this.streaming) {
309
+ this.surface?.RenderFrame(dataBase64);
310
+ }
311
+ }
312
+ /**
313
+ * Feeds one PUSHED tab-audio chunk to the client-side audio player. Called by the session service when a
314
+ * `RemoteBrowserAudioChunk` arrives on the push-status stream for THIS session. No-op when the channel
315
+ * isn't audio-streaming or the player has been torn down.
316
+ *
317
+ * @param chunk The pushed audio chunk (base64 webm-opus + codec/seq metadata).
318
+ */
319
+ OnAudioChunk(chunk) {
320
+ if (this.audioStreaming) {
321
+ this.audioPlayer?.Enqueue(chunk);
322
+ }
323
+ }
324
+ /**
325
+ * Asks the server to start the live screencast and, on success, flips the surface to canvas mode so it
326
+ * stops polling and starts painting pushed frames. Best-effort: a `null`/`Streaming: false` result
327
+ * (capability absent or transport failure) leaves the surface on its poll fallback.
328
+ */
329
+ async startScreencast(instance) {
330
+ const sessionId = this.Context?.AgentSessionID;
331
+ if (!sessionId) {
332
+ return;
333
+ }
334
+ const data = await this.Context?.ExecuteServerAction(START_SCREENCAST_MUTATION, { agentSessionID: sessionId });
335
+ if (data?.StartRemoteBrowserScreencast?.Streaming === true) {
336
+ this.streaming = true;
337
+ instance.Streaming = true;
338
+ }
339
+ }
340
+ /**
341
+ * Asks the server to start the live tab-audio stream and, on success, spins up the client-side
342
+ * {@link RemoteBrowserAudioPlayer} (speaker ON by default — the call is the activating user gesture) so
343
+ * pushed chunks play. Best-effort: a `null`/`Streaming: false` result (no audio capability or transport
344
+ * failure) leaves the channel silent with no player.
345
+ *
346
+ * @param instance The bound surface, flipped to show the speaker toggle when audio starts.
347
+ */
348
+ async startAudioStream(instance) {
349
+ const sessionId = this.Context?.AgentSessionID;
350
+ if (!sessionId) {
351
+ return;
352
+ }
353
+ const data = await this.Context?.ExecuteServerAction(START_AUDIO_STREAM_MUTATION, { agentSessionID: sessionId });
354
+ if (data?.StartRemoteBrowserAudioStream?.Streaming === true) {
355
+ this.audioStreaming = true;
356
+ this.audioPlayer = new RemoteBrowserAudioPlayer(new MediaSourceAudioSink());
357
+ // Speaker defaults ON; reflect that on the surface so the toggle renders un-muted.
358
+ instance.AudioAvailable = true;
359
+ instance.AudioMuted = false;
360
+ }
361
+ }
362
+ /** Asks the server to stop the tab-audio stream (best-effort), disposes the player, and clears state. */
363
+ async stopAudioStream() {
364
+ const wasStreaming = this.audioStreaming;
365
+ this.audioStreaming = false;
366
+ this.audioPlayer?.Dispose();
367
+ this.audioPlayer = null;
368
+ const sessionId = this.Context?.AgentSessionID;
369
+ if (!wasStreaming || !sessionId) {
370
+ return;
371
+ }
372
+ await this.Context?.ExecuteServerAction(STOP_AUDIO_STREAM_MUTATION, { agentSessionID: sessionId });
373
+ }
374
+ /**
375
+ * Relays ONE human-takeover input from the surface to the server's {@link RELAY_HUMAN_INPUT_MUTATION}.
376
+ * Best-effort and fire-and-forget: never throws, and the boolean result is ignored (the server already
377
+ * gates routing on the backend's `HumanTakeover` capability). No-op when no live session id exists.
378
+ *
379
+ * @param input The flattened pointer/keyboard input the user performed on the live canvas.
380
+ */
381
+ relayHumanInput(input) {
382
+ const sessionId = this.Context?.AgentSessionID;
383
+ if (!sessionId) {
384
+ return;
385
+ }
386
+ void this.Context?.ExecuteServerAction(RELAY_HUMAN_INPUT_MUTATION, {
387
+ agentSessionID: sessionId,
388
+ kind: input.kind,
389
+ x: input.x ?? null,
390
+ y: input.y ?? null,
391
+ button: input.button ?? null,
392
+ key: input.key ?? null,
393
+ // Paste-in: the `'text'` kind carries the local clipboard text the server inserts into the page.
394
+ text: input.text ?? null,
395
+ deltaX: input.deltaX ?? null,
396
+ deltaY: input.deltaY ?? null,
397
+ // Server expects a comma-separated modifier list (e.g. "Shift,Control"); null when none held.
398
+ modifiers: input.modifiers && input.modifiers.length > 0 ? input.modifiers.join(',') : null,
399
+ });
400
+ }
401
+ /**
402
+ * Reads the remote page's current selection for COPY-OUT — backs the surface's `FetchSelection`. Awaits
403
+ * the `GetRemoteBrowserSelection` query and returns its text. Best-effort by contract
404
+ * ({@link RemoteBrowserSelectionFetcher}): returns `''` when no session is live or the query fails, so a
405
+ * best-effort copy never throws.
406
+ */
407
+ async fetchSelection() {
408
+ const sessionId = this.Context?.AgentSessionID;
409
+ if (!sessionId) {
410
+ return '';
411
+ }
412
+ const data = await this.Context?.ExecuteServerAction(GET_SELECTION_QUERY, { agentSessionID: sessionId });
413
+ return data?.GetRemoteBrowserSelection?.Text ?? '';
414
+ }
415
+ /** Asks the server to stop the screencast (best-effort) and clears the streaming flag. */
416
+ async stopScreencast() {
417
+ const wasStreaming = this.streaming;
418
+ this.streaming = false;
419
+ const sessionId = this.Context?.AgentSessionID;
420
+ if (!wasStreaming || !sessionId) {
421
+ return;
422
+ }
423
+ await this.Context?.ExecuteServerAction(STOP_SCREENCAST_MUTATION, { agentSessionID: sessionId });
424
+ }
425
+ /**
426
+ * Fetches one live snapshot of the server browser for the surface — the PERCEPTION poll.
427
+ * Best-effort by contract ({@link RemoteBrowserSnapshotFetcher}): returns `null` when no
428
+ * session is live or the query fails (the surface keeps its last good frame).
429
+ */
430
+ async fetchSnapshot() {
431
+ const sessionId = this.Context?.AgentSessionID;
432
+ if (!sessionId) {
433
+ return null;
434
+ }
435
+ const data = await this.Context?.ExecuteServerAction(REMOTE_BROWSER_SNAPSHOT_QUERY, { agentSessionID: sessionId });
436
+ return data?.RemoteBrowserSnapshot ?? null;
437
+ }
438
+ /**
439
+ * Executes ONE `browser_*` tool call: maps it to a server action and awaits the
440
+ * `ExecuteRemoteBrowserAction` mutation, then returns a concise JSON result the model reads.
441
+ * On success it also feeds the new page URL to the agent as a `[browser]` context note. Never
442
+ * throws — bad arguments, no live session, and server failures all become a failed-result
443
+ * payload so the model can narrate the problem.
444
+ */
445
+ async ApplyAgentTool(toolName, argsJson) {
446
+ // VISION-QUERY branch: the two interpreter tools OBSERVE the page (run a vision model over a screenshot)
447
+ // rather than drive it, so they route to the separate interpret mutation, not MapToolToAction.
448
+ if (toolName === REMOTE_BROWSER_TOOL_NAMES.DescribePage) {
449
+ return this.interpretPage(undefined);
450
+ }
451
+ if (toolName === REMOTE_BROWSER_TOOL_NAMES.AchieveGoal) {
452
+ return this.achieveGoal(argsJson);
453
+ }
454
+ if (toolName === REMOTE_BROWSER_TOOL_NAMES.LocateElement) {
455
+ const description = this.asArgString(this.parseArgs(argsJson)['description']);
456
+ if (!description) {
457
+ return this.fail('browser_LocateElement requires a "description" of the element to find.');
458
+ }
459
+ return this.interpretPage(description);
460
+ }
461
+ let action;
462
+ try {
463
+ action = MapToolToAction(toolName, this.parseArgs(argsJson));
464
+ }
465
+ catch (error) {
466
+ const message = error instanceof RemoteBrowserToolArgError ? error.message : 'Invalid Remote Browser tool arguments.';
467
+ return this.fail(message);
468
+ }
469
+ // Briefly WAIT for the session id rather than failing instantly: the model can fire a tool the
470
+ // first beat it connects, before mintSession binds the id (the "session id missing" race).
471
+ const sessionId = await this.ResolveAgentSessionId();
472
+ if (!sessionId) {
473
+ // Diagnostic: distinguishes "channel never Initialized (no Context)" from "session id never
474
+ // resolved within the wait window" — the two distinct causes of a null id at tool-execution time.
475
+ console.warn('[RemoteBrowser] browser tool invoked but AgentSessionID is null', {
476
+ tool: toolName,
477
+ hasContext: !!this.Context,
478
+ agentSessionID: this.Context?.AgentSessionID ?? null,
479
+ });
480
+ return this.fail('No live browser session is available yet — the realtime session may still be connecting; try again in a moment.');
481
+ }
482
+ const data = await this.Context?.ExecuteServerAction(EXECUTE_REMOTE_BROWSER_ACTION_MUTATION, this.buildVariables(sessionId, action));
483
+ const result = data?.ExecuteRemoteBrowserAction ?? null;
484
+ if (!result) {
485
+ return this.fail('The browser action could not be executed (no response from the server).');
486
+ }
487
+ if (!result.Success) {
488
+ return this.fail(result.Detail ?? 'The browser action failed.');
489
+ }
490
+ if (result.CurrentUrl) {
491
+ // PERCEPTION: tell the agent where the page is now (background — no spoken reply).
492
+ this.Context?.SendContextNote(`[browser] current page: ${result.CurrentUrl}`);
493
+ // In streaming mode the surface's snapshot poll (which carries the URL) is stopped, so push the new
494
+ // URL to the live-view bar directly — otherwise it stays stuck on "No page loaded yet".
495
+ this.surface?.SetCurrentUrl(result.CurrentUrl);
496
+ }
497
+ return this.ok(result.CurrentUrl, result.Detail);
498
+ }
499
+ /** Builds the flat mutation variables from a normalized action (omitted fields ride as null). */
500
+ buildVariables(sessionId, action) {
501
+ return {
502
+ agentSessionID: sessionId,
503
+ kind: action.Kind,
504
+ url: action.Url ?? null,
505
+ selector: action.Selector ?? null,
506
+ x: action.X ?? null,
507
+ y: action.Y ?? null,
508
+ text: action.Text ?? null,
509
+ key: action.Key ?? null,
510
+ deltaX: action.DeltaX ?? null,
511
+ deltaY: action.DeltaY ?? null,
512
+ ms: action.Ms ?? null,
513
+ };
514
+ }
515
+ /**
516
+ * GOAL path for the `browser_AchieveGoal` tool: hands a high-level goal to the server's autonomous
517
+ * browser agent (computer-use loop / native AI) via {@link EXECUTE_REMOTE_BROWSER_GOAL_MUTATION} and
518
+ * returns a concise result for the model. Never throws — failures map to a `{ success: false }` string.
519
+ *
520
+ * @param argsJson The raw tool-call arguments (`{ goal, startUrl? }`).
521
+ * @returns The model-readable result string.
522
+ */
523
+ async achieveGoal(argsJson) {
524
+ // Wait briefly for the session id (mint/reconnect race) before giving up — see ResolveAgentSessionId.
525
+ const sessionId = await this.ResolveAgentSessionId();
526
+ if (!sessionId) {
527
+ return this.fail('No live browser session is available yet — the realtime session may still be connecting; try again in a moment.');
528
+ }
529
+ const args = this.parseArgs(argsJson);
530
+ const goal = this.asArgString(args['goal']);
531
+ if (!goal) {
532
+ return this.fail('browser_AchieveGoal requires a "goal" describing what to accomplish.');
533
+ }
534
+ const startUrl = this.asArgString(args['startUrl']) ?? null;
535
+ // START the goal (returns immediately with a GoalRunID) then POLL — a goal loop can run for
536
+ // minutes, far longer than any single request survives, so we never hold one open for the loop.
537
+ const startData = await this.Context?.ExecuteServerAction(EXECUTE_REMOTE_BROWSER_GOAL_MUTATION, {
538
+ agentSessionID: sessionId,
539
+ goal,
540
+ startUrl,
541
+ });
542
+ const started = startData?.ExecuteRemoteBrowserGoal ?? null;
543
+ if (!started) {
544
+ return this.fail('The browser goal could not be started (no response from the server).');
545
+ }
546
+ // Defensive: if the server ever returns a terminal status synchronously, use it directly.
547
+ const result = started.Status === 'Running' && started.GoalRunID
548
+ ? await this.pollGoalResult(sessionId, started.GoalRunID)
549
+ : started;
550
+ if (!result) {
551
+ return this.fail('The browser goal is taking longer than expected and could not be confirmed. It may still be running.');
552
+ }
553
+ if (result.CurrentUrl) {
554
+ this.Context?.SendContextNote(`[browser] current page: ${result.CurrentUrl}`);
555
+ this.surface?.SetCurrentUrl(result.CurrentUrl);
556
+ }
557
+ if (!result.Success) {
558
+ return this.fail(result.Detail ?? `The goal could not be completed (${result.Status ?? 'unknown'}).`);
559
+ }
560
+ return this.ok(result.CurrentUrl, result.Detail ?? `Goal completed (${result.Status ?? 'Completed'}, ${result.StepCount ?? 0} steps).`);
561
+ }
562
+ /**
563
+ * Polls {@link GET_REMOTE_BROWSER_GOAL_RESULT_QUERY} for a started goal run until it reports a
564
+ * terminal status (anything other than `Running`), then returns that terminal payload. Each poll is
565
+ * a short request, so no transport boundary times out while a long goal loop runs server-side.
566
+ *
567
+ * Returns `null` if the goal is still `Running` after {@link GoalPollTimeoutMs} (the loop keeps
568
+ * running server-side; the caller maps this to a "still running" message), the session went away, or
569
+ * the run id is no longer known (`Unknown` — expired/superseded).
570
+ */
571
+ async pollGoalResult(sessionId, goalRunID) {
572
+ const interval = Math.max(1, this.GoalPollIntervalMs);
573
+ for (let waited = 0; waited < this.GoalPollTimeoutMs; waited += interval) {
574
+ await new Promise((resolve) => setTimeout(resolve, interval));
575
+ // The session ended mid-goal — stop polling (the live browser is gone).
576
+ if (!this.Context?.AgentSessionID) {
577
+ return null;
578
+ }
579
+ const data = await this.Context.ExecuteServerAction(GET_REMOTE_BROWSER_GOAL_RESULT_QUERY, {
580
+ agentSessionID: sessionId,
581
+ goalRunID,
582
+ });
583
+ const payload = data?.GetRemoteBrowserGoalResult ?? null;
584
+ // A transient null (one failed poll) shouldn't abort — keep polling until the deadline.
585
+ if (payload && payload.Status !== 'Running') {
586
+ return payload;
587
+ }
588
+ }
589
+ return null;
590
+ }
591
+ /**
592
+ * Runs the VISION-QUERY path for the `browser_DescribePage` / `browser_LocateElement` tools: awaits the
593
+ * `InterpretRemoteBrowserPage` mutation (server captures a screenshot + runs a fast vision model) and returns
594
+ * a concise JSON string the model reads. For a describe (no `query`) it returns `{ description }`; for a locate
595
+ * it returns `{ found, element, all }` so the agent can `browser_Click` the centroid. Never throws — a null
596
+ * session, no response, or a server detail-only result all map to a result string the model can narrate.
597
+ *
598
+ * @param query The visual target to locate, or `undefined` for a plain page description.
599
+ * @returns A JSON string describing the interpretation for the model.
600
+ */
601
+ async interpretPage(query) {
602
+ // Wait briefly for the session id (mint/reconnect race) before giving up — see ResolveAgentSessionId.
603
+ const sessionId = await this.ResolveAgentSessionId();
604
+ if (!sessionId) {
605
+ console.warn('[RemoteBrowser] interpret tool invoked but AgentSessionID is null', {
606
+ hasContext: !!this.Context,
607
+ agentSessionID: this.Context?.AgentSessionID ?? null,
608
+ });
609
+ return this.fail('No live browser session is available yet — the realtime session may still be connecting; try again in a moment.');
610
+ }
611
+ const data = await this.Context?.ExecuteServerAction(INTERPRET_PAGE_MUTATION, {
612
+ agentSessionID: sessionId,
613
+ query: query ?? null,
614
+ });
615
+ const result = data?.InterpretRemoteBrowserPage ?? null;
616
+ if (!result) {
617
+ return this.fail('The page could not be interpreted (no response from the server).');
618
+ }
619
+ if (query === undefined) {
620
+ // DescribePage — hand back the description (or the server's detail note when nothing was interpreted).
621
+ return JSON.stringify({ description: result.Description ?? result.Detail ?? null });
622
+ }
623
+ // LocateElement — surface whether anything matched, the best match, and all candidates.
624
+ const elements = result.Elements ?? [];
625
+ const best = elements[0];
626
+ return JSON.stringify({
627
+ found: elements.length > 0,
628
+ element: best ? { label: best.Label, x: best.X, y: best.Y } : null,
629
+ all: elements,
630
+ ...(result.Detail ? { detail: result.Detail } : {}),
631
+ });
632
+ }
633
+ /** Coerces a parsed tool-arg to a non-empty string, or `undefined` when absent / wrong-typed. */
634
+ asArgString(value) {
635
+ return typeof value === 'string' && value.trim().length > 0 ? value.trim() : undefined;
636
+ }
637
+ /** Parses the tool-args JSON into a plain object; returns `{}` for empty/malformed input. */
638
+ parseArgs(argsJson) {
639
+ const trimmed = argsJson?.trim();
640
+ if (!trimmed) {
641
+ return {};
642
+ }
643
+ try {
644
+ const parsed = JSON.parse(trimmed);
645
+ return parsed !== null && typeof parsed === 'object' && !Array.isArray(parsed) ? parsed : {};
646
+ }
647
+ catch {
648
+ return {};
649
+ }
650
+ }
651
+ /** Builds a successful tool-result JSON string for the model. */
652
+ ok(currentUrl, detail) {
653
+ const result = { success: true };
654
+ if (currentUrl) {
655
+ result.currentUrl = currentUrl;
656
+ }
657
+ if (detail) {
658
+ result.detail = detail;
659
+ }
660
+ return JSON.stringify(result);
661
+ }
662
+ /** Builds a failed tool-result JSON string for the model. */
663
+ fail(error) {
664
+ const result = { success: false, error };
665
+ return JSON.stringify(result);
666
+ }
667
+ };
668
+ RemoteBrowserChannel = __decorate([
669
+ RegisterClass(BaseRealtimeChannelClient, 'RealtimeRemoteBrowserChannel')
670
+ ], RemoteBrowserChannel);
671
+ export { RemoteBrowserChannel };
672
+ /**
673
+ * Tree-shaking prevention: the Remote Browser channel is resolved dynamically through the
674
+ * ClassFactory (by the registry row's `ClientPluginClass` key), so this static call is what
675
+ * keeps its `@RegisterClass` side effect from being eliminated by the bundler. Called from
676
+ * `conversations.module.ts` alongside {@link LoadRealtimeWhiteboardChannel}.
677
+ */
678
+ export function LoadRealtimeRemoteBrowserChannel() {
679
+ // intentional no-op — the import side effect performs the registration
680
+ }
681
+ //# sourceMappingURL=remote-browser-channel.js.map