@memberjunction/ng-conversations 5.40.2 → 5.41.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 (378) 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 +423 -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/conversation/conversation-chat-area.component.d.ts +205 -3
  135. package/dist/lib/components/conversation/conversation-chat-area.component.d.ts.map +1 -1
  136. package/dist/lib/components/conversation/conversation-chat-area.component.js +911 -342
  137. package/dist/lib/components/conversation/conversation-chat-area.component.js.map +1 -1
  138. package/dist/lib/components/mention/mention-dropdown.component.js +35 -17
  139. package/dist/lib/components/mention/mention-dropdown.component.js.map +1 -1
  140. package/dist/lib/components/mention/mention-editor.component.d.ts +4 -0
  141. package/dist/lib/components/mention/mention-editor.component.d.ts.map +1 -1
  142. package/dist/lib/components/mention/mention-editor.component.js +43 -19
  143. package/dist/lib/components/mention/mention-editor.component.js.map +1 -1
  144. package/dist/lib/components/message/message-input-box.component.d.ts +17 -1
  145. package/dist/lib/components/message/message-input-box.component.d.ts.map +1 -1
  146. package/dist/lib/components/message/message-input-box.component.js +73 -15
  147. package/dist/lib/components/message/message-input-box.component.js.map +1 -1
  148. package/dist/lib/components/message/message-input.component.d.ts +142 -6
  149. package/dist/lib/components/message/message-input.component.d.ts.map +1 -1
  150. package/dist/lib/components/message/message-input.component.js +328 -82
  151. package/dist/lib/components/message/message-input.component.js.map +1 -1
  152. package/dist/lib/components/message/message-item.component.d.ts +28 -3
  153. package/dist/lib/components/message/message-item.component.d.ts.map +1 -1
  154. package/dist/lib/components/message/message-item.component.js +180 -108
  155. package/dist/lib/components/message/message-item.component.js.map +1 -1
  156. package/dist/lib/components/message/message-list.component.d.ts +81 -2
  157. package/dist/lib/components/message/message-list.component.d.ts.map +1 -1
  158. package/dist/lib/components/message/message-list.component.js +252 -87
  159. package/dist/lib/components/message/message-list.component.js.map +1 -1
  160. package/dist/lib/components/realtime/channels/base-realtime-channel-client.d.ts +282 -0
  161. package/dist/lib/components/realtime/channels/base-realtime-channel-client.d.ts.map +1 -0
  162. package/dist/lib/components/realtime/channels/base-realtime-channel-client.js +158 -0
  163. package/dist/lib/components/realtime/channels/base-realtime-channel-client.js.map +1 -0
  164. package/dist/lib/components/realtime/channels/channel-onboarding-panel.component.d.ts +25 -0
  165. package/dist/lib/components/realtime/channels/channel-onboarding-panel.component.d.ts.map +1 -0
  166. package/dist/lib/components/realtime/channels/channel-onboarding-panel.component.js +140 -0
  167. package/dist/lib/components/realtime/channels/channel-onboarding-panel.component.js.map +1 -0
  168. package/dist/lib/components/realtime/channels/realtime-channel-pane.component.d.ts +35 -0
  169. package/dist/lib/components/realtime/channels/realtime-channel-pane.component.d.ts.map +1 -0
  170. package/dist/lib/components/realtime/channels/realtime-channel-pane.component.js +58 -0
  171. package/dist/lib/components/realtime/channels/realtime-channel-pane.component.js.map +1 -0
  172. package/dist/lib/components/realtime/realtime-activity-rail.component.d.ts +63 -0
  173. package/dist/lib/components/realtime/realtime-activity-rail.component.d.ts.map +1 -0
  174. package/dist/lib/components/realtime/realtime-activity-rail.component.js +260 -0
  175. package/dist/lib/components/realtime/realtime-activity-rail.component.js.map +1 -0
  176. package/dist/lib/components/realtime/realtime-agent-banner.component.d.ts +117 -0
  177. package/dist/lib/components/realtime/realtime-agent-banner.component.d.ts.map +1 -0
  178. package/dist/lib/components/realtime/realtime-agent-banner.component.js +504 -0
  179. package/dist/lib/components/realtime/realtime-agent-banner.component.js.map +1 -0
  180. package/dist/lib/components/realtime/realtime-agent-picker.component.d.ts +168 -0
  181. package/dist/lib/components/realtime/realtime-agent-picker.component.d.ts.map +1 -0
  182. package/dist/lib/components/realtime/realtime-agent-picker.component.js +556 -0
  183. package/dist/lib/components/realtime/realtime-agent-picker.component.js.map +1 -0
  184. package/dist/lib/components/realtime/realtime-audio-visuals.d.ts +97 -0
  185. package/dist/lib/components/realtime/realtime-audio-visuals.d.ts.map +1 -0
  186. package/dist/lib/components/realtime/realtime-audio-visuals.js +139 -0
  187. package/dist/lib/components/realtime/realtime-audio-visuals.js.map +1 -0
  188. package/dist/lib/components/realtime/realtime-channel-strip.component.d.ts +29 -0
  189. package/dist/lib/components/realtime/realtime-channel-strip.component.d.ts.map +1 -0
  190. package/dist/lib/components/realtime/realtime-channel-strip.component.js +69 -0
  191. package/dist/lib/components/realtime/realtime-channel-strip.component.js.map +1 -0
  192. package/dist/lib/components/realtime/realtime-composer.component.d.ts +65 -0
  193. package/dist/lib/components/realtime/realtime-composer.component.d.ts.map +1 -0
  194. package/dist/lib/components/realtime/realtime-composer.component.js +256 -0
  195. package/dist/lib/components/realtime/realtime-composer.component.js.map +1 -0
  196. package/dist/lib/components/realtime/realtime-delegation-card.component.d.ts +71 -0
  197. package/dist/lib/components/realtime/realtime-delegation-card.component.d.ts.map +1 -0
  198. package/dist/lib/components/realtime/realtime-delegation-card.component.js +324 -0
  199. package/dist/lib/components/realtime/realtime-delegation-card.component.js.map +1 -0
  200. package/dist/lib/components/realtime/realtime-disclosure.d.ts +135 -0
  201. package/dist/lib/components/realtime/realtime-disclosure.d.ts.map +1 -0
  202. package/dist/lib/components/realtime/realtime-disclosure.js +188 -0
  203. package/dist/lib/components/realtime/realtime-disclosure.js.map +1 -0
  204. package/dist/lib/components/realtime/realtime-session-overlay.component.d.ts +491 -0
  205. package/dist/lib/components/realtime/realtime-session-overlay.component.d.ts.map +1 -0
  206. package/dist/lib/components/realtime/realtime-session-overlay.component.js +1274 -0
  207. package/dist/lib/components/realtime/realtime-session-overlay.component.js.map +1 -0
  208. package/dist/lib/components/realtime/realtime-session-state.d.ts +191 -0
  209. package/dist/lib/components/realtime/realtime-session-state.d.ts.map +1 -0
  210. package/dist/lib/components/realtime/realtime-session-state.js +244 -0
  211. package/dist/lib/components/realtime/realtime-session-state.js.map +1 -0
  212. package/dist/lib/components/realtime/realtime-session-thread.component.d.ts +56 -0
  213. package/dist/lib/components/realtime/realtime-session-thread.component.d.ts.map +1 -0
  214. package/dist/lib/components/realtime/realtime-session-thread.component.js +246 -0
  215. package/dist/lib/components/realtime/realtime-session-thread.component.js.map +1 -0
  216. package/dist/lib/components/realtime/realtime-session-timeline-card.component.d.ts +51 -0
  217. package/dist/lib/components/realtime/realtime-session-timeline-card.component.d.ts.map +1 -0
  218. package/dist/lib/components/realtime/realtime-session-timeline-card.component.js +193 -0
  219. package/dist/lib/components/realtime/realtime-session-timeline-card.component.js.map +1 -0
  220. package/dist/lib/components/realtime/realtime-surface-panel-prefs.d.ts +77 -0
  221. package/dist/lib/components/realtime/realtime-surface-panel-prefs.d.ts.map +1 -0
  222. package/dist/lib/components/realtime/realtime-surface-panel-prefs.js +114 -0
  223. package/dist/lib/components/realtime/realtime-surface-panel-prefs.js.map +1 -0
  224. package/dist/lib/components/realtime/realtime-surface-tabs.component.d.ts +173 -0
  225. package/dist/lib/components/realtime/realtime-surface-tabs.component.d.ts.map +1 -0
  226. package/dist/lib/components/realtime/realtime-surface-tabs.component.js +496 -0
  227. package/dist/lib/components/realtime/realtime-surface-tabs.component.js.map +1 -0
  228. package/dist/lib/components/realtime/realtime-surface-tabs.model.d.ts +181 -0
  229. package/dist/lib/components/realtime/realtime-surface-tabs.model.d.ts.map +1 -0
  230. package/dist/lib/components/realtime/realtime-surface-tabs.model.js +223 -0
  231. package/dist/lib/components/realtime/realtime-surface-tabs.model.js.map +1 -0
  232. package/dist/lib/components/realtime/remote-browser/remote-browser-audio-player.d.ts +163 -0
  233. package/dist/lib/components/realtime/remote-browser/remote-browser-audio-player.d.ts.map +1 -0
  234. package/dist/lib/components/realtime/remote-browser/remote-browser-audio-player.js +309 -0
  235. package/dist/lib/components/realtime/remote-browser/remote-browser-audio-player.js.map +1 -0
  236. package/dist/lib/components/realtime/remote-browser/remote-browser-channel.d.ts +168 -0
  237. package/dist/lib/components/realtime/remote-browser/remote-browser-channel.d.ts.map +1 -0
  238. package/dist/lib/components/realtime/remote-browser/remote-browser-channel.js +524 -0
  239. package/dist/lib/components/realtime/remote-browser/remote-browser-channel.js.map +1 -0
  240. package/dist/lib/components/realtime/remote-browser/remote-browser-surface.component.d.ts +346 -0
  241. package/dist/lib/components/realtime/remote-browser/remote-browser-surface.component.d.ts.map +1 -0
  242. package/dist/lib/components/realtime/remote-browser/remote-browser-surface.component.js +851 -0
  243. package/dist/lib/components/realtime/remote-browser/remote-browser-surface.component.js.map +1 -0
  244. package/dist/lib/components/realtime/remote-browser/remote-browser-tools.d.ts +86 -0
  245. package/dist/lib/components/realtime/remote-browser/remote-browser-tools.d.ts.map +1 -0
  246. package/dist/lib/components/realtime/remote-browser/remote-browser-tools.js +210 -0
  247. package/dist/lib/components/realtime/remote-browser/remote-browser-tools.js.map +1 -0
  248. package/dist/lib/components/realtime/whiteboard/whiteboard-artifact-viewer.component.d.ts +48 -0
  249. package/dist/lib/components/realtime/whiteboard/whiteboard-artifact-viewer.component.d.ts.map +1 -0
  250. package/dist/lib/components/realtime/whiteboard/whiteboard-artifact-viewer.component.js +180 -0
  251. package/dist/lib/components/realtime/whiteboard/whiteboard-artifact-viewer.component.js.map +1 -0
  252. package/dist/lib/components/realtime/whiteboard/whiteboard-channel.d.ts +119 -0
  253. package/dist/lib/components/realtime/whiteboard/whiteboard-channel.d.ts.map +1 -0
  254. package/dist/lib/components/realtime/whiteboard/whiteboard-channel.js +274 -0
  255. package/dist/lib/components/realtime/whiteboard/whiteboard-channel.js.map +1 -0
  256. package/dist/lib/components/slots/mj-chat-agent-presence-default.component.d.ts +11 -0
  257. package/dist/lib/components/slots/mj-chat-agent-presence-default.component.d.ts.map +1 -0
  258. package/dist/lib/components/slots/mj-chat-agent-presence-default.component.js +98 -0
  259. package/dist/lib/components/slots/mj-chat-agent-presence-default.component.js.map +1 -0
  260. package/dist/lib/components/slots/mj-chat-demonstration-surface-default.component.d.ts +9 -0
  261. package/dist/lib/components/slots/mj-chat-demonstration-surface-default.component.d.ts.map +1 -0
  262. package/dist/lib/components/slots/mj-chat-demonstration-surface-default.component.js +35 -0
  263. package/dist/lib/components/slots/mj-chat-demonstration-surface-default.component.js.map +1 -0
  264. package/dist/lib/components/slots/mj-chat-empty-state-default.component.d.ts +28 -0
  265. package/dist/lib/components/slots/mj-chat-empty-state-default.component.d.ts.map +1 -0
  266. package/dist/lib/components/slots/mj-chat-empty-state-default.component.js +104 -0
  267. package/dist/lib/components/slots/mj-chat-empty-state-default.component.js.map +1 -0
  268. package/dist/lib/components/slots/mj-chat-header-default.component.d.ts +11 -0
  269. package/dist/lib/components/slots/mj-chat-header-default.component.d.ts.map +1 -0
  270. package/dist/lib/components/slots/mj-chat-header-default.component.js +103 -0
  271. package/dist/lib/components/slots/mj-chat-header-default.component.js.map +1 -0
  272. package/dist/lib/components/slots/mj-chat-message-bubble-default.component.d.ts +15 -0
  273. package/dist/lib/components/slots/mj-chat-message-bubble-default.component.d.ts.map +1 -0
  274. package/dist/lib/components/slots/mj-chat-message-bubble-default.component.js +73 -0
  275. package/dist/lib/components/slots/mj-chat-message-bubble-default.component.js.map +1 -0
  276. package/dist/lib/components/slots/mj-chat-message-extra-default.component.d.ts +9 -0
  277. package/dist/lib/components/slots/mj-chat-message-extra-default.component.d.ts.map +1 -0
  278. package/dist/lib/components/slots/mj-chat-message-extra-default.component.js +34 -0
  279. package/dist/lib/components/slots/mj-chat-message-extra-default.component.js.map +1 -0
  280. package/dist/lib/components/slots/slot-interfaces.d.ts +95 -0
  281. package/dist/lib/components/slots/slot-interfaces.d.ts.map +1 -0
  282. package/dist/lib/components/slots/slot-interfaces.js +18 -0
  283. package/dist/lib/components/slots/slot-interfaces.js.map +1 -0
  284. package/dist/lib/components/workspace/conversation-workspace.component.d.ts +11 -0
  285. package/dist/lib/components/workspace/conversation-workspace.component.d.ts.map +1 -1
  286. package/dist/lib/components/workspace/conversation-workspace.component.js +28 -4
  287. package/dist/lib/components/workspace/conversation-workspace.component.js.map +1 -1
  288. package/dist/lib/conversations.module.d.ts +12 -1
  289. package/dist/lib/conversations.module.d.ts.map +1 -1
  290. package/dist/lib/conversations.module.js +93 -5
  291. package/dist/lib/conversations.module.js.map +1 -1
  292. package/dist/lib/directives/chat-slot.directive.d.ts +44 -0
  293. package/dist/lib/directives/chat-slot.directive.d.ts.map +1 -0
  294. package/dist/lib/directives/chat-slot.directive.js +54 -0
  295. package/dist/lib/directives/chat-slot.directive.js.map +1 -0
  296. package/dist/lib/events/chat-events.d.ts +137 -0
  297. package/dist/lib/events/chat-events.d.ts.map +1 -0
  298. package/dist/lib/events/chat-events.js +189 -0
  299. package/dist/lib/events/chat-events.js.map +1 -0
  300. package/dist/lib/models/conversation-state.model.d.ts +2 -1
  301. package/dist/lib/models/conversation-state.model.d.ts.map +1 -1
  302. package/dist/lib/models/conversation-state.model.js.map +1 -1
  303. package/dist/lib/services/artifact-state.service.d.ts.map +1 -1
  304. package/dist/lib/services/artifact-state.service.js +23 -6
  305. package/dist/lib/services/artifact-state.service.js.map +1 -1
  306. package/dist/lib/services/conversation-agent.service.d.ts +60 -74
  307. package/dist/lib/services/conversation-agent.service.d.ts.map +1 -1
  308. package/dist/lib/services/conversation-agent.service.js +100 -313
  309. package/dist/lib/services/conversation-agent.service.js.map +1 -1
  310. package/dist/lib/services/conversation-bridge.service.d.ts +11 -70
  311. package/dist/lib/services/conversation-bridge.service.d.ts.map +1 -1
  312. package/dist/lib/services/conversation-bridge.service.js +51 -85
  313. package/dist/lib/services/conversation-bridge.service.js.map +1 -1
  314. package/dist/lib/services/conversation-naming.d.ts +63 -0
  315. package/dist/lib/services/conversation-naming.d.ts.map +1 -0
  316. package/dist/lib/services/conversation-naming.js +58 -0
  317. package/dist/lib/services/conversation-naming.js.map +1 -0
  318. package/dist/lib/services/conversation-streaming.service.d.ts +24 -154
  319. package/dist/lib/services/conversation-streaming.service.d.ts.map +1 -1
  320. package/dist/lib/services/conversation-streaming.service.js +39 -361
  321. package/dist/lib/services/conversation-streaming.service.js.map +1 -1
  322. package/dist/lib/services/conversations-runtime-bootstrap.service.d.ts +10 -0
  323. package/dist/lib/services/conversations-runtime-bootstrap.service.d.ts.map +1 -0
  324. package/dist/lib/services/conversations-runtime-bootstrap.service.js +104 -0
  325. package/dist/lib/services/conversations-runtime-bootstrap.service.js.map +1 -0
  326. package/dist/lib/services/delegation-result-parser.d.ts +45 -0
  327. package/dist/lib/services/delegation-result-parser.d.ts.map +1 -0
  328. package/dist/lib/services/delegation-result-parser.js +48 -0
  329. package/dist/lib/services/delegation-result-parser.js.map +1 -0
  330. package/dist/lib/services/mention-autocomplete.service.d.ts +19 -4
  331. package/dist/lib/services/mention-autocomplete.service.d.ts.map +1 -1
  332. package/dist/lib/services/mention-autocomplete.service.js +65 -4
  333. package/dist/lib/services/mention-autocomplete.service.js.map +1 -1
  334. package/dist/lib/services/mention-parser.service.d.ts +8 -53
  335. package/dist/lib/services/mention-parser.service.d.ts.map +1 -1
  336. package/dist/lib/services/mention-parser.service.js +32 -243
  337. package/dist/lib/services/mention-parser.service.js.map +1 -1
  338. package/dist/lib/services/narration-template.d.ts +42 -0
  339. package/dist/lib/services/narration-template.d.ts.map +1 -0
  340. package/dist/lib/services/narration-template.js +73 -0
  341. package/dist/lib/services/narration-template.js.map +1 -0
  342. package/dist/lib/services/realtime-pairing.d.ts +120 -0
  343. package/dist/lib/services/realtime-pairing.d.ts.map +1 -0
  344. package/dist/lib/services/realtime-pairing.js +150 -0
  345. package/dist/lib/services/realtime-pairing.js.map +1 -0
  346. package/dist/lib/services/realtime-session-review.service.d.ts +233 -0
  347. package/dist/lib/services/realtime-session-review.service.d.ts.map +1 -0
  348. package/dist/lib/services/realtime-session-review.service.js +417 -0
  349. package/dist/lib/services/realtime-session-review.service.js.map +1 -0
  350. package/dist/lib/services/realtime-session.service.d.ts +739 -0
  351. package/dist/lib/services/realtime-session.service.d.ts.map +1 -0
  352. package/dist/lib/services/realtime-session.service.js +1647 -0
  353. package/dist/lib/services/realtime-session.service.js.map +1 -0
  354. package/dist/lib/services/realtime-sessions-adapter.d.ts +54 -0
  355. package/dist/lib/services/realtime-sessions-adapter.d.ts.map +1 -0
  356. package/dist/lib/services/realtime-sessions-adapter.js +154 -0
  357. package/dist/lib/services/realtime-sessions-adapter.js.map +1 -0
  358. package/dist/lib/services/user-authorization.d.ts +67 -0
  359. package/dist/lib/services/user-authorization.d.ts.map +1 -0
  360. package/dist/lib/services/user-authorization.js +66 -0
  361. package/dist/lib/services/user-authorization.js.map +1 -0
  362. package/dist/lib/utils/realtime-session-timeline.d.ts +84 -0
  363. package/dist/lib/utils/realtime-session-timeline.d.ts.map +1 -0
  364. package/dist/lib/utils/realtime-session-timeline.js +94 -0
  365. package/dist/lib/utils/realtime-session-timeline.js.map +1 -0
  366. package/dist/public-api.d.ts +41 -0
  367. package/dist/public-api.d.ts.map +1 -1
  368. package/dist/public-api.js +50 -0
  369. package/dist/public-api.js.map +1 -1
  370. package/package.json +27 -24
  371. package/dist/__tests__/conversation-bridge.service.test.d.ts +0 -2
  372. package/dist/__tests__/conversation-bridge.service.test.d.ts.map +0 -1
  373. package/dist/__tests__/conversation-bridge.service.test.js +0 -98
  374. package/dist/__tests__/conversation-bridge.service.test.js.map +0 -1
  375. package/dist/__tests__/mention-parser.test.d.ts +0 -2
  376. package/dist/__tests__/mention-parser.test.d.ts.map +0 -1
  377. package/dist/__tests__/mention-parser.test.js +0 -154
  378. package/dist/__tests__/mention-parser.test.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"remote-browser-surface.component.js","sourceRoot":"","sources":["../../../../../src/lib/components/realtime/remote-browser/remote-browser-surface.component.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,uBAAuB,EAAE,iBAAiB,EAAE,SAAS,EAAc,YAAY,EAAE,KAAK,EAAE,MAAM,EACtF,MAAM,EAAE,SAAS,EAAE,MAAM,EAClC,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;;;;;;IA6I9D,+BAAyE;IACvE,wBAA2D;IAAC,gCAC9D;IAAA,iBAAO;;;;IAGP,kCAQC;IADC,iMAAS,yBAAkB,KAAC;IAE5B,wBAAqH;IACvH,iBAAS;;;IAPP,sDAAsC;IAGtC,yFAAoE;;IAGhD,cAAoC;IAAC,AAArC,oDAAoC,sCAAqC;;;IAY3F,gCAAuE;;;IAIzE,+BAA4B;IAC1B,iCAAuE;IACzE,iBAAM;;;IAZR,+BAA2D;IACzD,gCAAqG;IACrG,kHAAmB;IAMrB,iBAAM;IACN,+GAAiB;;;IATY,6CAA6B;IACb,cAAgD;IAAhD,gEAAgD;IAC3F,eAKC;IALD,6CAKC;IAEH,cAIC;IAJD,2CAIC;;;IAED,0BAA6F;;;IAAlE,gEAAyB;;;IAEpD,+BAA4B;IAC1B,iCAAuE;IACzE,iBAAM;;AAlLhB,iGAAiG;AACjG,MAAM,gBAAgB,GAAG,GAAG,CAAC;AAE7B,2FAA2F;AAC3F,MAAM,wBAAwB,GAAG,EAAE,CAAC;AAEpC,kHAAkH;AAClH,MAAM,kBAAkB,GAAG,EAAE,CAAC;AAE9B,uGAAuG;AACvG,MAAM,uBAAuB,GAAG,CAAC,CAAC;AA8BlC;;;;GAIG;AACH,MAAM,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkDT;;kBA+IA,KAAK;;kBAWL,KAAK;;kBAyBL,KAAK;;kBAeL,MAAM;;kBAMN,KAAK;;kBAOL,KAAK;;kBAGL,MAAM;;kBA8BN,SAAS;mBAAC,aAAa;;kBAGvB,SAAS;mBAAC,cAAc;;kFAtGd,6BAA6B","sourcesContent":["import {\n ChangeDetectionStrategy, ChangeDetectorRef, Component, ElementRef, EventEmitter, Input, NgZone, OnDestroy,\n OnInit, Output, ViewChild, inject\n} from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { SharedGenericModule } from '@memberjunction/ng-shared-generic';\n\n/** How often the surface polls the server for a fresh page screenshot while bound (~1.4 fps). */\nconst SNAPSHOT_POLL_MS = 700;\n\n/** Min interval between forwarded pointer-move samples during takeover (~20 moves/sec). */\nconst POINTER_MOVE_THROTTLE_MS = 50;\n\n/** Min interval between forwarded scroll samples during takeover; the deltas coalesce between sends (~25/sec). */\nconst SCROLL_THROTTLE_MS = 40;\n\n/** Radius (px) of the synthetic cursor ring drawn on the overlay so the user can see their pointer. */\nconst SYNTHETIC_CURSOR_RADIUS = 6;\n\n/** A keyboard modifier held during a relayed human input (Shift-click selection, Ctrl/Cmd+key chords). */\nexport type RemoteBrowserModifier = 'Shift' | 'Control' | 'Alt' | 'Meta';\n\n/**\n * One human-takeover input the surface emits to the channel while the user \"drives\" the live view.\n * Mirrors the server's `RemoteBrowserHumanInput` union (flattened for transport): pointer\n * moves/clicks/down/up and scrolls carry VIEWPORT coordinates, a scroll also carries wheel deltas, a key\n * carries the pressed key string. Pointer clicks/down/up and keys also carry any held `modifiers`.\n */\nexport interface RemoteBrowserHumanInputEvent {\n /** Which input occurred. */\n kind: 'pointer-move' | 'pointer-click' | 'pointer-down' | 'pointer-up' | 'key' | 'scroll';\n /** Viewport X (pointer + scroll kinds only). */\n x?: number;\n /** Viewport Y (pointer + scroll kinds only). */\n y?: number;\n /** Mouse button (pointer-click / -down / -up only). */\n button?: 'left' | 'middle' | 'right';\n /** The pressed key (key kind only). */\n key?: string;\n /** Horizontal wheel delta in pixels (scroll kind only; positive = right). */\n deltaX?: number;\n /** Vertical wheel delta in pixels (scroll kind only; positive = down). */\n deltaY?: number;\n /** Modifier keys held during the input (pointer-click / -down / -up and key kinds). */\n modifiers?: RemoteBrowserModifier[];\n}\n\n/**\n * Keys forwarded into the page during takeover even though they aren't single printable characters —\n * navigation/editing keys the page (not the host app) should receive. `preventDefault` is applied only to\n * forwarded keys so the host app's own shortcuts on un-forwarded keys still work.\n */\nconst FORWARDED_CONTROL_KEYS = new Set<string>([\n 'Enter', 'Tab', 'Backspace', 'Delete', 'Escape',\n 'ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight',\n 'Home', 'End', 'PageUp', 'PageDown',\n]);\n\n/**\n * The modifier keys themselves — pressing one alone is never forwarded as a key (it only rides as a\n * modifier on the NEXT non-modifier key / click), so the page never receives a lone `'Shift'` keypress.\n */\nconst MODIFIER_KEYS = new Set<string>(['Shift', 'Control', 'Alt', 'Meta', 'CapsLock']);\n\n/**\n * Maps a display-space pointer position on the live canvas to the server browser's VIEWPORT pixel space.\n *\n * The canvas's internal resolution (`canvasWidth`/`canvasHeight`, set from each pushed frame) IS the\n * viewport pixel space; the canvas is displayed scaled to its bounding rect. So a display point maps as\n * `vx = (clientX - rect.left) / rect.width * canvasWidth` (and likewise for y), rounded to ints. Returns\n * `null` for a zero-size rect or un-sized canvas (divide-by-zero / not-ready guard).\n *\n * Pure + framework-free so it's unit-testable without a DOM.\n *\n * @param clientX The pointer's viewport X in the DOM (`event.clientX`).\n * @param clientY The pointer's viewport Y in the DOM (`event.clientY`).\n * @param rect The canvas's bounding rect (`getBoundingClientRect()`).\n * @param canvasWidth The canvas's internal pixel width (= frame/viewport width).\n * @param canvasHeight The canvas's internal pixel height (= frame/viewport height).\n * @returns Integer viewport coordinates, or `null` when mapping isn't possible.\n */\nexport function MapToViewportCoords(\n clientX: number,\n clientY: number,\n rect: { left: number; top: number; width: number; height: number },\n canvasWidth: number,\n canvasHeight: number,\n): { x: number; y: number } | null {\n if (rect.width <= 0 || rect.height <= 0 || canvasWidth <= 0 || canvasHeight <= 0) {\n return null;\n }\n const x = Math.round((clientX - rect.left) / rect.width * canvasWidth);\n const y = Math.round((clientY - rect.top) / rect.height * canvasHeight);\n return { x, y };\n}\n\n/**\n * One snapshot of the server-hosted browser — the shape the surface's {@link RemoteBrowserSurfaceComponent.Fetch}\n * callback resolves to. Mirrors the server's `RemoteBrowserSnapshot` query payload.\n */\nexport interface RemoteBrowserSnapshotView {\n /** The current page screenshot as raw base64 PNG, or `null` when none is available yet. */\n ScreenshotBase64: string | null;\n /** The current page URL, or `null` when no page is loaded. */\n CurrentUrl: string | null;\n}\n\n/**\n * Fetches one {@link RemoteBrowserSnapshotView} from the server. Supplied by the channel\n * plugin (it owns the session id + GraphQL provider). Best-effort by contract: resolves to\n * `null` on any failure rather than throwing, so the surface keeps the last good frame.\n */\nexport type RemoteBrowserSnapshotFetcher = () => Promise<RemoteBrowserSnapshotView | null>;\n\n/**\n * LIVE REMOTE-BROWSER surface (`mj-realtime-remote-browser-surface`) — the Browser channel\n * tab's pane. It renders the SERVER-hosted browser the agent drives: a refreshing screenshot\n * `<img>` with the current URL above it and a small \"live\" indicator. The agent's\n * `browser_*` tools mutate the page through the channel plugin; this surface only PERCEIVES\n * it, polling its {@link Fetch} callback every {@link SNAPSHOT_POLL_MS} ms while bound.\n *\n * The surface is transport-agnostic — it never touches GraphQL directly. The channel plugin\n * wires the {@link Fetch} callback (closing over the session id + provider) in `BindSurface`\n * before the surface's first change detection, so the `ngOnInit` poll has it. Polling stops\n * in `ngOnDestroy` (pane collapsed / overlay torn down) so no traffic continues after unbind.\n * View-only in v1 — there is no takeover input.\n *\n * ### Two render paths: pushed screencast (preferred) vs. snapshot poll (fallback)\n * When the backend advertises the `ScreenStreaming` capability, the server PUSHES encoded CDP\n * frames and the channel plugin sets {@link Streaming} = `true`. In that mode the surface paints\n * each frame onto a `<canvas>` via {@link RenderFrame} and DOES NOT start the poll. When streaming\n * is off (capability absent or start failed) the original behavior is unchanged: the surface polls\n * {@link Fetch} every {@link SNAPSHOT_POLL_MS} ms and renders the screenshot `<img>`.\n */\n@Component({\n standalone: true,\n selector: 'mj-realtime-remote-browser-surface',\n imports: [CommonModule, SharedGenericModule],\n changeDetection: ChangeDetectionStrategy.OnPush,\n template: `\n <div class=\"rb-surface\">\n <div class=\"rb-bar\">\n <span class=\"rb-live\" [class.rb-live--on]=\"HasSnapshot\" aria-hidden=\"true\"></span>\n <span class=\"rb-live-label\">{{ HasSnapshot ? 'Live' : 'Connecting…' }}</span>\n <span class=\"rb-url\" [title]=\"CurrentUrl || ''\">{{ CurrentUrl || 'No page loaded yet' }}</span>\n @if (CanTakeOver) {\n <span class=\"rb-driving\" title=\"Click and type to control the live page\">\n <i class=\"fa-solid fa-hand-pointer\" aria-hidden=\"true\"></i> You're driving\n </span>\n }\n @if (AudioAvailable) {\n <button\n type=\"button\"\n class=\"rb-speaker\"\n [class.rb-speaker--muted]=\"AudioMuted\"\n [attr.aria-pressed]=\"!AudioMuted\"\n [attr.aria-label]=\"AudioMuted ? 'Unmute browser audio' : 'Mute browser audio'\"\n [title]=\"AudioMuted ? 'Unmute browser audio' : 'Mute browser audio'\"\n (click)=\"ToggleAudioMuted()\"\n >\n <i class=\"fa-solid\" [class.fa-volume-high]=\"!AudioMuted\" [class.fa-volume-xmark]=\"AudioMuted\" aria-hidden=\"true\"></i>\n </button>\n }\n </div>\n <div class=\"rb-viewport\">\n @if (Streaming) {\n <div class=\"rb-canvas-stack\" [class.rb-hidden]=\"!HasFrame\">\n <canvas #frameCanvas class=\"rb-screenshot\" [class.rb-screenshot--interactive]=\"CanTakeOver\"></canvas>\n @if (CanTakeOver) {\n <!-- Synthetic cursor overlay: same internal resolution + CSS box as the frame canvas, so a\n point drawn at viewport coords aligns exactly. CDP screencast frames don't include the OS\n cursor, so we render the user's pointer locally for immediate, round-trip-free feedback. -->\n <canvas #cursorCanvas class=\"rb-screenshot rb-cursor-overlay\"></canvas>\n }\n </div>\n @if (!HasFrame) {\n <div class=\"rb-placeholder\">\n <mj-loading text=\"Waiting for the browser…\" size=\"medium\"></mj-loading>\n </div>\n }\n } @else if (ScreenshotDataUrl) {\n <img class=\"rb-screenshot\" [src]=\"ScreenshotDataUrl\" alt=\"Live view of the shared browser\" />\n } @else {\n <div class=\"rb-placeholder\">\n <mj-loading text=\"Waiting for the browser…\" size=\"medium\"></mj-loading>\n </div>\n }\n </div>\n </div>\n `,\n styles: [`\n :host { display: block; height: 100%; }\n .rb-surface {\n display: flex;\n flex-direction: column;\n height: 100%;\n background: var(--mj-bg-surface-sunken);\n }\n .rb-bar {\n display: flex;\n align-items: center;\n gap: 8px;\n padding: 8px 12px;\n border-bottom: 1px solid var(--mj-border-subtle);\n background: var(--mj-bg-surface);\n font-size: 0.8125rem;\n color: var(--mj-text-secondary);\n }\n .rb-live {\n width: 8px;\n height: 8px;\n border-radius: var(--mj-radius-full, 50%);\n background: var(--mj-text-disabled);\n flex: 0 0 auto;\n }\n .rb-live--on {\n background: var(--mj-status-success);\n box-shadow: 0 0 0 3px color-mix(in srgb, var(--mj-status-success) 25%, transparent);\n }\n .rb-live-label {\n flex: 0 0 auto;\n font-weight: 600;\n color: var(--mj-text-primary);\n }\n .rb-url {\n flex: 1 1 auto;\n min-width: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n font-family: var(--mj-font-mono, monospace);\n }\n .rb-viewport {\n flex: 1 1 auto;\n min-height: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n overflow: auto;\n padding: 12px;\n }\n .rb-screenshot {\n max-width: 100%;\n max-height: 100%;\n object-fit: contain;\n border: 1px solid var(--mj-border-default);\n border-radius: var(--mj-radius-md, 6px);\n box-shadow: var(--mj-shadow-sm, 0 1px 3px color-mix(in srgb, var(--mj-text-primary) 12%, transparent));\n background: var(--mj-bg-surface);\n }\n .rb-screenshot--interactive {\n /* Hide the OS cursor — we render a synthetic cursor on the overlay so there's exactly one pointer\n and it reads naturally for clicking on a web page (not the old crosshair). */\n cursor: none;\n outline: none;\n }\n .rb-screenshot--interactive:focus-visible {\n border-color: var(--mj-border-focus);\n box-shadow: 0 0 0 3px color-mix(in srgb, var(--mj-brand-primary) 25%, transparent);\n }\n /* Frame canvas + synthetic-cursor overlay share one box; the stack shrinks to the frame canvas so the\n absolutely-positioned overlay (inset:0, same object-fit) lines up pixel-for-pixel with it. */\n .rb-canvas-stack {\n position: relative;\n display: inline-flex;\n max-width: 100%;\n max-height: 100%;\n min-height: 0;\n }\n .rb-cursor-overlay {\n position: absolute;\n inset: 0;\n width: 100%;\n height: 100%;\n /* Transparent passthrough layer — no chrome of its own, and never steals pointer/wheel events from\n the frame canvas underneath (those listeners drive takeover). */\n border: none;\n box-shadow: none;\n background: transparent;\n pointer-events: none;\n }\n .rb-driving {\n flex: 0 0 auto;\n display: inline-flex;\n align-items: center;\n gap: 5px;\n padding: 2px 8px;\n border-radius: var(--mj-radius-full, 999px);\n font-size: 0.75rem;\n font-weight: 600;\n color: var(--mj-brand-primary);\n background: color-mix(in srgb, var(--mj-brand-primary) 12%, transparent);\n }\n .rb-placeholder {\n display: flex;\n align-items: center;\n justify-content: center;\n }\n .rb-hidden {\n display: none;\n }\n .rb-speaker {\n flex: 0 0 auto;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 28px;\n height: 28px;\n padding: 0;\n border: 1px solid var(--mj-border-default);\n border-radius: var(--mj-radius-md, 6px);\n background: var(--mj-bg-surface);\n color: var(--mj-brand-primary);\n cursor: pointer;\n font-size: 0.8125rem;\n transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;\n }\n .rb-speaker:hover {\n background: var(--mj-bg-surface-hover);\n }\n .rb-speaker:focus-visible {\n outline: none;\n border-color: var(--mj-border-focus);\n box-shadow: 0 0 0 3px color-mix(in srgb, var(--mj-brand-primary) 25%, transparent);\n }\n .rb-speaker--muted {\n color: var(--mj-text-muted);\n }\n `]\n})\nexport class RemoteBrowserSurfaceComponent implements OnInit, OnDestroy {\n /** Snapshot fetcher supplied by the channel plugin (closes over the session id + provider). */\n @Input() Fetch: RemoteBrowserSnapshotFetcher | null = null;\n\n /**\n * Whether the server is PUSHING live screencast frames for this session (the backend advertised the\n * `ScreenStreaming` capability and the start succeeded). When `true` the surface paints pushed frames\n * onto its `<canvas>` via {@link RenderFrame} and does NOT poll; when `false` it uses the snapshot\n * `<img>` poll fallback. Set by the channel plugin in `BindSurface` from the start-screencast result.\n *\n * The start-screencast result is async, so this may flip to `true` AFTER `ngOnInit` has already begun\n * polling — the setter tears the poll down in that case so the two render paths never run at once.\n */\n @Input()\n set Streaming(value: boolean) {\n if (value === this._streaming) {\n return;\n }\n this._streaming = value;\n if (value) {\n // Late flip after the poll-fallback already started: stop polling, switch to canvas frames.\n this.stopPolling();\n this.zone.run(() => this.cdr.markForCheck());\n }\n // Takeover only attaches on the canvas path — (de)attach as streaming flips.\n this.syncTakeoverListeners();\n }\n get Streaming(): boolean {\n return this._streaming;\n }\n private _streaming = false;\n\n /**\n * Whether HUMAN TAKEOVER is enabled — the user watching the live view can click/type into the page and\n * those events are relayed into the server browser (Collaborative control). Takeover only attaches to the\n * canvas render path (pushed screencast); the `<img>` poll fallback stays view-only. When enabled while\n * already streaming the setter attaches listeners; flipping it off (or streaming off) detaches them.\n */\n @Input()\n set Interactive(value: boolean) {\n if (value === this._interactive) {\n return;\n }\n this._interactive = value;\n this.syncTakeoverListeners();\n this.zone.run(() => this.cdr.markForCheck());\n }\n get Interactive(): boolean {\n return this._interactive;\n }\n private _interactive = false;\n\n /** Emits each human-takeover input (pointer move/click, key) the user performs on the live canvas. */\n @Output() HumanInput = new EventEmitter<RemoteBrowserHumanInputEvent>();\n\n /**\n * Whether the live tab-audio stream is available — the channel sets this `true` when the server confirms\n * it is pushing audio. Drives whether the speaker toggle renders in the live-view bar.\n */\n @Input() AudioAvailable = false;\n\n /**\n * Whether tab audio is currently muted. Two-way: the channel sets the initial value (un-muted when audio\n * starts) and the toggle updates it; {@link AudioMutedChange} relays each user change to the channel,\n * which mutes/unmutes the player.\n */\n @Input() AudioMuted = false;\n\n /** Emits the new muted state each time the user toggles the speaker (two-way `AudioMuted`). */\n @Output() AudioMutedChange = new EventEmitter<boolean>();\n\n /** Toggles the speaker mute state and relays it to the channel (which mutes/unmutes the audio player). */\n public ToggleAudioMuted(): void {\n this.AudioMuted = !this.AudioMuted;\n this.AudioMutedChange.emit(this.AudioMuted);\n }\n\n /** True when takeover is both enabled AND on the canvas path — drives the cursor + \"driving\" pill. */\n public get CanTakeOver(): boolean {\n return this._interactive && this._streaming;\n }\n\n /**\n * True while the user is actively driving the remote browser with the keyboard — the takeover canvas\n * holds focus. The host overlay reads this to stand down its own global keyboard shortcuts (e.g.\n * T-to-type opening the local composer) so keystrokes go to the remote page, not the local input.\n */\n public get IsCapturingInput(): boolean {\n return this.surfaceFocused && this.CanTakeOver;\n }\n\n /** The current screenshot as a `data:` URL, or `null` before the first snapshot arrives. */\n public ScreenshotDataUrl: string | null = null;\n /** The current page URL reported by the server, or `null` when none. */\n public CurrentUrl: string | null = null;\n /** Whether at least one pushed screencast frame has been painted (drives the canvas placeholder). */\n public HasFrame = false;\n\n /** The canvas the pushed screencast frames are painted onto (present only while {@link Streaming}). */\n @ViewChild('frameCanvas') private frameCanvas?: ElementRef<HTMLCanvasElement>;\n\n /** The transparent overlay the synthetic cursor is drawn onto (present only while {@link CanTakeOver}). */\n @ViewChild('cursorCanvas') private cursorCanvas?: ElementRef<HTMLCanvasElement>;\n\n /** Whether at least one screenshot OR frame has been rendered (drives the \"Live\" indicator). */\n public get HasSnapshot(): boolean {\n return this.ScreenshotDataUrl !== null || this.HasFrame;\n }\n\n private readonly cdr = inject(ChangeDetectorRef);\n private readonly zone = inject(NgZone);\n /** Active poll timer; `null` when polling is stopped. */\n private pollTimer: ReturnType<typeof setInterval> | null = null;\n /** Guards against overlapping polls when a request runs longer than the interval. */\n private polling = false;\n /** Set on destroy so an in-flight poll's late resolution doesn't touch a torn-down view. */\n private destroyed = false;\n /** Reused decode target for pushed frames — avoids allocating an `Image` per frame. */\n private readonly frameImage = new Image();\n /** The most recent un-painted frame data URL, drained on the next animation frame (drop-old coalescing). */\n private pendingFrameDataUrl: string | null = null;\n /** True while a paint is scheduled, so rapid frames coalesce to one `requestAnimationFrame`. */\n private framePaintScheduled = false;\n\n /** The canvas element takeover listeners are currently bound to, or `null` when detached. */\n private takeoverCanvas: HTMLCanvasElement | null = null;\n /** Timestamp (ms) of the last forwarded pointer-move, for throttling the high-frequency stream. */\n private lastPointerMoveAt = 0;\n /** Timestamp (ms) of the last forwarded scroll, for throttling the high-frequency wheel stream. */\n private lastScrollAt = 0;\n /** Horizontal wheel delta accumulated since the last forwarded scroll (coalesced across throttled events). */\n private pendingScrollDeltaX = 0;\n /** Vertical wheel delta accumulated since the last forwarded scroll (coalesced across throttled events). */\n private pendingScrollDeltaY = 0;\n\n /** Last canvas-relative mouse position in VIEWPORT pixel space, or `null` when the pointer is off-canvas. */\n private cursorViewportPoint: { x: number; y: number } | null = null;\n /** True while a synthetic-cursor repaint is queued, so rapid moves coalesce to one `requestAnimationFrame`. */\n private cursorPaintScheduled = false;\n\n /**\n * True while the user is mid-drag on the canvas (a `mousedown` not yet released) — drives forwarding\n * intermediate moves as a drag and emitting the closing `pointer-up`. Click-drag text selection relies on\n * this so the drag relays as down → moves → up rather than a single discrete click.\n */\n private dragging = false;\n\n /**\n * True when the most recent `mousedown`→`mouseup` actually MOVED (a real drag), so the synthetic `click`\n * the browser fires right after should be suppressed — the drag's down/move/up already conveyed the intent,\n * and a trailing click would collapse a just-made text selection.\n */\n private suppressNextClick = false;\n\n /** Viewport point of the active drag's mousedown, used to tell a real drag from a stationary click. */\n private dragStartPoint: { x: number; y: number } | null = null;\n\n /**\n * True while the takeover canvas currently HOLDS keyboard focus. The host overlay reads this (via\n * {@link IsCapturingInput}) to suppress its own global key shortcuts (e.g. T-to-type) so the user's\n * keystrokes land in the remote browser, not the local composer — fixing the \"greedy textbox\" focus theft.\n */\n private surfaceFocused = false;\n\n /** Bound handlers — stored so the exact same references can be removed on detach. */\n private readonly onCanvasMouseMove = (e: MouseEvent): void => this.handlePointerMove(e);\n private readonly onCanvasMouseDown = (e: MouseEvent): void => this.handlePointerDown(e);\n private readonly onCanvasMouseUp = (e: MouseEvent): void => this.handlePointerUp(e);\n private readonly onCanvasClick = (e: MouseEvent): void => this.handlePointerClick(e);\n private readonly onCanvasKeyDown = (e: KeyboardEvent): void => this.handleKeyDown(e);\n private readonly onCanvasMouseLeave = (): void => this.handleMouseLeave();\n private readonly onCanvasWheel = (e: WheelEvent): void => this.handleWheel(e);\n private readonly onCanvasFocus = (): void => { this.surfaceFocused = true; };\n private readonly onCanvasBlur = (): void => { this.surfaceFocused = false; };\n\n ngOnInit(): void {\n // In streaming mode the server pushes frames — never start the poll (it would be redundant traffic).\n if (this.Streaming) {\n return;\n }\n void this.pollOnce();\n this.startPolling();\n }\n\n ngOnDestroy(): void {\n this.destroyed = true;\n this.stopPolling();\n this.detachTakeoverListeners();\n }\n\n /** Starts the interval poll OUTSIDE Angular's zone so it doesn't trigger CD on every tick. */\n private startPolling(): void {\n if (this.pollTimer !== null) {\n return;\n }\n this.zone.runOutsideAngular(() => {\n this.pollTimer = setInterval(() => void this.pollOnce(), SNAPSHOT_POLL_MS);\n });\n }\n\n /** Stops the interval poll (no further snapshot requests are issued). */\n private stopPolling(): void {\n if (this.pollTimer !== null) {\n clearInterval(this.pollTimer);\n this.pollTimer = null;\n }\n }\n\n /**\n * Fetches one snapshot and applies it to the view. Best-effort: the fetcher resolves to\n * `null` on failure (the prior frame stays on screen) so a single failed poll never breaks\n * the live view. Skips when a prior poll is still in flight, the fetcher isn't wired, or\n * after destroy.\n */\n private async pollOnce(): Promise<void> {\n if (this.polling || this.destroyed || !this.Fetch) {\n return;\n }\n this.polling = true;\n try {\n const snapshot = await this.Fetch();\n this.applySnapshot(snapshot);\n } catch {\n // Defensive — the fetcher is contractually non-throwing, but never let a poll break the view.\n } finally {\n this.polling = false;\n }\n }\n\n /** Applies a fetched snapshot to the view fields and triggers OnPush change detection. */\n private applySnapshot(snapshot: RemoteBrowserSnapshotView | null): void {\n if (this.destroyed) {\n return;\n }\n const base64 = snapshot?.ScreenshotBase64 ?? null;\n const nextUrl = snapshot?.CurrentUrl ?? null;\n const nextDataUrl = base64 ? `data:image/png;base64,${base64}` : this.ScreenshotDataUrl;\n if (nextDataUrl === this.ScreenshotDataUrl && nextUrl === this.CurrentUrl) {\n return; // nothing changed — skip the CD pass\n }\n this.ScreenshotDataUrl = nextDataUrl;\n this.CurrentUrl = nextUrl;\n // Re-enter the zone for the OnPush update (the poll runs outside Angular).\n this.zone.run(() => this.cdr.markForCheck());\n }\n\n /**\n * Paints one PUSHED screencast frame (base64 JPEG) onto the canvas. Called by the channel plugin for\n * each frame the server pushes while {@link Streaming}. Coalesces a burst of frames to one paint per\n * animation frame (the newest wins) so a fast stream never floods the main thread, and reuses a single\n * `Image` decode target to avoid per-frame allocation. No-op after destroy or when not in streaming mode.\n *\n * @param dataBase64 The frame image as raw base64 JPEG (no `data:` prefix).\n */\n public RenderFrame(dataBase64: string): void {\n if (this.destroyed || !this.Streaming || !dataBase64) {\n return;\n }\n this.pendingFrameDataUrl = `data:image/jpeg;base64,${dataBase64}`;\n if (this.framePaintScheduled) {\n return; // a paint is already queued — it will pick up this newest frame\n }\n this.framePaintScheduled = true;\n this.zone.runOutsideAngular(() => requestAnimationFrame(() => this.paintPendingFrame()));\n }\n\n /**\n * Updates the URL shown above the live view. In streaming (canvas) mode the snapshot poll is stopped, so\n * the channel pushes the current URL here after a navigation/action reports one — otherwise the bar would\n * stay stuck on \"No page loaded yet\" even though the page is live. No-op for an unchanged / empty value.\n *\n * @param url The current page URL, or null/empty to leave the bar unchanged.\n */\n public SetCurrentUrl(url: string | null | undefined): void {\n if (this.destroyed || !url || url === this.CurrentUrl) {\n return;\n }\n this.CurrentUrl = url;\n this.zone.run(() => this.cdr.markForCheck());\n }\n\n /** Drains the most recent pending frame onto the canvas (drop-old coalescing target). */\n private paintPendingFrame(): void {\n this.framePaintScheduled = false;\n const dataUrl = this.pendingFrameDataUrl;\n this.pendingFrameDataUrl = null;\n if (this.destroyed || !dataUrl) {\n return;\n }\n this.frameImage.onload = () => this.drawFrameImage();\n this.frameImage.src = dataUrl;\n }\n\n /** Draws the decoded frame image onto the canvas, sizing the canvas to the frame on the first paint. */\n private drawFrameImage(): void {\n const canvas = this.frameCanvas?.nativeElement;\n if (this.destroyed || !canvas) {\n return;\n }\n const ctx = canvas.getContext('2d');\n if (!ctx) {\n return;\n }\n const { naturalWidth: w, naturalHeight: h } = this.frameImage;\n if (w > 0 && h > 0 && (canvas.width !== w || canvas.height !== h)) {\n canvas.width = w;\n canvas.height = h;\n }\n ctx.drawImage(this.frameImage, 0, 0);\n if (!this.HasFrame) {\n // First frame arrived — re-enter the zone to clear the placeholder + flip the \"Live\" indicator,\n // and attach takeover listeners now that the canvas element exists in the DOM.\n this.zone.run(() => {\n this.HasFrame = true;\n this.cdr.markForCheck();\n });\n this.syncTakeoverListeners();\n }\n }\n\n // ----- human takeover (Collaborative control) --------------------------------------------\n\n /**\n * Attaches or detaches the canvas takeover listeners so they're bound exactly when takeover is live —\n * {@link CanTakeOver} is true AND the canvas element exists. Idempotent: re-binds only when the target\n * canvas changed, detaches when the conditions no longer hold. Safe to call from any state-flip path\n * (the `Interactive`/`Streaming` setters, the first-frame paint, destroy).\n */\n private syncTakeoverListeners(): void {\n const canvas = this.CanTakeOver && !this.destroyed ? (this.frameCanvas?.nativeElement ?? null) : null;\n if (canvas === this.takeoverCanvas) {\n return; // already in the desired state\n }\n this.detachTakeoverListeners();\n if (canvas) {\n this.attachTakeoverListeners(canvas);\n }\n }\n\n /** Binds the pointer/keyboard/wheel listeners to the canvas OUTSIDE the zone (mousemove/wheel are high-frequency). */\n private attachTakeoverListeners(canvas: HTMLCanvasElement): void {\n canvas.tabIndex = 0; // focusable so it can receive keydown\n // Marks this canvas as a keyboard-capturing surface so the host overlay's global shortcuts (e.g.\n // T-to-type) stand down while it holds focus — see the overlay's isKeyboardCapturingSurfaceFocused().\n canvas.setAttribute('data-mj-capture-keys', '');\n this.zone.runOutsideAngular(() => {\n canvas.addEventListener('mousemove', this.onCanvasMouseMove);\n canvas.addEventListener('mousedown', this.onCanvasMouseDown);\n canvas.addEventListener('mouseup', this.onCanvasMouseUp);\n canvas.addEventListener('click', this.onCanvasClick);\n canvas.addEventListener('keydown', this.onCanvasKeyDown);\n canvas.addEventListener('mouseleave', this.onCanvasMouseLeave);\n canvas.addEventListener('focus', this.onCanvasFocus);\n canvas.addEventListener('blur', this.onCanvasBlur);\n // `passive: false` so preventDefault stops the host page from scrolling while the user drives the page.\n canvas.addEventListener('wheel', this.onCanvasWheel, { passive: false });\n });\n this.takeoverCanvas = canvas;\n }\n\n /** Removes the listeners from the currently-bound canvas (no-op when none are bound) and clears the cursor. */\n private detachTakeoverListeners(): void {\n const canvas = this.takeoverCanvas;\n if (!canvas) {\n return;\n }\n canvas.removeEventListener('mousemove', this.onCanvasMouseMove);\n canvas.removeEventListener('mousedown', this.onCanvasMouseDown);\n canvas.removeEventListener('mouseup', this.onCanvasMouseUp);\n canvas.removeEventListener('click', this.onCanvasClick);\n canvas.removeEventListener('keydown', this.onCanvasKeyDown);\n canvas.removeEventListener('mouseleave', this.onCanvasMouseLeave);\n canvas.removeEventListener('focus', this.onCanvasFocus);\n canvas.removeEventListener('blur', this.onCanvasBlur);\n canvas.removeEventListener('wheel', this.onCanvasWheel);\n canvas.removeAttribute('data-mj-capture-keys');\n this.takeoverCanvas = null;\n this.cursorViewportPoint = null;\n this.dragging = false;\n this.suppressNextClick = false;\n this.dragStartPoint = null;\n this.surfaceFocused = false;\n this.clearSyntheticCursor();\n }\n\n /**\n * Pointer-move → tracks the cursor for the synthetic-cursor overlay (every move, immediate, no\n * round-trip) AND emits a throttled viewport-mapped move to the server. Runs outside the zone (no CD\n * per move).\n */\n private handlePointerMove(event: MouseEvent): void {\n const point = this.toViewportCoords(event);\n if (point) {\n // Always update the local cursor for instant feedback — independent of the server-relay throttle.\n this.cursorViewportPoint = point;\n this.scheduleCursorPaint();\n }\n const now = Date.now();\n if (now - this.lastPointerMoveAt < POINTER_MOVE_THROTTLE_MS) {\n return;\n }\n this.lastPointerMoveAt = now;\n if (point) {\n this.emitInput({ kind: 'pointer-move', x: point.x, y: point.y });\n }\n }\n\n /** Mouse leaves the canvas → hide the synthetic cursor (nothing to relay). */\n private handleMouseLeave(): void {\n this.cursorViewportPoint = null;\n this.scheduleCursorPaint();\n }\n\n /**\n * Wheel/trackpad/Magic-Mouse scroll over the canvas → forwards a viewport-mapped scroll to the server.\n * Calls `preventDefault` so the host page doesn't scroll while the user drives the live page. Throttled\n * to {@link SCROLL_THROTTLE_MS}, coalescing the skipped deltas so no scroll distance is lost.\n */\n private handleWheel(event: WheelEvent): void {\n event.preventDefault();\n this.pendingScrollDeltaX += event.deltaX;\n this.pendingScrollDeltaY += event.deltaY;\n const point = this.toViewportCoords(event);\n if (point) {\n this.cursorViewportPoint = point;\n this.scheduleCursorPaint();\n }\n const now = Date.now();\n if (now - this.lastScrollAt < SCROLL_THROTTLE_MS) {\n return; // accumulate into pendingScrollDelta* until the throttle window opens\n }\n this.lastScrollAt = now;\n const target = point ?? this.cursorViewportPoint;\n if (target && (this.pendingScrollDeltaX !== 0 || this.pendingScrollDeltaY !== 0)) {\n this.emitInput({ kind: 'scroll', x: target.x, y: target.y, deltaX: this.pendingScrollDeltaX, deltaY: this.pendingScrollDeltaY });\n this.pendingScrollDeltaX = 0;\n this.pendingScrollDeltaY = 0;\n }\n }\n\n /**\n * Mouse-down on the canvas → focuses the canvas (so subsequent keys are captured) and BEGINS a drag:\n * emits a `pointer-down` and arms drag mode so the following moves relay as drag motion and the matching\n * `pointer-up` closes it. This is what makes click-drag text selection work (rather than a discrete click).\n */\n private handlePointerDown(event: MouseEvent): void {\n this.takeoverCanvas?.focus();\n const point = this.toViewportCoords(event);\n if (!point) {\n return;\n }\n this.dragging = true;\n this.dragStartPoint = point;\n this.suppressNextClick = false;\n this.cursorViewportPoint = point;\n this.scheduleCursorPaint();\n this.emitInput({ kind: 'pointer-down', x: point.x, y: point.y, button: this.mapButton(event.button), modifiers: this.collectModifiers(event) });\n }\n\n /**\n * Mouse-up on the canvas → closes a drag with a `pointer-up` at the release point, disarming drag mode.\n * If the pointer actually moved between down and up, marks the following synthetic `click` to be suppressed\n * (so the drag selection isn't immediately collapsed by a trailing click).\n */\n private handlePointerUp(event: MouseEvent): void {\n if (!this.dragging) {\n return;\n }\n this.dragging = false;\n const point = this.toViewportCoords(event);\n if (point) {\n const start = this.dragStartPoint;\n this.suppressNextClick = !!start && (start.x !== point.x || start.y !== point.y);\n this.emitInput({ kind: 'pointer-up', x: point.x, y: point.y, button: this.mapButton(event.button), modifiers: this.collectModifiers(event) });\n }\n this.dragStartPoint = null;\n }\n\n /**\n * Click → emits a viewport-mapped click WITH any held modifiers (e.g. Shift-click text selection). The\n * server browser receives the press/release of a drag via {@link handlePointerDown}/{@link handlePointerUp};\n * a plain click (down+up with no motion) still fires this `click` event, so a simple click relays as one\n * click action — but we skip emitting it when it terminates a real drag (where down/up already covered it).\n */\n private handlePointerClick(event: MouseEvent): void {\n this.takeoverCanvas?.focus();\n if (this.suppressNextClick) {\n // This click terminates a real drag (selection) — the down/move/up already conveyed it.\n this.suppressNextClick = false;\n return;\n }\n const point = this.toViewportCoords(event);\n if (point) {\n this.emitInput({ kind: 'pointer-click', x: point.x, y: point.y, button: this.mapButton(event.button), modifiers: this.collectModifiers(event) });\n }\n }\n\n /**\n * Keydown → forwards printable keys, a curated set of control keys ({@link FORWARDED_CONTROL_KEYS}), AND\n * any key combined with a Ctrl/Cmd/Alt modifier (so combos like Ctrl/Cmd+A select-all, Cmd+C/Cmd+V relay).\n * Calls `preventDefault` + `stopPropagation` ONLY on forwarded keys, so (a) the host app keeps its own\n * shortcuts on un-forwarded keys and (b) forwarded keys never bubble to the host overlay's global shortcuts\n * (the T-to-type focus-steal). Lone modifier keys are never forwarded — they ride as `modifiers` on the\n * next key/click.\n */\n private handleKeyDown(event: KeyboardEvent): void {\n const key = event.key;\n if (MODIFIER_KEYS.has(key)) {\n return; // a modifier on its own is not a keypress — it rides on the next key/click\n }\n const isPrintable = key.length === 1;\n const hasComboModifier = event.ctrlKey || event.metaKey || event.altKey;\n const isForwardable = isPrintable || FORWARDED_CONTROL_KEYS.has(key) || hasComboModifier;\n if (!isForwardable) {\n return; // leave non-forwarded keys to the host app\n }\n event.preventDefault();\n // Stop the keystroke from reaching document-level handlers (e.g. the overlay's T-to-type) so the user's\n // typing lands in the remote browser, not the local composer.\n event.stopPropagation();\n this.emitInput({ kind: 'key', key, modifiers: this.collectModifiers(event) });\n }\n\n /**\n * Collects the modifier keys currently held during a DOM mouse/keyboard event into the relayed\n * {@link RemoteBrowserModifier} list (empty when none are held).\n *\n * @param event The DOM event whose modifier flags to read.\n * @returns The held modifiers, in a stable order.\n */\n private collectModifiers(event: MouseEvent | KeyboardEvent): RemoteBrowserModifier[] {\n const modifiers: RemoteBrowserModifier[] = [];\n if (event.shiftKey) { modifiers.push('Shift'); }\n if (event.ctrlKey) { modifiers.push('Control'); }\n if (event.altKey) { modifiers.push('Alt'); }\n if (event.metaKey) { modifiers.push('Meta'); }\n return modifiers;\n }\n\n /** Re-enters the zone to emit one human input (so subscribers see it inside Angular). */\n private emitInput(input: RemoteBrowserHumanInputEvent): void {\n this.zone.run(() => this.HumanInput.emit(input));\n }\n\n /**\n * Maps a DOM pointer event on the live canvas to VIEWPORT coordinates via {@link MapToViewportCoords}\n * (the pure, unit-tested mapping). Returns `null` when no canvas is bound or mapping isn't possible yet.\n *\n * @param event The pointer event on the canvas.\n * @returns The integer viewport coordinates, or `null` when mapping isn't possible yet.\n */\n private toViewportCoords(event: MouseEvent): { x: number; y: number } | null {\n const canvas = this.takeoverCanvas;\n if (!canvas) {\n return null;\n }\n return MapToViewportCoords(event.clientX, event.clientY, canvas.getBoundingClientRect(), canvas.width, canvas.height);\n }\n\n // ----- synthetic cursor (local feedback — CDP frames don't include the OS cursor) -----------\n\n /**\n * Schedules a synthetic-cursor repaint on the next animation frame, coalescing a burst of moves to one\n * paint (the newest position wins). Runs outside the zone — drawing the cursor never triggers Angular CD.\n */\n private scheduleCursorPaint(): void {\n if (this.cursorPaintScheduled) {\n return;\n }\n this.cursorPaintScheduled = true;\n this.zone.runOutsideAngular(() => requestAnimationFrame(() => this.paintSyntheticCursor()));\n }\n\n /**\n * Draws (or clears) the synthetic cursor on the overlay canvas at {@link cursorViewportPoint}. The overlay\n * shares the frame canvas's internal resolution (sized here to match), so a point drawn at viewport coords\n * aligns exactly with the page underneath. A small brand-tinted ring with a center dot reads as a pointer\n * without obscuring what it's over. No-op after destroy or when the overlay isn't mounted.\n */\n private paintSyntheticCursor(): void {\n this.cursorPaintScheduled = false;\n const overlay = this.cursorCanvas?.nativeElement;\n const frame = this.frameCanvas?.nativeElement;\n if (this.destroyed || !overlay || !frame) {\n return;\n }\n // Keep the overlay's internal resolution locked to the frame canvas so coordinate spaces match.\n if (overlay.width !== frame.width || overlay.height !== frame.height) {\n overlay.width = frame.width;\n overlay.height = frame.height;\n }\n const ctx = overlay.getContext('2d');\n if (!ctx) {\n return;\n }\n ctx.clearRect(0, 0, overlay.width, overlay.height);\n const point = this.cursorViewportPoint;\n if (!point) {\n return; // pointer left the canvas — leave the overlay cleared\n }\n const ring = this.resolveCssColor('--mj-brand-primary', '#264FAF');\n ctx.beginPath();\n ctx.arc(point.x, point.y, SYNTHETIC_CURSOR_RADIUS, 0, Math.PI * 2);\n ctx.lineWidth = 2;\n ctx.strokeStyle = ring;\n ctx.stroke();\n ctx.beginPath();\n ctx.arc(point.x, point.y, 1.5, 0, Math.PI * 2);\n ctx.fillStyle = ring;\n ctx.fill();\n }\n\n /** Clears the synthetic-cursor overlay (e.g. on detach). No-op when the overlay isn't mounted. */\n private clearSyntheticCursor(): void {\n const overlay = this.cursorCanvas?.nativeElement;\n const ctx = overlay?.getContext('2d');\n if (overlay && ctx) {\n ctx.clearRect(0, 0, overlay.width, overlay.height);\n }\n }\n\n /**\n * Resolves a CSS custom property (design token) to its computed color value off the host element, so the\n * canvas-drawn cursor honors theming. Falls back to the supplied default when the token is unset or the\n * host isn't measurable.\n *\n * @param token The CSS custom property name (e.g. `'--mj-brand-primary'`).\n * @param fallback The color to use when the token resolves empty.\n * @returns The resolved color string.\n */\n private resolveCssColor(token: string, fallback: string): string {\n const host = this.frameCanvas?.nativeElement;\n if (!host) {\n return fallback;\n }\n const value = getComputedStyle(host).getPropertyValue(token).trim();\n return value.length > 0 ? value : fallback;\n }\n\n /** Maps a DOM `MouseEvent.button` (0/1/2) to the relayed button union, defaulting to `'left'`. */\n private mapButton(button: number): 'left' | 'middle' | 'right' {\n if (button === 1) {\n return 'middle';\n }\n if (button === 2) {\n return 'right';\n }\n return 'left';\n }\n}\n"]}
@@ -0,0 +1,86 @@
1
+ import { RealtimeToolDefinition } from '@memberjunction/ai';
2
+ /**
3
+ * The shared name prefix of every Remote Browser tool — the key the session registers so all
4
+ * `browser_*` tool calls route locally to the channel's {@link RemoteBrowserChannel.ApplyAgentTool}
5
+ * (executed in the browser, which in turn drives the SERVER-hosted browser via the
6
+ * `ExecuteRemoteBrowserAction` GraphQL mutation) instead of the generic server tool relay.
7
+ */
8
+ export declare const REMOTE_BROWSER_TOOL_PREFIX = "browser_";
9
+ /** The canonical Remote Browser tool names (one per `browser_*` capability). */
10
+ export declare const REMOTE_BROWSER_TOOL_NAMES: {
11
+ readonly OpenUrl: "browser_OpenUrl";
12
+ readonly Click: "browser_Click";
13
+ readonly Type: "browser_Type";
14
+ readonly Key: "browser_Key";
15
+ readonly Scroll: "browser_Scroll";
16
+ readonly Back: "browser_Back";
17
+ readonly Forward: "browser_Forward";
18
+ readonly Wait: "browser_Wait";
19
+ readonly GetPageText: "browser_GetPageText";
20
+ readonly DescribePage: "browser_DescribePage";
21
+ readonly LocateElement: "browser_LocateElement";
22
+ };
23
+ /**
24
+ * The discriminated `kind` the server's `ExecuteRemoteBrowserAction` mutation switches on.
25
+ * Each Remote Browser tool maps to exactly one of these (see {@link MapToolToAction}).
26
+ */
27
+ export type RemoteBrowserActionKind = 'navigate' | 'click' | 'type' | 'key' | 'scroll' | 'back' | 'forward' | 'wait' | 'getPageText';
28
+ /**
29
+ * A normalized Remote Browser action — the flat field set the `ExecuteRemoteBrowserAction`
30
+ * mutation accepts, derived from a `browser_*` tool call by {@link MapToolToAction}. Only the
31
+ * fields meaningful for the action's {@link Kind} are populated; the rest stay `undefined`
32
+ * (the mutation's optional args).
33
+ */
34
+ export interface RemoteBrowserAction {
35
+ /** The action discriminator the server switches on. */
36
+ Kind: RemoteBrowserActionKind;
37
+ /** Target URL (openUrl). */
38
+ Url?: string;
39
+ /** CSS selector to target (click / type / scroll / wait). */
40
+ Selector?: string;
41
+ /** Viewport X coordinate for a positional click (click). */
42
+ X?: number;
43
+ /** Viewport Y coordinate for a positional click (click). */
44
+ Y?: number;
45
+ /** Text to type (type). */
46
+ Text?: string;
47
+ /** Key name to press, e.g. `'Enter'` / `'Tab'` (key). */
48
+ Key?: string;
49
+ /** Horizontal scroll delta in px (scroll). */
50
+ DeltaX?: number;
51
+ /** Vertical scroll delta in px (scroll). */
52
+ DeltaY?: number;
53
+ /** Wait duration in ms (wait). */
54
+ Ms?: number;
55
+ }
56
+ /** A JSON-serializable value (the building block of a parsed tool-args object). */
57
+ type ToolArgValue = string | number | boolean | null | ToolArgValue[] | {
58
+ [key: string]: ToolArgValue;
59
+ };
60
+ /**
61
+ * Thrown by {@link MapToolToAction} when a tool's REQUIRED argument is missing or invalid
62
+ * (e.g. `browser_OpenUrl` without a `url`, `browser_Type` without `text`). The channel
63
+ * catches it and returns the message to the model as a failed-tool result string — it is
64
+ * never allowed to propagate out of `ApplyAgentTool`.
65
+ */
66
+ export declare class RemoteBrowserToolArgError extends Error {
67
+ }
68
+ /**
69
+ * Maps ONE parsed `browser_*` tool-call args object to its normalized
70
+ * {@link RemoteBrowserAction}. Pure + synchronous so it can be unit-tested in isolation from
71
+ * the GraphQL round-trip. Validates required args and throws {@link RemoteBrowserToolArgError}
72
+ * with a model-readable message when they're missing/invalid; unknown tool names also throw.
73
+ *
74
+ * @param toolName One of the `browser_*` names (see {@link REMOTE_BROWSER_TOOL_NAMES}).
75
+ * @param args The parsed tool-call arguments object.
76
+ * @returns The normalized action ready to feed the `ExecuteRemoteBrowserAction` mutation.
77
+ */
78
+ export declare function MapToolToAction(toolName: string, args: Record<string, ToolArgValue>): RemoteBrowserAction;
79
+ /**
80
+ * The Remote Browser channel's CLIENT-EXECUTED tool declarations — registered with the
81
+ * realtime model at session mint and routed back to {@link RemoteBrowserChannel.ApplyAgentTool}
82
+ * by the `browser_` prefix. Each maps 1:1 to a {@link RemoteBrowserActionKind}.
83
+ */
84
+ export declare const REMOTE_BROWSER_TOOL_DEFINITIONS: RealtimeToolDefinition[];
85
+ export {};
86
+ //# sourceMappingURL=remote-browser-tools.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"remote-browser-tools.d.ts","sourceRoot":"","sources":["../../../../../src/lib/components/realtime/remote-browser/remote-browser-tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAE5D;;;;;GAKG;AACH,eAAO,MAAM,0BAA0B,aAAa,CAAC;AAErD,gFAAgF;AAChF,eAAO,MAAM,yBAAyB;;;;;;;;;;;;CAY5B,CAAC;AAEX;;;GAGG;AACH,MAAM,MAAM,uBAAuB,GAAG,UAAU,GAAG,OAAO,GAAG,MAAM,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,aAAa,CAAC;AAErI;;;;;GAKG;AACH,MAAM,WAAW,mBAAmB;IAClC,uDAAuD;IACvD,IAAI,EAAE,uBAAuB,CAAC;IAC9B,4BAA4B;IAC5B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,6DAA6D;IAC7D,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,4DAA4D;IAC5D,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,4DAA4D;IAC5D,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,2BAA2B;IAC3B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,yDAAyD;IACzD,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,8CAA8C;IAC9C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,4CAA4C;IAC5C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,kCAAkC;IAClC,EAAE,CAAC,EAAE,MAAM,CAAC;CACb;AAED,mFAAmF;AACnF,KAAK,YAAY,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,GAAG,YAAY,EAAE,GAAG;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,YAAY,CAAA;CAAE,CAAC;AAYxG;;;;;GAKG;AACH,qBAAa,yBAA0B,SAAQ,KAAK;CAAG;AAEvD;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,GAAG,mBAAmB,CAsDzG;AAED;;;;GAIG;AACH,eAAO,MAAM,+BAA+B,EAAE,sBAAsB,EAwGnE,CAAC"}
@@ -0,0 +1,210 @@
1
+ /**
2
+ * The shared name prefix of every Remote Browser tool — the key the session registers so all
3
+ * `browser_*` tool calls route locally to the channel's {@link RemoteBrowserChannel.ApplyAgentTool}
4
+ * (executed in the browser, which in turn drives the SERVER-hosted browser via the
5
+ * `ExecuteRemoteBrowserAction` GraphQL mutation) instead of the generic server tool relay.
6
+ */
7
+ export const REMOTE_BROWSER_TOOL_PREFIX = 'browser_';
8
+ /** The canonical Remote Browser tool names (one per `browser_*` capability). */
9
+ export const REMOTE_BROWSER_TOOL_NAMES = {
10
+ OpenUrl: 'browser_OpenUrl',
11
+ Click: 'browser_Click',
12
+ Type: 'browser_Type',
13
+ Key: 'browser_Key',
14
+ Scroll: 'browser_Scroll',
15
+ Back: 'browser_Back',
16
+ Forward: 'browser_Forward',
17
+ Wait: 'browser_Wait',
18
+ GetPageText: 'browser_GetPageText',
19
+ DescribePage: 'browser_DescribePage',
20
+ LocateElement: 'browser_LocateElement',
21
+ };
22
+ /** Coerces a parsed arg to a non-empty string, or `undefined` when absent / wrong-typed. */
23
+ function asString(value) {
24
+ return typeof value === 'string' && value.length > 0 ? value : undefined;
25
+ }
26
+ /** Coerces a parsed arg to a finite number, or `undefined` when absent / wrong-typed. */
27
+ function asNumber(value) {
28
+ return typeof value === 'number' && Number.isFinite(value) ? value : undefined;
29
+ }
30
+ /**
31
+ * Thrown by {@link MapToolToAction} when a tool's REQUIRED argument is missing or invalid
32
+ * (e.g. `browser_OpenUrl` without a `url`, `browser_Type` without `text`). The channel
33
+ * catches it and returns the message to the model as a failed-tool result string — it is
34
+ * never allowed to propagate out of `ApplyAgentTool`.
35
+ */
36
+ export class RemoteBrowserToolArgError extends Error {
37
+ }
38
+ /**
39
+ * Maps ONE parsed `browser_*` tool-call args object to its normalized
40
+ * {@link RemoteBrowserAction}. Pure + synchronous so it can be unit-tested in isolation from
41
+ * the GraphQL round-trip. Validates required args and throws {@link RemoteBrowserToolArgError}
42
+ * with a model-readable message when they're missing/invalid; unknown tool names also throw.
43
+ *
44
+ * @param toolName One of the `browser_*` names (see {@link REMOTE_BROWSER_TOOL_NAMES}).
45
+ * @param args The parsed tool-call arguments object.
46
+ * @returns The normalized action ready to feed the `ExecuteRemoteBrowserAction` mutation.
47
+ */
48
+ export function MapToolToAction(toolName, args) {
49
+ switch (toolName) {
50
+ case REMOTE_BROWSER_TOOL_NAMES.OpenUrl: {
51
+ const url = asString(args['url']);
52
+ if (!url) {
53
+ throw new RemoteBrowserToolArgError('browser_OpenUrl requires a non-empty "url".');
54
+ }
55
+ return { Kind: 'navigate', Url: url };
56
+ }
57
+ case REMOTE_BROWSER_TOOL_NAMES.Click: {
58
+ const selector = asString(args['selector']);
59
+ const x = asNumber(args['x']);
60
+ const y = asNumber(args['y']);
61
+ if (!selector && (x === undefined || y === undefined)) {
62
+ throw new RemoteBrowserToolArgError('browser_Click requires either a "selector" or both "x" and "y" coordinates.');
63
+ }
64
+ return { Kind: 'click', Selector: selector, X: x, Y: y };
65
+ }
66
+ case REMOTE_BROWSER_TOOL_NAMES.Type: {
67
+ // Empty string is a VALID value to type — only a missing / non-string `text` is an error,
68
+ // so check the raw type here rather than via asString (which treats '' as absent).
69
+ const text = args['text'];
70
+ if (typeof text !== 'string') {
71
+ throw new RemoteBrowserToolArgError('browser_Type requires "text" to type.');
72
+ }
73
+ return { Kind: 'type', Text: text, Selector: asString(args['selector']) };
74
+ }
75
+ case REMOTE_BROWSER_TOOL_NAMES.Key: {
76
+ const key = asString(args['key']);
77
+ if (!key) {
78
+ throw new RemoteBrowserToolArgError('browser_Key requires a "key" name (e.g. "Enter", "Tab").');
79
+ }
80
+ return { Kind: 'key', Key: key };
81
+ }
82
+ case REMOTE_BROWSER_TOOL_NAMES.Scroll: {
83
+ return {
84
+ Kind: 'scroll',
85
+ DeltaX: asNumber(args['deltaX']),
86
+ DeltaY: asNumber(args['deltaY']),
87
+ Selector: asString(args['selector']),
88
+ };
89
+ }
90
+ case REMOTE_BROWSER_TOOL_NAMES.Back:
91
+ return { Kind: 'back' };
92
+ case REMOTE_BROWSER_TOOL_NAMES.Forward:
93
+ return { Kind: 'forward' };
94
+ case REMOTE_BROWSER_TOOL_NAMES.Wait: {
95
+ return { Kind: 'wait', Ms: asNumber(args['ms']), Selector: asString(args['selector']) };
96
+ }
97
+ case REMOTE_BROWSER_TOOL_NAMES.GetPageText:
98
+ return { Kind: 'getPageText' };
99
+ default:
100
+ throw new RemoteBrowserToolArgError(`Unknown Remote Browser tool "${toolName}".`);
101
+ }
102
+ }
103
+ /**
104
+ * The Remote Browser channel's CLIENT-EXECUTED tool declarations — registered with the
105
+ * realtime model at session mint and routed back to {@link RemoteBrowserChannel.ApplyAgentTool}
106
+ * by the `browser_` prefix. Each maps 1:1 to a {@link RemoteBrowserActionKind}.
107
+ */
108
+ export const REMOTE_BROWSER_TOOL_DEFINITIONS = [
109
+ {
110
+ Name: REMOTE_BROWSER_TOOL_NAMES.OpenUrl,
111
+ Description: 'Navigate the shared browser to a URL. The user watches the live page in the Browser tab.',
112
+ ParametersSchema: {
113
+ type: 'object',
114
+ properties: {
115
+ url: { type: 'string', description: 'Absolute URL to open (include the scheme, e.g. https://…).' },
116
+ },
117
+ required: ['url'],
118
+ },
119
+ },
120
+ {
121
+ Name: REMOTE_BROWSER_TOOL_NAMES.Click,
122
+ Description: 'Click an element in the shared browser, by CSS selector or by viewport x/y coordinates. Provide a selector when you know it; otherwise provide both x and y.',
123
+ ParametersSchema: {
124
+ type: 'object',
125
+ properties: {
126
+ selector: { type: 'string', description: 'CSS selector of the element to click (preferred).' },
127
+ x: { type: 'number', description: 'Viewport X in CSS px (used when no selector is given).' },
128
+ y: { type: 'number', description: 'Viewport Y in CSS px (used when no selector is given).' },
129
+ },
130
+ },
131
+ },
132
+ {
133
+ Name: REMOTE_BROWSER_TOOL_NAMES.Type,
134
+ Description: 'Type text into the shared browser. Provide a selector to focus a specific field first; omit it to type into the currently focused element.',
135
+ ParametersSchema: {
136
+ type: 'object',
137
+ properties: {
138
+ text: { type: 'string', description: 'The text to type.' },
139
+ selector: { type: 'string', description: 'Optional CSS selector to focus before typing.' },
140
+ },
141
+ required: ['text'],
142
+ },
143
+ },
144
+ {
145
+ Name: REMOTE_BROWSER_TOOL_NAMES.Key,
146
+ Description: 'Press a single key in the shared browser (e.g. "Enter" to submit, "Tab" to move focus, "Escape" to dismiss).',
147
+ ParametersSchema: {
148
+ type: 'object',
149
+ properties: {
150
+ key: { type: 'string', description: 'Key name, e.g. "Enter", "Tab", "Escape", "ArrowDown".' },
151
+ },
152
+ required: ['key'],
153
+ },
154
+ },
155
+ {
156
+ Name: REMOTE_BROWSER_TOOL_NAMES.Scroll,
157
+ Description: 'Scroll the shared browser page (or a scrollable element) by a pixel delta. Positive deltaY scrolls down.',
158
+ ParametersSchema: {
159
+ type: 'object',
160
+ properties: {
161
+ deltaX: { type: 'number', description: 'Horizontal scroll delta in px (positive = right).' },
162
+ deltaY: { type: 'number', description: 'Vertical scroll delta in px (positive = down).' },
163
+ selector: { type: 'string', description: 'Optional CSS selector of a scrollable element; omit to scroll the page.' },
164
+ },
165
+ },
166
+ },
167
+ {
168
+ Name: REMOTE_BROWSER_TOOL_NAMES.Back,
169
+ Description: 'Navigate the shared browser back to the previous page in its history.',
170
+ ParametersSchema: { type: 'object', properties: {} },
171
+ },
172
+ {
173
+ Name: REMOTE_BROWSER_TOOL_NAMES.Forward,
174
+ Description: 'Navigate the shared browser forward to the next page in its history.',
175
+ ParametersSchema: { type: 'object', properties: {} },
176
+ },
177
+ {
178
+ Name: REMOTE_BROWSER_TOOL_NAMES.Wait,
179
+ Description: 'Wait for the shared browser to settle — for a fixed number of milliseconds, or until an element matching a selector appears.',
180
+ ParametersSchema: {
181
+ type: 'object',
182
+ properties: {
183
+ ms: { type: 'number', description: 'Milliseconds to wait. Omit when waiting on a selector.' },
184
+ selector: { type: 'string', description: 'Optional CSS selector to wait for.' },
185
+ },
186
+ },
187
+ },
188
+ {
189
+ Name: REMOTE_BROWSER_TOOL_NAMES.GetPageText,
190
+ Description: 'Read the visible text content of the current page in the shared browser, so you can understand what is on screen.',
191
+ ParametersSchema: { type: 'object', properties: {} },
192
+ },
193
+ {
194
+ Name: REMOTE_BROWSER_TOOL_NAMES.DescribePage,
195
+ Description: "Look at the current page and get a concise text description of what is visible — use this to 'see' the page since you cannot view images directly.",
196
+ ParametersSchema: { type: 'object', properties: {} },
197
+ },
198
+ {
199
+ Name: REMOTE_BROWSER_TOOL_NAMES.LocateElement,
200
+ Description: "Find a UI element by visual description (e.g. 'the blue Sign In button', 'the search box') and get its approximate pixel center (x,y) so you can browser_Click it. Returns whether it was found, its label, and coordinates.",
201
+ ParametersSchema: {
202
+ type: 'object',
203
+ properties: {
204
+ description: { type: 'string', description: "Visual description of the element to find (e.g. 'the blue Sign In button')." },
205
+ },
206
+ required: ['description'],
207
+ },
208
+ },
209
+ ];
210
+ //# sourceMappingURL=remote-browser-tools.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"remote-browser-tools.js","sourceRoot":"","sources":["../../../../../src/lib/components/realtime/remote-browser/remote-browser-tools.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,UAAU,CAAC;AAErD,gFAAgF;AAChF,MAAM,CAAC,MAAM,yBAAyB,GAAG;IACvC,OAAO,EAAE,iBAAiB;IAC1B,KAAK,EAAE,eAAe;IACtB,IAAI,EAAE,cAAc;IACpB,GAAG,EAAE,aAAa;IAClB,MAAM,EAAE,gBAAgB;IACxB,IAAI,EAAE,cAAc;IACpB,OAAO,EAAE,iBAAiB;IAC1B,IAAI,EAAE,cAAc;IACpB,WAAW,EAAE,qBAAqB;IAClC,YAAY,EAAE,sBAAsB;IACpC,aAAa,EAAE,uBAAuB;CAC9B,CAAC;AAwCX,4FAA4F;AAC5F,SAAS,QAAQ,CAAC,KAA+B;IAC/C,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;AAC3E,CAAC;AAED,yFAAyF;AACzF,SAAS,QAAQ,CAAC,KAA+B;IAC/C,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;AACjF,CAAC;AAED;;;;;GAKG;AACH,MAAM,OAAO,yBAA0B,SAAQ,KAAK;CAA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B,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,EAAE,EAAE;KACrD;IACD;QACE,IAAI,EAAE,yBAAyB,CAAC,YAAY;QAC5C,WAAW,EACT,oJAAoJ;QACtJ,gBAAgB,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,EAAE,EAAE;KACrD;IACD;QACE,IAAI,EAAE,yBAAyB,CAAC,aAAa;QAC7C,WAAW,EACT,8NAA8N;QAChO,gBAAgB,EAAE;YAChB,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,WAAW,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,6EAA6E,EAAE;aAC5H;YACD,QAAQ,EAAE,CAAC,aAAa,CAAC;SAC1B;KACF;CACF,CAAC","sourcesContent":["import { RealtimeToolDefinition } from '@memberjunction/ai';\n\n/**\n * The shared name prefix of every Remote Browser tool — the key the session registers so all\n * `browser_*` tool calls route locally to the channel's {@link RemoteBrowserChannel.ApplyAgentTool}\n * (executed in the browser, which in turn drives the SERVER-hosted browser via the\n * `ExecuteRemoteBrowserAction` GraphQL mutation) instead of the generic server tool relay.\n */\nexport const REMOTE_BROWSER_TOOL_PREFIX = 'browser_';\n\n/** The canonical Remote Browser tool names (one per `browser_*` capability). */\nexport const REMOTE_BROWSER_TOOL_NAMES = {\n OpenUrl: 'browser_OpenUrl',\n Click: 'browser_Click',\n Type: 'browser_Type',\n Key: 'browser_Key',\n Scroll: 'browser_Scroll',\n Back: 'browser_Back',\n Forward: 'browser_Forward',\n Wait: 'browser_Wait',\n GetPageText: 'browser_GetPageText',\n DescribePage: 'browser_DescribePage',\n LocateElement: 'browser_LocateElement',\n} as const;\n\n/**\n * The discriminated `kind` the server's `ExecuteRemoteBrowserAction` mutation switches on.\n * Each Remote Browser tool maps to exactly one of these (see {@link MapToolToAction}).\n */\nexport type RemoteBrowserActionKind = 'navigate' | 'click' | 'type' | 'key' | 'scroll' | 'back' | 'forward' | 'wait' | 'getPageText';\n\n/**\n * A normalized Remote Browser action — the flat field set the `ExecuteRemoteBrowserAction`\n * mutation accepts, derived from a `browser_*` tool call by {@link MapToolToAction}. Only the\n * fields meaningful for the action's {@link Kind} are populated; the rest stay `undefined`\n * (the mutation's optional args).\n */\nexport interface RemoteBrowserAction {\n /** The action discriminator the server switches on. */\n Kind: RemoteBrowserActionKind;\n /** Target URL (openUrl). */\n Url?: string;\n /** CSS selector to target (click / type / scroll / wait). */\n Selector?: string;\n /** Viewport X coordinate for a positional click (click). */\n X?: number;\n /** Viewport Y coordinate for a positional click (click). */\n Y?: number;\n /** Text to type (type). */\n Text?: string;\n /** Key name to press, e.g. `'Enter'` / `'Tab'` (key). */\n Key?: string;\n /** Horizontal scroll delta in px (scroll). */\n DeltaX?: number;\n /** Vertical scroll delta in px (scroll). */\n DeltaY?: number;\n /** Wait duration in ms (wait). */\n Ms?: number;\n}\n\n/** A JSON-serializable value (the building block of a parsed tool-args object). */\ntype ToolArgValue = string | number | boolean | null | ToolArgValue[] | { [key: string]: ToolArgValue };\n\n/** Coerces a parsed arg to a non-empty string, or `undefined` when absent / wrong-typed. */\nfunction asString(value: ToolArgValue | undefined): string | undefined {\n return typeof value === 'string' && value.length > 0 ? value : undefined;\n}\n\n/** Coerces a parsed arg to a finite number, or `undefined` when absent / wrong-typed. */\nfunction asNumber(value: ToolArgValue | undefined): number | undefined {\n return typeof value === 'number' && Number.isFinite(value) ? value : undefined;\n}\n\n/**\n * Thrown by {@link MapToolToAction} when a tool's REQUIRED argument is missing or invalid\n * (e.g. `browser_OpenUrl` without a `url`, `browser_Type` without `text`). The channel\n * catches it and returns the message to the model as a failed-tool result string — it is\n * never allowed to propagate out of `ApplyAgentTool`.\n */\nexport class RemoteBrowserToolArgError extends Error {}\n\n/**\n * Maps ONE parsed `browser_*` tool-call args object to its normalized\n * {@link RemoteBrowserAction}. Pure + synchronous so it can be unit-tested in isolation from\n * the GraphQL round-trip. Validates required args and throws {@link RemoteBrowserToolArgError}\n * with a model-readable message when they're missing/invalid; unknown tool names also throw.\n *\n * @param toolName One of the `browser_*` names (see {@link REMOTE_BROWSER_TOOL_NAMES}).\n * @param args The parsed tool-call arguments object.\n * @returns The normalized action ready to feed the `ExecuteRemoteBrowserAction` mutation.\n */\nexport function MapToolToAction(toolName: string, args: Record<string, ToolArgValue>): RemoteBrowserAction {\n switch (toolName) {\n case REMOTE_BROWSER_TOOL_NAMES.OpenUrl: {\n const url = asString(args['url']);\n if (!url) {\n throw new RemoteBrowserToolArgError('browser_OpenUrl requires a non-empty \"url\".');\n }\n return { Kind: 'navigate', Url: url };\n }\n case REMOTE_BROWSER_TOOL_NAMES.Click: {\n const selector = asString(args['selector']);\n const x = asNumber(args['x']);\n const y = asNumber(args['y']);\n if (!selector && (x === undefined || y === undefined)) {\n throw new RemoteBrowserToolArgError('browser_Click requires either a \"selector\" or both \"x\" and \"y\" coordinates.');\n }\n return { Kind: 'click', Selector: selector, X: x, Y: y };\n }\n case REMOTE_BROWSER_TOOL_NAMES.Type: {\n // Empty string is a VALID value to type — only a missing / non-string `text` is an error,\n // so check the raw type here rather than via asString (which treats '' as absent).\n const text = args['text'];\n if (typeof text !== 'string') {\n throw new RemoteBrowserToolArgError('browser_Type requires \"text\" to type.');\n }\n return { Kind: 'type', Text: text, Selector: asString(args['selector']) };\n }\n case REMOTE_BROWSER_TOOL_NAMES.Key: {\n const key = asString(args['key']);\n if (!key) {\n throw new RemoteBrowserToolArgError('browser_Key requires a \"key\" name (e.g. \"Enter\", \"Tab\").');\n }\n return { Kind: 'key', Key: key };\n }\n case REMOTE_BROWSER_TOOL_NAMES.Scroll: {\n return {\n Kind: 'scroll',\n DeltaX: asNumber(args['deltaX']),\n DeltaY: asNumber(args['deltaY']),\n Selector: asString(args['selector']),\n };\n }\n case REMOTE_BROWSER_TOOL_NAMES.Back:\n return { Kind: 'back' };\n case REMOTE_BROWSER_TOOL_NAMES.Forward:\n return { Kind: 'forward' };\n case REMOTE_BROWSER_TOOL_NAMES.Wait: {\n return { Kind: 'wait', Ms: asNumber(args['ms']), Selector: asString(args['selector']) };\n }\n case REMOTE_BROWSER_TOOL_NAMES.GetPageText:\n return { Kind: 'getPageText' };\n default:\n throw new RemoteBrowserToolArgError(`Unknown Remote Browser tool \"${toolName}\".`);\n }\n}\n\n/**\n * The Remote Browser channel's CLIENT-EXECUTED tool declarations — registered with the\n * realtime model at session mint and routed back to {@link RemoteBrowserChannel.ApplyAgentTool}\n * by the `browser_` prefix. Each maps 1:1 to a {@link RemoteBrowserActionKind}.\n */\nexport const REMOTE_BROWSER_TOOL_DEFINITIONS: RealtimeToolDefinition[] = [\n {\n Name: REMOTE_BROWSER_TOOL_NAMES.OpenUrl,\n Description: 'Navigate the shared browser to a URL. The user watches the live page in the Browser tab.',\n ParametersSchema: {\n type: 'object',\n properties: {\n url: { type: 'string', description: 'Absolute URL to open (include the scheme, e.g. https://…).' },\n },\n required: ['url'],\n },\n },\n {\n Name: REMOTE_BROWSER_TOOL_NAMES.Click,\n Description:\n 'Click an element in the shared browser, by CSS selector or by viewport x/y coordinates. Provide a selector when you know it; otherwise provide both x and y.',\n ParametersSchema: {\n type: 'object',\n properties: {\n selector: { type: 'string', description: 'CSS selector of the element to click (preferred).' },\n x: { type: 'number', description: 'Viewport X in CSS px (used when no selector is given).' },\n y: { type: 'number', description: 'Viewport Y in CSS px (used when no selector is given).' },\n },\n },\n },\n {\n Name: REMOTE_BROWSER_TOOL_NAMES.Type,\n Description: 'Type text into the shared browser. Provide a selector to focus a specific field first; omit it to type into the currently focused element.',\n ParametersSchema: {\n type: 'object',\n properties: {\n text: { type: 'string', description: 'The text to type.' },\n selector: { type: 'string', description: 'Optional CSS selector to focus before typing.' },\n },\n required: ['text'],\n },\n },\n {\n Name: REMOTE_BROWSER_TOOL_NAMES.Key,\n Description: 'Press a single key in the shared browser (e.g. \"Enter\" to submit, \"Tab\" to move focus, \"Escape\" to dismiss).',\n ParametersSchema: {\n type: 'object',\n properties: {\n key: { type: 'string', description: 'Key name, e.g. \"Enter\", \"Tab\", \"Escape\", \"ArrowDown\".' },\n },\n required: ['key'],\n },\n },\n {\n Name: REMOTE_BROWSER_TOOL_NAMES.Scroll,\n Description: 'Scroll the shared browser page (or a scrollable element) by a pixel delta. Positive deltaY scrolls down.',\n ParametersSchema: {\n type: 'object',\n properties: {\n deltaX: { type: 'number', description: 'Horizontal scroll delta in px (positive = right).' },\n deltaY: { type: 'number', description: 'Vertical scroll delta in px (positive = down).' },\n selector: { type: 'string', description: 'Optional CSS selector of a scrollable element; omit to scroll the page.' },\n },\n },\n },\n {\n Name: REMOTE_BROWSER_TOOL_NAMES.Back,\n Description: 'Navigate the shared browser back to the previous page in its history.',\n ParametersSchema: { type: 'object', properties: {} },\n },\n {\n Name: REMOTE_BROWSER_TOOL_NAMES.Forward,\n Description: 'Navigate the shared browser forward to the next page in its history.',\n ParametersSchema: { type: 'object', properties: {} },\n },\n {\n Name: REMOTE_BROWSER_TOOL_NAMES.Wait,\n Description: 'Wait for the shared browser to settle — for a fixed number of milliseconds, or until an element matching a selector appears.',\n ParametersSchema: {\n type: 'object',\n properties: {\n ms: { type: 'number', description: 'Milliseconds to wait. Omit when waiting on a selector.' },\n selector: { type: 'string', description: 'Optional CSS selector to wait for.' },\n },\n },\n },\n {\n Name: REMOTE_BROWSER_TOOL_NAMES.GetPageText,\n Description: 'Read the visible text content of the current page in the shared browser, so you can understand what is on screen.',\n ParametersSchema: { type: 'object', properties: {} },\n },\n {\n Name: REMOTE_BROWSER_TOOL_NAMES.DescribePage,\n Description:\n \"Look at the current page and get a concise text description of what is visible — use this to 'see' the page since you cannot view images directly.\",\n ParametersSchema: { type: 'object', properties: {} },\n },\n {\n Name: REMOTE_BROWSER_TOOL_NAMES.LocateElement,\n Description:\n \"Find a UI element by visual description (e.g. 'the blue Sign In button', 'the search box') and get its approximate pixel center (x,y) so you can browser_Click it. Returns whether it was found, its label, and coordinates.\",\n ParametersSchema: {\n type: 'object',\n properties: {\n description: { type: 'string', description: \"Visual description of the element to find (e.g. 'the blue Sign In button').\" },\n },\n required: ['description'],\n },\n },\n];\n"]}
@@ -0,0 +1,48 @@
1
+ import { DataSnapshot } from '@memberjunction/core';
2
+ import { BaseArtifactViewerPluginComponent } from '@memberjunction/ng-artifacts';
3
+ import { WhiteboardState } from '@memberjunction/ng-whiteboard';
4
+ import * as i0 from "@angular/core";
5
+ /**
6
+ * ARTIFACT VIEWER PLUGIN for saved whiteboards — renders the session-channel board
7
+ * artifact (a {@link WhiteboardState.ToJSON} payload) as a read-only snapshot with the
8
+ * same export affordances the live board offers (Download HTML / Download SVG / Print).
9
+ *
10
+ * Resolved dynamically by the artifact plugin host via the MJ ClassFactory (keyed by the
11
+ * artifact type's DriverClass), which instantiates the class ONCE with a bare `new` to
12
+ * discover the component type — so this class must stay constructible outside an Angular
13
+ * injection context (no `inject()` field initializers, no constructor DI).
14
+ */
15
+ export declare class WhiteboardArtifactViewerComponent extends BaseArtifactViewerPluginComponent {
16
+ /** Memoized parse — keyed by the raw content string so version switches re-parse. */
17
+ private parsedForJson;
18
+ private parsedState;
19
+ /** Raw board payload fed to the snapshot component (setter-driven re-parse there). */
20
+ get ContentJson(): string;
21
+ /** Rehydrated board engine for export/snapshot duty (null when content is malformed). */
22
+ get BoardState(): WhiteboardState | null;
23
+ get HasBoard(): boolean;
24
+ get hasDisplayContent(): boolean;
25
+ GetCurrentStateSnapshot(): DataSnapshot | null;
26
+ /** Download the board as one self-contained HTML document. */
27
+ OnDownloadHtml(): void;
28
+ /** Download the board as a standalone SVG document. */
29
+ OnDownloadSvg(): void;
30
+ /**
31
+ * Print the board: open a blank window, write the self-contained export document and
32
+ * invoke the print dialog (same precedent as the live board host's print path). When
33
+ * the popup is blocked this is a logged no-op — nothing breaks, the user can retry.
34
+ */
35
+ OnPrint(): void;
36
+ private buildExportHtml;
37
+ private downloadBlob;
38
+ private static exportDateStamp;
39
+ static ɵfac: i0.ɵɵFactoryDeclaration<WhiteboardArtifactViewerComponent, never>;
40
+ static ɵcmp: i0.ɵɵComponentDeclaration<WhiteboardArtifactViewerComponent, "mj-whiteboard-artifact-viewer", never, {}, {}, never, never, true, never>;
41
+ }
42
+ /**
43
+ * Tree-shaking prevention: the plugin is resolved dynamically through the MJ ClassFactory
44
+ * (keyed by the artifact type's DriverClass), so this static call keeps the @RegisterClass
45
+ * side effect from being eliminated by the bundler.
46
+ */
47
+ export declare function LoadWhiteboardArtifactViewer(): void;
48
+ //# sourceMappingURL=whiteboard-artifact-viewer.component.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"whiteboard-artifact-viewer.component.d.ts","sourceRoot":"","sources":["../../../../../src/lib/components/realtime/whiteboard/whiteboard-artifact-viewer.component.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEpD,OAAO,EAAE,iCAAiC,EAAE,MAAM,8BAA8B,CAAC;AACjF,OAAO,EAEwB,eAAe,EAC7C,MAAM,+BAA+B,CAAC;;AAEvC;;;;;;;;;GASG;AACH,qBAyEa,iCAAkC,SAAQ,iCAAiC;IACtF,qFAAqF;IACrF,OAAO,CAAC,aAAa,CAAuB;IAC5C,OAAO,CAAC,WAAW,CAAgC;IAEnD,sFAAsF;IACtF,IAAW,WAAW,IAAI,MAAM,CAE/B;IAED,yFAAyF;IACzF,IAAW,UAAU,IAAI,eAAe,GAAG,IAAI,CAO9C;IAED,IAAW,QAAQ,IAAI,OAAO,CAE7B;IAED,IAAoB,iBAAiB,IAAI,OAAO,CAE/C;IAEe,uBAAuB,IAAI,YAAY,GAAG,IAAI;IAe9D,8DAA8D;IACvD,cAAc,IAAI,IAAI;IAQ7B,uDAAuD;IAChD,aAAa,IAAI,IAAI;IAQ5B;;;;OAIG;IACI,OAAO,IAAI,IAAI;IAiBtB,OAAO,CAAC,eAAe;IAQvB,OAAO,CAAC,YAAY;IASpB,OAAO,CAAC,MAAM,CAAC,eAAe;yCApGnB,iCAAiC;2CAAjC,iCAAiC;CAuG7C;AAED;;;;GAIG;AACH,wBAAgB,4BAA4B,IAAI,IAAI,CAEnD"}