@memberjunction/ng-conversations 6.2.0-edge.3 → 6.2.0-edge.5

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 (318) hide show
  1. package/README.md +33 -7
  2. package/dist/lib/components/collection/collection-view.component.d.ts.map +1 -1
  3. package/dist/lib/components/collection/collection-view.component.js +1 -0
  4. package/dist/lib/components/collection/collection-view.component.js.map +1 -1
  5. package/dist/lib/components/composer/ai-composer.component.d.ts +14 -2
  6. package/dist/lib/components/composer/ai-composer.component.d.ts.map +1 -1
  7. package/dist/lib/components/composer/ai-composer.component.js +35 -4
  8. package/dist/lib/components/composer/ai-composer.component.js.map +1 -1
  9. package/dist/lib/components/conversation/conversation-agent-picker.component.d.ts +1 -1
  10. package/dist/lib/components/conversation/conversation-agent-picker.component.js +3 -3
  11. package/dist/lib/components/conversation/conversation-agent-picker.component.js.map +1 -1
  12. package/dist/lib/components/conversation/conversation-chat-area.component.d.ts +651 -53
  13. package/dist/lib/components/conversation/conversation-chat-area.component.d.ts.map +1 -1
  14. package/dist/lib/components/conversation/conversation-chat-area.component.js +3002 -661
  15. package/dist/lib/components/conversation/conversation-chat-area.component.js.map +1 -1
  16. package/dist/lib/components/conversation/forks-popover.component.d.ts +37 -0
  17. package/dist/lib/components/conversation/forks-popover.component.d.ts.map +1 -0
  18. package/dist/lib/components/conversation/forks-popover.component.js +164 -0
  19. package/dist/lib/components/conversation/forks-popover.component.js.map +1 -0
  20. package/dist/lib/components/export/export-modal.component.d.ts +7 -2
  21. package/dist/lib/components/export/export-modal.component.d.ts.map +1 -1
  22. package/dist/lib/components/export/export-modal.component.js +16 -3
  23. package/dist/lib/components/export/export-modal.component.js.map +1 -1
  24. package/dist/lib/components/message/conversation-message-rating.component.d.ts.map +1 -1
  25. package/dist/lib/components/message/conversation-message-rating.component.js +11 -9
  26. package/dist/lib/components/message/conversation-message-rating.component.js.map +1 -1
  27. package/dist/lib/components/message/message-input.component.d.ts +96 -11
  28. package/dist/lib/components/message/message-input.component.d.ts.map +1 -1
  29. package/dist/lib/components/message/message-input.component.js +253 -112
  30. package/dist/lib/components/message/message-input.component.js.map +1 -1
  31. package/dist/lib/components/message/message-item.component.d.ts +304 -16
  32. package/dist/lib/components/message/message-item.component.d.ts.map +1 -1
  33. package/dist/lib/components/message/message-item.component.js +2029 -363
  34. package/dist/lib/components/message/message-item.component.js.map +1 -1
  35. package/dist/lib/components/message/message-list.component.d.ts +101 -22
  36. package/dist/lib/components/message/message-list.component.d.ts.map +1 -1
  37. package/dist/lib/components/message/message-list.component.js +326 -55
  38. package/dist/lib/components/message/message-list.component.js.map +1 -1
  39. package/dist/lib/components/realtime/avatar/realtime-avatar-channel.d.ts +34 -0
  40. package/dist/lib/components/realtime/avatar/realtime-avatar-channel.d.ts.map +1 -0
  41. package/dist/lib/components/realtime/avatar/realtime-avatar-channel.js +75 -0
  42. package/dist/lib/components/realtime/avatar/realtime-avatar-channel.js.map +1 -0
  43. package/dist/lib/components/realtime/avatar/realtime-avatar-surface.component.d.ts +80 -0
  44. package/dist/lib/components/realtime/avatar/realtime-avatar-surface.component.d.ts.map +1 -0
  45. package/dist/lib/components/realtime/avatar/realtime-avatar-surface.component.js +202 -0
  46. package/dist/lib/components/realtime/avatar/realtime-avatar-surface.component.js.map +1 -0
  47. package/dist/lib/components/realtime/capture/realtime-camera-check-card.component.d.ts +45 -0
  48. package/dist/lib/components/realtime/capture/realtime-camera-check-card.component.d.ts.map +1 -0
  49. package/dist/lib/components/realtime/capture/realtime-camera-check-card.component.js +123 -0
  50. package/dist/lib/components/realtime/capture/realtime-camera-check-card.component.js.map +1 -0
  51. package/dist/lib/components/realtime/capture/realtime-capture-channel.d.ts +90 -0
  52. package/dist/lib/components/realtime/capture/realtime-capture-channel.d.ts.map +1 -0
  53. package/dist/lib/components/realtime/capture/realtime-capture-channel.js +223 -0
  54. package/dist/lib/components/realtime/capture/realtime-capture-channel.js.map +1 -0
  55. package/dist/lib/components/realtime/capture/realtime-capture-model.d.ts +98 -0
  56. package/dist/lib/components/realtime/capture/realtime-capture-model.d.ts.map +1 -0
  57. package/dist/lib/components/realtime/capture/realtime-capture-model.js +161 -0
  58. package/dist/lib/components/realtime/capture/realtime-capture-model.js.map +1 -0
  59. package/dist/lib/components/realtime/capture/realtime-capture-surface.component.d.ts +48 -0
  60. package/dist/lib/components/realtime/capture/realtime-capture-surface.component.d.ts.map +1 -0
  61. package/dist/lib/components/realtime/capture/realtime-capture-surface.component.js +205 -0
  62. package/dist/lib/components/realtime/capture/realtime-capture-surface.component.js.map +1 -0
  63. package/dist/lib/components/realtime/channels/client-context-channel.d.ts +19 -2
  64. package/dist/lib/components/realtime/channels/client-context-channel.d.ts.map +1 -1
  65. package/dist/lib/components/realtime/channels/client-context-channel.js +83 -9
  66. package/dist/lib/components/realtime/channels/client-context-channel.js.map +1 -1
  67. package/dist/lib/components/realtime/channels/realtime-channel-pane.component.d.ts +30 -9
  68. package/dist/lib/components/realtime/channels/realtime-channel-pane.component.d.ts.map +1 -1
  69. package/dist/lib/components/realtime/channels/realtime-channel-pane.component.js +78 -14
  70. package/dist/lib/components/realtime/channels/realtime-channel-pane.component.js.map +1 -1
  71. package/dist/lib/components/realtime/identity-verification/identity-verification-channel.d.ts +71 -0
  72. package/dist/lib/components/realtime/identity-verification/identity-verification-channel.d.ts.map +1 -0
  73. package/dist/lib/components/realtime/identity-verification/identity-verification-channel.js +259 -0
  74. package/dist/lib/components/realtime/identity-verification/identity-verification-channel.js.map +1 -0
  75. package/dist/lib/components/realtime/identity-verification/identity-verification-model.d.ts +129 -0
  76. package/dist/lib/components/realtime/identity-verification/identity-verification-model.d.ts.map +1 -0
  77. package/dist/lib/components/realtime/identity-verification/identity-verification-model.js +373 -0
  78. package/dist/lib/components/realtime/identity-verification/identity-verification-model.js.map +1 -0
  79. package/dist/lib/components/realtime/identity-verification/identity-verification-surface.component.d.ts +77 -0
  80. package/dist/lib/components/realtime/identity-verification/identity-verification-surface.component.d.ts.map +1 -0
  81. package/dist/lib/components/realtime/identity-verification/identity-verification-surface.component.js +420 -0
  82. package/dist/lib/components/realtime/identity-verification/identity-verification-surface.component.js.map +1 -0
  83. package/dist/lib/components/realtime/interactive-component/component-contract.d.ts +83 -0
  84. package/dist/lib/components/realtime/interactive-component/component-contract.d.ts.map +1 -0
  85. package/dist/lib/components/realtime/interactive-component/component-contract.js +292 -0
  86. package/dist/lib/components/realtime/interactive-component/component-contract.js.map +1 -0
  87. package/dist/lib/components/realtime/interactive-component/component-data-state.d.ts +39 -0
  88. package/dist/lib/components/realtime/interactive-component/component-data-state.d.ts.map +1 -0
  89. package/dist/lib/components/realtime/interactive-component/component-data-state.js +152 -0
  90. package/dist/lib/components/realtime/interactive-component/component-data-state.js.map +1 -0
  91. package/dist/lib/components/realtime/interactive-component/component-instance-engine.d.ts +109 -0
  92. package/dist/lib/components/realtime/interactive-component/component-instance-engine.d.ts.map +1 -0
  93. package/dist/lib/components/realtime/interactive-component/component-instance-engine.js +146 -0
  94. package/dist/lib/components/realtime/interactive-component/component-instance-engine.js.map +1 -0
  95. package/dist/lib/components/realtime/interactive-component/component-spec-content.d.ts +19 -0
  96. package/dist/lib/components/realtime/interactive-component/component-spec-content.d.ts.map +1 -0
  97. package/dist/lib/components/realtime/interactive-component/component-spec-content.js +39 -0
  98. package/dist/lib/components/realtime/interactive-component/component-spec-content.js.map +1 -0
  99. package/dist/lib/components/realtime/interactive-component/interactive-component-channel.d.ts +183 -0
  100. package/dist/lib/components/realtime/interactive-component/interactive-component-channel.d.ts.map +1 -0
  101. package/dist/lib/components/realtime/interactive-component/interactive-component-channel.js +761 -0
  102. package/dist/lib/components/realtime/interactive-component/interactive-component-channel.js.map +1 -0
  103. package/dist/lib/components/realtime/interactive-component/interactive-component-config.d.ts +25 -0
  104. package/dist/lib/components/realtime/interactive-component/interactive-component-config.d.ts.map +1 -0
  105. package/dist/lib/components/realtime/interactive-component/interactive-component-config.js +57 -0
  106. package/dist/lib/components/realtime/interactive-component/interactive-component-config.js.map +1 -0
  107. package/dist/lib/components/realtime/interactive-component/interactive-component-host.component.d.ts +40 -0
  108. package/dist/lib/components/realtime/interactive-component/interactive-component-host.component.d.ts.map +1 -0
  109. package/dist/lib/components/realtime/interactive-component/interactive-component-host.component.js +97 -0
  110. package/dist/lib/components/realtime/interactive-component/interactive-component-host.component.js.map +1 -0
  111. package/dist/lib/components/realtime/interactive-component/interactive-component-types.d.ts +144 -0
  112. package/dist/lib/components/realtime/interactive-component/interactive-component-types.d.ts.map +1 -0
  113. package/dist/lib/components/realtime/interactive-component/interactive-component-types.js +57 -0
  114. package/dist/lib/components/realtime/interactive-component/interactive-component-types.js.map +1 -0
  115. package/dist/lib/components/realtime/interactive-component/react-component-handle.d.ts +36 -0
  116. package/dist/lib/components/realtime/interactive-component/react-component-handle.d.ts.map +1 -0
  117. package/dist/lib/components/realtime/interactive-component/react-component-handle.js +55 -0
  118. package/dist/lib/components/realtime/interactive-component/react-component-handle.js.map +1 -0
  119. package/dist/lib/components/realtime/interactive-component/realtime-interactive-component-surface.component.d.ts +55 -0
  120. package/dist/lib/components/realtime/interactive-component/realtime-interactive-component-surface.component.d.ts.map +1 -0
  121. package/dist/lib/components/realtime/interactive-component/realtime-interactive-component-surface.component.js +210 -0
  122. package/dist/lib/components/realtime/interactive-component/realtime-interactive-component-surface.component.js.map +1 -0
  123. package/dist/lib/components/realtime/interactive-component/run-view-component-artifact-source.d.ts +32 -0
  124. package/dist/lib/components/realtime/interactive-component/run-view-component-artifact-source.d.ts.map +1 -0
  125. package/dist/lib/components/realtime/interactive-component/run-view-component-artifact-source.js +90 -0
  126. package/dist/lib/components/realtime/interactive-component/run-view-component-artifact-source.js.map +1 -0
  127. package/dist/lib/components/realtime/media/media-channel.d.ts +7 -0
  128. package/dist/lib/components/realtime/media/media-channel.d.ts.map +1 -1
  129. package/dist/lib/components/realtime/media/media-channel.js +28 -1
  130. package/dist/lib/components/realtime/media/media-channel.js.map +1 -1
  131. package/dist/lib/components/realtime/realtime-agent-banner.component.d.ts +8 -1
  132. package/dist/lib/components/realtime/realtime-agent-banner.component.d.ts.map +1 -1
  133. package/dist/lib/components/realtime/realtime-agent-banner.component.js +89 -71
  134. package/dist/lib/components/realtime/realtime-agent-banner.component.js.map +1 -1
  135. package/dist/lib/components/realtime/realtime-agent-orb.component.d.ts +21 -0
  136. package/dist/lib/components/realtime/realtime-agent-orb.component.d.ts.map +1 -0
  137. package/dist/lib/components/realtime/realtime-agent-orb.component.js +49 -0
  138. package/dist/lib/components/realtime/realtime-agent-orb.component.js.map +1 -0
  139. package/dist/lib/components/realtime/realtime-agent-picker.component.d.ts +44 -11
  140. package/dist/lib/components/realtime/realtime-agent-picker.component.d.ts.map +1 -1
  141. package/dist/lib/components/realtime/realtime-agent-picker.component.js +162 -50
  142. package/dist/lib/components/realtime/realtime-agent-picker.component.js.map +1 -1
  143. package/dist/lib/components/realtime/realtime-audio-visuals.d.ts +8 -2
  144. package/dist/lib/components/realtime/realtime-audio-visuals.d.ts.map +1 -1
  145. package/dist/lib/components/realtime/realtime-audio-visuals.js +14 -18
  146. package/dist/lib/components/realtime/realtime-audio-visuals.js.map +1 -1
  147. package/dist/lib/components/realtime/realtime-composer.component.d.ts +42 -2
  148. package/dist/lib/components/realtime/realtime-composer.component.d.ts.map +1 -1
  149. package/dist/lib/components/realtime/realtime-composer.component.js +137 -102
  150. package/dist/lib/components/realtime/realtime-composer.component.js.map +1 -1
  151. package/dist/lib/components/realtime/realtime-perception-chip.component.d.ts +71 -0
  152. package/dist/lib/components/realtime/realtime-perception-chip.component.d.ts.map +1 -0
  153. package/dist/lib/components/realtime/realtime-perception-chip.component.js +221 -0
  154. package/dist/lib/components/realtime/realtime-perception-chip.component.js.map +1 -0
  155. package/dist/lib/components/realtime/realtime-session-overlay.component.d.ts +264 -22
  156. package/dist/lib/components/realtime/realtime-session-overlay.component.d.ts.map +1 -1
  157. package/dist/lib/components/realtime/realtime-session-overlay.component.js +851 -135
  158. package/dist/lib/components/realtime/realtime-session-overlay.component.js.map +1 -1
  159. package/dist/lib/components/realtime/realtime-surface-placement-prefs.d.ts +14 -0
  160. package/dist/lib/components/realtime/realtime-surface-placement-prefs.d.ts.map +1 -0
  161. package/dist/lib/components/realtime/realtime-surface-placement-prefs.js +14 -0
  162. package/dist/lib/components/realtime/realtime-surface-placement-prefs.js.map +1 -0
  163. package/dist/lib/components/realtime/realtime-surface-stage.model.d.ts +74 -0
  164. package/dist/lib/components/realtime/realtime-surface-stage.model.d.ts.map +1 -0
  165. package/dist/lib/components/realtime/realtime-surface-stage.model.js +171 -0
  166. package/dist/lib/components/realtime/realtime-surface-stage.model.js.map +1 -0
  167. package/dist/lib/components/realtime/realtime-surface-tabs.component.d.ts +71 -13
  168. package/dist/lib/components/realtime/realtime-surface-tabs.component.d.ts.map +1 -1
  169. package/dist/lib/components/realtime/realtime-surface-tabs.component.js +232 -73
  170. package/dist/lib/components/realtime/realtime-surface-tabs.component.js.map +1 -1
  171. package/dist/lib/components/realtime/realtime-surface-tabs.model.d.ts +5 -0
  172. package/dist/lib/components/realtime/realtime-surface-tabs.model.d.ts.map +1 -1
  173. package/dist/lib/components/realtime/realtime-surface-tabs.model.js +8 -0
  174. package/dist/lib/components/realtime/realtime-surface-tabs.model.js.map +1 -1
  175. package/dist/lib/components/realtime/realtime-ui-config.d.ts +12 -2
  176. package/dist/lib/components/realtime/realtime-ui-config.d.ts.map +1 -1
  177. package/dist/lib/components/realtime/realtime-ui-config.js +5 -1
  178. package/dist/lib/components/realtime/realtime-ui-config.js.map +1 -1
  179. package/dist/lib/components/realtime/remote-browser/remote-browser-channel.d.ts +10 -1
  180. package/dist/lib/components/realtime/remote-browser/remote-browser-channel.d.ts.map +1 -1
  181. package/dist/lib/components/realtime/remote-browser/remote-browser-channel.js +42 -2
  182. package/dist/lib/components/realtime/remote-browser/remote-browser-channel.js.map +1 -1
  183. package/dist/lib/components/realtime/remote-browser/remote-browser-surface.component.d.ts +20 -3
  184. package/dist/lib/components/realtime/remote-browser/remote-browser-surface.component.d.ts.map +1 -1
  185. package/dist/lib/components/realtime/remote-browser/remote-browser-surface.component.js +44 -10
  186. package/dist/lib/components/realtime/remote-browser/remote-browser-surface.component.js.map +1 -1
  187. package/dist/lib/components/realtime/whiteboard/whiteboard-channel.d.ts +28 -44
  188. package/dist/lib/components/realtime/whiteboard/whiteboard-channel.d.ts.map +1 -1
  189. package/dist/lib/components/realtime/whiteboard/whiteboard-channel.js +76 -162
  190. package/dist/lib/components/realtime/whiteboard/whiteboard-channel.js.map +1 -1
  191. package/dist/lib/components/search/search-panel.component.d.ts +2 -0
  192. package/dist/lib/components/search/search-panel.component.d.ts.map +1 -1
  193. package/dist/lib/components/search/search-panel.component.js +25 -12
  194. package/dist/lib/components/search/search-panel.component.js.map +1 -1
  195. package/dist/lib/components/sidebar/routines-section.component.js +1 -1
  196. package/dist/lib/components/sidebar/routines-section.component.js.map +1 -1
  197. package/dist/lib/components/task/tasks-full-view.component.d.ts +152 -31
  198. package/dist/lib/components/task/tasks-full-view.component.d.ts.map +1 -1
  199. package/dist/lib/components/task/tasks-full-view.component.js +2227 -214
  200. package/dist/lib/components/task/tasks-full-view.component.js.map +1 -1
  201. package/dist/lib/components/tasks/tasks-dropdown.component.js +4 -4
  202. package/dist/lib/components/tasks/tasks-dropdown.component.js.map +1 -1
  203. package/dist/lib/components/workspace/conversation-workspace.component.d.ts +33 -32
  204. package/dist/lib/components/workspace/conversation-workspace.component.d.ts.map +1 -1
  205. package/dist/lib/components/workspace/conversation-workspace.component.js +72 -88
  206. package/dist/lib/components/workspace/conversation-workspace.component.js.map +1 -1
  207. package/dist/lib/conversations.module.d.ts +30 -29
  208. package/dist/lib/conversations.module.d.ts.map +1 -1
  209. package/dist/lib/conversations.module.js +27 -5
  210. package/dist/lib/conversations.module.js.map +1 -1
  211. package/dist/lib/events/chat-events.d.ts +25 -0
  212. package/dist/lib/events/chat-events.d.ts.map +1 -1
  213. package/dist/lib/events/chat-events.js +36 -0
  214. package/dist/lib/events/chat-events.js.map +1 -1
  215. package/dist/lib/models/agent-turn.model.d.ts +5 -0
  216. package/dist/lib/models/agent-turn.model.d.ts.map +1 -1
  217. package/dist/lib/models/agent-turn.model.js.map +1 -1
  218. package/dist/lib/services/agent-state.service.d.ts +34 -8
  219. package/dist/lib/services/agent-state.service.d.ts.map +1 -1
  220. package/dist/lib/services/agent-state.service.js +90 -37
  221. package/dist/lib/services/agent-state.service.js.map +1 -1
  222. package/dist/lib/services/artifact-state.service.d.ts +0 -9
  223. package/dist/lib/services/artifact-state.service.d.ts.map +1 -1
  224. package/dist/lib/services/artifact-state.service.js +1 -32
  225. package/dist/lib/services/artifact-state.service.js.map +1 -1
  226. package/dist/lib/services/browser-realtime-media-host.d.ts +19 -7
  227. package/dist/lib/services/browser-realtime-media-host.d.ts.map +1 -1
  228. package/dist/lib/services/browser-realtime-media-host.js +21 -72
  229. package/dist/lib/services/browser-realtime-media-host.js.map +1 -1
  230. package/dist/lib/services/conversation-agent.service.d.ts +48 -16
  231. package/dist/lib/services/conversation-agent.service.d.ts.map +1 -1
  232. package/dist/lib/services/conversation-agent.service.js +110 -35
  233. package/dist/lib/services/conversation-agent.service.js.map +1 -1
  234. package/dist/lib/services/conversation-detail-window.store.d.ts +22 -4
  235. package/dist/lib/services/conversation-detail-window.store.d.ts.map +1 -1
  236. package/dist/lib/services/conversation-detail-window.store.js +50 -9
  237. package/dist/lib/services/conversation-detail-window.store.js.map +1 -1
  238. package/dist/lib/services/conversation-naming.d.ts +72 -22
  239. package/dist/lib/services/conversation-naming.d.ts.map +1 -1
  240. package/dist/lib/services/conversation-naming.js +93 -12
  241. package/dist/lib/services/conversation-naming.js.map +1 -1
  242. package/dist/lib/services/conversation-tasks-filter.d.ts +15 -0
  243. package/dist/lib/services/conversation-tasks-filter.d.ts.map +1 -0
  244. package/dist/lib/services/conversation-tasks-filter.js +69 -0
  245. package/dist/lib/services/conversation-tasks-filter.js.map +1 -0
  246. package/dist/lib/services/data-cache.service.d.ts +13 -5
  247. package/dist/lib/services/data-cache.service.d.ts.map +1 -1
  248. package/dist/lib/services/data-cache.service.js +39 -19
  249. package/dist/lib/services/data-cache.service.js.map +1 -1
  250. package/dist/lib/services/export.service.d.ts +26 -9
  251. package/dist/lib/services/export.service.d.ts.map +1 -1
  252. package/dist/lib/services/export.service.js +61 -18
  253. package/dist/lib/services/export.service.js.map +1 -1
  254. package/dist/lib/services/realtime-audio-recorder.d.ts +115 -79
  255. package/dist/lib/services/realtime-audio-recorder.d.ts.map +1 -1
  256. package/dist/lib/services/realtime-audio-recorder.js +273 -186
  257. package/dist/lib/services/realtime-audio-recorder.js.map +1 -1
  258. package/dist/lib/services/realtime-pairing.d.ts +10 -5
  259. package/dist/lib/services/realtime-pairing.d.ts.map +1 -1
  260. package/dist/lib/services/realtime-pairing.js +15 -6
  261. package/dist/lib/services/realtime-pairing.js.map +1 -1
  262. package/dist/lib/services/realtime-session.service.d.ts +31 -2
  263. package/dist/lib/services/realtime-session.service.d.ts.map +1 -1
  264. package/dist/lib/services/realtime-session.service.js +34 -2
  265. package/dist/lib/services/realtime-session.service.js.map +1 -1
  266. package/dist/lib/services/recording/libopus-wasm-binary.d.ts +3 -0
  267. package/dist/lib/services/recording/libopus-wasm-binary.d.ts.map +1 -0
  268. package/dist/lib/services/recording/libopus-wasm-binary.js +489 -0
  269. package/dist/lib/services/recording/libopus-wasm-binary.js.map +1 -0
  270. package/dist/lib/services/recording/libopus-worker-source.d.ts +48 -0
  271. package/dist/lib/services/recording/libopus-worker-source.d.ts.map +1 -0
  272. package/dist/lib/services/recording/libopus-worker-source.js +170 -0
  273. package/dist/lib/services/recording/libopus-worker-source.js.map +1 -0
  274. package/dist/lib/services/recording/linear-resampler.d.ts +45 -0
  275. package/dist/lib/services/recording/linear-resampler.d.ts.map +1 -0
  276. package/dist/lib/services/recording/linear-resampler.js +85 -0
  277. package/dist/lib/services/recording/linear-resampler.js.map +1 -0
  278. package/dist/lib/services/recording/opus-packet-encoder.d.ts +50 -0
  279. package/dist/lib/services/recording/opus-packet-encoder.d.ts.map +1 -0
  280. package/dist/lib/services/recording/opus-packet-encoder.js +41 -0
  281. package/dist/lib/services/recording/opus-packet-encoder.js.map +1 -0
  282. package/dist/lib/services/recording/wasm-opus-encoder.d.ts +86 -0
  283. package/dist/lib/services/recording/wasm-opus-encoder.d.ts.map +1 -0
  284. package/dist/lib/services/recording/wasm-opus-encoder.js +232 -0
  285. package/dist/lib/services/recording/wasm-opus-encoder.js.map +1 -0
  286. package/dist/lib/services/recording/webcodecs-opus-encoder.d.ts +39 -0
  287. package/dist/lib/services/recording/webcodecs-opus-encoder.d.ts.map +1 -0
  288. package/dist/lib/services/recording/webcodecs-opus-encoder.js +101 -0
  289. package/dist/lib/services/recording/webcodecs-opus-encoder.js.map +1 -0
  290. package/dist/lib/services/search.service.d.ts +7 -2
  291. package/dist/lib/services/search.service.d.ts.map +1 -1
  292. package/dist/lib/services/search.service.js +16 -20
  293. package/dist/lib/services/search.service.js.map +1 -1
  294. package/dist/lib/utils/conversation-branching.d.ts +4 -0
  295. package/dist/lib/utils/conversation-branching.d.ts.map +1 -0
  296. package/dist/lib/utils/conversation-branching.js +5 -0
  297. package/dist/lib/utils/conversation-branching.js.map +1 -0
  298. package/dist/lib/utils/conversation-forks.d.ts +315 -0
  299. package/dist/lib/utils/conversation-forks.d.ts.map +1 -0
  300. package/dist/lib/utils/conversation-forks.js +456 -0
  301. package/dist/lib/utils/conversation-forks.js.map +1 -0
  302. package/dist/lib/utils/distinct-artifacts.d.ts +9 -3
  303. package/dist/lib/utils/distinct-artifacts.d.ts.map +1 -1
  304. package/dist/lib/utils/distinct-artifacts.js +24 -5
  305. package/dist/lib/utils/distinct-artifacts.js.map +1 -1
  306. package/dist/public-api.d.ts +23 -1
  307. package/dist/public-api.d.ts.map +1 -1
  308. package/dist/public-api.js +30 -1
  309. package/dist/public-api.js.map +1 -1
  310. package/package.json +37 -33
  311. package/dist/lib/components/thread/thread-panel.component.d.ts +0 -126
  312. package/dist/lib/components/thread/thread-panel.component.d.ts.map +0 -1
  313. package/dist/lib/components/thread/thread-panel.component.js +0 -440
  314. package/dist/lib/components/thread/thread-panel.component.js.map +0 -1
  315. package/dist/lib/services/realtime-pcm-wav.d.ts +0 -79
  316. package/dist/lib/services/realtime-pcm-wav.d.ts.map +0 -1
  317. package/dist/lib/services/realtime-pcm-wav.js +0 -213
  318. package/dist/lib/services/realtime-pcm-wav.js.map +0 -1
@@ -1,35 +1,56 @@
1
1
  import { OnDestroy, OnInit } from '@angular/core';
2
+ import type { MediaPlacement } from '@memberjunction/ai-realtime-client/media';
2
3
  import { BaseRealtimeChannelClient } from '@memberjunction/realtime-runtime';
3
4
  import * as i0 from "@angular/core";
4
5
  /**
5
- * Generic pane host for an interactive channel's surface inside the overlay's tabbed
6
- * surface panel. Given the per-session channel {@link Plugin}, it:
6
+ * Generic host for an interactive channel's surface on the call overlay's stage. Given the per-session channel
7
+ * {@link Plugin}, it:
7
8
  *
8
9
  * 1. dynamically creates the plugin's surface component
9
10
  * ({@link BaseRealtimeChannelClient.GetSurfaceComponent}) into its own view container;
10
11
  * 2. immediately hands the created instance to
11
12
  * {@link BaseRealtimeChannelClient.BindSurface} — synchronously, BEFORE the surface's
12
13
  * first change detection, so inputs the plugin sets are visible in its `ngOnInit`;
13
- * 3. notifies {@link BaseRealtimeChannelClient.UnbindSurface} when the pane is destroyed
14
- * (panel collapsed / overlay torn down), flipping the plugin back into its
15
- * no-surface tool-execution mode.
14
+ * 3. tells the plugin whether the surface is on screen
15
+ * ({@link BaseRealtimeChannelClient.OnSurfaceVisibilityChange}) and where it is placed
16
+ * ({@link BaseRealtimeChannelClient.OnSurfacePlacementChange}) right after binding and whenever
17
+ * {@link Visible} or {@link Placement} changes;
18
+ * 4. notifies {@link BaseRealtimeChannelClient.UnbindSurface} when the pane is destroyed
19
+ * (the channel left the session / the overlay was torn down) or handed another plugin,
20
+ * flipping the plugin back into its no-surface tool-execution mode.
16
21
  *
17
22
  * This is how channel surfaces render with ZERO channel-specific wiring in the overlay:
18
23
  * the host never knows the surface component's type or API — the plugin wires its own
19
24
  * inputs/outputs in `BindSurface`.
20
25
  *
21
26
  * The created component is inserted as a SIBLING of this host element (standard
22
- * `ViewContainerRef` semantics), so it participates directly in the pane's flex layout;
27
+ * `ViewContainerRef` semantics), so it participates directly in its container's layout;
23
28
  * the host element itself renders nothing (`display: none`).
24
29
  */
25
30
  export declare class RealtimeChannelPaneComponent implements OnInit, OnDestroy {
26
- /** The per-session channel plugin whose surface this pane hosts. */
27
- Plugin: BaseRealtimeChannelClient;
28
31
  private viewContainer;
29
32
  private surfaceRef;
33
+ private plugin;
34
+ private initialized;
35
+ private visible;
36
+ private placement;
37
+ /**
38
+ * The per-session channel plugin whose surface this pane hosts. Handing the pane another plugin (the same channel
39
+ * in a new session) releases the old plugin's surface and creates the new one's.
40
+ */
41
+ set Plugin(value: BaseRealtimeChannelClient);
42
+ get Plugin(): BaseRealtimeChannelClient;
43
+ /** Whether the surface is on screen. The plugin hears of every change while its surface is bound. */
44
+ set Visible(value: boolean);
45
+ get Visible(): boolean;
46
+ /** Where the surface is placed. The plugin hears of every move while its surface is bound. */
47
+ set Placement(value: MediaPlacement);
48
+ get Placement(): MediaPlacement;
30
49
  ngOnInit(): void;
31
50
  ngOnDestroy(): void;
51
+ private createSurface;
52
+ private releaseSurface;
32
53
  static ɵfac: i0.ɵɵFactoryDeclaration<RealtimeChannelPaneComponent, never>;
33
- static ɵcmp: i0.ɵɵComponentDeclaration<RealtimeChannelPaneComponent, "mj-realtime-channel-pane", never, { "Plugin": { "alias": "Plugin"; "required": true; }; }, {}, never, never, true, never>;
54
+ static ɵcmp: i0.ɵɵComponentDeclaration<RealtimeChannelPaneComponent, "mj-realtime-channel-pane", never, { "Plugin": { "alias": "Plugin"; "required": true; }; "Visible": { "alias": "Visible"; "required": false; }; "Placement": { "alias": "Placement"; "required": false; }; }, {}, never, never, true, never>;
34
55
  }
35
56
  //# sourceMappingURL=realtime-channel-pane.component.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"realtime-channel-pane.component.d.ts","sourceRoot":"","sources":["../../../../../src/lib/components/realtime/channels/realtime-channel-pane.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkC,SAAS,EAAE,MAAM,EAAkC,MAAM,eAAe,CAAC;AAClH,OAAO,EAAE,yBAAyB,EAAE,MAAM,kCAAkC,CAAC;;AAE7E;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,qBAMa,4BAA6B,YAAW,MAAM,EAAE,SAAS;IACpE,oEAAoE;IACzC,MAAM,EAAG,yBAAyB,CAAC;IAE9D,OAAO,CAAC,aAAa,CAA4B;IACjD,OAAO,CAAC,UAAU,CAAqC;IAEvD,QAAQ,IAAI,IAAI;IAiBhB,WAAW,IAAI,IAAI;yCAxBR,4BAA4B;2CAA5B,4BAA4B;CA6BxC"}
1
+ {"version":3,"file":"realtime-channel-pane.component.d.ts","sourceRoot":"","sources":["../../../../../src/lib/components/realtime/channels/realtime-channel-pane.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkC,SAAS,EAAE,MAAM,EAAkC,MAAM,eAAe,CAAC;AAClH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0CAA0C,CAAC;AAC/E,OAAO,EAAE,yBAAyB,EAAE,MAAM,kCAAkC,CAAC;;AAE7E;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,qBAMa,4BAA6B,YAAW,MAAM,EAAE,SAAS;IACpE,OAAO,CAAC,aAAa,CAA4B;IACjD,OAAO,CAAC,UAAU,CAAqC;IACvD,OAAO,CAAC,MAAM,CAA6B;IAC3C,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,OAAO,CAAQ;IACvB,OAAO,CAAC,SAAS,CAAyB;IAE1C;;;OAGG;IACH,IACI,MAAM,CAAC,KAAK,EAAE,yBAAyB,EAW1C;IACD,IAAI,MAAM,IAAI,yBAAyB,CAEtC;IAED,qGAAqG;IACrG,IACI,OAAO,CAAC,KAAK,EAAE,OAAO,EAQzB;IACD,IAAI,OAAO,IAAI,OAAO,CAErB;IAED,8FAA8F;IAC9F,IACI,SAAS,CAAC,KAAK,EAAE,cAAc,EAQlC;IACD,IAAI,SAAS,IAAI,cAAc,CAE9B;IAED,QAAQ,IAAI,IAAI;IAKhB,WAAW,IAAI,IAAI;IAInB,OAAO,CAAC,aAAa;IAmBrB,OAAO,CAAC,cAAc;yCAvFX,4BAA4B;2CAA5B,4BAA4B;CA4FxC"}
@@ -1,35 +1,93 @@
1
1
  import { Component, Input, ViewContainerRef, inject } from '@angular/core';
2
2
  import * as i0 from "@angular/core";
3
3
  /**
4
- * Generic pane host for an interactive channel's surface inside the overlay's tabbed
5
- * surface panel. Given the per-session channel {@link Plugin}, it:
4
+ * Generic host for an interactive channel's surface on the call overlay's stage. Given the per-session channel
5
+ * {@link Plugin}, it:
6
6
  *
7
7
  * 1. dynamically creates the plugin's surface component
8
8
  * ({@link BaseRealtimeChannelClient.GetSurfaceComponent}) into its own view container;
9
9
  * 2. immediately hands the created instance to
10
10
  * {@link BaseRealtimeChannelClient.BindSurface} — synchronously, BEFORE the surface's
11
11
  * first change detection, so inputs the plugin sets are visible in its `ngOnInit`;
12
- * 3. notifies {@link BaseRealtimeChannelClient.UnbindSurface} when the pane is destroyed
13
- * (panel collapsed / overlay torn down), flipping the plugin back into its
14
- * no-surface tool-execution mode.
12
+ * 3. tells the plugin whether the surface is on screen
13
+ * ({@link BaseRealtimeChannelClient.OnSurfaceVisibilityChange}) and where it is placed
14
+ * ({@link BaseRealtimeChannelClient.OnSurfacePlacementChange}) right after binding and whenever
15
+ * {@link Visible} or {@link Placement} changes;
16
+ * 4. notifies {@link BaseRealtimeChannelClient.UnbindSurface} when the pane is destroyed
17
+ * (the channel left the session / the overlay was torn down) or handed another plugin,
18
+ * flipping the plugin back into its no-surface tool-execution mode.
15
19
  *
16
20
  * This is how channel surfaces render with ZERO channel-specific wiring in the overlay:
17
21
  * the host never knows the surface component's type or API — the plugin wires its own
18
22
  * inputs/outputs in `BindSurface`.
19
23
  *
20
24
  * The created component is inserted as a SIBLING of this host element (standard
21
- * `ViewContainerRef` semantics), so it participates directly in the pane's flex layout;
25
+ * `ViewContainerRef` semantics), so it participates directly in its container's layout;
22
26
  * the host element itself renders nothing (`display: none`).
23
27
  */
24
28
  export class RealtimeChannelPaneComponent {
25
- /** The per-session channel plugin whose surface this pane hosts. */
26
- Plugin;
27
29
  viewContainer = inject(ViewContainerRef);
28
30
  surfaceRef = null;
31
+ plugin;
32
+ initialized = false;
33
+ visible = true;
34
+ placement = 'tab';
35
+ /**
36
+ * The per-session channel plugin whose surface this pane hosts. Handing the pane another plugin (the same channel
37
+ * in a new session) releases the old plugin's surface and creates the new one's.
38
+ */
39
+ set Plugin(value) {
40
+ if (value === this.plugin) {
41
+ return;
42
+ }
43
+ if (this.initialized) {
44
+ this.releaseSurface();
45
+ }
46
+ this.plugin = value;
47
+ if (this.initialized) {
48
+ this.createSurface();
49
+ }
50
+ }
51
+ get Plugin() {
52
+ return this.plugin;
53
+ }
54
+ /** Whether the surface is on screen. The plugin hears of every change while its surface is bound. */
55
+ set Visible(value) {
56
+ if (value === this.visible) {
57
+ return;
58
+ }
59
+ this.visible = value;
60
+ if (this.surfaceRef) {
61
+ this.plugin.OnSurfaceVisibilityChange(value);
62
+ }
63
+ }
64
+ get Visible() {
65
+ return this.visible;
66
+ }
67
+ /** Where the surface is placed. The plugin hears of every move while its surface is bound. */
68
+ set Placement(value) {
69
+ if (value === this.placement) {
70
+ return;
71
+ }
72
+ this.placement = value;
73
+ if (this.surfaceRef) {
74
+ this.plugin.OnSurfacePlacementChange(value);
75
+ }
76
+ }
77
+ get Placement() {
78
+ return this.placement;
79
+ }
29
80
  ngOnInit() {
81
+ this.initialized = true;
82
+ this.createSurface();
83
+ }
84
+ ngOnDestroy() {
85
+ this.releaseSurface();
86
+ }
87
+ createSurface() {
30
88
  // Server-only channels have no surface (GetSurfaceComponent === null). The overlay should not
31
89
  // register a pane for them, but guard here too so a stray registration never crashes the panel.
32
- const surface = this.Plugin.GetSurfaceComponent();
90
+ const surface = this.plugin.GetSurfaceComponent();
33
91
  if (!surface) {
34
92
  return;
35
93
  }
@@ -39,16 +97,18 @@ export class RealtimeChannelPaneComponent {
39
97
  this.surfaceRef = this.viewContainer.createComponent(surface);
40
98
  // Bind BEFORE the created component's first change detection — inputs the plugin sets
41
99
  // here are in place when the surface's ngOnInit runs.
42
- this.Plugin.BindSurface(this.surfaceRef.instance);
100
+ this.plugin.BindSurface(this.surfaceRef.instance);
101
+ this.plugin.OnSurfaceVisibilityChange(this.visible);
102
+ this.plugin.OnSurfacePlacementChange(this.placement);
43
103
  this.surfaceRef.changeDetectorRef.markForCheck();
44
104
  }
45
- ngOnDestroy() {
46
- this.Plugin.UnbindSurface();
105
+ releaseSurface() {
106
+ this.plugin.UnbindSurface();
47
107
  this.surfaceRef?.destroy();
48
108
  this.surfaceRef = null;
49
109
  }
50
110
  static ɵfac = function RealtimeChannelPaneComponent_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || RealtimeChannelPaneComponent)(); };
51
- static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: RealtimeChannelPaneComponent, selectors: [["mj-realtime-channel-pane"]], inputs: { Plugin: "Plugin" }, decls: 0, vars: 0, template: function RealtimeChannelPaneComponent_Template(rf, ctx) { }, styles: ["[_nghost-%COMP%] { display: none; }"] });
111
+ static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: RealtimeChannelPaneComponent, selectors: [["mj-realtime-channel-pane"]], inputs: { Plugin: "Plugin", Visible: "Visible", Placement: "Placement" }, decls: 0, vars: 0, template: function RealtimeChannelPaneComponent_Template(rf, ctx) { }, styles: ["[_nghost-%COMP%] { display: none; }"] });
52
112
  }
53
113
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(RealtimeChannelPaneComponent, [{
54
114
  type: Component,
@@ -56,6 +116,10 @@ export class RealtimeChannelPaneComponent {
56
116
  }], null, { Plugin: [{
57
117
  type: Input,
58
118
  args: [{ required: true }]
119
+ }], Visible: [{
120
+ type: Input
121
+ }], Placement: [{
122
+ type: Input
59
123
  }] }); })();
60
- (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(RealtimeChannelPaneComponent, { className: "RealtimeChannelPaneComponent", filePath: "src/lib/components/realtime/channels/realtime-channel-pane.component.ts", lineNumber: 31 }); })();
124
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(RealtimeChannelPaneComponent, { className: "RealtimeChannelPaneComponent", filePath: "src/lib/components/realtime/channels/realtime-channel-pane.component.ts", lineNumber: 36 }); })();
61
125
  //# sourceMappingURL=realtime-channel-pane.component.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"realtime-channel-pane.component.js","sourceRoot":"","sources":["../../../../../src/lib/components/realtime/channels/realtime-channel-pane.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAgB,KAAK,EAA2B,gBAAgB,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;;AAGlH;;;;;;;;;;;;;;;;;;;;GAoBG;AAOH,MAAM,OAAO,4BAA4B;IACvC,oEAAoE;IACzC,MAAM,CAA6B;IAEtD,aAAa,GAAG,MAAM,CAAC,gBAAgB,CAAC,CAAC;IACzC,UAAU,GAAgC,IAAI,CAAC;IAEvD,QAAQ;QACN,8FAA8F;QAC9F,gGAAgG;QAChG,MAAM,OAAO,GAAG,IAAI,CAAC,MAAM,CAAC,mBAAmB,EAAE,CAAC;QAClD,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,OAAO;QACT,CAAC;QACD,4FAA4F;QAC5F,yFAAyF;QACzF,2FAA2F;QAC3F,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,aAAa,CAAC,eAAe,CAAC,OAAuB,CAAC,CAAC;QAC9E,sFAAsF;QACtF,sDAAsD;QACtD,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;QAClD,IAAI,CAAC,UAAU,CAAC,iBAAiB,CAAC,YAAY,EAAE,CAAC;IACnD,CAAC;IAED,WAAW;QACT,IAAI,CAAC,MAAM,CAAC,aAAa,EAAE,CAAC;QAC5B,IAAI,CAAC,UAAU,EAAE,OAAO,EAAE,CAAC;QAC3B,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;IACzB,CAAC;sHA5BU,4BAA4B;6DAA5B,4BAA4B;;iFAA5B,4BAA4B;cANxC,SAAS;6BACI,IAAI,YACN,0BAA0B,YAC1B,EAAE;;kBAKX,KAAK;mBAAC,EAAE,QAAQ,EAAE,IAAI,EAAE;;kFAFd,4BAA4B","sourcesContent":["import { Component, ComponentRef, Input, OnDestroy, OnInit, Type, ViewContainerRef, inject } from '@angular/core';\nimport { BaseRealtimeChannelClient } from '@memberjunction/realtime-runtime';\n\n/**\n * Generic pane host for an interactive channel's surface inside the overlay's tabbed\n * surface panel. Given the per-session channel {@link Plugin}, it:\n *\n * 1. dynamically creates the plugin's surface component\n * ({@link BaseRealtimeChannelClient.GetSurfaceComponent}) into its own view container;\n * 2. immediately hands the created instance to\n * {@link BaseRealtimeChannelClient.BindSurface} — synchronously, BEFORE the surface's\n * first change detection, so inputs the plugin sets are visible in its `ngOnInit`;\n * 3. notifies {@link BaseRealtimeChannelClient.UnbindSurface} when the pane is destroyed\n * (panel collapsed / overlay torn down), flipping the plugin back into its\n * no-surface tool-execution mode.\n *\n * This is how channel surfaces render with ZERO channel-specific wiring in the overlay:\n * the host never knows the surface component's type or API — the plugin wires its own\n * inputs/outputs in `BindSurface`.\n *\n * The created component is inserted as a SIBLING of this host element (standard\n * `ViewContainerRef` semantics), so it participates directly in the pane's flex layout;\n * the host element itself renders nothing (`display: none`).\n */\n@Component({\n standalone: true,\n selector: 'mj-realtime-channel-pane',\n template: '',\n styles: [':host { display: none; }']\n})\nexport class RealtimeChannelPaneComponent implements OnInit, OnDestroy {\n /** The per-session channel plugin whose surface this pane hosts. */\n @Input({ required: true }) Plugin!: BaseRealtimeChannelClient;\n\n private viewContainer = inject(ViewContainerRef);\n private surfaceRef: ComponentRef<object> | null = null;\n\n ngOnInit(): void {\n // Server-only channels have no surface (GetSurfaceComponent === null). The overlay should not\n // register a pane for them, but guard here too so a stray registration never crashes the panel.\n const surface = this.Plugin.GetSurfaceComponent();\n if (!surface) {\n return;\n }\n // The runtime carries the surface as an opaque component class — it has no business knowing\n // what a component is in any given framework. This is the single point that does, so the\n // Angular narrowing belongs here rather than as a structural claim in the shared contract.\n this.surfaceRef = this.viewContainer.createComponent(surface as Type<object>);\n // Bind BEFORE the created component's first change detection — inputs the plugin sets\n // here are in place when the surface's ngOnInit runs.\n this.Plugin.BindSurface(this.surfaceRef.instance);\n this.surfaceRef.changeDetectorRef.markForCheck();\n }\n\n ngOnDestroy(): void {\n this.Plugin.UnbindSurface();\n this.surfaceRef?.destroy();\n this.surfaceRef = null;\n }\n}\n"]}
1
+ {"version":3,"file":"realtime-channel-pane.component.js","sourceRoot":"","sources":["../../../../../src/lib/components/realtime/channels/realtime-channel-pane.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAgB,KAAK,EAA2B,gBAAgB,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;;AAIlH;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAOH,MAAM,OAAO,4BAA4B;IAC/B,aAAa,GAAG,MAAM,CAAC,gBAAgB,CAAC,CAAC;IACzC,UAAU,GAAgC,IAAI,CAAC;IAC/C,MAAM,CAA6B;IACnC,WAAW,GAAG,KAAK,CAAC;IACpB,OAAO,GAAG,IAAI,CAAC;IACf,SAAS,GAAmB,KAAK,CAAC;IAE1C;;;OAGG;IACH,IACI,MAAM,CAAC,KAAgC;QACzC,IAAI,KAAK,KAAK,IAAI,CAAC,MAAM,EAAE,CAAC;YAC1B,OAAO;QACT,CAAC;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AI,CAAC,MAAM,CAAC,mBAAmB,EAAE,CAAC;QAClD,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,OAAO;QACT,CAAC;QACD,4FAA4F;QAC5F,yFAAyF;QACzF,2FAA2F;QAC3F,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,aAAa,CAAC,eAAe,CAAC,OAAuB,CAAC,CAAC;QAC9E,sFAAsF;QACtF,sDAAsD;QACtD,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;QAClD,IAAI,CAAC,MAAM,CAAC,yBAAyB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACpD,IAAI,CAAC,MAAM,CAAC,wBAAwB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACrD,IAAI,CAAC,UAAU,CAAC,iBAAiB,CAAC,YAAY,EAAE,CAAC;IACnD,CAAC;IAEO,cAAc;QACpB,IAAI,CAAC,MAAM,CAAC,aAAa,EAAE,CAAC;QAC5B,IAAI,CAAC,UAAU,EAAE,OAAO,EAAE,CAAC;QAC3B,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;IACzB,CAAC;sHA3FU,4BAA4B;6DAA5B,4BAA4B;;iFAA5B,4BAA4B;cANxC,SAAS;6BACI,IAAI,YACN,0BAA0B,YAC1B,EAAE;;kBAeX,KAAK;mBAAC,EAAE,QAAQ,EAAE,IAAI,EAAE;;kBAkBxB,KAAK;;kBAeL,KAAK;;kFA7CK,4BAA4B","sourcesContent":["import { Component, ComponentRef, Input, OnDestroy, OnInit, Type, ViewContainerRef, inject } from '@angular/core';\nimport type { MediaPlacement } from '@memberjunction/ai-realtime-client/media';\nimport { BaseRealtimeChannelClient } from '@memberjunction/realtime-runtime';\n\n/**\n * Generic host for an interactive channel's surface on the call overlay's stage. Given the per-session channel\n * {@link Plugin}, it:\n *\n * 1. dynamically creates the plugin's surface component\n * ({@link BaseRealtimeChannelClient.GetSurfaceComponent}) into its own view container;\n * 2. immediately hands the created instance to\n * {@link BaseRealtimeChannelClient.BindSurface} — synchronously, BEFORE the surface's\n * first change detection, so inputs the plugin sets are visible in its `ngOnInit`;\n * 3. tells the plugin whether the surface is on screen\n * ({@link BaseRealtimeChannelClient.OnSurfaceVisibilityChange}) and where it is placed\n * ({@link BaseRealtimeChannelClient.OnSurfacePlacementChange}) right after binding and whenever\n * {@link Visible} or {@link Placement} changes;\n * 4. notifies {@link BaseRealtimeChannelClient.UnbindSurface} when the pane is destroyed\n * (the channel left the session / the overlay was torn down) or handed another plugin,\n * flipping the plugin back into its no-surface tool-execution mode.\n *\n * This is how channel surfaces render with ZERO channel-specific wiring in the overlay:\n * the host never knows the surface component's type or API — the plugin wires its own\n * inputs/outputs in `BindSurface`.\n *\n * The created component is inserted as a SIBLING of this host element (standard\n * `ViewContainerRef` semantics), so it participates directly in its container's layout;\n * the host element itself renders nothing (`display: none`).\n */\n@Component({\n standalone: true,\n selector: 'mj-realtime-channel-pane',\n template: '',\n styles: [':host { display: none; }']\n})\nexport class RealtimeChannelPaneComponent implements OnInit, OnDestroy {\n private viewContainer = inject(ViewContainerRef);\n private surfaceRef: ComponentRef<object> | null = null;\n private plugin!: BaseRealtimeChannelClient;\n private initialized = false;\n private visible = true;\n private placement: MediaPlacement = 'tab';\n\n /**\n * The per-session channel plugin whose surface this pane hosts. Handing the pane another plugin (the same channel\n * in a new session) releases the old plugin's surface and creates the new one's.\n */\n @Input({ required: true })\n set Plugin(value: BaseRealtimeChannelClient) {\n if (value === this.plugin) {\n return;\n }\n if (this.initialized) {\n this.releaseSurface();\n }\n this.plugin = value;\n if (this.initialized) {\n this.createSurface();\n }\n }\n get Plugin(): BaseRealtimeChannelClient {\n return this.plugin;\n }\n\n /** Whether the surface is on screen. The plugin hears of every change while its surface is bound. */\n @Input()\n set Visible(value: boolean) {\n if (value === this.visible) {\n return;\n }\n this.visible = value;\n if (this.surfaceRef) {\n this.plugin.OnSurfaceVisibilityChange(value);\n }\n }\n get Visible(): boolean {\n return this.visible;\n }\n\n /** Where the surface is placed. The plugin hears of every move while its surface is bound. */\n @Input()\n set Placement(value: MediaPlacement) {\n if (value === this.placement) {\n return;\n }\n this.placement = value;\n if (this.surfaceRef) {\n this.plugin.OnSurfacePlacementChange(value);\n }\n }\n get Placement(): MediaPlacement {\n return this.placement;\n }\n\n ngOnInit(): void {\n this.initialized = true;\n this.createSurface();\n }\n\n ngOnDestroy(): void {\n this.releaseSurface();\n }\n\n private createSurface(): void {\n // Server-only channels have no surface (GetSurfaceComponent === null). The overlay should not\n // register a pane for them, but guard here too so a stray registration never crashes the panel.\n const surface = this.plugin.GetSurfaceComponent();\n if (!surface) {\n return;\n }\n // The runtime carries the surface as an opaque component class — it has no business knowing\n // what a component is in any given framework. This is the single point that does, so the\n // Angular narrowing belongs here rather than as a structural claim in the shared contract.\n this.surfaceRef = this.viewContainer.createComponent(surface as Type<object>);\n // Bind BEFORE the created component's first change detection — inputs the plugin sets\n // here are in place when the surface's ngOnInit runs.\n this.plugin.BindSurface(this.surfaceRef.instance);\n this.plugin.OnSurfaceVisibilityChange(this.visible);\n this.plugin.OnSurfacePlacementChange(this.placement);\n this.surfaceRef.changeDetectorRef.markForCheck();\n }\n\n private releaseSurface(): void {\n this.plugin.UnbindSurface();\n this.surfaceRef?.destroy();\n this.surfaceRef = null;\n }\n}\n"]}
@@ -0,0 +1,71 @@
1
+ import type { Type } from '@angular/core';
2
+ import type { JSONObject } from '@memberjunction/ai';
3
+ import { type RealtimeChannelActor, type RealtimeChannelDescriptor } from '@memberjunction/ai-core-plus';
4
+ import { GraphQLDataProvider, GraphQLRealtimeSessionClient } from '@memberjunction/graphql-dataprovider';
5
+ import { BaseRealtimeChannelClient, type ChannelOnboardingDetails, type RealtimeChannelVerbResult } from '@memberjunction/realtime-runtime';
6
+ import { IdentityVerificationModel } from './identity-verification-model';
7
+ import { IdentityVerificationSurfaceComponent } from './identity-verification-surface.component';
8
+ /** The registry key (`MJ: AI Agent Channels` → `ClientPluginClass`) and the channel's name. */
9
+ export declare const IDENTITY_VERIFICATION_CHANNEL_NAME = "IdentityVerification";
10
+ /** The verbs, by name — the vocabulary the agent, the surface and the tests share. */
11
+ export declare const IDENTITY_VERIFICATION_VERBS: {
12
+ readonly Fill: "fill";
13
+ readonly Confirm: "confirm";
14
+ readonly Submit: "submit";
15
+ readonly Resend: "resend";
16
+ readonly EnterCode: "enter_code";
17
+ };
18
+ /**
19
+ * IDENTITY VERIFICATION as a generic, opt-in interactive channel: the way an agent helps a person —
20
+ * typically an anonymous visitor — prove they control an email address without leaving the call.
21
+ *
22
+ * What it models: three nouns (name, email, status), five verbs. The agent can `fill` what it heard, but
23
+ * only the USER can `confirm` it (enforced twice: `InvokableBy: 'user'`, which the runtime checks before
24
+ * dispatch, and again inside the verb). `submit` then asks the server to email a one-time code and link;
25
+ * `enter_code` hands the typed code back; `resend` asks for a fresh one. The channel never decides whether
26
+ * a person IS verified — the server's `identity.verified` session event does, and the channel follows it.
27
+ *
28
+ * The server half is a thin plugin that validates nothing beyond scope (see `IdentityVerificationChannelServer`);
29
+ * the real checks — domain policy, rate limits, hashing, expiry — live in the verification service.
30
+ *
31
+ * Opt in per agent or app with `channels.config.IdentityVerification`; open it from the host with
32
+ * `openChannel('IdentityVerification', { name, email })` or let the agent open it on demand.
33
+ */
34
+ export declare class IdentityVerificationChannel extends BaseRealtimeChannelClient<IdentityVerificationSurfaceComponent> {
35
+ /** The state machine. Public so the surface and tests share the one instance. */
36
+ readonly Model: IdentityVerificationModel;
37
+ private surface;
38
+ private eventsSub;
39
+ get ChannelName(): string;
40
+ get TabTitle(): string;
41
+ get TabIcon(): string;
42
+ /** Clock hook for tests. */
43
+ protected now(): number;
44
+ GetDescriptor(): RealtimeChannelDescriptor;
45
+ GetState(): JSONObject;
46
+ GetSurfaceComponent(): Type<IdentityVerificationSurfaceComponent>;
47
+ GetOnboardingDetails(): ChannelOnboardingDetails;
48
+ protected OnInitialize(): void;
49
+ protected OnOpen(inputs: JSONObject): void;
50
+ BindSurface(instance: IdentityVerificationSurfaceComponent): void;
51
+ UnbindSurface(): void;
52
+ /** Runs one verb. The runtime already validated the call against the descriptor; confirm is guarded again here. */
53
+ ApplyVerb(verb: string, args: JSONObject, actor: RealtimeChannelActor, _instanceId?: string): Promise<RealtimeChannelVerbResult>;
54
+ Dispose(): void;
55
+ /** Records every change (events immediately, one coalesced note to the model) and completes on verification. */
56
+ private onModelChange;
57
+ /**
58
+ * The server calls, riding the session's own provider and live session id. `null` when the session has
59
+ * no GraphQL provider — the channel then refuses to send rather than pretending.
60
+ */
61
+ private createService;
62
+ private withClient;
63
+ /** Builds the transport; protected so a test (or a host on another transport) can substitute it. */
64
+ protected createVerificationClient(provider: GraphQLDataProvider): GraphQLRealtimeSessionClient;
65
+ }
66
+ /**
67
+ * Tree-shaking prevention: the channel is resolved through the ClassFactory by the registry row's
68
+ * `ClientPluginClass` key, so this static call keeps its `@RegisterClass` side effect alive.
69
+ */
70
+ export declare function LoadIdentityVerificationChannel(): void;
71
+ //# sourceMappingURL=identity-verification-channel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"identity-verification-channel.d.ts","sourceRoot":"","sources":["../../../../../src/lib/components/realtime/identity-verification/identity-verification-channel.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAG1C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAGL,KAAK,oBAAoB,EACzB,KAAK,yBAAyB,EAC/B,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,mBAAmB,EAAE,4BAA4B,EAAE,MAAM,sCAAsC,CAAC;AACzG,OAAO,EACL,yBAAyB,EACzB,KAAK,wBAAwB,EAC7B,KAAK,yBAAyB,EAC/B,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,yBAAyB,EAAqE,MAAM,+BAA+B,CAAC;AAC7I,OAAO,EAAE,oCAAoC,EAA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0,0 +1,259 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ import { RegisterClass } from '@memberjunction/global';
8
+ import { IsIdentityVerifiedEventPayload, REALTIME_CHANNEL_CONTRACT_VERSION } from '@memberjunction/ai-core-plus';
9
+ import { GraphQLRealtimeSessionClient } from '@memberjunction/graphql-dataprovider';
10
+ import { BaseRealtimeChannelClient } from '@memberjunction/realtime-runtime';
11
+ import { IdentityVerificationModel } from './identity-verification-model';
12
+ import { IdentityVerificationSurfaceComponent } from './identity-verification-surface.component';
13
+ /** The registry key (`MJ: AI Agent Channels` → `ClientPluginClass`) and the channel's name. */
14
+ export const IDENTITY_VERIFICATION_CHANNEL_NAME = 'IdentityVerification';
15
+ /** The verbs, by name — the vocabulary the agent, the surface and the tests share. */
16
+ export const IDENTITY_VERIFICATION_VERBS = {
17
+ Fill: 'fill',
18
+ Confirm: 'confirm',
19
+ Submit: 'submit',
20
+ Resend: 'resend',
21
+ EnterCode: 'enter_code'
22
+ };
23
+ const FIELD_PARAM = { type: 'string', enum: ['name', 'email'], description: 'Which detail: "name" or "email".' };
24
+ /**
25
+ * IDENTITY VERIFICATION as a generic, opt-in interactive channel: the way an agent helps a person —
26
+ * typically an anonymous visitor — prove they control an email address without leaving the call.
27
+ *
28
+ * What it models: three nouns (name, email, status), five verbs. The agent can `fill` what it heard, but
29
+ * only the USER can `confirm` it (enforced twice: `InvokableBy: 'user'`, which the runtime checks before
30
+ * dispatch, and again inside the verb). `submit` then asks the server to email a one-time code and link;
31
+ * `enter_code` hands the typed code back; `resend` asks for a fresh one. The channel never decides whether
32
+ * a person IS verified — the server's `identity.verified` session event does, and the channel follows it.
33
+ *
34
+ * The server half is a thin plugin that validates nothing beyond scope (see `IdentityVerificationChannelServer`);
35
+ * the real checks — domain policy, rate limits, hashing, expiry — live in the verification service.
36
+ *
37
+ * Opt in per agent or app with `channels.config.IdentityVerification`; open it from the host with
38
+ * `openChannel('IdentityVerification', { name, email })` or let the agent open it on demand.
39
+ */
40
+ let IdentityVerificationChannel = class IdentityVerificationChannel extends BaseRealtimeChannelClient {
41
+ /** The state machine. Public so the surface and tests share the one instance. */
42
+ Model = new IdentityVerificationModel(this.createService(), () => this.now());
43
+ surface = null;
44
+ eventsSub = null;
45
+ get ChannelName() {
46
+ return IDENTITY_VERIFICATION_CHANNEL_NAME;
47
+ }
48
+ get TabTitle() {
49
+ return 'Verify your identity';
50
+ }
51
+ get TabIcon() {
52
+ return 'fa-solid fa-user-shield';
53
+ }
54
+ /** Clock hook for tests. */
55
+ now() {
56
+ return Date.now();
57
+ }
58
+ GetDescriptor() {
59
+ return {
60
+ Key: this.ChannelName,
61
+ Version: REALTIME_CHANNEL_CONTRACT_VERSION,
62
+ DisplayName: 'Identity verification',
63
+ OwningPackage: '@memberjunction/ng-conversations',
64
+ Instructions: 'Helps the user prove who they are by email, during this call. Ask for their name and email, `fill` what you hear, ' +
65
+ 'then ask the user to check the form and press Confirm — only they can confirm, so never claim you did. ' +
66
+ 'Once both are confirmed, `submit` emails them a code and a link. They can type the code in themselves, or you can ' +
67
+ '`enter_code` if they read it to you; or they can open the link, which completes it on its own. ' +
68
+ 'Never repeat a code or an email back unprompted. Check `status`: it becomes "verified" when the server confirms it — ' +
69
+ 'do not treat the person as verified before that.',
70
+ Nouns: [
71
+ { Name: 'name', Description: "The person's name, as entered.", Schema: { type: 'string' } },
72
+ { Name: 'email', Description: "The person's email address, as entered.", Schema: { type: 'string' } },
73
+ {
74
+ Name: 'status',
75
+ Description: 'Where verification stands: collecting (getting details, or ready to send), sending, code_sent, verifying, verified.',
76
+ Schema: { type: 'string', enum: ['collecting', 'sending', 'code_sent', 'verifying', 'verified'] }
77
+ },
78
+ {
79
+ Name: 'confirmed',
80
+ Description: 'Whether the USER has confirmed each detail. Only confirmed details can be sent.',
81
+ Schema: { type: 'object', properties: { name: { type: 'boolean' }, email: { type: 'boolean' } } }
82
+ },
83
+ { Name: 'problem', Description: 'The latest problem in plain words, or empty.', Schema: { type: 'string' } }
84
+ ],
85
+ Verbs: [
86
+ {
87
+ Name: IDENTITY_VERIFICATION_VERBS.Fill,
88
+ Description: 'Set the name or the email. What you fill is shown to the user marked as suggested until they confirm it.',
89
+ ParametersSchema: {
90
+ type: 'object',
91
+ properties: { field: FIELD_PARAM, value: { type: 'string', description: 'The value to set.', maxLength: 200 } },
92
+ required: ['field', 'value'],
93
+ additionalProperties: false
94
+ },
95
+ InvokableBy: 'both'
96
+ },
97
+ {
98
+ Name: IDENTITY_VERIFICATION_VERBS.Confirm,
99
+ Description: 'Confirm the details shown. Only the user can do this.',
100
+ ParametersSchema: { type: 'object', properties: { field: FIELD_PARAM }, additionalProperties: false },
101
+ InvokableBy: 'user'
102
+ },
103
+ {
104
+ Name: IDENTITY_VERIFICATION_VERBS.Submit,
105
+ Description: 'Email the user a one-time code and link. Needs both details filled and confirmed by the user.',
106
+ ParametersSchema: { type: 'object', additionalProperties: false },
107
+ InvokableBy: 'both',
108
+ Preconditions: ['name and email are filled', 'the user has confirmed both']
109
+ },
110
+ {
111
+ Name: IDENTITY_VERIFICATION_VERBS.Resend,
112
+ Description: 'Email a fresh code to the same address. Only after a code was sent, and subject to a short wait.',
113
+ ParametersSchema: { type: 'object', additionalProperties: false },
114
+ InvokableBy: 'both',
115
+ Preconditions: ['a code was already sent']
116
+ },
117
+ {
118
+ Name: IDENTITY_VERIFICATION_VERBS.EnterCode,
119
+ Description: 'Submit the code the user received (digits as they gave them).',
120
+ ParametersSchema: {
121
+ type: 'object',
122
+ properties: { code: { type: 'string', description: 'The code from the email.', maxLength: 16 } },
123
+ required: ['code'],
124
+ additionalProperties: false
125
+ },
126
+ InvokableBy: 'both',
127
+ Preconditions: ['a code was sent']
128
+ }
129
+ ],
130
+ Inputs: {
131
+ type: 'object',
132
+ properties: {
133
+ name: { type: 'string', description: 'A name the host already knows, to pre-fill (the user still confirms it).' },
134
+ email: { type: 'string', description: 'An email the host already knows, to pre-fill (the user still confirms it).' }
135
+ },
136
+ additionalProperties: false
137
+ },
138
+ Events: [
139
+ { Name: 'field_filled', Description: 'A detail was filled in, by the agent or the user.' },
140
+ { Name: 'confirmed', Description: 'The user confirmed one or both details.' },
141
+ { Name: 'code_sent', Description: 'The server emailed a code and link.' },
142
+ { Name: 'code_entered', Description: 'A code was submitted for checking (the code itself is never included).' },
143
+ { Name: 'verified', Description: 'The server confirmed the person is verified.' },
144
+ { Name: 'error', Description: 'A step failed; the payload carries the error code and the stage.' }
145
+ ],
146
+ Output: {
147
+ type: 'object',
148
+ properties: { verified: { type: 'boolean' }, email: { type: 'string' }, name: { type: 'string' } },
149
+ required: ['verified', 'email', 'name']
150
+ },
151
+ DisplayPolicy: 'on-demand',
152
+ DefaultAvailability: 'opt-in',
153
+ MaxExposure: 'state'
154
+ };
155
+ }
156
+ GetState() {
157
+ return this.Model.ToState();
158
+ }
159
+ GetSurfaceComponent() {
160
+ return IdentityVerificationSurfaceComponent;
161
+ }
162
+ GetOnboardingDetails() {
163
+ return {
164
+ Heading: 'Verify your identity',
165
+ Description: 'Confirm your name and email so we can recognise you. We email you a code and a link; either one completes it.',
166
+ Tips: ['Check the details the assistant filled in, then press Confirm.', 'You can type the code here, or just open the link in the email.'],
167
+ IconClass: 'fa-solid fa-user-shield'
168
+ };
169
+ }
170
+ OnInitialize() {
171
+ this.Model.OnChange((change) => this.onModelChange(change));
172
+ this.eventsSub = this.Context?.SessionEvents$?.subscribe((event) => {
173
+ if (event.Type === 'identity.verified' && IsIdentityVerifiedEventPayload(event.Payload)) {
174
+ this.Model.MarkVerified(event.Payload);
175
+ }
176
+ }) ?? null;
177
+ }
178
+ OnOpen(inputs) {
179
+ this.Model.Seed(inputs);
180
+ }
181
+ BindSurface(instance) {
182
+ this.surface = instance;
183
+ instance.Model = this.Model;
184
+ instance.AgentName = this.Context?.AgentName ?? 'The assistant';
185
+ instance.Dispatch = (verb, args) => this.ApplyVerb(verb, args, 'user');
186
+ }
187
+ UnbindSurface() {
188
+ this.surface = null;
189
+ }
190
+ /** Runs one verb. The runtime already validated the call against the descriptor; confirm is guarded again here. */
191
+ async ApplyVerb(verb, args, actor, _instanceId) {
192
+ switch (verb) {
193
+ case IDENTITY_VERIFICATION_VERBS.Fill:
194
+ return this.Model.Fill(args, actor);
195
+ case IDENTITY_VERIFICATION_VERBS.Confirm:
196
+ return this.Model.Confirm(args, actor);
197
+ case IDENTITY_VERIFICATION_VERBS.Submit:
198
+ return this.Model.Submit();
199
+ case IDENTITY_VERIFICATION_VERBS.Resend:
200
+ return this.Model.Resend();
201
+ case IDENTITY_VERIFICATION_VERBS.EnterCode:
202
+ return this.Model.EnterCode(args);
203
+ default:
204
+ return { Success: false, ErrorCode: 'unknown_verb', Error: `${this.ChannelName} has no verb "${verb}".` };
205
+ }
206
+ }
207
+ Dispose() {
208
+ this.eventsSub?.unsubscribe();
209
+ this.eventsSub = null;
210
+ this.Model.OnChange(null);
211
+ this.surface = null;
212
+ super.Dispose();
213
+ }
214
+ /** Records every change (events immediately, one coalesced note to the model) and completes on verification. */
215
+ onModelChange(change) {
216
+ if (change.Event) {
217
+ this.EmitChannelEvent(change.Event.Name, change.Event.Payload);
218
+ }
219
+ this.RecordChange({ Author: change.Author });
220
+ if (change.Event?.Name === 'verified') {
221
+ const view = this.Model.View;
222
+ this.Complete({ verified: true, email: view.Email.Value, name: view.Name.Value });
223
+ }
224
+ }
225
+ /**
226
+ * The server calls, riding the session's own provider and live session id. `null` when the session has
227
+ * no GraphQL provider — the channel then refuses to send rather than pretending.
228
+ */
229
+ createService() {
230
+ return {
231
+ Request: (input) => this.withClient((client, id) => client.RequestVerification({ AgentSessionID: id, Name: input.Name, Email: input.Email })),
232
+ SubmitCode: (code) => this.withClient((client, id) => client.SubmitVerificationCode({ AgentSessionID: id, Code: code }))
233
+ };
234
+ }
235
+ async withClient(run) {
236
+ const provider = this.Context?.Provider;
237
+ const sessionId = this.Context?.AgentSessionID ?? null;
238
+ if (!provider || !sessionId) {
239
+ return { Success: false, VerificationState: 'unverified', ErrorCode: 'session_not_found' };
240
+ }
241
+ return run(this.createVerificationClient(provider), sessionId);
242
+ }
243
+ /** Builds the transport; protected so a test (or a host on another transport) can substitute it. */
244
+ createVerificationClient(provider) {
245
+ return new GraphQLRealtimeSessionClient(provider);
246
+ }
247
+ };
248
+ IdentityVerificationChannel = __decorate([
249
+ RegisterClass(BaseRealtimeChannelClient, 'IdentityVerificationChannel')
250
+ ], IdentityVerificationChannel);
251
+ export { IdentityVerificationChannel };
252
+ /**
253
+ * Tree-shaking prevention: the channel is resolved through the ClassFactory by the registry row's
254
+ * `ClientPluginClass` key, so this static call keeps its `@RegisterClass` side effect alive.
255
+ */
256
+ export function LoadIdentityVerificationChannel() {
257
+ // intentional no-op — the import side effect performs the registration
258
+ }
259
+ //# sourceMappingURL=identity-verification-channel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"identity-verification-channel.js","sourceRoot":"","sources":["../../../../../src/lib/components/realtime/identity-verification/identity-verification-channel.ts"],"names":[],"mappings":";;;;;;AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAEvD,OAAO,EACL,8BAA8B,EAC9B,iCAAiC,EAGlC,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAuB,4BAA4B,EAAE,MAAM,sCAAsC,CAAC;AACzG,OAAO,EACL,yBAAyB,EAG1B,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,yBAAyB,EAAqE,MAAM,+BAA+B,CAAC;AAC7I,OAAO,EAAE,oCAAoC,EAAE,MAAM,2CAA2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C,yBAAyB,EAAE,6BAA6B,CAAC;GAC3D,2BAA2B,CA2OvC;;AASD;;;GAGG;AACH,MAAM,UAAU,+BAA+B;IAC7C,uEAAuE;AACzE,CAAC","sourcesContent":["import type { Type } from '@angular/core';\nimport type { Subscription } from 'rxjs';\nimport { RegisterClass } from '@memberjunction/global';\nimport type { JSONObject } from '@memberjunction/ai';\nimport {\n IsIdentityVerifiedEventPayload,\n REALTIME_CHANNEL_CONTRACT_VERSION,\n type RealtimeChannelActor,\n type RealtimeChannelDescriptor\n} from '@memberjunction/ai-core-plus';\nimport { GraphQLDataProvider, GraphQLRealtimeSessionClient } from '@memberjunction/graphql-dataprovider';\nimport {\n BaseRealtimeChannelClient,\n type ChannelOnboardingDetails,\n type RealtimeChannelVerbResult\n} from '@memberjunction/realtime-runtime';\nimport { IdentityVerificationModel, type IdentityVerificationChange, type IdentityVerificationService } from './identity-verification-model';\nimport { IdentityVerificationSurfaceComponent } from './identity-verification-surface.component';\n\n/** The registry key (`MJ: AI Agent Channels` → `ClientPluginClass`) and the channel's name. */\nexport const IDENTITY_VERIFICATION_CHANNEL_NAME = 'IdentityVerification';\n\n/** The verbs, by name — the vocabulary the agent, the surface and the tests share. */\nexport const IDENTITY_VERIFICATION_VERBS = {\n Fill: 'fill',\n Confirm: 'confirm',\n Submit: 'submit',\n Resend: 'resend',\n EnterCode: 'enter_code'\n} as const;\n\nconst FIELD_PARAM = { type: 'string', enum: ['name', 'email'], description: 'Which detail: \"name\" or \"email\".' };\n\n/**\n * IDENTITY VERIFICATION as a generic, opt-in interactive channel: the way an agent helps a person —\n * typically an anonymous visitor — prove they control an email address without leaving the call.\n *\n * What it models: three nouns (name, email, status), five verbs. The agent can `fill` what it heard, but\n * only the USER can `confirm` it (enforced twice: `InvokableBy: 'user'`, which the runtime checks before\n * dispatch, and again inside the verb). `submit` then asks the server to email a one-time code and link;\n * `enter_code` hands the typed code back; `resend` asks for a fresh one. The channel never decides whether\n * a person IS verified — the server's `identity.verified` session event does, and the channel follows it.\n *\n * The server half is a thin plugin that validates nothing beyond scope (see `IdentityVerificationChannelServer`);\n * the real checks — domain policy, rate limits, hashing, expiry — live in the verification service.\n *\n * Opt in per agent or app with `channels.config.IdentityVerification`; open it from the host with\n * `openChannel('IdentityVerification', { name, email })` or let the agent open it on demand.\n */\n@RegisterClass(BaseRealtimeChannelClient, 'IdentityVerificationChannel')\nexport class IdentityVerificationChannel extends BaseRealtimeChannelClient<IdentityVerificationSurfaceComponent> {\n /** The state machine. Public so the surface and tests share the one instance. */\n public readonly Model: IdentityVerificationModel = new IdentityVerificationModel(this.createService(), () => this.now());\n\n private surface: IdentityVerificationSurfaceComponent | null = null;\n private eventsSub: Subscription | null = null;\n\n public get ChannelName(): string {\n return IDENTITY_VERIFICATION_CHANNEL_NAME;\n }\n\n public override get TabTitle(): string {\n return 'Verify your identity';\n }\n\n public override get TabIcon(): string {\n return 'fa-solid fa-user-shield';\n }\n\n /** Clock hook for tests. */\n protected now(): number {\n return Date.now();\n }\n\n public override GetDescriptor(): RealtimeChannelDescriptor {\n return {\n Key: this.ChannelName,\n Version: REALTIME_CHANNEL_CONTRACT_VERSION,\n DisplayName: 'Identity verification',\n OwningPackage: '@memberjunction/ng-conversations',\n Instructions:\n 'Helps the user prove who they are by email, during this call. Ask for their name and email, `fill` what you hear, ' +\n 'then ask the user to check the form and press Confirm — only they can confirm, so never claim you did. ' +\n 'Once both are confirmed, `submit` emails them a code and a link. They can type the code in themselves, or you can ' +\n '`enter_code` if they read it to you; or they can open the link, which completes it on its own. ' +\n 'Never repeat a code or an email back unprompted. Check `status`: it becomes \"verified\" when the server confirms it — ' +\n 'do not treat the person as verified before that.',\n Nouns: [\n { Name: 'name', Description: \"The person's name, as entered.\", Schema: { type: 'string' } },\n { Name: 'email', Description: \"The person's email address, as entered.\", Schema: { type: 'string' } },\n {\n Name: 'status',\n Description: 'Where verification stands: collecting (getting details, or ready to send), sending, code_sent, verifying, verified.',\n Schema: { type: 'string', enum: ['collecting', 'sending', 'code_sent', 'verifying', 'verified'] }\n },\n {\n Name: 'confirmed',\n Description: 'Whether the USER has confirmed each detail. Only confirmed details can be sent.',\n Schema: { type: 'object', properties: { name: { type: 'boolean' }, email: { type: 'boolean' } } }\n },\n { Name: 'problem', Description: 'The latest problem in plain words, or empty.', Schema: { type: 'string' } }\n ],\n Verbs: [\n {\n Name: IDENTITY_VERIFICATION_VERBS.Fill,\n Description: 'Set the name or the email. What you fill is shown to the user marked as suggested until they confirm it.',\n ParametersSchema: {\n type: 'object',\n properties: { field: FIELD_PARAM, value: { type: 'string', description: 'The value to set.', maxLength: 200 } },\n required: ['field', 'value'],\n additionalProperties: false\n },\n InvokableBy: 'both'\n },\n {\n Name: IDENTITY_VERIFICATION_VERBS.Confirm,\n Description: 'Confirm the details shown. Only the user can do this.',\n ParametersSchema: { type: 'object', properties: { field: FIELD_PARAM }, additionalProperties: false },\n InvokableBy: 'user'\n },\n {\n Name: IDENTITY_VERIFICATION_VERBS.Submit,\n Description: 'Email the user a one-time code and link. Needs both details filled and confirmed by the user.',\n ParametersSchema: { type: 'object', additionalProperties: false },\n InvokableBy: 'both',\n Preconditions: ['name and email are filled', 'the user has confirmed both']\n },\n {\n Name: IDENTITY_VERIFICATION_VERBS.Resend,\n Description: 'Email a fresh code to the same address. Only after a code was sent, and subject to a short wait.',\n ParametersSchema: { type: 'object', additionalProperties: false },\n InvokableBy: 'both',\n Preconditions: ['a code was already sent']\n },\n {\n Name: IDENTITY_VERIFICATION_VERBS.EnterCode,\n Description: 'Submit the code the user received (digits as they gave them).',\n ParametersSchema: {\n type: 'object',\n properties: { code: { type: 'string', description: 'The code from the email.', maxLength: 16 } },\n required: ['code'],\n additionalProperties: false\n },\n InvokableBy: 'both',\n Preconditions: ['a code was sent']\n }\n ],\n Inputs: {\n type: 'object',\n properties: {\n name: { type: 'string', description: 'A name the host already knows, to pre-fill (the user still confirms it).' },\n email: { type: 'string', description: 'An email the host already knows, to pre-fill (the user still confirms it).' }\n },\n additionalProperties: false\n },\n Events: [\n { Name: 'field_filled', Description: 'A detail was filled in, by the agent or the user.' },\n { Name: 'confirmed', Description: 'The user confirmed one or both details.' },\n { Name: 'code_sent', Description: 'The server emailed a code and link.' },\n { Name: 'code_entered', Description: 'A code was submitted for checking (the code itself is never included).' },\n { Name: 'verified', Description: 'The server confirmed the person is verified.' },\n { Name: 'error', Description: 'A step failed; the payload carries the error code and the stage.' }\n ],\n Output: {\n type: 'object',\n properties: { verified: { type: 'boolean' }, email: { type: 'string' }, name: { type: 'string' } },\n required: ['verified', 'email', 'name']\n },\n DisplayPolicy: 'on-demand',\n DefaultAvailability: 'opt-in',\n MaxExposure: 'state'\n };\n }\n\n public override GetState(): JSONObject {\n return this.Model.ToState();\n }\n\n public override GetSurfaceComponent(): Type<IdentityVerificationSurfaceComponent> {\n return IdentityVerificationSurfaceComponent;\n }\n\n public override GetOnboardingDetails(): ChannelOnboardingDetails {\n return {\n Heading: 'Verify your identity',\n Description:\n 'Confirm your name and email so we can recognise you. We email you a code and a link; either one completes it.',\n Tips: ['Check the details the assistant filled in, then press Confirm.', 'You can type the code here, or just open the link in the email.'],\n IconClass: 'fa-solid fa-user-shield'\n };\n }\n\n protected override OnInitialize(): void {\n this.Model.OnChange((change) => this.onModelChange(change));\n this.eventsSub = this.Context?.SessionEvents$?.subscribe((event) => {\n if (event.Type === 'identity.verified' && IsIdentityVerifiedEventPayload(event.Payload)) {\n this.Model.MarkVerified(event.Payload);\n }\n }) ?? null;\n }\n\n protected override OnOpen(inputs: JSONObject): void {\n this.Model.Seed(inputs);\n }\n\n public BindSurface(instance: IdentityVerificationSurfaceComponent): void {\n this.surface = instance;\n instance.Model = this.Model;\n instance.AgentName = this.Context?.AgentName ?? 'The assistant';\n instance.Dispatch = (verb, args) => this.ApplyVerb(verb, args, 'user');\n }\n\n public override UnbindSurface(): void {\n this.surface = null;\n }\n\n /** Runs one verb. The runtime already validated the call against the descriptor; confirm is guarded again here. */\n public override async ApplyVerb(\n verb: string,\n args: JSONObject,\n actor: RealtimeChannelActor,\n _instanceId?: string\n ): Promise<RealtimeChannelVerbResult> {\n switch (verb) {\n case IDENTITY_VERIFICATION_VERBS.Fill:\n return this.Model.Fill(args, actor);\n case IDENTITY_VERIFICATION_VERBS.Confirm:\n return this.Model.Confirm(args, actor);\n case IDENTITY_VERIFICATION_VERBS.Submit:\n return this.Model.Submit();\n case IDENTITY_VERIFICATION_VERBS.Resend:\n return this.Model.Resend();\n case IDENTITY_VERIFICATION_VERBS.EnterCode:\n return this.Model.EnterCode(args);\n default:\n return { Success: false, ErrorCode: 'unknown_verb', Error: `${this.ChannelName} has no verb \"${verb}\".` };\n }\n }\n\n public override Dispose(): void {\n this.eventsSub?.unsubscribe();\n this.eventsSub = null;\n this.Model.OnChange(null);\n this.surface = null;\n super.Dispose();\n }\n\n /** Records every change (events immediately, one coalesced note to the model) and completes on verification. */\n private onModelChange(change: IdentityVerificationChange): void {\n if (change.Event) {\n this.EmitChannelEvent(change.Event.Name, change.Event.Payload);\n }\n this.RecordChange({ Author: change.Author });\n if (change.Event?.Name === 'verified') {\n const view = this.Model.View;\n this.Complete({ verified: true, email: view.Email.Value, name: view.Name.Value });\n }\n }\n\n /**\n * The server calls, riding the session's own provider and live session id. `null` when the session has\n * no GraphQL provider — the channel then refuses to send rather than pretending.\n */\n private createService(): IdentityVerificationService | null {\n return {\n Request: (input) => this.withClient((client, id) => client.RequestVerification({ AgentSessionID: id, Name: input.Name, Email: input.Email })),\n SubmitCode: (code) => this.withClient((client, id) => client.SubmitVerificationCode({ AgentSessionID: id, Code: code }))\n };\n }\n\n private async withClient<T extends { Success: boolean }>(\n run: (client: GraphQLRealtimeSessionClient, agentSessionId: string) => Promise<T>\n ): Promise<T | NoSessionResult> {\n const provider = this.Context?.Provider as GraphQLDataProvider | null | undefined;\n const sessionId = this.Context?.AgentSessionID ?? null;\n if (!provider || !sessionId) {\n return { Success: false, VerificationState: 'unverified', ErrorCode: 'session_not_found' };\n }\n return run(this.createVerificationClient(provider), sessionId);\n }\n\n /** Builds the transport; protected so a test (or a host on another transport) can substitute it. */\n protected createVerificationClient(provider: GraphQLDataProvider): GraphQLRealtimeSessionClient {\n return new GraphQLRealtimeSessionClient(provider);\n }\n}\n\n/** The shape returned when there is no live session to talk to (mirrors the client's own failure results). */\ninterface NoSessionResult {\n Success: false;\n VerificationState: 'unverified';\n ErrorCode: 'session_not_found';\n}\n\n/**\n * Tree-shaking prevention: the channel is resolved through the ClassFactory by the registry row's\n * `ClientPluginClass` key, so this static call keeps its `@RegisterClass` side effect alive.\n */\nexport function LoadIdentityVerificationChannel(): void {\n // intentional no-op — the import side effect performs the registration\n}\n"]}