@memberjunction/ng-conversations 5.40.2 → 5.41.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (378) hide show
  1. package/README.md +57 -0
  2. package/dist/__tests__/channel-optional-surface.test.d.ts +2 -0
  3. package/dist/__tests__/channel-optional-surface.test.d.ts.map +1 -0
  4. package/dist/__tests__/channel-optional-surface.test.js +53 -0
  5. package/dist/__tests__/channel-optional-surface.test.js.map +1 -0
  6. package/dist/__tests__/chat-events.test.d.ts +14 -0
  7. package/dist/__tests__/chat-events.test.d.ts.map +1 -0
  8. package/dist/__tests__/chat-events.test.js +109 -0
  9. package/dist/__tests__/chat-events.test.js.map +1 -0
  10. package/dist/__tests__/conversation-naming.test.d.ts +2 -0
  11. package/dist/__tests__/conversation-naming.test.d.ts.map +1 -0
  12. package/dist/__tests__/conversation-naming.test.js +110 -0
  13. package/dist/__tests__/conversation-naming.test.js.map +1 -0
  14. package/dist/__tests__/delegation-result-parser.test.d.ts +2 -0
  15. package/dist/__tests__/delegation-result-parser.test.d.ts.map +1 -0
  16. package/dist/__tests__/delegation-result-parser.test.js +107 -0
  17. package/dist/__tests__/delegation-result-parser.test.js.map +1 -0
  18. package/dist/__tests__/event-wiring.test.d.ts +15 -0
  19. package/dist/__tests__/event-wiring.test.d.ts.map +1 -0
  20. package/dist/__tests__/event-wiring.test.js +100 -0
  21. package/dist/__tests__/event-wiring.test.js.map +1 -0
  22. package/dist/__tests__/narration-template.test.d.ts +2 -0
  23. package/dist/__tests__/narration-template.test.d.ts.map +1 -0
  24. package/dist/__tests__/narration-template.test.js +76 -0
  25. package/dist/__tests__/narration-template.test.js.map +1 -0
  26. package/dist/__tests__/realtime-agent-picker-models.test.d.ts +2 -0
  27. package/dist/__tests__/realtime-agent-picker-models.test.d.ts.map +1 -0
  28. package/dist/__tests__/realtime-agent-picker-models.test.js +49 -0
  29. package/dist/__tests__/realtime-agent-picker-models.test.js.map +1 -0
  30. package/dist/__tests__/realtime-audio-visuals.test.d.ts +2 -0
  31. package/dist/__tests__/realtime-audio-visuals.test.d.ts.map +1 -0
  32. package/dist/__tests__/realtime-audio-visuals.test.js +123 -0
  33. package/dist/__tests__/realtime-audio-visuals.test.js.map +1 -0
  34. package/dist/__tests__/realtime-delegation-card-cancel.test.d.ts +2 -0
  35. package/dist/__tests__/realtime-delegation-card-cancel.test.d.ts.map +1 -0
  36. package/dist/__tests__/realtime-delegation-card-cancel.test.js +48 -0
  37. package/dist/__tests__/realtime-delegation-card-cancel.test.js.map +1 -0
  38. package/dist/__tests__/realtime-disclosure.test.d.ts +2 -0
  39. package/dist/__tests__/realtime-disclosure.test.d.ts.map +1 -0
  40. package/dist/__tests__/realtime-disclosure.test.js +164 -0
  41. package/dist/__tests__/realtime-disclosure.test.js.map +1 -0
  42. package/dist/__tests__/realtime-pairing.test.d.ts +2 -0
  43. package/dist/__tests__/realtime-pairing.test.d.ts.map +1 -0
  44. package/dist/__tests__/realtime-pairing.test.js +207 -0
  45. package/dist/__tests__/realtime-pairing.test.js.map +1 -0
  46. package/dist/__tests__/realtime-review-lifecycle.test.d.ts +2 -0
  47. package/dist/__tests__/realtime-review-lifecycle.test.d.ts.map +1 -0
  48. package/dist/__tests__/realtime-review-lifecycle.test.js +154 -0
  49. package/dist/__tests__/realtime-review-lifecycle.test.js.map +1 -0
  50. package/dist/__tests__/realtime-session-cancel-usage.test.d.ts +2 -0
  51. package/dist/__tests__/realtime-session-cancel-usage.test.d.ts.map +1 -0
  52. package/dist/__tests__/realtime-session-cancel-usage.test.js +230 -0
  53. package/dist/__tests__/realtime-session-cancel-usage.test.js.map +1 -0
  54. package/dist/__tests__/realtime-session-channels.test.d.ts +2 -0
  55. package/dist/__tests__/realtime-session-channels.test.d.ts.map +1 -0
  56. package/dist/__tests__/realtime-session-channels.test.js +252 -0
  57. package/dist/__tests__/realtime-session-channels.test.js.map +1 -0
  58. package/dist/__tests__/realtime-session-client-tools.test.d.ts +2 -0
  59. package/dist/__tests__/realtime-session-client-tools.test.d.ts.map +1 -0
  60. package/dist/__tests__/realtime-session-client-tools.test.js +103 -0
  61. package/dist/__tests__/realtime-session-client-tools.test.js.map +1 -0
  62. package/dist/__tests__/realtime-session-minimized.test.d.ts +2 -0
  63. package/dist/__tests__/realtime-session-minimized.test.d.ts.map +1 -0
  64. package/dist/__tests__/realtime-session-minimized.test.js +32 -0
  65. package/dist/__tests__/realtime-session-minimized.test.js.map +1 -0
  66. package/dist/__tests__/realtime-session-mint.test.d.ts +2 -0
  67. package/dist/__tests__/realtime-session-mint.test.d.ts.map +1 -0
  68. package/dist/__tests__/realtime-session-mint.test.js +69 -0
  69. package/dist/__tests__/realtime-session-mint.test.js.map +1 -0
  70. package/dist/__tests__/realtime-session-policy.test.d.ts +2 -0
  71. package/dist/__tests__/realtime-session-policy.test.d.ts.map +1 -0
  72. package/dist/__tests__/realtime-session-policy.test.js +303 -0
  73. package/dist/__tests__/realtime-session-policy.test.js.map +1 -0
  74. package/dist/__tests__/realtime-session-review.service.test.d.ts +2 -0
  75. package/dist/__tests__/realtime-session-review.service.test.d.ts.map +1 -0
  76. package/dist/__tests__/realtime-session-review.service.test.js +743 -0
  77. package/dist/__tests__/realtime-session-review.service.test.js.map +1 -0
  78. package/dist/__tests__/realtime-session-state.test.d.ts +2 -0
  79. package/dist/__tests__/realtime-session-state.test.d.ts.map +1 -0
  80. package/dist/__tests__/realtime-session-state.test.js +83 -0
  81. package/dist/__tests__/realtime-session-state.test.js.map +1 -0
  82. package/dist/__tests__/realtime-session-timeline-card.test.d.ts +2 -0
  83. package/dist/__tests__/realtime-session-timeline-card.test.d.ts.map +1 -0
  84. package/dist/__tests__/realtime-session-timeline-card.test.js +106 -0
  85. package/dist/__tests__/realtime-session-timeline-card.test.js.map +1 -0
  86. package/dist/__tests__/realtime-session-timeline.test.d.ts +2 -0
  87. package/dist/__tests__/realtime-session-timeline.test.d.ts.map +1 -0
  88. package/dist/__tests__/realtime-session-timeline.test.js +142 -0
  89. package/dist/__tests__/realtime-session-timeline.test.js.map +1 -0
  90. package/dist/__tests__/realtime-sessions-adapter.test.d.ts +19 -0
  91. package/dist/__tests__/realtime-sessions-adapter.test.d.ts.map +1 -0
  92. package/dist/__tests__/realtime-sessions-adapter.test.js +188 -0
  93. package/dist/__tests__/realtime-sessions-adapter.test.js.map +1 -0
  94. package/dist/__tests__/realtime-surface-panel-prefs.test.d.ts +2 -0
  95. package/dist/__tests__/realtime-surface-panel-prefs.test.d.ts.map +1 -0
  96. package/dist/__tests__/realtime-surface-panel-prefs.test.js +100 -0
  97. package/dist/__tests__/realtime-surface-panel-prefs.test.js.map +1 -0
  98. package/dist/__tests__/realtime-surface-tabs-model.test.d.ts +2 -0
  99. package/dist/__tests__/realtime-surface-tabs-model.test.d.ts.map +1 -0
  100. package/dist/__tests__/realtime-surface-tabs-model.test.js +193 -0
  101. package/dist/__tests__/realtime-surface-tabs-model.test.js.map +1 -0
  102. package/dist/__tests__/remote-browser-audio-player.test.d.ts +2 -0
  103. package/dist/__tests__/remote-browser-audio-player.test.d.ts.map +1 -0
  104. package/dist/__tests__/remote-browser-audio-player.test.js +137 -0
  105. package/dist/__tests__/remote-browser-audio-player.test.js.map +1 -0
  106. package/dist/__tests__/remote-browser-channel.test.d.ts +2 -0
  107. package/dist/__tests__/remote-browser-channel.test.d.ts.map +1 -0
  108. package/dist/__tests__/remote-browser-channel.test.js +423 -0
  109. package/dist/__tests__/remote-browser-channel.test.js.map +1 -0
  110. package/dist/__tests__/slot-defaults.test.d.ts +24 -0
  111. package/dist/__tests__/slot-defaults.test.d.ts.map +1 -0
  112. package/dist/__tests__/slot-defaults.test.js +63 -0
  113. package/dist/__tests__/slot-defaults.test.js.map +1 -0
  114. package/dist/__tests__/user-authorization.test.d.ts +2 -0
  115. package/dist/__tests__/user-authorization.test.d.ts.map +1 -0
  116. package/dist/__tests__/user-authorization.test.js +97 -0
  117. package/dist/__tests__/user-authorization.test.js.map +1 -0
  118. package/dist/__tests__/voice-session-narration.test.d.ts +2 -0
  119. package/dist/__tests__/voice-session-narration.test.d.ts.map +1 -0
  120. package/dist/__tests__/voice-session-narration.test.js +609 -0
  121. package/dist/__tests__/voice-session-narration.test.js.map +1 -0
  122. package/dist/__tests__/whiteboard-artifact-viewer.test.d.ts +2 -0
  123. package/dist/__tests__/whiteboard-artifact-viewer.test.d.ts.map +1 -0
  124. package/dist/__tests__/whiteboard-artifact-viewer.test.js +101 -0
  125. package/dist/__tests__/whiteboard-artifact-viewer.test.js.map +1 -0
  126. package/dist/__tests__/whiteboard-channel.test.d.ts +2 -0
  127. package/dist/__tests__/whiteboard-channel.test.d.ts.map +1 -0
  128. package/dist/__tests__/whiteboard-channel.test.js +260 -0
  129. package/dist/__tests__/whiteboard-channel.test.js.map +1 -0
  130. package/dist/__tests__/whiteboard-restore-state.test.d.ts +2 -0
  131. package/dist/__tests__/whiteboard-restore-state.test.d.ts.map +1 -0
  132. package/dist/__tests__/whiteboard-restore-state.test.js +108 -0
  133. package/dist/__tests__/whiteboard-restore-state.test.js.map +1 -0
  134. package/dist/lib/components/conversation/conversation-chat-area.component.d.ts +205 -3
  135. package/dist/lib/components/conversation/conversation-chat-area.component.d.ts.map +1 -1
  136. package/dist/lib/components/conversation/conversation-chat-area.component.js +911 -342
  137. package/dist/lib/components/conversation/conversation-chat-area.component.js.map +1 -1
  138. package/dist/lib/components/mention/mention-dropdown.component.js +35 -17
  139. package/dist/lib/components/mention/mention-dropdown.component.js.map +1 -1
  140. package/dist/lib/components/mention/mention-editor.component.d.ts +4 -0
  141. package/dist/lib/components/mention/mention-editor.component.d.ts.map +1 -1
  142. package/dist/lib/components/mention/mention-editor.component.js +43 -19
  143. package/dist/lib/components/mention/mention-editor.component.js.map +1 -1
  144. package/dist/lib/components/message/message-input-box.component.d.ts +17 -1
  145. package/dist/lib/components/message/message-input-box.component.d.ts.map +1 -1
  146. package/dist/lib/components/message/message-input-box.component.js +73 -15
  147. package/dist/lib/components/message/message-input-box.component.js.map +1 -1
  148. package/dist/lib/components/message/message-input.component.d.ts +142 -6
  149. package/dist/lib/components/message/message-input.component.d.ts.map +1 -1
  150. package/dist/lib/components/message/message-input.component.js +328 -82
  151. package/dist/lib/components/message/message-input.component.js.map +1 -1
  152. package/dist/lib/components/message/message-item.component.d.ts +28 -3
  153. package/dist/lib/components/message/message-item.component.d.ts.map +1 -1
  154. package/dist/lib/components/message/message-item.component.js +180 -108
  155. package/dist/lib/components/message/message-item.component.js.map +1 -1
  156. package/dist/lib/components/message/message-list.component.d.ts +81 -2
  157. package/dist/lib/components/message/message-list.component.d.ts.map +1 -1
  158. package/dist/lib/components/message/message-list.component.js +252 -87
  159. package/dist/lib/components/message/message-list.component.js.map +1 -1
  160. package/dist/lib/components/realtime/channels/base-realtime-channel-client.d.ts +282 -0
  161. package/dist/lib/components/realtime/channels/base-realtime-channel-client.d.ts.map +1 -0
  162. package/dist/lib/components/realtime/channels/base-realtime-channel-client.js +158 -0
  163. package/dist/lib/components/realtime/channels/base-realtime-channel-client.js.map +1 -0
  164. package/dist/lib/components/realtime/channels/channel-onboarding-panel.component.d.ts +25 -0
  165. package/dist/lib/components/realtime/channels/channel-onboarding-panel.component.d.ts.map +1 -0
  166. package/dist/lib/components/realtime/channels/channel-onboarding-panel.component.js +140 -0
  167. package/dist/lib/components/realtime/channels/channel-onboarding-panel.component.js.map +1 -0
  168. package/dist/lib/components/realtime/channels/realtime-channel-pane.component.d.ts +35 -0
  169. package/dist/lib/components/realtime/channels/realtime-channel-pane.component.d.ts.map +1 -0
  170. package/dist/lib/components/realtime/channels/realtime-channel-pane.component.js +58 -0
  171. package/dist/lib/components/realtime/channels/realtime-channel-pane.component.js.map +1 -0
  172. package/dist/lib/components/realtime/realtime-activity-rail.component.d.ts +63 -0
  173. package/dist/lib/components/realtime/realtime-activity-rail.component.d.ts.map +1 -0
  174. package/dist/lib/components/realtime/realtime-activity-rail.component.js +260 -0
  175. package/dist/lib/components/realtime/realtime-activity-rail.component.js.map +1 -0
  176. package/dist/lib/components/realtime/realtime-agent-banner.component.d.ts +117 -0
  177. package/dist/lib/components/realtime/realtime-agent-banner.component.d.ts.map +1 -0
  178. package/dist/lib/components/realtime/realtime-agent-banner.component.js +504 -0
  179. package/dist/lib/components/realtime/realtime-agent-banner.component.js.map +1 -0
  180. package/dist/lib/components/realtime/realtime-agent-picker.component.d.ts +168 -0
  181. package/dist/lib/components/realtime/realtime-agent-picker.component.d.ts.map +1 -0
  182. package/dist/lib/components/realtime/realtime-agent-picker.component.js +556 -0
  183. package/dist/lib/components/realtime/realtime-agent-picker.component.js.map +1 -0
  184. package/dist/lib/components/realtime/realtime-audio-visuals.d.ts +97 -0
  185. package/dist/lib/components/realtime/realtime-audio-visuals.d.ts.map +1 -0
  186. package/dist/lib/components/realtime/realtime-audio-visuals.js +139 -0
  187. package/dist/lib/components/realtime/realtime-audio-visuals.js.map +1 -0
  188. package/dist/lib/components/realtime/realtime-channel-strip.component.d.ts +29 -0
  189. package/dist/lib/components/realtime/realtime-channel-strip.component.d.ts.map +1 -0
  190. package/dist/lib/components/realtime/realtime-channel-strip.component.js +69 -0
  191. package/dist/lib/components/realtime/realtime-channel-strip.component.js.map +1 -0
  192. package/dist/lib/components/realtime/realtime-composer.component.d.ts +65 -0
  193. package/dist/lib/components/realtime/realtime-composer.component.d.ts.map +1 -0
  194. package/dist/lib/components/realtime/realtime-composer.component.js +256 -0
  195. package/dist/lib/components/realtime/realtime-composer.component.js.map +1 -0
  196. package/dist/lib/components/realtime/realtime-delegation-card.component.d.ts +71 -0
  197. package/dist/lib/components/realtime/realtime-delegation-card.component.d.ts.map +1 -0
  198. package/dist/lib/components/realtime/realtime-delegation-card.component.js +324 -0
  199. package/dist/lib/components/realtime/realtime-delegation-card.component.js.map +1 -0
  200. package/dist/lib/components/realtime/realtime-disclosure.d.ts +135 -0
  201. package/dist/lib/components/realtime/realtime-disclosure.d.ts.map +1 -0
  202. package/dist/lib/components/realtime/realtime-disclosure.js +188 -0
  203. package/dist/lib/components/realtime/realtime-disclosure.js.map +1 -0
  204. package/dist/lib/components/realtime/realtime-session-overlay.component.d.ts +491 -0
  205. package/dist/lib/components/realtime/realtime-session-overlay.component.d.ts.map +1 -0
  206. package/dist/lib/components/realtime/realtime-session-overlay.component.js +1274 -0
  207. package/dist/lib/components/realtime/realtime-session-overlay.component.js.map +1 -0
  208. package/dist/lib/components/realtime/realtime-session-state.d.ts +191 -0
  209. package/dist/lib/components/realtime/realtime-session-state.d.ts.map +1 -0
  210. package/dist/lib/components/realtime/realtime-session-state.js +244 -0
  211. package/dist/lib/components/realtime/realtime-session-state.js.map +1 -0
  212. package/dist/lib/components/realtime/realtime-session-thread.component.d.ts +56 -0
  213. package/dist/lib/components/realtime/realtime-session-thread.component.d.ts.map +1 -0
  214. package/dist/lib/components/realtime/realtime-session-thread.component.js +246 -0
  215. package/dist/lib/components/realtime/realtime-session-thread.component.js.map +1 -0
  216. package/dist/lib/components/realtime/realtime-session-timeline-card.component.d.ts +51 -0
  217. package/dist/lib/components/realtime/realtime-session-timeline-card.component.d.ts.map +1 -0
  218. package/dist/lib/components/realtime/realtime-session-timeline-card.component.js +193 -0
  219. package/dist/lib/components/realtime/realtime-session-timeline-card.component.js.map +1 -0
  220. package/dist/lib/components/realtime/realtime-surface-panel-prefs.d.ts +77 -0
  221. package/dist/lib/components/realtime/realtime-surface-panel-prefs.d.ts.map +1 -0
  222. package/dist/lib/components/realtime/realtime-surface-panel-prefs.js +114 -0
  223. package/dist/lib/components/realtime/realtime-surface-panel-prefs.js.map +1 -0
  224. package/dist/lib/components/realtime/realtime-surface-tabs.component.d.ts +173 -0
  225. package/dist/lib/components/realtime/realtime-surface-tabs.component.d.ts.map +1 -0
  226. package/dist/lib/components/realtime/realtime-surface-tabs.component.js +496 -0
  227. package/dist/lib/components/realtime/realtime-surface-tabs.component.js.map +1 -0
  228. package/dist/lib/components/realtime/realtime-surface-tabs.model.d.ts +181 -0
  229. package/dist/lib/components/realtime/realtime-surface-tabs.model.d.ts.map +1 -0
  230. package/dist/lib/components/realtime/realtime-surface-tabs.model.js +223 -0
  231. package/dist/lib/components/realtime/realtime-surface-tabs.model.js.map +1 -0
  232. package/dist/lib/components/realtime/remote-browser/remote-browser-audio-player.d.ts +163 -0
  233. package/dist/lib/components/realtime/remote-browser/remote-browser-audio-player.d.ts.map +1 -0
  234. package/dist/lib/components/realtime/remote-browser/remote-browser-audio-player.js +309 -0
  235. package/dist/lib/components/realtime/remote-browser/remote-browser-audio-player.js.map +1 -0
  236. package/dist/lib/components/realtime/remote-browser/remote-browser-channel.d.ts +168 -0
  237. package/dist/lib/components/realtime/remote-browser/remote-browser-channel.d.ts.map +1 -0
  238. package/dist/lib/components/realtime/remote-browser/remote-browser-channel.js +524 -0
  239. package/dist/lib/components/realtime/remote-browser/remote-browser-channel.js.map +1 -0
  240. package/dist/lib/components/realtime/remote-browser/remote-browser-surface.component.d.ts +346 -0
  241. package/dist/lib/components/realtime/remote-browser/remote-browser-surface.component.d.ts.map +1 -0
  242. package/dist/lib/components/realtime/remote-browser/remote-browser-surface.component.js +851 -0
  243. package/dist/lib/components/realtime/remote-browser/remote-browser-surface.component.js.map +1 -0
  244. package/dist/lib/components/realtime/remote-browser/remote-browser-tools.d.ts +86 -0
  245. package/dist/lib/components/realtime/remote-browser/remote-browser-tools.d.ts.map +1 -0
  246. package/dist/lib/components/realtime/remote-browser/remote-browser-tools.js +210 -0
  247. package/dist/lib/components/realtime/remote-browser/remote-browser-tools.js.map +1 -0
  248. package/dist/lib/components/realtime/whiteboard/whiteboard-artifact-viewer.component.d.ts +48 -0
  249. package/dist/lib/components/realtime/whiteboard/whiteboard-artifact-viewer.component.d.ts.map +1 -0
  250. package/dist/lib/components/realtime/whiteboard/whiteboard-artifact-viewer.component.js +180 -0
  251. package/dist/lib/components/realtime/whiteboard/whiteboard-artifact-viewer.component.js.map +1 -0
  252. package/dist/lib/components/realtime/whiteboard/whiteboard-channel.d.ts +119 -0
  253. package/dist/lib/components/realtime/whiteboard/whiteboard-channel.d.ts.map +1 -0
  254. package/dist/lib/components/realtime/whiteboard/whiteboard-channel.js +274 -0
  255. package/dist/lib/components/realtime/whiteboard/whiteboard-channel.js.map +1 -0
  256. package/dist/lib/components/slots/mj-chat-agent-presence-default.component.d.ts +11 -0
  257. package/dist/lib/components/slots/mj-chat-agent-presence-default.component.d.ts.map +1 -0
  258. package/dist/lib/components/slots/mj-chat-agent-presence-default.component.js +98 -0
  259. package/dist/lib/components/slots/mj-chat-agent-presence-default.component.js.map +1 -0
  260. package/dist/lib/components/slots/mj-chat-demonstration-surface-default.component.d.ts +9 -0
  261. package/dist/lib/components/slots/mj-chat-demonstration-surface-default.component.d.ts.map +1 -0
  262. package/dist/lib/components/slots/mj-chat-demonstration-surface-default.component.js +35 -0
  263. package/dist/lib/components/slots/mj-chat-demonstration-surface-default.component.js.map +1 -0
  264. package/dist/lib/components/slots/mj-chat-empty-state-default.component.d.ts +28 -0
  265. package/dist/lib/components/slots/mj-chat-empty-state-default.component.d.ts.map +1 -0
  266. package/dist/lib/components/slots/mj-chat-empty-state-default.component.js +104 -0
  267. package/dist/lib/components/slots/mj-chat-empty-state-default.component.js.map +1 -0
  268. package/dist/lib/components/slots/mj-chat-header-default.component.d.ts +11 -0
  269. package/dist/lib/components/slots/mj-chat-header-default.component.d.ts.map +1 -0
  270. package/dist/lib/components/slots/mj-chat-header-default.component.js +103 -0
  271. package/dist/lib/components/slots/mj-chat-header-default.component.js.map +1 -0
  272. package/dist/lib/components/slots/mj-chat-message-bubble-default.component.d.ts +15 -0
  273. package/dist/lib/components/slots/mj-chat-message-bubble-default.component.d.ts.map +1 -0
  274. package/dist/lib/components/slots/mj-chat-message-bubble-default.component.js +73 -0
  275. package/dist/lib/components/slots/mj-chat-message-bubble-default.component.js.map +1 -0
  276. package/dist/lib/components/slots/mj-chat-message-extra-default.component.d.ts +9 -0
  277. package/dist/lib/components/slots/mj-chat-message-extra-default.component.d.ts.map +1 -0
  278. package/dist/lib/components/slots/mj-chat-message-extra-default.component.js +34 -0
  279. package/dist/lib/components/slots/mj-chat-message-extra-default.component.js.map +1 -0
  280. package/dist/lib/components/slots/slot-interfaces.d.ts +95 -0
  281. package/dist/lib/components/slots/slot-interfaces.d.ts.map +1 -0
  282. package/dist/lib/components/slots/slot-interfaces.js +18 -0
  283. package/dist/lib/components/slots/slot-interfaces.js.map +1 -0
  284. package/dist/lib/components/workspace/conversation-workspace.component.d.ts +11 -0
  285. package/dist/lib/components/workspace/conversation-workspace.component.d.ts.map +1 -1
  286. package/dist/lib/components/workspace/conversation-workspace.component.js +28 -4
  287. package/dist/lib/components/workspace/conversation-workspace.component.js.map +1 -1
  288. package/dist/lib/conversations.module.d.ts +12 -1
  289. package/dist/lib/conversations.module.d.ts.map +1 -1
  290. package/dist/lib/conversations.module.js +93 -5
  291. package/dist/lib/conversations.module.js.map +1 -1
  292. package/dist/lib/directives/chat-slot.directive.d.ts +44 -0
  293. package/dist/lib/directives/chat-slot.directive.d.ts.map +1 -0
  294. package/dist/lib/directives/chat-slot.directive.js +54 -0
  295. package/dist/lib/directives/chat-slot.directive.js.map +1 -0
  296. package/dist/lib/events/chat-events.d.ts +137 -0
  297. package/dist/lib/events/chat-events.d.ts.map +1 -0
  298. package/dist/lib/events/chat-events.js +189 -0
  299. package/dist/lib/events/chat-events.js.map +1 -0
  300. package/dist/lib/models/conversation-state.model.d.ts +2 -1
  301. package/dist/lib/models/conversation-state.model.d.ts.map +1 -1
  302. package/dist/lib/models/conversation-state.model.js.map +1 -1
  303. package/dist/lib/services/artifact-state.service.d.ts.map +1 -1
  304. package/dist/lib/services/artifact-state.service.js +23 -6
  305. package/dist/lib/services/artifact-state.service.js.map +1 -1
  306. package/dist/lib/services/conversation-agent.service.d.ts +60 -74
  307. package/dist/lib/services/conversation-agent.service.d.ts.map +1 -1
  308. package/dist/lib/services/conversation-agent.service.js +100 -313
  309. package/dist/lib/services/conversation-agent.service.js.map +1 -1
  310. package/dist/lib/services/conversation-bridge.service.d.ts +11 -70
  311. package/dist/lib/services/conversation-bridge.service.d.ts.map +1 -1
  312. package/dist/lib/services/conversation-bridge.service.js +51 -85
  313. package/dist/lib/services/conversation-bridge.service.js.map +1 -1
  314. package/dist/lib/services/conversation-naming.d.ts +63 -0
  315. package/dist/lib/services/conversation-naming.d.ts.map +1 -0
  316. package/dist/lib/services/conversation-naming.js +58 -0
  317. package/dist/lib/services/conversation-naming.js.map +1 -0
  318. package/dist/lib/services/conversation-streaming.service.d.ts +24 -154
  319. package/dist/lib/services/conversation-streaming.service.d.ts.map +1 -1
  320. package/dist/lib/services/conversation-streaming.service.js +39 -361
  321. package/dist/lib/services/conversation-streaming.service.js.map +1 -1
  322. package/dist/lib/services/conversations-runtime-bootstrap.service.d.ts +10 -0
  323. package/dist/lib/services/conversations-runtime-bootstrap.service.d.ts.map +1 -0
  324. package/dist/lib/services/conversations-runtime-bootstrap.service.js +104 -0
  325. package/dist/lib/services/conversations-runtime-bootstrap.service.js.map +1 -0
  326. package/dist/lib/services/delegation-result-parser.d.ts +45 -0
  327. package/dist/lib/services/delegation-result-parser.d.ts.map +1 -0
  328. package/dist/lib/services/delegation-result-parser.js +48 -0
  329. package/dist/lib/services/delegation-result-parser.js.map +1 -0
  330. package/dist/lib/services/mention-autocomplete.service.d.ts +19 -4
  331. package/dist/lib/services/mention-autocomplete.service.d.ts.map +1 -1
  332. package/dist/lib/services/mention-autocomplete.service.js +65 -4
  333. package/dist/lib/services/mention-autocomplete.service.js.map +1 -1
  334. package/dist/lib/services/mention-parser.service.d.ts +8 -53
  335. package/dist/lib/services/mention-parser.service.d.ts.map +1 -1
  336. package/dist/lib/services/mention-parser.service.js +32 -243
  337. package/dist/lib/services/mention-parser.service.js.map +1 -1
  338. package/dist/lib/services/narration-template.d.ts +42 -0
  339. package/dist/lib/services/narration-template.d.ts.map +1 -0
  340. package/dist/lib/services/narration-template.js +73 -0
  341. package/dist/lib/services/narration-template.js.map +1 -0
  342. package/dist/lib/services/realtime-pairing.d.ts +120 -0
  343. package/dist/lib/services/realtime-pairing.d.ts.map +1 -0
  344. package/dist/lib/services/realtime-pairing.js +150 -0
  345. package/dist/lib/services/realtime-pairing.js.map +1 -0
  346. package/dist/lib/services/realtime-session-review.service.d.ts +233 -0
  347. package/dist/lib/services/realtime-session-review.service.d.ts.map +1 -0
  348. package/dist/lib/services/realtime-session-review.service.js +417 -0
  349. package/dist/lib/services/realtime-session-review.service.js.map +1 -0
  350. package/dist/lib/services/realtime-session.service.d.ts +739 -0
  351. package/dist/lib/services/realtime-session.service.d.ts.map +1 -0
  352. package/dist/lib/services/realtime-session.service.js +1647 -0
  353. package/dist/lib/services/realtime-session.service.js.map +1 -0
  354. package/dist/lib/services/realtime-sessions-adapter.d.ts +54 -0
  355. package/dist/lib/services/realtime-sessions-adapter.d.ts.map +1 -0
  356. package/dist/lib/services/realtime-sessions-adapter.js +154 -0
  357. package/dist/lib/services/realtime-sessions-adapter.js.map +1 -0
  358. package/dist/lib/services/user-authorization.d.ts +67 -0
  359. package/dist/lib/services/user-authorization.d.ts.map +1 -0
  360. package/dist/lib/services/user-authorization.js +66 -0
  361. package/dist/lib/services/user-authorization.js.map +1 -0
  362. package/dist/lib/utils/realtime-session-timeline.d.ts +84 -0
  363. package/dist/lib/utils/realtime-session-timeline.d.ts.map +1 -0
  364. package/dist/lib/utils/realtime-session-timeline.js +94 -0
  365. package/dist/lib/utils/realtime-session-timeline.js.map +1 -0
  366. package/dist/public-api.d.ts +41 -0
  367. package/dist/public-api.d.ts.map +1 -1
  368. package/dist/public-api.js +50 -0
  369. package/dist/public-api.js.map +1 -1
  370. package/package.json +27 -24
  371. package/dist/__tests__/conversation-bridge.service.test.d.ts +0 -2
  372. package/dist/__tests__/conversation-bridge.service.test.d.ts.map +0 -1
  373. package/dist/__tests__/conversation-bridge.service.test.js +0 -98
  374. package/dist/__tests__/conversation-bridge.service.test.js.map +0 -1
  375. package/dist/__tests__/mention-parser.test.d.ts +0 -2
  376. package/dist/__tests__/mention-parser.test.d.ts.map +0 -1
  377. package/dist/__tests__/mention-parser.test.js +0 -154
  378. package/dist/__tests__/mention-parser.test.js.map +0 -1
@@ -1,261 +1,50 @@
1
- import { Injectable } from '@angular/core';
2
- import { ConversationUtility } from '@memberjunction/ai-core-plus';
3
- import * as i0 from "@angular/core";
4
1
  /**
5
- * Service for parsing @mentions from message text
6
- * Supports both JSON format and legacy text format
2
+ * @fileoverview Angular DI shim over the framework-agnostic `MentionParser` from
3
+ * `@memberjunction/conversations-runtime`.
4
+ *
5
+ * Previously this service owned the regex-based mention-parsing logic. That logic
6
+ * moved into the runtime in PR 1; this file is now a thin pass-through so existing
7
+ * `inject(MentionParserService)` call sites keep working without changes.
8
+ *
9
+ * **For new code:** prefer `ConversationsRuntime.Instance.Mentions` directly.
7
10
  */
11
+ import { Injectable } from '@angular/core';
12
+ import { ConversationsRuntime } from '@memberjunction/conversations-runtime';
13
+ import * as i0 from "@angular/core";
14
+ import * as i1 from "./conversations-runtime-bootstrap.service";
15
+ // NOTE: `Mention` and `MentionParseResult` are NOT re-exported from this file —
16
+ // the model's `conversation-state.model.ts` already exports `MentionParseResult`,
17
+ // and re-exporting here causes a public-api ambiguity. Consumers wanting the
18
+ // runtime's types should import from `@memberjunction/conversations-runtime`.
8
19
  export class MentionParserService {
9
- // Regex to match JSON mentions: @{type:"agent",id:"uuid",name:"Name",configId:"uuid",config:"High"}
10
- JSON_MENTION_REGEX = /@\{[^}]+\}/g;
11
- // Regex to match legacy @mentions - supports names with spaces if quoted: @"Agent Name" or @AgentName
12
- LEGACY_MENTION_REGEX = /@"([^"]+)"|@(\S+)/g;
13
- constructor() { }
14
- /**
15
- * Parse mentions from message text
16
- * Supports both JSON format (@{type:"agent",id:"uuid",...}) and legacy text format (@AgentName)
17
- * @param text The message text to parse
18
- * @param availableAgents List of available agents for matching
19
- * @param availableUsers List of available users for matching (optional)
20
- * @returns Parsed mentions with agent and user separation
21
- */
22
- parseMentions(text, availableAgents, availableUsers) {
23
- const mentions = [];
24
- // First, try to parse JSON mentions (new format)
25
- const jsonMatches = Array.from(text.matchAll(this.JSON_MENTION_REGEX));
26
- for (const match of jsonMatches) {
27
- try {
28
- // Extract JSON string (remove @ prefix)
29
- const jsonStr = match[0].substring(1); // Remove '@'
30
- const mentionData = JSON.parse(jsonStr);
31
- // Validate required fields
32
- if (mentionData.type && mentionData.id && mentionData.name) {
33
- const mention = {
34
- type: mentionData.type,
35
- id: mentionData.id,
36
- name: mentionData.name
37
- };
38
- // Add configuration if present (for agents)
39
- if (mentionData.configId) {
40
- mention.configurationId = mentionData.configId;
41
- }
42
- mentions.push(mention);
43
- }
44
- }
45
- catch (error) {
46
- console.warn('Failed to parse JSON mention:', match[0], error);
47
- // Continue to next match
48
- }
49
- }
50
- // If no JSON mentions found, fall back to legacy text format
51
- if (mentions.length === 0) {
52
- const legacyMatches = Array.from(text.matchAll(this.LEGACY_MENTION_REGEX));
53
- for (const match of legacyMatches) {
54
- // Extract the mention name (either quoted or unquoted)
55
- const mentionName = match[1] || match[2];
56
- if (!mentionName)
57
- continue;
58
- // Try to match against agents first
59
- const agent = this.findAgent(mentionName, availableAgents);
60
- if (agent) {
61
- mentions.push({
62
- type: 'agent',
63
- id: agent.ID,
64
- name: agent.Name || 'Unknown'
65
- });
66
- continue;
67
- }
68
- // Try to match against users
69
- if (availableUsers) {
70
- const user = this.findUser(mentionName, availableUsers);
71
- if (user) {
72
- mentions.push({
73
- type: 'user',
74
- id: user.ID,
75
- name: user.Name
76
- });
77
- }
78
- }
79
- }
80
- }
81
- // Extract first agent mention and all user mentions
82
- const agentMention = mentions.find(m => m.type === 'agent') || null;
83
- const userMentions = mentions.filter(m => m.type === 'user');
84
- return {
85
- mentions,
86
- agentMention,
87
- userMentions
88
- };
89
- }
90
- /**
91
- * Find an agent by name (case-insensitive)
92
- * Uses exact match or starts-with match (no contains match to avoid ambiguity)
93
- */
94
- findAgent(name, agents) {
95
- // Remove trailing punctuation and trim
96
- const cleanName = name.replace(/[.,;!?]+$/, '').trim();
97
- const lowerName = cleanName.toLowerCase();
98
- // Try exact match first
99
- let agent = agents.find(a => (a.Name?.toLowerCase() || '') === lowerName);
100
- if (agent) {
101
- return agent;
102
- }
103
- // Try starts with match
104
- agent = agents.find(a => (a.Name?.toLowerCase() || '').startsWith(lowerName));
105
- if (agent) {
106
- return agent;
107
- }
108
- return null;
109
- // Note: Removed "contains" match to avoid ambiguous matches
110
- // e.g., "@Agent" would match multiple agents like "Marketing Agent", "Data Agent"
111
- // Future: Could add LLM-based disambiguation as fallback
20
+ constructor(_bootstrap) {
21
+ // Injecting the bootstrap forces adapter registration on first construction.
112
22
  }
113
- /**
114
- * Find a user by name (case-insensitive)
115
- * Uses exact match, email match, or starts-with match (no contains match to avoid ambiguity)
116
- */
117
- findUser(name, users) {
118
- const lowerName = name.toLowerCase().trim();
119
- // Try exact match first
120
- let user = users.find(u => u.Name.toLowerCase() === lowerName);
121
- if (user)
122
- return user;
123
- // Try email match
124
- user = users.find(u => u.Email?.toLowerCase() === lowerName);
125
- if (user)
126
- return user;
127
- // Try starts with match
128
- user = users.find(u => u.Name.toLowerCase().startsWith(lowerName));
129
- return user || null;
130
- // Note: Removed "contains" match for consistency with agent matching
23
+ /** Pass-through to {@link ConversationsRuntime.Instance.Mentions.parseMentions}. */
24
+ parseMentions(text, availableAgents, availableUsers) {
25
+ return ConversationsRuntime.Instance.Mentions.parseMentions(text, availableAgents, availableUsers);
131
26
  }
132
- /**
133
- * Validate mentions - check if all mentions are valid
134
- * Returns array of invalid mention names
135
- * Supports both JSON and legacy mention formats
136
- */
27
+ /** Pass-through to {@link ConversationsRuntime.Instance.Mentions.validateMentions}. */
137
28
  validateMentions(text, availableAgents, availableUsers) {
138
- const invalidMentions = [];
139
- // Check JSON mentions first
140
- const jsonMatches = Array.from(text.matchAll(this.JSON_MENTION_REGEX));
141
- if (jsonMatches.length > 0) {
142
- for (const match of jsonMatches) {
143
- try {
144
- const jsonStr = match[0].substring(1);
145
- const mentionData = JSON.parse(jsonStr);
146
- const mentionName = mentionData.name;
147
- if (mentionData.type === 'agent') {
148
- const isAgent = this.findAgent(mentionName, availableAgents) !== null;
149
- if (!isAgent) {
150
- invalidMentions.push(mentionName);
151
- }
152
- }
153
- else if (mentionData.type === 'user') {
154
- const isUser = availableUsers ? this.findUser(mentionName, availableUsers) !== null : false;
155
- if (!isUser) {
156
- invalidMentions.push(mentionName);
157
- }
158
- }
159
- }
160
- catch (error) {
161
- // Invalid JSON mention
162
- invalidMentions.push(match[0]);
163
- }
164
- }
165
- }
166
- else {
167
- // Fall back to legacy format
168
- const matches = Array.from(text.matchAll(this.LEGACY_MENTION_REGEX));
169
- for (const match of matches) {
170
- const mentionName = match[1] || match[2];
171
- if (!mentionName)
172
- continue;
173
- const isAgent = this.findAgent(mentionName, availableAgents) !== null;
174
- const isUser = availableUsers ? this.findUser(mentionName, availableUsers) !== null : false;
175
- if (!isAgent && !isUser) {
176
- invalidMentions.push(mentionName);
177
- }
178
- }
179
- }
180
- return invalidMentions;
29
+ return ConversationsRuntime.Instance.Mentions.validateMentions(text, availableAgents, availableUsers);
181
30
  }
182
- /**
183
- * Extract all mention names from text (raw strings)
184
- * Supports both JSON and legacy mention formats
185
- */
31
+ /** Pass-through to {@link ConversationsRuntime.Instance.Mentions.extractMentionNames}. */
186
32
  extractMentionNames(text) {
187
- // Check JSON mentions first
188
- const jsonMatches = Array.from(text.matchAll(this.JSON_MENTION_REGEX));
189
- if (jsonMatches.length > 0) {
190
- return jsonMatches.map(match => {
191
- try {
192
- const jsonStr = match[0].substring(1);
193
- const mentionData = JSON.parse(jsonStr);
194
- return mentionData.name;
195
- }
196
- catch (error) {
197
- return '';
198
- }
199
- }).filter(Boolean);
200
- }
201
- // Fall back to legacy format
202
- const matches = Array.from(text.matchAll(this.LEGACY_MENTION_REGEX));
203
- return matches.map(match => match[1] || match[2]).filter(Boolean);
33
+ return ConversationsRuntime.Instance.Mentions.extractMentionNames(text);
204
34
  }
205
- /**
206
- * Replace mentions in text with formatted versions
207
- * Example: "@agent" -> "@Agent Name" (with proper casing)
208
- */
35
+ /** Pass-through to {@link ConversationsRuntime.Instance.Mentions.formatMentions}. */
209
36
  formatMentions(text, mentions) {
210
- let formattedText = text;
211
- for (const mention of mentions) {
212
- // Find the mention in the text and replace with proper name
213
- const patterns = [
214
- new RegExp(`@"${mention.name}"`, 'gi'),
215
- new RegExp(`@${mention.name.replace(/\s+/g, '\\s*')}`, 'gi')
216
- ];
217
- for (const pattern of patterns) {
218
- formattedText = formattedText.replace(pattern, `@${mention.name}`);
219
- }
220
- }
221
- return formattedText;
37
+ return ConversationsRuntime.Instance.Mentions.formatMentions(text, mentions);
222
38
  }
223
- /**
224
- * Convert a message with JSON-encoded mentions to plain text.
225
- * Replaces @{...} JSON mentions with simple @Name format.
226
- * This is a wrapper around ConversationUtility.ToPlainText() for Angular injection.
227
- *
228
- * @param text - The message text containing JSON mentions
229
- * @param agents - Optional array of agents for name lookup
230
- * @param users - Optional array of users for name lookup
231
- * @returns Plain text with mentions converted to @Name format
232
- *
233
- * @example
234
- * // Input: '@{"type":"agent","id":"123","name":"Sage"} help me'
235
- * // Output: '@Sage help me'
236
- */
39
+ /** Pass-through to {@link ConversationsRuntime.Instance.Mentions.toPlainText}. */
237
40
  toPlainText(text, agents, users) {
238
- if (!text)
239
- return '';
240
- // Convert agents to the AgentInfo format expected by ConversationUtility
241
- const agentInfos = agents?.map(a => ({
242
- ID: a.ID,
243
- Name: a.Name || 'Unknown'
244
- }));
245
- // Convert users to the UserInfo format expected by ConversationUtility
246
- const userInfos = users?.map(u => ({
247
- ID: u.ID,
248
- Name: u.Name
249
- }));
250
- return ConversationUtility.ToPlainText(text, agentInfos, userInfos);
41
+ return ConversationsRuntime.Instance.Mentions.toPlainText(text, agents, users);
251
42
  }
252
- static ɵfac = function MentionParserService_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || MentionParserService)(); };
43
+ static ɵfac = function MentionParserService_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || MentionParserService)(i0.ɵɵinject(i1.ConversationsRuntimeBootstrap)); };
253
44
  static ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: MentionParserService, factory: MentionParserService.ɵfac, providedIn: 'root' });
254
45
  }
255
46
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(MentionParserService, [{
256
47
  type: Injectable,
257
- args: [{
258
- providedIn: 'root'
259
- }]
260
- }], () => [], null); })();
48
+ args: [{ providedIn: 'root' }]
49
+ }], () => [{ type: i1.ConversationsRuntimeBootstrap }], null); })();
261
50
  //# sourceMappingURL=mention-parser.service.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"mention-parser.service.js","sourceRoot":"","sources":["../../../src/lib/services/mention-parser.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,OAAO,EAA2B,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;;AAG5F;;;GAGG;AAIH,MAAM,OAAO,oBAAoB;IAC/B,oGAAoG;IACnF,kBAAkB,GAAG,aAAa,CAAC;IACpD,sGAAsG;IACrF,oBAAoB,GAAG,oBAAoB,CAAC;IAE7D,gBAAe,CAAC;IAEhB;;;;;;;OAOG;IACH,aAAa,CACX,IAAY,EACZ,eAA0C,EAC1C,cAA2B;QAE3B,MAAM,QAAQ,GAAc,EAAE,CAAC;QAE/B,iDAAiD;QACjD,MAAM,WAAW,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC,CAAC;QAEvE,KAAK,MAAM,KAAK,IAAI,WAAW,EAAE,CAAC;YAChC,IAAI,CAAC;gBACH,wCAAwC;gBACxC,MAAM,OAAO,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,aAAa;gBACpD,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;gB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AG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;YACjC,EAAE,EAAE,CAAC,CAAC,EAAE;YACR,IAAI,EAAE,CAAC,CAAC,IAAI;SACb,CAAC,CAAC,CAAC;QAEJ,OAAO,mBAAmB,CAAC,WAAW,CAAC,IAAI,EAAE,UAAU,EAAE,SAAS,CAAC,CAAC;IACtE,CAAC;8GAhSU,oBAAoB;gEAApB,oBAAoB,WAApB,oBAAoB,mBAFnB,MAAM;;iFAEP,oBAAoB;cAHhC,UAAU;eAAC;gBACV,UAAU,EAAE,MAAM;aACnB","sourcesContent":["import { Injectable } from '@angular/core';\nimport { Mention, MentionParseResult } from '../models/conversation-state.model';\nimport { MJAIAgentEntityExtended, ConversationUtility } from '@memberjunction/ai-core-plus';\nimport { UserInfo } from '@memberjunction/core';\n\n/**\n * Service for parsing @mentions from message text\n * Supports both JSON format and legacy text format\n */\n@Injectable({\n providedIn: 'root'\n})\nexport class MentionParserService {\n // Regex to match JSON mentions: @{type:\"agent\",id:\"uuid\",name:\"Name\",configId:\"uuid\",config:\"High\"}\n private readonly JSON_MENTION_REGEX = /@\\{[^}]+\\}/g;\n // Regex to match legacy @mentions - supports names with spaces if quoted: @\"Agent Name\" or @AgentName\n private readonly LEGACY_MENTION_REGEX = /@\"([^\"]+)\"|@(\\S+)/g;\n\n constructor() {}\n\n /**\n * Parse mentions from message text\n * Supports both JSON format (@{type:\"agent\",id:\"uuid\",...}) and legacy text format (@AgentName)\n * @param text The message text to parse\n * @param availableAgents List of available agents for matching\n * @param availableUsers List of available users for matching (optional)\n * @returns Parsed mentions with agent and user separation\n */\n parseMentions(\n text: string,\n availableAgents: MJAIAgentEntityExtended[],\n availableUsers?: UserInfo[]\n ): MentionParseResult {\n const mentions: Mention[] = [];\n\n // First, try to parse JSON mentions (new format)\n const jsonMatches = Array.from(text.matchAll(this.JSON_MENTION_REGEX));\n\n for (const match of jsonMatches) {\n try {\n // Extract JSON string (remove @ prefix)\n const jsonStr = match[0].substring(1); // Remove '@'\n const mentionData = JSON.parse(jsonStr);\n\n // Validate required fields\n if (mentionData.type && mentionData.id && mentionData.name) {\n const mention: Mention = {\n type: mentionData.type,\n id: mentionData.id,\n name: mentionData.name\n };\n\n // Add configuration if present (for agents)\n if (mentionData.configId) {\n mention.configurationId = mentionData.configId;\n }\n\n mentions.push(mention);\n }\n } catch (error) {\n console.warn('Failed to parse JSON mention:', match[0], error);\n // Continue to next match\n }\n }\n\n // If no JSON mentions found, fall back to legacy text format\n if (mentions.length === 0) {\n const legacyMatches = Array.from(text.matchAll(this.LEGACY_MENTION_REGEX));\n\n for (const match of legacyMatches) {\n // Extract the mention name (either quoted or unquoted)\n const mentionName = match[1] || match[2];\n if (!mentionName) continue;\n\n // Try to match against agents first\n const agent = this.findAgent(mentionName, availableAgents);\n if (agent) {\n mentions.push({\n type: 'agent',\n id: agent.ID,\n name: agent.Name || 'Unknown'\n });\n continue;\n }\n\n // Try to match against users\n if (availableUsers) {\n const user = this.findUser(mentionName, availableUsers);\n if (user) {\n mentions.push({\n type: 'user',\n id: user.ID,\n name: user.Name\n });\n }\n }\n }\n }\n\n // Extract first agent mention and all user mentions\n const agentMention = mentions.find(m => m.type === 'agent') || null;\n const userMentions = mentions.filter(m => m.type === 'user');\n\n return {\n mentions,\n agentMention,\n userMentions\n };\n }\n\n /**\n * Find an agent by name (case-insensitive)\n * Uses exact match or starts-with match (no contains match to avoid ambiguity)\n */\n private findAgent(name: string, agents: MJAIAgentEntityExtended[]): MJAIAgentEntityExtended | null {\n // Remove trailing punctuation and trim\n const cleanName = name.replace(/[.,;!?]+$/, '').trim();\n const lowerName = cleanName.toLowerCase();\n\n // Try exact match first\n let agent = agents.find(a => (a.Name?.toLowerCase() || '') === lowerName);\n if (agent) {\n return agent;\n }\n\n // Try starts with match\n agent = agents.find(a => (a.Name?.toLowerCase() || '').startsWith(lowerName));\n if (agent) {\n return agent;\n }\n\n return null;\n\n // Note: Removed \"contains\" match to avoid ambiguous matches\n // e.g., \"@Agent\" would match multiple agents like \"Marketing Agent\", \"Data Agent\"\n // Future: Could add LLM-based disambiguation as fallback\n }\n\n /**\n * Find a user by name (case-insensitive)\n * Uses exact match, email match, or starts-with match (no contains match to avoid ambiguity)\n */\n private findUser(name: string, users: UserInfo[]): UserInfo | null {\n const lowerName = name.toLowerCase().trim();\n\n // Try exact match first\n let user = users.find(u => u.Name.toLowerCase() === lowerName);\n if (user) return user;\n\n // Try email match\n user = users.find(u => u.Email?.toLowerCase() === lowerName);\n if (user) return user;\n\n // Try starts with match\n user = users.find(u => u.Name.toLowerCase().startsWith(lowerName));\n return user || null;\n\n // Note: Removed \"contains\" match for consistency with agent matching\n }\n\n /**\n * Validate mentions - check if all mentions are valid\n * Returns array of invalid mention names\n * Supports both JSON and legacy mention formats\n */\n validateMentions(\n text: string,\n availableAgents: MJAIAgentEntityExtended[],\n availableUsers?: UserInfo[]\n ): string[] {\n const invalidMentions: string[] = [];\n\n // Check JSON mentions first\n const jsonMatches = Array.from(text.matchAll(this.JSON_MENTION_REGEX));\n if (jsonMatches.length > 0) {\n for (const match of jsonMatches) {\n try {\n const jsonStr = match[0].substring(1);\n const mentionData = JSON.parse(jsonStr);\n const mentionName = mentionData.name;\n\n if (mentionData.type === 'agent') {\n const isAgent = this.findAgent(mentionName, availableAgents) !== null;\n if (!isAgent) {\n invalidMentions.push(mentionName);\n }\n } else if (mentionData.type === 'user') {\n const isUser = availableUsers ? this.findUser(mentionName, availableUsers) !== null : false;\n if (!isUser) {\n invalidMentions.push(mentionName);\n }\n }\n } catch (error) {\n // Invalid JSON mention\n invalidMentions.push(match[0]);\n }\n }\n } else {\n // Fall back to legacy format\n const matches = Array.from(text.matchAll(this.LEGACY_MENTION_REGEX));\n\n for (const match of matches) {\n const mentionName = match[1] || match[2];\n if (!mentionName) continue;\n\n const isAgent = this.findAgent(mentionName, availableAgents) !== null;\n const isUser = availableUsers ? this.findUser(mentionName, availableUsers) !== null : false;\n\n if (!isAgent && !isUser) {\n invalidMentions.push(mentionName);\n }\n }\n }\n\n return invalidMentions;\n }\n\n /**\n * Extract all mention names from text (raw strings)\n * Supports both JSON and legacy mention formats\n */\n extractMentionNames(text: string): string[] {\n // Check JSON mentions first\n const jsonMatches = Array.from(text.matchAll(this.JSON_MENTION_REGEX));\n if (jsonMatches.length > 0) {\n return jsonMatches.map(match => {\n try {\n const jsonStr = match[0].substring(1);\n const mentionData = JSON.parse(jsonStr);\n return mentionData.name;\n } catch (error) {\n return '';\n }\n }).filter(Boolean);\n }\n\n // Fall back to legacy format\n const matches = Array.from(text.matchAll(this.LEGACY_MENTION_REGEX));\n return matches.map(match => match[1] || match[2]).filter(Boolean);\n }\n\n /**\n * Replace mentions in text with formatted versions\n * Example: \"@agent\" -> \"@Agent Name\" (with proper casing)\n */\n formatMentions(\n text: string,\n mentions: Mention[]\n ): string {\n let formattedText = text;\n\n for (const mention of mentions) {\n // Find the mention in the text and replace with proper name\n const patterns = [\n new RegExp(`@\"${mention.name}\"`, 'gi'),\n new RegExp(`@${mention.name.replace(/\\s+/g, '\\\\s*')}`, 'gi')\n ];\n\n for (const pattern of patterns) {\n formattedText = formattedText.replace(pattern, `@${mention.name}`);\n }\n }\n\n return formattedText;\n }\n\n /**\n * Convert a message with JSON-encoded mentions to plain text.\n * Replaces @{...} JSON mentions with simple @Name format.\n * This is a wrapper around ConversationUtility.ToPlainText() for Angular injection.\n *\n * @param text - The message text containing JSON mentions\n * @param agents - Optional array of agents for name lookup\n * @param users - Optional array of users for name lookup\n * @returns Plain text with mentions converted to @Name format\n *\n * @example\n * // Input: '@{\"type\":\"agent\",\"id\":\"123\",\"name\":\"Sage\"} help me'\n * // Output: '@Sage help me'\n */\n toPlainText(\n text: string,\n agents?: MJAIAgentEntityExtended[],\n users?: UserInfo[]\n ): string {\n if (!text) return '';\n\n // Convert agents to the AgentInfo format expected by ConversationUtility\n const agentInfos = agents?.map(a => ({\n ID: a.ID,\n Name: a.Name || 'Unknown'\n }));\n\n // Convert users to the UserInfo format expected by ConversationUtility\n const userInfos = users?.map(u => ({\n ID: u.ID,\n Name: u.Name\n }));\n\n return ConversationUtility.ToPlainText(text, agentInfos, userInfos);\n }\n}\n"]}
1
+ {"version":3,"file":"mention-parser.service.js","sourceRoot":"","sources":["../../../src/lib/services/mention-parser.service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;;;AAO7E,gFAAgF;AAChF,kFAAkF;AAClF,6EAA6E;AAC7E,8EAA8E;AAG9E,MAAM,OAAO,oBAAoB;IAC7B,YAAY,UAAyC;QACjD,6EAA6E;IACjF,CAAC;IAED,oFAAoF;IACpF,aAAa,CACT,IAAY,EACZ,eAA0C,EAC1C,cAA2B;QAE3B,OAAO,oBAAoB,CAAC,QAAQ,CAAC,QAAQ,CAAC,aAAa,CACvD,IAAI,EACJ,eAAe,EACf,cAAc,CACjB,CAAC;IACN,CAAC;IAED,uFAAuF;IACvF,gBAAgB,CACZ,IAAY,EACZ,eAA0C,EAC1C,cAA2B;QAE3B,OAAO,oBAAoB,CAAC,QAAQ,CAAC,QAAQ,CAAC,gBAAgB,CAC1D,IAAI,EACJ,eAAe,EACf,cAAc,CACjB,CAAC;IACN,CAAC;IAED,0FAA0F;IAC1F,mBAAmB,CAAC,IAAY;QAC5B,OAAO,oBAAoB,CAAC,QAAQ,CAAC,QAAQ,CAAC,mBAAmB,CAAC,IAAI,CAAC,CAAC;IAC5E,CAAC;IAED,qFAAqF;IACrF,cAAc,CAAC,IAAY,EAAE,QAAmB;QAC5C,OAAO,oBAAoB,CAAC,QAAQ,CAAC,QAAQ,CAAC,cAAc,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IACjF,CAAC;IAED,kFAAkF;IAClF,WAAW,CACP,IAAY,EACZ,MAAkC,EAClC,KAAkB;QAElB,OAAO,oBAAoB,CAAC,QAAQ,CAAC,QAAQ,CAAC,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;IACnF,CAAC;8GAhDQ,oBAAoB;gEAApB,oBAAoB,WAApB,oBAAoB,mBADP,MAAM;;iFACnB,oBAAoB;cADhC,UAAU;eAAC,EAAE,UAAU,EAAE,MAAM,EAAE","sourcesContent":["/**\n * @fileoverview Angular DI shim over the framework-agnostic `MentionParser` from\n * `@memberjunction/conversations-runtime`.\n *\n * Previously this service owned the regex-based mention-parsing logic. That logic\n * moved into the runtime in PR 1; this file is now a thin pass-through so existing\n * `inject(MentionParserService)` call sites keep working without changes.\n *\n * **For new code:** prefer `ConversationsRuntime.Instance.Mentions` directly.\n */\n\nimport { Injectable } from '@angular/core';\nimport { ConversationsRuntime } from '@memberjunction/conversations-runtime';\nimport type { Mention, MentionParseResult } from '@memberjunction/conversations-runtime';\nimport { MJAIAgentEntityExtended } from '@memberjunction/ai-core-plus';\nimport { UserInfo } from '@memberjunction/core';\n\nimport { ConversationsRuntimeBootstrap } from './conversations-runtime-bootstrap.service';\n\n// NOTE: `Mention` and `MentionParseResult` are NOT re-exported from this file —\n// the model's `conversation-state.model.ts` already exports `MentionParseResult`,\n// and re-exporting here causes a public-api ambiguity. Consumers wanting the\n// runtime's types should import from `@memberjunction/conversations-runtime`.\n\n@Injectable({ providedIn: 'root' })\nexport class MentionParserService {\n constructor(_bootstrap: ConversationsRuntimeBootstrap) {\n // Injecting the bootstrap forces adapter registration on first construction.\n }\n\n /** Pass-through to {@link ConversationsRuntime.Instance.Mentions.parseMentions}. */\n parseMentions(\n text: string,\n availableAgents: MJAIAgentEntityExtended[],\n availableUsers?: UserInfo[]\n ): MentionParseResult {\n return ConversationsRuntime.Instance.Mentions.parseMentions(\n text,\n availableAgents,\n availableUsers\n );\n }\n\n /** Pass-through to {@link ConversationsRuntime.Instance.Mentions.validateMentions}. */\n validateMentions(\n text: string,\n availableAgents: MJAIAgentEntityExtended[],\n availableUsers?: UserInfo[]\n ): string[] {\n return ConversationsRuntime.Instance.Mentions.validateMentions(\n text,\n availableAgents,\n availableUsers\n );\n }\n\n /** Pass-through to {@link ConversationsRuntime.Instance.Mentions.extractMentionNames}. */\n extractMentionNames(text: string): string[] {\n return ConversationsRuntime.Instance.Mentions.extractMentionNames(text);\n }\n\n /** Pass-through to {@link ConversationsRuntime.Instance.Mentions.formatMentions}. */\n formatMentions(text: string, mentions: Mention[]): string {\n return ConversationsRuntime.Instance.Mentions.formatMentions(text, mentions);\n }\n\n /** Pass-through to {@link ConversationsRuntime.Instance.Mentions.toPlainText}. */\n toPlainText(\n text: string,\n agents?: MJAIAgentEntityExtended[],\n users?: UserInfo[]\n ): string {\n return ConversationsRuntime.Instance.Mentions.toPlainText(text, agents, users);\n }\n}\n"]}
@@ -0,0 +1,42 @@
1
+ /**
2
+ * @fileoverview Pure helpers for building the one-off spoken progress-narration instructions a
3
+ * realtime voice session sends to the model while delegated work runs.
4
+ *
5
+ * The instruction text is DB-driven: the server resolves the `Realtime Co-Agent - Progress Narration`
6
+ * prompt's `TemplateText` at session start and threads it to the browser. The template may use:
7
+ * - `{{ progressMessage }}` — the aggregated progress digest (one or more updates, oldest first)
8
+ * - `{{ priorNarrations }}` — what the model has ALREADY said aloud for this task (so it can
9
+ * continue the story instead of repeating itself)
10
+ * - `{{ updateNumber }}` — 1-based count of spoken updates for this task
11
+ * When a deployment hasn't synced that prompt yet, the built-in
12
+ * {@link DefaultNarrationInstructions} fallback keeps narration working with the same semantics.
13
+ */
14
+ /** Options accompanying the progress digest when building narration instructions. */
15
+ export interface NarrationBuildOptions {
16
+ /** The narration utterances the model has already spoken for this task, oldest first. */
17
+ PriorNarrations?: string[];
18
+ /** 1-based number of this spoken update within the current task. */
19
+ UpdateNumber?: number;
20
+ }
21
+ /**
22
+ * Builds the built-in (fallback) narration instructions — same semantics as the DB template:
23
+ * first person, varied phrasing that continues from what was already said, no repeats.
24
+ *
25
+ * @param digest The aggregated progress digest (one or more updates, oldest first).
26
+ * @param options Prior narrations + update number for phrasing variation/chaining.
27
+ * @returns The complete spoken-update instruction text.
28
+ */
29
+ export declare function DefaultNarrationInstructions(digest: string, options?: NarrationBuildOptions): string;
30
+ /**
31
+ * Builds the narration instructions from the server-provided template by substituting
32
+ * `{{ progressMessage }}`, `{{ priorNarrations }}`, and `{{ updateNumber }}` (space and no-space
33
+ * variants). Falls back to {@link DefaultNarrationInstructions} when the template is absent or
34
+ * blank (deployments that haven't synced the narration prompt).
35
+ *
36
+ * @param template The DB-driven instruction template, or `null`/`undefined` when unavailable.
37
+ * @param digest The aggregated progress digest (one or more updates, oldest first).
38
+ * @param options Prior narrations + update number for phrasing variation/chaining.
39
+ * @returns The complete spoken-update instruction text.
40
+ */
41
+ export declare function BuildNarrationInstructions(template: string | null | undefined, digest: string, options?: NarrationBuildOptions): string;
42
+ //# sourceMappingURL=narration-template.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"narration-template.d.ts","sourceRoot":"","sources":["../../../src/lib/services/narration-template.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,qFAAqF;AACrF,MAAM,WAAW,qBAAqB;IACpC,yFAAyF;IACzF,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;IAC3B,oEAAoE;IACpE,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAuBD;;;;;;;GAOG;AACH,wBAAgB,4BAA4B,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,qBAAqB,GAAG,MAAM,CAcpG;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,0BAA0B,CACxC,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EACnC,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE,qBAAqB,GAC9B,MAAM,CAQR"}
@@ -0,0 +1,73 @@
1
+ /**
2
+ * @fileoverview Pure helpers for building the one-off spoken progress-narration instructions a
3
+ * realtime voice session sends to the model while delegated work runs.
4
+ *
5
+ * The instruction text is DB-driven: the server resolves the `Realtime Co-Agent - Progress Narration`
6
+ * prompt's `TemplateText` at session start and threads it to the browser. The template may use:
7
+ * - `{{ progressMessage }}` — the aggregated progress digest (one or more updates, oldest first)
8
+ * - `{{ priorNarrations }}` — what the model has ALREADY said aloud for this task (so it can
9
+ * continue the story instead of repeating itself)
10
+ * - `{{ updateNumber }}` — 1-based count of spoken updates for this task
11
+ * When a deployment hasn't synced that prompt yet, the built-in
12
+ * {@link DefaultNarrationInstructions} fallback keeps narration working with the same semantics.
13
+ */
14
+ const PROGRESS_TOKENS = ['{{ progressMessage }}', '{{progressMessage}}'];
15
+ const PRIOR_TOKENS = ['{{ priorNarrations }}', '{{priorNarrations}}'];
16
+ const NUMBER_TOKENS = ['{{ updateNumber }}', '{{updateNumber}}'];
17
+ /** Replaces every occurrence of each token with the value. */
18
+ function replaceTokens(text, tokens, value) {
19
+ let out = text;
20
+ for (const t of tokens) {
21
+ out = out.split(t).join(value);
22
+ }
23
+ return out;
24
+ }
25
+ /** Formats the prior spoken narrations for injection ("none yet" when this is the first update). */
26
+ function formatPriorNarrations(prior) {
27
+ if (!prior || prior.length === 0) {
28
+ return 'Nothing yet — this is your first spoken update for this task.';
29
+ }
30
+ return prior.map((p) => `- "${p}"`).join('\n');
31
+ }
32
+ /**
33
+ * Builds the built-in (fallback) narration instructions — same semantics as the DB template:
34
+ * first person, varied phrasing that continues from what was already said, no repeats.
35
+ *
36
+ * @param digest The aggregated progress digest (one or more updates, oldest first).
37
+ * @param options Prior narrations + update number for phrasing variation/chaining.
38
+ * @returns The complete spoken-update instruction text.
39
+ */
40
+ export function DefaultNarrationInstructions(digest, options) {
41
+ const updateNumber = options?.UpdateNumber ?? 1;
42
+ return (`Live progress on the work YOU are doing for the user (oldest first): ${digest}. ` +
43
+ `This is spoken update #${updateNumber} for this task. You have already told the user:\n` +
44
+ `${formatPriorNarrations(options?.PriorNarrations)}\n` +
45
+ `Say ONE short, natural sentence in the FIRST PERSON continuing the story of what you are doing. ` +
46
+ `For the first update something like "I'm pulling that up now" is fine; for later updates VARY the ` +
47
+ `phrasing and build on what you last said ("Got the first part — grabbing the rest", "Almost there, ` +
48
+ `just double-checking the numbers") instead of repeating an "I'm now…" pattern. Never repeat ` +
49
+ `information you've already conveyed — only add what's new. Strictly first person: the words "it" ` +
50
+ `and the agent's name must not be the subject of your sentence, and never say generic filler like ` +
51
+ `"it's still running in the background".`);
52
+ }
53
+ /**
54
+ * Builds the narration instructions from the server-provided template by substituting
55
+ * `{{ progressMessage }}`, `{{ priorNarrations }}`, and `{{ updateNumber }}` (space and no-space
56
+ * variants). Falls back to {@link DefaultNarrationInstructions} when the template is absent or
57
+ * blank (deployments that haven't synced the narration prompt).
58
+ *
59
+ * @param template The DB-driven instruction template, or `null`/`undefined` when unavailable.
60
+ * @param digest The aggregated progress digest (one or more updates, oldest first).
61
+ * @param options Prior narrations + update number for phrasing variation/chaining.
62
+ * @returns The complete spoken-update instruction text.
63
+ */
64
+ export function BuildNarrationInstructions(template, digest, options) {
65
+ if (!template || template.trim().length === 0) {
66
+ return DefaultNarrationInstructions(digest, options);
67
+ }
68
+ let out = replaceTokens(template, PROGRESS_TOKENS, digest);
69
+ out = replaceTokens(out, PRIOR_TOKENS, formatPriorNarrations(options?.PriorNarrations));
70
+ out = replaceTokens(out, NUMBER_TOKENS, String(options?.UpdateNumber ?? 1));
71
+ return out;
72
+ }
73
+ //# sourceMappingURL=narration-template.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"narration-template.js","sourceRoot":"","sources":["../../../src/lib/services/narration-template.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAUH,MAAM,eAAe,GAAG,CAAC,uBAAuB,EAAE,qBAAqB,CAAC,CAAC;AACzE,MAAM,YAAY,GAAG,CAAC,uBAAuB,EAAE,qBAAqB,CAAC,CAAC;AACtE,MAAM,aAAa,GAAG,CAAC,oBAAoB,EAAE,kBAAkB,CAAC,CAAC;AAEjE,8DAA8D;AAC9D,SAAS,aAAa,CAA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AE,MAAM,CAAC,CAAC;IAC3D,GAAG,GAAG,aAAa,CAAC,GAAG,EAAE,YAAY,EAAE,qBAAqB,CAAC,OAAO,EAAE,eAAe,CAAC,CAAC,CAAC;IACxF,GAAG,GAAG,aAAa,CAAC,GAAG,EAAE,aAAa,EAAE,MAAM,CAAC,OAAO,EAAE,YAAY,IAAI,CAAC,CAAC,CAAC,CAAC;IAC5E,OAAO,GAAG,CAAC;AACb,CAAC","sourcesContent":["/**\n * @fileoverview Pure helpers for building the one-off spoken progress-narration instructions a\n * realtime voice session sends to the model while delegated work runs.\n *\n * The instruction text is DB-driven: the server resolves the `Realtime Co-Agent - Progress Narration`\n * prompt's `TemplateText` at session start and threads it to the browser. The template may use:\n * - `{{ progressMessage }}` — the aggregated progress digest (one or more updates, oldest first)\n * - `{{ priorNarrations }}` — what the model has ALREADY said aloud for this task (so it can\n * continue the story instead of repeating itself)\n * - `{{ updateNumber }}` — 1-based count of spoken updates for this task\n * When a deployment hasn't synced that prompt yet, the built-in\n * {@link DefaultNarrationInstructions} fallback keeps narration working with the same semantics.\n */\n\n/** Options accompanying the progress digest when building narration instructions. */\nexport interface NarrationBuildOptions {\n /** The narration utterances the model has already spoken for this task, oldest first. */\n PriorNarrations?: string[];\n /** 1-based number of this spoken update within the current task. */\n UpdateNumber?: number;\n}\n\nconst PROGRESS_TOKENS = ['{{ progressMessage }}', '{{progressMessage}}'];\nconst PRIOR_TOKENS = ['{{ priorNarrations }}', '{{priorNarrations}}'];\nconst NUMBER_TOKENS = ['{{ updateNumber }}', '{{updateNumber}}'];\n\n/** Replaces every occurrence of each token with the value. */\nfunction replaceTokens(text: string, tokens: string[], value: string): string {\n let out = text;\n for (const t of tokens) {\n out = out.split(t).join(value);\n }\n return out;\n}\n\n/** Formats the prior spoken narrations for injection (\"none yet\" when this is the first update). */\nfunction formatPriorNarrations(prior: string[] | undefined): string {\n if (!prior || prior.length === 0) {\n return 'Nothing yet — this is your first spoken update for this task.';\n }\n return prior.map((p) => `- \"${p}\"`).join('\\n');\n}\n\n/**\n * Builds the built-in (fallback) narration instructions — same semantics as the DB template:\n * first person, varied phrasing that continues from what was already said, no repeats.\n *\n * @param digest The aggregated progress digest (one or more updates, oldest first).\n * @param options Prior narrations + update number for phrasing variation/chaining.\n * @returns The complete spoken-update instruction text.\n */\nexport function DefaultNarrationInstructions(digest: string, options?: NarrationBuildOptions): string {\n const updateNumber = options?.UpdateNumber ?? 1;\n return (\n `Live progress on the work YOU are doing for the user (oldest first): ${digest}. ` +\n `This is spoken update #${updateNumber} for this task. You have already told the user:\\n` +\n `${formatPriorNarrations(options?.PriorNarrations)}\\n` +\n `Say ONE short, natural sentence in the FIRST PERSON continuing the story of what you are doing. ` +\n `For the first update something like \"I'm pulling that up now\" is fine; for later updates VARY the ` +\n `phrasing and build on what you last said (\"Got the first part — grabbing the rest\", \"Almost there, ` +\n `just double-checking the numbers\") instead of repeating an \"I'm now…\" pattern. Never repeat ` +\n `information you've already conveyed — only add what's new. Strictly first person: the words \"it\" ` +\n `and the agent's name must not be the subject of your sentence, and never say generic filler like ` +\n `\"it's still running in the background\".`\n );\n}\n\n/**\n * Builds the narration instructions from the server-provided template by substituting\n * `{{ progressMessage }}`, `{{ priorNarrations }}`, and `{{ updateNumber }}` (space and no-space\n * variants). Falls back to {@link DefaultNarrationInstructions} when the template is absent or\n * blank (deployments that haven't synced the narration prompt).\n *\n * @param template The DB-driven instruction template, or `null`/`undefined` when unavailable.\n * @param digest The aggregated progress digest (one or more updates, oldest first).\n * @param options Prior narrations + update number for phrasing variation/chaining.\n * @returns The complete spoken-update instruction text.\n */\nexport function BuildNarrationInstructions(\n template: string | null | undefined,\n digest: string,\n options?: NarrationBuildOptions\n): string {\n if (!template || template.trim().length === 0) {\n return DefaultNarrationInstructions(digest, options);\n }\n let out = replaceTokens(template, PROGRESS_TOKENS, digest);\n out = replaceTokens(out, PRIOR_TOKENS, formatPriorNarrations(options?.PriorNarrations));\n out = replaceTokens(out, NUMBER_TOKENS, String(options?.UpdateNumber ?? 1));\n return out;\n}\n"]}
@@ -0,0 +1,120 @@
1
+ import { IMetadataProvider } from '@memberjunction/core';
2
+ /**
3
+ * The narrow read-only projection of an `MJ: AI Agent Co Agents` row the voice UI consumes
4
+ * (loaded via {@link LoadCoAgentPairings} from {@link AIEngineBase}'s cached `AgentCoAgents`;
5
+ * only **Active** rows of relationship **Type `'CoAgent'`** with a specific agent target —
6
+ * type-level rows express the resolution-chain default, not a target restriction, and
7
+ * reserved relationship types are ignored until their features ship). Pairing semantics: a
8
+ * co-agent with ZERO such rows is **universal** (it can front any target agent — the
9
+ * zero-config default); a co-agent WITH rows may front exactly the listed targets, with the
10
+ * `IsDefault` row as its preselected target.
11
+ */
12
+ export interface RealtimePairedAgentRow {
13
+ /** The pairing row id. */
14
+ ID: string;
15
+ /** The Realtime-type co-agent the pairing belongs to. */
16
+ CoAgentID: string;
17
+ /** The target agent this co-agent may front. */
18
+ TargetAgentID: string;
19
+ /** Denormalized target-agent display name (from the base view). */
20
+ TargetAgent: string | null;
21
+ /** When true, this target is the co-agent's default (at most one per co-agent). */
22
+ IsDefault: boolean;
23
+ /** Display/list ordering of the pairing rows. */
24
+ Sequence: number | null;
25
+ }
26
+ /** Minimal agent shape the pure pairing/co-agent helpers operate on. */
27
+ export interface RealtimeAgentLike {
28
+ ID: string;
29
+ }
30
+ /**
31
+ * Loads the pairing rows for one co-agent from {@link AIEngineBase}'s cached
32
+ * `MJ: AI Agent Co Agents` metadata (provider-scoped engine instance, lazy `Config`),
33
+ * in `Sequence` order. The engine's BaseEntity-event reactivity keeps the cache fresh —
34
+ * no per-call RunView round-trip.
35
+ *
36
+ * Tolerant by design: any failure degrades to an EMPTY list — i.e. "no pairing
37
+ * constraint". The client gate is pure disclosure; the server independently validates
38
+ * the co-agent/target pairing at session mint.
39
+ */
40
+ export declare function LoadCoAgentPairings(provider: IMetadataProvider, coAgentId: string): Promise<RealtimePairedAgentRow[]>;
41
+ /**
42
+ * Returns the pairing rows in canonical display order: `Sequence` ascending (null/missing
43
+ * sequences last), ties broken by target-agent name. Pure; never mutates the input.
44
+ */
45
+ export declare function SortPairings(pairings: readonly RealtimePairedAgentRow[]): RealtimePairedAgentRow[];
46
+ /**
47
+ * Applies the pairing constraint to a candidate target-agent list:
48
+ * - ZERO pairing rows → the co-agent is universal; the candidates are returned unchanged
49
+ * (today's flow untouched).
50
+ * - One or more rows → only candidates that appear among the pairing targets are
51
+ * returned, ordered by the pairings' `Sequence`. Paired targets the user can't see /
52
+ * run (absent from `agents`) are silently dropped.
53
+ *
54
+ * Pure and UUID-casing safe (`NormalizeUUID` keys).
55
+ */
56
+ export declare function ConstrainTargetsToPairings<T extends RealtimeAgentLike>(agents: readonly T[], pairings: readonly RealtimePairedAgentRow[]): T[];
57
+ /**
58
+ * The co-agent's default target from its pairing rows — the first `IsDefault` row in
59
+ * `Sequence` order (server enforces at most one, but the helper stays deterministic
60
+ * regardless). `null` when there are no rows or none is marked default.
61
+ */
62
+ export declare function DefaultPairedTargetId(pairings: readonly RealtimePairedAgentRow[]): string | null;
63
+ /**
64
+ * Whether the pairing rows permit `targetAgentId` as a target. ZERO rows means the
65
+ * co-agent is universal (always allowed); otherwise the target must appear among the
66
+ * rows. Missing/empty target id is never allowed against a constrained co-agent.
67
+ */
68
+ export declare function PairingsAllowTarget(pairings: readonly RealtimePairedAgentRow[], targetAgentId: string | null | undefined): boolean;
69
+ /**
70
+ * Filters an agent list down to ACTIVE Realtime-type **co-agent** candidates. The input
71
+ * is expected to already be the run-permission-filtered active-agent set the host uses
72
+ * for routing/@mentions, so this only applies the agent-TYPE cut (trim +
73
+ * case-insensitive match on the denormalized `Type` name).
74
+ */
75
+ export declare function FilterRealtimeCoAgents<T extends {
76
+ Type: string | null;
77
+ }>(agents: readonly T[]): T[];
78
+ /**
79
+ * A selectable realtime model option in the voice picker (narrow read-only projection of
80
+ * `MJ: AI Models` — only the fields the dropdown renders).
81
+ */
82
+ export interface RealtimeModelOption {
83
+ /** The `MJ: AI Models` row id. */
84
+ ID: string;
85
+ /** The model's display name. */
86
+ Name: string;
87
+ }
88
+ /**
89
+ * The minimal `MJ: AI Models` row shape {@link BuildRealtimeModelOptions} consumes —
90
+ * structurally satisfied by `AIEngineBase`'s cached `Models` entities.
91
+ */
92
+ export interface VoiceModelCandidate {
93
+ /** The `MJ: AI Models` row id. */
94
+ ID: string;
95
+ /** The model's display name. */
96
+ Name: string;
97
+ /** Denormalized model-type name (e.g. 'LLM', 'Realtime'). */
98
+ AIModelType: string | null;
99
+ /** Whether the model is active and selectable. */
100
+ IsActive: boolean;
101
+ }
102
+ /**
103
+ * Builds the "Voice model" dropdown options from a cached model list: ACTIVE models whose
104
+ * type is `Realtime` (trim + case-insensitive — SQL-collation parity with the previous
105
+ * `IsActive = 1 AND AIModelType = 'Realtime'` filter), projected to {@link RealtimeModelOption}
106
+ * and sorted by Name. Pure; never mutates the input.
107
+ */
108
+ export declare function BuildRealtimeModelOptions(models: ReadonlyArray<VoiceModelCandidate>): RealtimeModelOption[];
109
+ /**
110
+ * Builds the `configOverridesJson` payload for the `StartRealtimeClientSession` mint from
111
+ * what the (authorization-gated) pickers chose. Currently the only override is the
112
+ * explicit realtime model preference; the envelope shape —
113
+ * `{"realtime":{"modelPreference":"<id>"}}` — is the pinned server contract and is
114
+ * structured so future overrides ride alongside without reshaping.
115
+ *
116
+ * @returns The JSON string, or `null` when nothing was overridden (the common case —
117
+ * `null` keeps the mint identical to today's behavior).
118
+ */
119
+ export declare function BuildRealtimeConfigOverridesJson(preferredModelId: string | null | undefined): string | null;
120
+ //# sourceMappingURL=realtime-pairing.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"realtime-pairing.d.ts","sourceRoot":"","sources":["../../../src/lib/services/realtime-pairing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAIzD;;;;;;;;;GASG;AACH,MAAM,WAAW,sBAAsB;IACrC,0BAA0B;IAC1B,EAA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