@memberjunction/ng-conversations 5.40.1 → 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
@@ -1,38 +1,57 @@
1
1
  import { Injectable } from '@angular/core';
2
- import { BehaviorSubject } from 'rxjs';
3
- import { Metadata, RunView } from '@memberjunction/core';
2
+ import { Metadata } from '@memberjunction/core';
4
3
  import { GraphQLAIClient } from '@memberjunction/graphql-dataprovider';
5
- import { AIEngineBase, AIAgentPermissionHelper } from '@memberjunction/ai-engine-base';
4
+ import { AIEngineBase } from '@memberjunction/ai-engine-base';
6
5
  import { MJNotificationService } from '@memberjunction/ng-notifications';
6
+ import { ConversationsRuntime } from '@memberjunction/conversations-runtime';
7
7
  import { UUIDsEqual } from '@memberjunction/global';
8
8
  import * as i0 from "@angular/core";
9
- import * as i1 from "./mention-parser.service";
10
- import * as i2 from "@memberjunction/ng-agent-client";
9
+ import * as i1 from "./conversations-runtime-bootstrap.service";
10
+ import * as i2 from "./mention-parser.service";
11
+ import * as i3 from "@memberjunction/ng-agent-client";
11
12
  /**
12
- * Service for managing agent interactions within conversations.
13
- * Handles communication with the ambient Sage Agent and other agents.
13
+ * Angular DI service for conversation-level agent orchestration.
14
+ *
15
+ * After PR 2 of the conversations-runtime extraction, the core
16
+ * `processMessage` flow and the conversation-manager-agent resolution are
17
+ * delegated to `@memberjunction/conversations-runtime`. This service is
18
+ * primarily a shim for those operations PLUS the holder of the helpers
19
+ * that haven't been ported yet:
20
+ *
21
+ * - `invokeSubAgent(...)` — used by Sage's routing decisions in
22
+ * `message-input.component`.
23
+ * - `checkAgentContinuityIntent(...)` — fast intent classification when the
24
+ * user replies to a previous-agent thread.
25
+ * - `findConfigurationPresetFromHistory(...)` — locates an agent's preset
26
+ * from prior @mentions in the conversation.
27
+ * - `clearSession(...)` — per-conversation session-id bookkeeping.
28
+ *
29
+ * These can move to the runtime in a follow-up; they aren't strictly needed
30
+ * to invoke an agent end-to-end and stay here so the shim has zero behavior
31
+ * difference vs. the original.
14
32
  */
15
33
  export class ConversationAgentService {
16
34
  mentionParser;
17
35
  agentClientService;
18
36
  /** GraphQL AI client - retained for RunAIPrompt (intent checking) which AgentClientService doesn't wrap */
19
37
  _aiClient = null;
38
+ /** Cached resolution of the conversation manager agent (default agent). */
20
39
  _conversationManagerAgent = null;
21
- _sessionIds = new Map(); // conversationId -> sessionId
22
- _isProcessing$ = new BehaviorSubject(false);
23
- /**
24
- * Observable indicating if the ambient agent is currently processing
25
- */
26
- isProcessing$ = this._isProcessing$.asObservable();
40
+ _sessionIds = new Map();
41
+ /** Observable indicating if the ambient agent is currently processing — delegated to the runtime's AgentRunner. */
42
+ isProcessing$;
27
43
  _provider = null;
28
- constructor(mentionParser, agentClientService) {
44
+ constructor(_bootstrap, mentionParser, agentClientService) {
29
45
  this.mentionParser = mentionParser;
30
46
  this.agentClientService = agentClientService;
47
+ // Injecting `_bootstrap` forces the runtime's INotificationAdapter +
48
+ // IActiveTaskTracker adapters to register before any shim method runs.
49
+ this.isProcessing$ = ConversationsRuntime.Instance.AgentRunner.isProcessing$;
31
50
  this.initializeAIClient();
32
51
  }
33
52
  /**
34
53
  * The metadata provider this service uses. When unset, falls back to Metadata.Provider.
35
- * Setting it re-initializes the AI client to bind to the supplied provider.
54
+ * Setting it re-initializes the AI client and forwards the provider to the runtime's runner.
36
55
  */
37
56
  get Provider() {
38
57
  return this._provider ?? Metadata.Provider;
@@ -40,11 +59,12 @@ export class ConversationAgentService {
40
59
  set Provider(value) {
41
60
  this._provider = value;
42
61
  this.initializeAIClient();
62
+ ConversationsRuntime.Instance.AgentRunner.Provider = value;
43
63
  }
44
64
  /**
45
65
  * Initialize the GraphQL AI Client.
46
66
  * Retained for RunAIPrompt calls (intent checking) which the AgentClientService doesn't wrap.
47
- * Agent execution (RunAIAgentFromConversationDetail) now goes through AgentClientService.
67
+ * Agent execution (RunAIAgentFromConversationDetail) now goes through ConversationsRuntime.AgentRunner.
48
68
  */
49
69
  initializeAIClient() {
50
70
  try {
@@ -61,133 +81,78 @@ export class ConversationAgentService {
61
81
  }
62
82
  }
63
83
  /**
64
- * Get or load the Sage Agent (formerly Conversation Manager Agent)
84
+ * Resolve the conversation manager agent via the runtime's 4-step
85
+ * DefaultAgentResolver chain (explicit input → app-scoped Application
86
+ * Setting → global Application Setting → code-const Sage fallback). The
87
+ * result is cached on this service for use by the synchronous
88
+ * {@link ConversationManagerAgentName} getter.
89
+ *
90
+ * Existing callers expect a Promise<MJAIAgentEntityExtended | null> — we
91
+ * preserve that shape (returning null on failure rather than throwing)
92
+ * so the call sites don't need to change.
65
93
  */
66
94
  async getConversationManagerAgent() {
67
95
  if (this._conversationManagerAgent) {
68
96
  return this._conversationManagerAgent;
69
97
  }
70
98
  try {
71
- // Ensure AIEngineBase is configured
72
- await AIEngineBase.Instance.Config(false);
73
- // Find the Sage Agent
74
- const agents = AIEngineBase.Instance.Agents;
75
- this._conversationManagerAgent = agents.find((agent) => agent.Name === 'Sage') || null;
76
- if (!this._conversationManagerAgent) {
77
- const errorMsg = 'Sage Agent not found in AIEngineBase.Agents';
78
- console.warn(errorMsg);
79
- MJNotificationService.Instance?.CreateSimpleNotification(errorMsg, 'error', 5000);
80
- }
81
- return this._conversationManagerAgent;
99
+ const provider = this.Provider;
100
+ const agent = await ConversationsRuntime.Instance.DefaultAgent.resolve({
101
+ contextUser: provider.CurrentUser ?? undefined,
102
+ provider,
103
+ });
104
+ this._conversationManagerAgent = agent;
105
+ return agent;
82
106
  }
83
107
  catch (error) {
84
- const errorMsg = 'Error loading Sage Agent: ' + (error instanceof Error ? error.message : String(error));
85
- console.error('Error loading Sage Agent:', error);
108
+ const errorMsg = 'Error resolving conversation manager agent: ' + (error instanceof Error ? error.message : String(error));
109
+ console.error(errorMsg);
86
110
  MJNotificationService.Instance?.CreateSimpleNotification(errorMsg, 'error', 5000);
87
111
  return null;
88
112
  }
89
113
  }
90
114
  /**
91
- * Process a message through the ambient Sage Agent.
92
- * This should be called for every message sent in a conversation.
93
- *
94
- * Uses the optimized RunAIAgentFromConversationDetail mutation which loads
95
- * conversation history (including attachments) server-side for better performance.
115
+ * Synchronous read of the cached conversation-manager-agent name. Returns
116
+ * `null` until {@link getConversationManagerAgent} has been called at least
117
+ * once and resolved successfully. Used by `MessageItemComponent.isConversationManager`
118
+ * to flag messages from the routing agent without hardcoding `'Sage'`.
119
+ */
120
+ get ConversationManagerAgentName() {
121
+ return this._conversationManagerAgent?.Name ?? null;
122
+ }
123
+ /**
124
+ * Returns `true` if the supplied agent identifier (UUID or name) matches the
125
+ * currently cached conversation manager agent. Robust to either input.
126
+ */
127
+ IsConversationManagerAgent(agentIdOrName) {
128
+ if (!agentIdOrName || !this._conversationManagerAgent)
129
+ return false;
130
+ return (UUIDsEqual(this._conversationManagerAgent.ID, agentIdOrName) ||
131
+ this._conversationManagerAgent.Name === agentIdOrName);
132
+ }
133
+ /**
134
+ * Process a message through the conversation manager agent. Delegates to
135
+ * `ConversationsRuntime.Instance.AgentRunner.processMessage(...)`.
96
136
  *
97
- * @param conversationId The conversation ID
98
- * @param message The message that was just sent
99
- * @param conversationHistory Recent messages in the conversation for context (kept for backwards compatibility but not used)
100
- * @param conversationDetailId The ID of the conversation detail record to link to the agent run
101
- * @param onProgress Optional callback for receiving progress updates during execution
102
- * @returns The agent's response, or null if the agent chooses not to respond
137
+ * Signature is preserved verbatim from the original service so existing
138
+ * call sites continue to compile. The unused `conversationHistory`
139
+ * parameter is kept for backwards compatibility (it was already
140
+ * documented as "kept for backwards compatibility but not used" in the
141
+ * original).
103
142
  */
104
143
  async processMessage(conversationId, message, conversationHistory, conversationDetailId, onProgress, appContext) {
105
- // Don't process if user is tagging someone else (future enhancement)
106
- // For now, we'll always send to the ambient agent
107
- const agent = await this.getConversationManagerAgent();
108
- if (!agent || !agent.ID) {
109
- const errorMsg = 'Sage Agent not available';
110
- console.warn(errorMsg);
111
- MJNotificationService.Instance?.CreateSimpleNotification(errorMsg, 'warning', 5000);
112
- return null;
113
- }
114
- try {
115
- // Indicate agent is processing
116
- this._isProcessing$.next(true);
117
- // Get current user for permission filtering
118
- const currentUser = this.Provider.CurrentUser;
119
- if (!currentUser) {
120
- console.warn('⚠️ No current user available for permission filtering, using unfiltered agents');
121
- }
122
- // Filter agents by status and hierarchy first
123
- const candidateAgents = AIEngineBase.Instance.Agents.filter(a => !UUIDsEqual(a.ID, agent.ID) &&
124
- !a.ParentID &&
125
- a.Status === 'Active' &&
126
- a.InvocationMode !== 'Sub-Agent' // ensure that the agent is intended to run as top-level
127
- );
128
- // Filter by user permissions if user context available
129
- const availAgents = currentUser
130
- ? await this.filterAgentsByPermissions(candidateAgents, currentUser)
131
- : candidateAgents;
132
- console.log(`📋 Available agents for Sage: ${availAgents.length} (filtered from ${candidateAgents.length} candidates)`);
133
- // Use AgentClientService which wraps GraphQLAIClient.RunAIAgentFromConversationDetail
134
- // and automatically integrates with client tool request handling
135
- const agentParams = {
136
- ConversationDetailId: conversationDetailId,
137
- AgentId: agent.ID,
138
- MaxHistoryMessages: 20,
139
- Data: {
140
- ALL_AVAILABLE_AGENTS: availAgents.map(a => ({
141
- ID: a.ID,
142
- Name: a.Name,
143
- Description: a.Description
144
- })),
145
- conversationId: conversationId,
146
- latestMessageId: message.ID,
147
- ...(appContext ? { appContext } : {}),
148
- // Include all registered client tools so the LLM sees them in the prompt.
149
- // These are ephemeral tools registered by the client app (CopyToClipboard, etc.)
150
- // that supplement the metadata-defined tools from the junction table.
151
- clientTools: this.agentClientService.GetRegisteredTools().map(t => ({
152
- Name: t.Name,
153
- Description: t.Description,
154
- InputSchema: t.ParameterSchema
155
- }))
156
- },
157
- CreateArtifacts: true,
158
- CreateNotification: true,
159
- OnProgress: onProgress ? (progress) => {
160
- onProgress({
161
- step: progress.CurrentStep,
162
- percentage: progress.Percentage,
163
- message: progress.Message,
164
- metadata: progress.Metadata
165
- });
166
- } : undefined
167
- };
168
- const runResult = await this.agentClientService.RunAgentFromConversationDetail(agentParams);
169
- // Unwrap RunAgentResult to get the original ExecuteAgentResult
170
- if (runResult.Success && runResult.Result) {
171
- return runResult.Result;
172
- }
173
- else if (!runResult.Success) {
174
- const errorMsg = runResult.ErrorMessage || 'Agent execution failed';
175
- console.error('Agent execution failed:', errorMsg);
176
- MJNotificationService.Instance?.CreateSimpleNotification(errorMsg, 'error', 5000);
177
- return null;
178
- }
179
- return null;
180
- }
181
- catch (error) {
182
- const errorMsg = 'Error processing message through agent: ' + (error instanceof Error ? error.message : String(error));
183
- console.error('Error processing message through agent:', error);
184
- MJNotificationService.Instance?.CreateSimpleNotification(errorMsg, 'error', 5000);
185
- return null;
186
- }
187
- finally {
188
- // Always clear processing state
189
- this._isProcessing$.next(false);
144
+ // Warm the cached default-agent name for any synchronous consumers
145
+ // before the runtime resolves on its own.
146
+ if (!this._conversationManagerAgent) {
147
+ await this.getConversationManagerAgent();
190
148
  }
149
+ return ConversationsRuntime.Instance.AgentRunner.processMessage({
150
+ conversationId,
151
+ message,
152
+ conversationDetailId,
153
+ appContext,
154
+ onProgress,
155
+ });
191
156
  }
192
157
  /**
193
158
  * Find the configuration preset ID from a previous @mention of an agent in conversation history.
@@ -206,7 +171,6 @@ export class ConversationAgentService {
206
171
  .find(msg => {
207
172
  if (msg.Role !== 'User' || !msg.Message)
208
173
  return false;
209
- // Parse the message to check for an @mention of this agent with a configId
210
174
  const mentionResult = this.mentionParser.parseMentions(msg.Message, AIEngineBase.Instance.Agents, []);
211
175
  return mentionResult.agentMention?.id === agentId && mentionResult.agentMention?.configurationId;
212
176
  });
@@ -220,132 +184,17 @@ export class ConversationAgentService {
220
184
  return undefined;
221
185
  }
222
186
  /**
223
- * Build the message array for the agent from conversation history.
224
- * Note: conversationHistory already includes the current message, so we don't add it separately.
225
- * IMPORTANT: This method loads artifacts and attachments for each message.
226
- *
227
- * @deprecated This method is no longer used by processMessage() which now uses the optimized
228
- * RunAIAgentFromConversationDetail mutation that loads history server-side. Kept for backwards
229
- * compatibility with other callers that may need client-side message building.
230
- */
231
- async buildAgentMessages(history) {
232
- const messages = [];
233
- // Add historical messages (limit to recent context, e.g., last 20 messages)
234
- // History already includes the current message from the caller
235
- const recentHistory = history.slice(-20);
236
- // Get IDs of all messages in history
237
- const messageIds = recentHistory.map(msg => msg.ID).filter(id => id); // Filter out any undefined IDs
238
- // Create lookup maps
239
- const artifactsByDetailId = new Map(); // DetailID -> array of artifact JSON strings
240
- // attachmentsByDetailId removed — artifact junction is the single source of truth
241
- // after the backfill migration. Multimodal content handled server-side.
242
- if (messageIds.length > 0) {
243
- const rv = RunView.FromMetadataProvider(this.Provider);
244
- // Load artifacts for messages. Since the backfill migration
245
- // (V202605271400__Backfill_Attachment_Artifacts) converted all legacy
246
- // ConversationDetailAttachment rows to artifact pairs, the artifact
247
- // junction is the single source of truth. Multimodal content (images,
248
- // audio, video) is handled server-side by the resolver's artifact path.
249
- const artifactsLoaded = await this.loadArtifactsForMessages(rv, messageIds, artifactsByDetailId);
250
- if (artifactsLoaded) {
251
- console.log(`📦 Loaded ${artifactsByDetailId.size} artifact groups for ${messageIds.length} messages`);
252
- }
253
- }
254
- // Build messages with artifact context
255
- for (const msg of recentHistory) {
256
- const messageText = msg.Message || '';
257
- const artifacts = artifactsByDetailId.get(msg.ID);
258
- let content = messageText;
259
- if (artifacts && artifacts.length > 0) {
260
- for (const artifactJson of artifacts) {
261
- content += `\n\n# Artifact\n${artifactJson}\n`;
262
- }
263
- }
264
- messages.push({
265
- role: this.mapRoleToAgentRole(msg.Role),
266
- content: content
267
- });
268
- }
269
- return messages;
270
- }
271
- /**
272
- * Load artifacts for messages (OUTPUT direction only)
273
- */
274
- async loadArtifactsForMessages(rv, messageIds, artifactsByDetailId) {
275
- try {
276
- const junctionResult = await rv.RunView({
277
- EntityName: 'MJ: Conversation Detail Artifacts',
278
- ExtraFilter: `ConversationDetailID IN ('${messageIds.join("','")}') AND Direction='Output'`,
279
- ResultType: 'entity_object'
280
- });
281
- if (junctionResult.Success && junctionResult.Results && junctionResult.Results.length > 0) {
282
- // Collect unique version IDs
283
- const versionIds = new Set();
284
- for (const junction of junctionResult.Results) {
285
- versionIds.add(junction.ArtifactVersionID);
286
- }
287
- // Batch load all artifact versions
288
- const versionResult = await rv.RunView({
289
- EntityName: 'MJ: Artifact Versions',
290
- ExtraFilter: `ID IN ('${Array.from(versionIds).join("','")}')`,
291
- ResultType: 'entity_object'
292
- });
293
- if (versionResult.Success && versionResult.Results) {
294
- const versionMap = new Map(versionResult.Results.map(v => [v.ID, v]));
295
- for (const junction of junctionResult.Results) {
296
- const version = versionMap.get(junction.ArtifactVersionID);
297
- if (version && version.Content) {
298
- const existing = artifactsByDetailId.get(junction.ConversationDetailID) || [];
299
- existing.push(version.Content);
300
- artifactsByDetailId.set(junction.ConversationDetailID, existing);
301
- }
302
- }
303
- return true;
304
- }
305
- }
306
- }
307
- catch (error) {
308
- console.error('Error loading artifacts for conversation context:', error);
309
- }
310
- return false;
311
- }
312
- /**
313
- * Map ConversationDetail Role to agent message role
314
- */
315
- mapRoleToAgentRole(role) {
316
- const roleLower = (role || '').toLowerCase();
317
- if (roleLower === 'user')
318
- return 'user';
319
- if (roleLower === 'assistant' || roleLower === 'agent')
320
- return 'assistant';
321
- return 'user'; // Default to user
322
- }
323
- /**
324
- * Check if a message is tagging another user or agent.
325
- * Returns true if the message contains @mentions that are NOT the ambient agent.
326
- * Future enhancement: parse @mentions and determine if ambient agent should process.
187
+ * Clear the session for a conversation (useful when starting a new topic)
327
188
  */
328
- isTaggingOthers(message) {
329
- // Future implementation: check for @mentions
330
- // For now, always return false (always process through ambient agent)
331
- return false;
189
+ clearSession(conversationId) {
190
+ this._sessionIds.delete(conversationId);
332
191
  }
333
192
  /**
334
193
  * Invoke a sub-agent based on Sage Agent's payload.
335
194
  * This is called when Sage decides to delegate to a specialist agent.
336
195
  *
337
- * @param agentName Name of the agent to invoke
338
- * @param conversationId The conversation ID
339
- * @param message The user message that triggered this
340
- * @param conversationHistory Recent conversation history for context
341
- * @param reasoning Why this agent is being invoked
342
- * @param conversationDetailId The ID of the conversation detail record to link to the agent run
343
- * @param payload Optional payload to pass to the agent (e.g., previous OUTPUT artifact for continuity)
344
- * @param onProgress Optional callback for receiving progress updates during execution
345
- * @param sourceArtifactId Optional source artifact ID for versioning
346
- * @param sourceArtifactVersionId Optional source artifact version ID for versioning
347
- * @param agentConfigurationPresetId Optional ID of the AIAgentConfiguration preset (will be mapped to AIConfigurationID)
348
- * @returns The agent's execution result, or null if agent not found
196
+ * Stays on the Angular shim because it directly uses AgentClientService.
197
+ * Could move to the runtime in a follow-up if needed.
349
198
  */
350
199
  async invokeSubAgent(agentName, conversationId, message, conversationHistory, reasoning, conversationDetailId, payload, onProgress, sourceArtifactId, sourceArtifactVersionId, agentConfigurationPresetId, appContext) {
351
200
  try {
@@ -363,10 +212,7 @@ export class ConversationAgentService {
363
212
  // Map AIAgentConfiguration preset ID to actual AIConfiguration ID
364
213
  let aiConfigurationId = undefined;
365
214
  if (agentConfigurationPresetId) {
366
- // Get the preset from AIEngineBase to extract the AIConfigurationID
367
215
  const presets = AIEngineBase.Instance.GetAgentConfigurationPresets(agent.ID, false);
368
- // check by preset ID or AIConfigurationID - since sometimes we have the actual
369
- // configuration ID. Since both UUID no collisions should ever be possible.
370
216
  const preset = presets.find(p => UUIDsEqual(p.ID, agentConfigurationPresetId) || UUIDsEqual(p.AIConfigurationID, agentConfigurationPresetId));
371
217
  if (preset) {
372
218
  aiConfigurationId = preset.AIConfigurationID || undefined;
@@ -376,8 +222,6 @@ export class ConversationAgentService {
376
222
  console.warn(`Agent configuration preset ${agentConfigurationPresetId} not found for agent ${agent.ID}`);
377
223
  }
378
224
  }
379
- // Use AgentClientService which wraps GraphQLAIClient.RunAIAgentFromConversationDetail
380
- // and integrates with client tool request handling
381
225
  const agentParams = {
382
226
  ConversationDetailId: conversationDetailId,
383
227
  AgentId: agent.ID,
@@ -386,12 +230,6 @@ export class ConversationAgentService {
386
230
  conversationId: conversationId,
387
231
  latestMessageId: message.ID,
388
232
  invocationReason: reasoning,
389
- // Pass the embedder's appContext through to the agent runtime
390
- // so direct-routed sub-agents (e.g. Form Builder invoked via the
391
- // cockpit's `defaultAgentId`) see the same `appContext` block in
392
- // their system prompt that Sage-routed agents do. Without this,
393
- // the ActiveForm/Schema/OverrideID context the embedder
394
- // assembles is dropped on the floor for direct routing.
395
233
  ...(appContext ? { appContext } : {}),
396
234
  },
397
235
  ...(payload ? { Payload: payload } : {}),
@@ -410,7 +248,6 @@ export class ConversationAgentService {
410
248
  } : undefined
411
249
  };
412
250
  const runResult = await this.agentClientService.RunAgentFromConversationDetail(agentParams);
413
- // Unwrap RunAgentResult to get the original ExecuteAgentResult
414
251
  if (runResult.Success && runResult.Result) {
415
252
  return runResult.Result;
416
253
  }
@@ -433,11 +270,8 @@ export class ConversationAgentService {
433
270
  * Check if user's latest message should continue with the previous agent or route through Sage.
434
271
  * Uses fast inference (<500ms) to determine intent and avoid unnecessary Sage overhead.
435
272
  *
436
- * @param agentId The ID of the previous agent
437
- * @param latestMessage The user's new message
438
- * @param conversationHistory Recent conversation history for context (last 10 messages)
439
- * @param context Pre-loaded artifact and agent run data to avoid database queries
440
- * @returns IntentCheckResult with decision, reasoning, and optional target artifact version
273
+ * Stays on the Angular shim because it directly uses GraphQLAIClient.
274
+ * Could move to the runtime in a follow-up.
441
275
  */
442
276
  async checkAgentContinuityIntent(agentId, latestMessage, conversationHistory, context) {
443
277
  if (!this._aiClient) {
@@ -445,29 +279,24 @@ export class ConversationAgentService {
445
279
  return { decision: 'UNSURE', reasoning: 'AI Client not initialized' };
446
280
  }
447
281
  try {
448
- // Load the Check Sage Intent prompt
449
282
  await AIEngineBase.Instance.Config(false);
450
283
  const prompt = AIEngineBase.Instance.Prompts.find(p => p.Name === 'Check Sage Intent');
451
284
  if (!prompt) {
452
285
  console.warn('⚠️ Check Sage Intent prompt not found, defaulting to UNSURE');
453
286
  return { decision: 'UNSURE', reasoning: 'Check Sage Intent prompt not found' };
454
287
  }
455
- // Get agent details
456
288
  const agent = AIEngineBase.Instance.Agents.find(a => UUIDsEqual(a.ID, agentId));
457
289
  if (!agent) {
458
290
  console.warn('⚠️ Previous agent not found, defaulting to UNSURE');
459
291
  return { decision: 'UNSURE', reasoning: 'Previous agent not found' };
460
292
  }
461
- // Find all artifacts from this agent in this conversation
462
293
  const agentArtifacts = this.findAllAgentArtifacts(agentId, conversationHistory, context);
463
- // Build compact conversation history (last 10 messages)
464
294
  const recentHistory = conversationHistory.slice(-10);
465
295
  const compactHistory = recentHistory.map((msg, idx) => {
466
296
  const role = msg.Role === 'User' ? 'User' : agent.Name || 'Agent';
467
297
  const content = msg.Message || '';
468
298
  return `${idx + 1}. ${role}: ${content.substring(0, 150)}${content.length > 150 ? '...' : ''}`;
469
299
  }).join('\n');
470
- // Build artifact context if available
471
300
  let artifactContext = '';
472
301
  if (agentArtifacts.length > 0) {
473
302
  artifactContext = '\n\n**Prior Artifacts Created by This Agent**:\n';
@@ -483,7 +312,6 @@ export class ConversationAgentService {
483
312
  }
484
313
  });
485
314
  }
486
- // Build user message with context
487
315
  const userMessage = `**Previous Agent**: ${agent.Name} - ${agent.Description || 'No description'}
488
316
 
489
317
  **Conversation History** (last ${recentHistory.length} messages):
@@ -495,7 +323,6 @@ ${compactHistory}${artifactContext}
495
323
  messagePreview: latestMessage.substring(0, 50),
496
324
  artifactCount: agentArtifacts.length
497
325
  });
498
- // Run the prompt with artifact data included
499
326
  const result = await this._aiClient.RunAIPrompt({
500
327
  promptId: prompt.ID,
501
328
  messages: [{ role: 'user', content: userMessage }],
@@ -516,7 +343,6 @@ ${compactHistory}${artifactContext}
516
343
  targetArtifactVersionId,
517
344
  latency: result.executionTimeMs || 'unknown'
518
345
  });
519
- // Validate the response
520
346
  if (decision === 'YES' || decision === 'NO' || decision === 'UNSURE') {
521
347
  return {
522
348
  decision: decision,
@@ -531,43 +357,12 @@ ${compactHistory}${artifactContext}
531
357
  }
532
358
  catch (error) {
533
359
  console.error('❌ Error checking agent continuity intent:', error);
534
- // On error, default to UNSURE (safer to let Sage evaluate)
535
360
  return {
536
361
  decision: 'UNSURE',
537
362
  reasoning: `Error during intent check: ${error instanceof Error ? error.message : String(error)}`
538
363
  };
539
364
  }
540
365
  }
541
- /**
542
- * Clear the session for a conversation (useful when starting a new topic)
543
- */
544
- clearSession(conversationId) {
545
- this._sessionIds.delete(conversationId);
546
- }
547
- /**
548
- * Filter agents based on user's 'run' permission.
549
- * Only returns agents that the user has permission to run.
550
- *
551
- * @param agents List of candidate agents to filter
552
- * @param user User to check permissions for
553
- * @returns Filtered list of agents the user can run
554
- */
555
- async filterAgentsByPermissions(agents, user) {
556
- const permittedAgents = [];
557
- for (const agent of agents) {
558
- try {
559
- const hasPermission = await AIAgentPermissionHelper.HasPermission(agent.ID, user, 'run');
560
- if (hasPermission) {
561
- permittedAgents.push(agent);
562
- }
563
- }
564
- catch (error) {
565
- console.error(`Error checking permission for agent ${agent.Name}:`, error);
566
- // On error, exclude agent (fail closed)
567
- }
568
- }
569
- return permittedAgents;
570
- }
571
366
  /**
572
367
  * Find all artifacts created by the specified agent in this conversation.
573
368
  * Returns artifacts grouped by artifact with versions, ordered most recent first.
@@ -577,25 +372,19 @@ ${compactHistory}${artifactContext}
577
372
  */
578
373
  findAllAgentArtifacts(agentId, conversationDetails, context) {
579
374
  const artifactMap = new Map();
580
- // Iterate backwards through conversation details (most recent first)
581
375
  for (let i = conversationDetails.length - 1; i >= 0; i--) {
582
376
  const detail = conversationDetails[i];
583
- // Skip non-AI messages and errors
584
377
  if (detail.Role !== 'AI' || detail.Status === 'Error')
585
378
  continue;
586
- // O(1) lookup for agent run from pre-loaded data
587
379
  const agentRun = context.agentRunsByDetailId.get(detail.ID);
588
380
  if (!agentRun || !UUIDsEqual(agentRun.AgentID, agentId) || agentRun.Status !== 'Completed') {
589
381
  continue;
590
382
  }
591
- // O(1) lookup for artifacts from pre-loaded data
592
383
  const artifacts = context.artifactsByDetailId.get(detail.ID);
593
384
  if (!artifacts || artifacts.length === 0)
594
385
  continue;
595
- // Process each artifact
596
386
  for (const lazyArtifact of artifacts) {
597
387
  const mainArtifactId = lazyArtifact.artifactId;
598
- // Get or create artifact entry
599
388
  if (!artifactMap.has(mainArtifactId)) {
600
389
  artifactMap.set(mainArtifactId, {
601
390
  artifactId: mainArtifactId,
@@ -605,7 +394,6 @@ ${compactHistory}${artifactContext}
605
394
  versions: []
606
395
  });
607
396
  }
608
- // Add version to artifact
609
397
  const artifactEntry = artifactMap.get(mainArtifactId);
610
398
  artifactEntry.versions.push({
611
399
  runId: agentRun.ID,
@@ -617,14 +405,13 @@ ${compactHistory}${artifactContext}
617
405
  });
618
406
  }
619
407
  }
620
- // Convert map to array (most recent artifacts first based on their latest version)
621
408
  return Array.from(artifactMap.values()).sort((a, b) => {
622
409
  const aLatest = a.versions[0]?.createdAt || new Date(0);
623
410
  const bLatest = b.versions[0]?.createdAt || new Date(0);
624
411
  return bLatest.getTime() - aLatest.getTime();
625
412
  });
626
413
  }
627
- static ɵfac = function ConversationAgentService_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || ConversationAgentService)(i0.ɵɵinject(i1.MentionParserService), i0.ɵɵinject(i2.AgentClientService)); };
414
+ static ɵfac = function ConversationAgentService_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || ConversationAgentService)(i0.ɵɵinject(i1.ConversationsRuntimeBootstrap), i0.ɵɵinject(i2.MentionParserService), i0.ɵɵinject(i3.AgentClientService)); };
628
415
  static ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: ConversationAgentService, factory: ConversationAgentService.ɵfac, providedIn: 'root' });
629
416
  }
630
417
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(ConversationAgentService, [{
@@ -632,5 +419,5 @@ ${compactHistory}${artifactContext}
632
419
  args: [{
633
420
  providedIn: 'root'
634
421
  }]
635
- }], () => [{ type: i1.MentionParserService }, { type: i2.AgentClientService }], null); })();
422
+ }], () => [{ type: i1.ConversationsRuntimeBootstrap }, { type: i2.MentionParserService }, { type: i3.AgentClientService }], null); })();
636
423
  //# sourceMappingURL=conversation-agent.service.js.map