@memberjunction/ng-conversations 6.2.0-edge.0 → 6.2.0-edge.1

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 (343) hide show
  1. package/README.md +35 -2
  2. package/dist/lib/components/active-tasks/active-tasks-panel.component.d.ts +19 -3
  3. package/dist/lib/components/active-tasks/active-tasks-panel.component.d.ts.map +1 -1
  4. package/dist/lib/components/active-tasks/active-tasks-panel.component.js +39 -7
  5. package/dist/lib/components/active-tasks/active-tasks-panel.component.js.map +1 -1
  6. package/dist/lib/components/agent/active-agent-indicator.component.d.ts +74 -6
  7. package/dist/lib/components/agent/active-agent-indicator.component.d.ts.map +1 -1
  8. package/dist/lib/components/agent/active-agent-indicator.component.js +111 -21
  9. package/dist/lib/components/agent/active-agent-indicator.component.js.map +1 -1
  10. package/dist/lib/components/agent/agent-process-panel.component.d.ts +31 -5
  11. package/dist/lib/components/agent/agent-process-panel.component.d.ts.map +1 -1
  12. package/dist/lib/components/agent/agent-process-panel.component.js +71 -15
  13. package/dist/lib/components/agent/agent-process-panel.component.js.map +1 -1
  14. package/dist/lib/components/artifact/artifact-share-modal.component.d.ts +65 -9
  15. package/dist/lib/components/artifact/artifact-share-modal.component.d.ts.map +1 -1
  16. package/dist/lib/components/artifact/artifact-share-modal.component.js +169 -57
  17. package/dist/lib/components/artifact/artifact-share-modal.component.js.map +1 -1
  18. package/dist/lib/components/attachment/image-viewer.component.d.ts +77 -11
  19. package/dist/lib/components/attachment/image-viewer.component.d.ts.map +1 -1
  20. package/dist/lib/components/attachment/image-viewer.component.js +181 -47
  21. package/dist/lib/components/attachment/image-viewer.component.js.map +1 -1
  22. package/dist/lib/components/collection/artifact-collection-picker-modal.component.d.ts +129 -19
  23. package/dist/lib/components/collection/artifact-collection-picker-modal.component.d.ts.map +1 -1
  24. package/dist/lib/components/collection/artifact-collection-picker-modal.component.js +350 -116
  25. package/dist/lib/components/collection/artifact-collection-picker-modal.component.js.map +1 -1
  26. package/dist/lib/components/collection/artifact-create-modal.component.d.ts +60 -8
  27. package/dist/lib/components/collection/artifact-create-modal.component.d.ts.map +1 -1
  28. package/dist/lib/components/collection/artifact-create-modal.component.js +130 -46
  29. package/dist/lib/components/collection/artifact-create-modal.component.js.map +1 -1
  30. package/dist/lib/components/collection/collection-artifact-card.component.d.ts +63 -3
  31. package/dist/lib/components/collection/collection-artifact-card.component.d.ts.map +1 -1
  32. package/dist/lib/components/collection/collection-artifact-card.component.js +113 -19
  33. package/dist/lib/components/collection/collection-artifact-card.component.js.map +1 -1
  34. package/dist/lib/components/collection/collection-form-modal.component.d.ts +54 -8
  35. package/dist/lib/components/collection/collection-form-modal.component.d.ts.map +1 -1
  36. package/dist/lib/components/collection/collection-form-modal.component.js +130 -46
  37. package/dist/lib/components/collection/collection-form-modal.component.js.map +1 -1
  38. package/dist/lib/components/collection/collection-share-modal.component.d.ts +70 -10
  39. package/dist/lib/components/collection/collection-share-modal.component.d.ts.map +1 -1
  40. package/dist/lib/components/collection/collection-share-modal.component.js +175 -53
  41. package/dist/lib/components/collection/collection-share-modal.component.js.map +1 -1
  42. package/dist/lib/components/collection/collection-tree.component.d.ts +89 -9
  43. package/dist/lib/components/collection/collection-tree.component.d.ts.map +1 -1
  44. package/dist/lib/components/collection/collection-tree.component.js +220 -70
  45. package/dist/lib/components/collection/collection-tree.component.js.map +1 -1
  46. package/dist/lib/components/collection/collection-view.component.d.ts +89 -11
  47. package/dist/lib/components/collection/collection-view.component.d.ts.map +1 -1
  48. package/dist/lib/components/collection/collection-view.component.js +154 -40
  49. package/dist/lib/components/collection/collection-view.component.js.map +1 -1
  50. package/dist/lib/components/collection/collections-full-view.component.d.ts +390 -38
  51. package/dist/lib/components/collection/collections-full-view.component.d.ts.map +1 -1
  52. package/dist/lib/components/collection/collections-full-view.component.js +951 -367
  53. package/dist/lib/components/collection/collections-full-view.component.js.map +1 -1
  54. package/dist/lib/components/composer/ai-composer.component.d.ts +213 -18
  55. package/dist/lib/components/composer/ai-composer.component.d.ts.map +1 -1
  56. package/dist/lib/components/composer/ai-composer.component.js +388 -44
  57. package/dist/lib/components/composer/ai-composer.component.js.map +1 -1
  58. package/dist/lib/components/conversation/conversation-agent-picker.component.d.ts +12 -1
  59. package/dist/lib/components/conversation/conversation-agent-picker.component.d.ts.map +1 -1
  60. package/dist/lib/components/conversation/conversation-agent-picker.component.js +26 -4
  61. package/dist/lib/components/conversation/conversation-agent-picker.component.js.map +1 -1
  62. package/dist/lib/components/conversation/conversation-chat-area.component.d.ts +1090 -123
  63. package/dist/lib/components/conversation/conversation-chat-area.component.d.ts.map +1 -1
  64. package/dist/lib/components/conversation/conversation-chat-area.component.js +2399 -706
  65. package/dist/lib/components/conversation/conversation-chat-area.component.js.map +1 -1
  66. package/dist/lib/components/conversation/conversation-empty-state.component.d.ts +139 -19
  67. package/dist/lib/components/conversation/conversation-empty-state.component.d.ts.map +1 -1
  68. package/dist/lib/components/conversation/conversation-empty-state.component.js +296 -59
  69. package/dist/lib/components/conversation/conversation-empty-state.component.js.map +1 -1
  70. package/dist/lib/components/conversation/conversation-list.component.d.ts +579 -78
  71. package/dist/lib/components/conversation/conversation-list.component.d.ts.map +1 -1
  72. package/dist/lib/components/conversation/conversation-list.component.js +2322 -823
  73. package/dist/lib/components/conversation/conversation-list.component.js.map +1 -1
  74. package/dist/lib/components/conversation/pinned-messages-panel.component.d.ts +40 -4
  75. package/dist/lib/components/conversation/pinned-messages-panel.component.d.ts.map +1 -1
  76. package/dist/lib/components/conversation/pinned-messages-panel.component.js +72 -14
  77. package/dist/lib/components/conversation/pinned-messages-panel.component.js.map +1 -1
  78. package/dist/lib/components/dialogs/input-dialog.component.d.ts +57 -11
  79. package/dist/lib/components/dialogs/input-dialog.component.d.ts.map +1 -1
  80. package/dist/lib/components/dialogs/input-dialog.component.js +128 -16
  81. package/dist/lib/components/dialogs/input-dialog.component.js.map +1 -1
  82. package/dist/lib/components/dialogs/rating-dialog.component.d.ts +68 -10
  83. package/dist/lib/components/dialogs/rating-dialog.component.d.ts.map +1 -1
  84. package/dist/lib/components/dialogs/rating-dialog.component.js +151 -27
  85. package/dist/lib/components/dialogs/rating-dialog.component.js.map +1 -1
  86. package/dist/lib/components/export/export-modal.component.d.ts +84 -10
  87. package/dist/lib/components/export/export-modal.component.d.ts.map +1 -1
  88. package/dist/lib/components/export/export-modal.component.js +173 -49
  89. package/dist/lib/components/export/export-modal.component.js.map +1 -1
  90. package/dist/lib/components/global-tasks/global-tasks-panel.component.d.ts +29 -3
  91. package/dist/lib/components/global-tasks/global-tasks-panel.component.d.ts.map +1 -1
  92. package/dist/lib/components/global-tasks/global-tasks-panel.component.js +58 -12
  93. package/dist/lib/components/global-tasks/global-tasks-panel.component.js.map +1 -1
  94. package/dist/lib/components/library/library-full-view.component.d.ts +57 -8
  95. package/dist/lib/components/library/library-full-view.component.d.ts.map +1 -1
  96. package/dist/lib/components/library/library-full-view.component.js +119 -35
  97. package/dist/lib/components/library/library-full-view.component.js.map +1 -1
  98. package/dist/lib/components/members/members-modal.component.d.ts +76 -10
  99. package/dist/lib/components/members/members-modal.component.d.ts.map +1 -1
  100. package/dist/lib/components/members/members-modal.component.js +164 -50
  101. package/dist/lib/components/members/members-modal.component.js.map +1 -1
  102. package/dist/lib/components/message/actionable-commands.component.d.ts +37 -5
  103. package/dist/lib/components/message/actionable-commands.component.d.ts.map +1 -1
  104. package/dist/lib/components/message/actionable-commands.component.js +82 -16
  105. package/dist/lib/components/message/actionable-commands.component.js.map +1 -1
  106. package/dist/lib/components/message/conversation-message-rating.component.d.ts +46 -10
  107. package/dist/lib/components/message/conversation-message-rating.component.d.ts.map +1 -1
  108. package/dist/lib/components/message/conversation-message-rating.component.js +120 -36
  109. package/dist/lib/components/message/conversation-message-rating.component.js.map +1 -1
  110. package/dist/lib/components/message/message-input.component.d.ts +549 -74
  111. package/dist/lib/components/message/message-input.component.d.ts.map +1 -1
  112. package/dist/lib/components/message/message-input.component.js +1250 -421
  113. package/dist/lib/components/message/message-input.component.js.map +1 -1
  114. package/dist/lib/components/message/message-item.component.d.ts +411 -29
  115. package/dist/lib/components/message/message-item.component.d.ts.map +1 -1
  116. package/dist/lib/components/message/message-item.component.js +896 -222
  117. package/dist/lib/components/message/message-item.component.js.map +1 -1
  118. package/dist/lib/components/message/message-list.component.d.ts +288 -29
  119. package/dist/lib/components/message/message-list.component.d.ts.map +1 -1
  120. package/dist/lib/components/message/message-list.component.js +561 -123
  121. package/dist/lib/components/message/message-list.component.js.map +1 -1
  122. package/dist/lib/components/navigation/conversation-navigation.component.d.ts +64 -5
  123. package/dist/lib/components/navigation/conversation-navigation.component.d.ts.map +1 -1
  124. package/dist/lib/components/navigation/conversation-navigation.component.js +101 -11
  125. package/dist/lib/components/navigation/conversation-navigation.component.js.map +1 -1
  126. package/dist/lib/components/notification/activity-indicator.component.d.ts +6 -2
  127. package/dist/lib/components/notification/activity-indicator.component.d.ts.map +1 -1
  128. package/dist/lib/components/notification/activity-indicator.component.js +13 -3
  129. package/dist/lib/components/notification/activity-indicator.component.js.map +1 -1
  130. package/dist/lib/components/notification/notification-badge.component.d.ts +15 -3
  131. package/dist/lib/components/notification/notification-badge.component.d.ts.map +1 -1
  132. package/dist/lib/components/notification/notification-badge.component.js +36 -8
  133. package/dist/lib/components/notification/notification-badge.component.js.map +1 -1
  134. package/dist/lib/components/overlay/chat-overlay.component.d.ts +1 -1
  135. package/dist/lib/components/overlay/chat-overlay.component.js +4 -4
  136. package/dist/lib/components/overlay/chat-overlay.component.js.map +1 -1
  137. package/dist/lib/components/project/project-form-modal.component.d.ts +93 -11
  138. package/dist/lib/components/project/project-form-modal.component.d.ts.map +1 -1
  139. package/dist/lib/components/project/project-form-modal.component.js +348 -87
  140. package/dist/lib/components/project/project-form-modal.component.js.map +1 -1
  141. package/dist/lib/components/project/project-selector.component.d.ts +78 -8
  142. package/dist/lib/components/project/project-selector.component.d.ts.map +1 -1
  143. package/dist/lib/components/project/project-selector.component.js +177 -46
  144. package/dist/lib/components/project/project-selector.component.js.map +1 -1
  145. package/dist/lib/components/realtime/realtime-activity-rail.component.d.ts +1 -1
  146. package/dist/lib/components/realtime/realtime-activity-rail.component.js +2 -2
  147. package/dist/lib/components/realtime/realtime-activity-rail.component.js.map +1 -1
  148. package/dist/lib/components/realtime/realtime-delegation-card.component.d.ts +1 -1
  149. package/dist/lib/components/realtime/realtime-delegation-card.component.js +2 -2
  150. package/dist/lib/components/realtime/realtime-delegation-card.component.js.map +1 -1
  151. package/dist/lib/components/realtime/realtime-session-overlay.component.d.ts +2 -2
  152. package/dist/lib/components/realtime/realtime-session-overlay.component.js +18 -18
  153. package/dist/lib/components/realtime/realtime-session-overlay.component.js.map +1 -1
  154. package/dist/lib/components/realtime/realtime-session-timeline-card.component.d.ts +47 -23
  155. package/dist/lib/components/realtime/realtime-session-timeline-card.component.d.ts.map +1 -1
  156. package/dist/lib/components/realtime/realtime-session-timeline-card.component.js +136 -92
  157. package/dist/lib/components/realtime/realtime-session-timeline-card.component.js.map +1 -1
  158. package/dist/lib/components/realtime/realtime-surface-tabs.component.d.ts +2 -2
  159. package/dist/lib/components/realtime/realtime-surface-tabs.component.js +4 -4
  160. package/dist/lib/components/realtime/realtime-surface-tabs.component.js.map +1 -1
  161. package/dist/lib/components/realtime/realtime-surface-tabs.model.d.ts +1 -1
  162. package/dist/lib/components/realtime/realtime-surface-tabs.model.js +3 -3
  163. package/dist/lib/components/realtime/realtime-surface-tabs.model.js.map +1 -1
  164. package/dist/lib/components/realtime/realtime-ui-config.d.ts +13 -11
  165. package/dist/lib/components/realtime/realtime-ui-config.d.ts.map +1 -1
  166. package/dist/lib/components/realtime/realtime-ui-config.js +29 -25
  167. package/dist/lib/components/realtime/realtime-ui-config.js.map +1 -1
  168. package/dist/lib/components/realtime/whiteboard/whiteboard-channel.d.ts +3 -1
  169. package/dist/lib/components/realtime/whiteboard/whiteboard-channel.d.ts.map +1 -1
  170. package/dist/lib/components/realtime/whiteboard/whiteboard-channel.js +6 -2
  171. package/dist/lib/components/realtime/whiteboard/whiteboard-channel.js.map +1 -1
  172. package/dist/lib/components/search/search-panel.component.d.ts +133 -22
  173. package/dist/lib/components/search/search-panel.component.d.ts.map +1 -1
  174. package/dist/lib/components/search/search-panel.component.js +312 -83
  175. package/dist/lib/components/search/search-panel.component.js.map +1 -1
  176. package/dist/lib/components/share/share-modal.component.d.ts +69 -9
  177. package/dist/lib/components/share/share-modal.component.d.ts.map +1 -1
  178. package/dist/lib/components/share/share-modal.component.js +139 -31
  179. package/dist/lib/components/share/share-modal.component.js.map +1 -1
  180. package/dist/lib/components/shared/user-picker.component.d.ts +48 -8
  181. package/dist/lib/components/shared/user-picker.component.d.ts.map +1 -1
  182. package/dist/lib/components/shared/user-picker.component.js +110 -30
  183. package/dist/lib/components/shared/user-picker.component.js.map +1 -1
  184. package/dist/lib/components/sidebar/conversation-sidebar.component.d.ts +114 -11
  185. package/dist/lib/components/sidebar/conversation-sidebar.component.d.ts.map +1 -1
  186. package/dist/lib/components/sidebar/conversation-sidebar.component.js +199 -21
  187. package/dist/lib/components/sidebar/conversation-sidebar.component.js.map +1 -1
  188. package/dist/lib/components/sidebar/routines-section.component.d.ts +20 -1
  189. package/dist/lib/components/sidebar/routines-section.component.d.ts.map +1 -1
  190. package/dist/lib/components/sidebar/routines-section.component.js +25 -5
  191. package/dist/lib/components/sidebar/routines-section.component.js.map +1 -1
  192. package/dist/lib/components/slots/slot-interfaces.d.ts +19 -0
  193. package/dist/lib/components/slots/slot-interfaces.d.ts.map +1 -1
  194. package/dist/lib/components/slots/slot-interfaces.js.map +1 -1
  195. package/dist/lib/components/task/tasks-full-view.component.d.ts +95 -13
  196. package/dist/lib/components/task/tasks-full-view.component.d.ts.map +1 -1
  197. package/dist/lib/components/task/tasks-full-view.component.js +223 -75
  198. package/dist/lib/components/task/tasks-full-view.component.js.map +1 -1
  199. package/dist/lib/components/tasks/task-widget.component.d.ts +46 -6
  200. package/dist/lib/components/tasks/task-widget.component.d.ts.map +1 -1
  201. package/dist/lib/components/tasks/task-widget.component.js +100 -16
  202. package/dist/lib/components/tasks/task-widget.component.js.map +1 -1
  203. package/dist/lib/components/tasks/tasks-dropdown.component.d.ts +64 -7
  204. package/dist/lib/components/tasks/tasks-dropdown.component.d.ts.map +1 -1
  205. package/dist/lib/components/tasks/tasks-dropdown.component.js +127 -27
  206. package/dist/lib/components/tasks/tasks-dropdown.component.js.map +1 -1
  207. package/dist/lib/components/thread/thread-panel.component.d.ts +66 -8
  208. package/dist/lib/components/thread/thread-panel.component.d.ts.map +1 -1
  209. package/dist/lib/components/thread/thread-panel.component.js +146 -36
  210. package/dist/lib/components/thread/thread-panel.component.js.map +1 -1
  211. package/dist/lib/components/toast/toast.component.d.ts +11 -1
  212. package/dist/lib/components/toast/toast.component.d.ts.map +1 -1
  213. package/dist/lib/components/toast/toast.component.js +25 -5
  214. package/dist/lib/components/toast/toast.component.js.map +1 -1
  215. package/dist/lib/components/workspace/conversation-workspace.component.d.ts +385 -42
  216. package/dist/lib/components/workspace/conversation-workspace.component.d.ts.map +1 -1
  217. package/dist/lib/components/workspace/conversation-workspace.component.js +887 -291
  218. package/dist/lib/components/workspace/conversation-workspace.component.js.map +1 -1
  219. package/dist/lib/composer-plugins/base-conversation-mention.provider.d.ts +8 -0
  220. package/dist/lib/composer-plugins/base-conversation-mention.provider.d.ts.map +1 -1
  221. package/dist/lib/composer-plugins/base-conversation-mention.provider.js +8 -1
  222. package/dist/lib/composer-plugins/base-conversation-mention.provider.js.map +1 -1
  223. package/dist/lib/directives/chat-slot.directive.d.ts +5 -1
  224. package/dist/lib/directives/chat-slot.directive.d.ts.map +1 -1
  225. package/dist/lib/directives/chat-slot.directive.js.map +1 -1
  226. package/dist/lib/directives/search-shortcut.directive.d.ts +9 -1
  227. package/dist/lib/directives/search-shortcut.directive.d.ts.map +1 -1
  228. package/dist/lib/directives/search-shortcut.directive.js +14 -4
  229. package/dist/lib/directives/search-shortcut.directive.js.map +1 -1
  230. package/dist/lib/events/chat-events.d.ts +34 -7
  231. package/dist/lib/events/chat-events.d.ts.map +1 -1
  232. package/dist/lib/events/chat-events.js +37 -7
  233. package/dist/lib/events/chat-events.js.map +1 -1
  234. package/dist/lib/models/agent-turn.model.d.ts +103 -0
  235. package/dist/lib/models/agent-turn.model.d.ts.map +1 -0
  236. package/dist/lib/models/agent-turn.model.js +12 -0
  237. package/dist/lib/models/agent-turn.model.js.map +1 -0
  238. package/dist/lib/models/collection-view.model.js.map +1 -1
  239. package/dist/lib/models/conversation-state.model.d.ts +8 -0
  240. package/dist/lib/models/conversation-state.model.d.ts.map +1 -1
  241. package/dist/lib/models/conversation-state.model.js.map +1 -1
  242. package/dist/lib/models/lazy-artifact-info.d.ts +44 -12
  243. package/dist/lib/models/lazy-artifact-info.d.ts.map +1 -1
  244. package/dist/lib/models/lazy-artifact-info.js +98 -34
  245. package/dist/lib/models/lazy-artifact-info.js.map +1 -1
  246. package/dist/lib/services/active-tasks.service.d.ts +30 -4
  247. package/dist/lib/services/active-tasks.service.d.ts.map +1 -1
  248. package/dist/lib/services/active-tasks.service.js +71 -19
  249. package/dist/lib/services/active-tasks.service.js.map +1 -1
  250. package/dist/lib/services/agent-state.service.d.ts +17 -1
  251. package/dist/lib/services/agent-state.service.d.ts.map +1 -1
  252. package/dist/lib/services/agent-state.service.js +48 -16
  253. package/dist/lib/services/agent-state.service.js.map +1 -1
  254. package/dist/lib/services/artifact-permission.service.d.ts +39 -0
  255. package/dist/lib/services/artifact-permission.service.d.ts.map +1 -1
  256. package/dist/lib/services/artifact-permission.service.js +152 -17
  257. package/dist/lib/services/artifact-permission.service.js.map +1 -1
  258. package/dist/lib/services/artifact-state.service.d.ts +58 -5
  259. package/dist/lib/services/artifact-state.service.d.ts.map +1 -1
  260. package/dist/lib/services/artifact-state.service.js +135 -35
  261. package/dist/lib/services/artifact-state.service.js.map +1 -1
  262. package/dist/lib/services/collection-permission.service.d.ts +28 -0
  263. package/dist/lib/services/collection-permission.service.d.ts.map +1 -1
  264. package/dist/lib/services/collection-permission.service.js +88 -32
  265. package/dist/lib/services/collection-permission.service.js.map +1 -1
  266. package/dist/lib/services/collection-state.service.d.ts +11 -1
  267. package/dist/lib/services/collection-state.service.d.ts.map +1 -1
  268. package/dist/lib/services/collection-state.service.js +25 -5
  269. package/dist/lib/services/collection-state.service.js.map +1 -1
  270. package/dist/lib/services/conversation-agent.service.d.ts +26 -4
  271. package/dist/lib/services/conversation-agent.service.d.ts.map +1 -1
  272. package/dist/lib/services/conversation-agent.service.js +57 -18
  273. package/dist/lib/services/conversation-agent.service.js.map +1 -1
  274. package/dist/lib/services/conversation-attachment.service.d.ts +17 -0
  275. package/dist/lib/services/conversation-attachment.service.d.ts.map +1 -1
  276. package/dist/lib/services/conversation-attachment.service.js +38 -10
  277. package/dist/lib/services/conversation-attachment.service.js.map +1 -1
  278. package/dist/lib/services/conversation-streaming.service.d.ts +22 -0
  279. package/dist/lib/services/conversation-streaming.service.d.ts.map +1 -1
  280. package/dist/lib/services/conversation-streaming.service.js +50 -10
  281. package/dist/lib/services/conversation-streaming.service.js.map +1 -1
  282. package/dist/lib/services/data-cache.service.d.ts +31 -0
  283. package/dist/lib/services/data-cache.service.d.ts.map +1 -1
  284. package/dist/lib/services/data-cache.service.js +71 -15
  285. package/dist/lib/services/data-cache.service.js.map +1 -1
  286. package/dist/lib/services/dialog.service.d.ts +13 -0
  287. package/dist/lib/services/dialog.service.d.ts.map +1 -1
  288. package/dist/lib/services/dialog.service.js +25 -5
  289. package/dist/lib/services/dialog.service.js.map +1 -1
  290. package/dist/lib/services/export.service.d.ts +2 -0
  291. package/dist/lib/services/export.service.d.ts.map +1 -1
  292. package/dist/lib/services/export.service.js +5 -1
  293. package/dist/lib/services/export.service.js.map +1 -1
  294. package/dist/lib/services/mention-parser.service.d.ts +10 -0
  295. package/dist/lib/services/mention-parser.service.d.ts.map +1 -1
  296. package/dist/lib/services/mention-parser.service.js +25 -5
  297. package/dist/lib/services/mention-parser.service.js.map +1 -1
  298. package/dist/lib/services/notification.service.d.ts +54 -6
  299. package/dist/lib/services/notification.service.d.ts.map +1 -1
  300. package/dist/lib/services/notification.service.js +123 -27
  301. package/dist/lib/services/notification.service.js.map +1 -1
  302. package/dist/lib/services/realtime-audio-recorder.d.ts +4 -4
  303. package/dist/lib/services/realtime-audio-recorder.js +12 -12
  304. package/dist/lib/services/realtime-audio-recorder.js.map +1 -1
  305. package/dist/lib/services/realtime-pcm-wav.d.ts +4 -0
  306. package/dist/lib/services/realtime-pcm-wav.d.ts.map +1 -1
  307. package/dist/lib/services/realtime-pcm-wav.js +10 -2
  308. package/dist/lib/services/realtime-pcm-wav.js.map +1 -1
  309. package/dist/lib/services/search.service.d.ts +42 -9
  310. package/dist/lib/services/search.service.d.ts.map +1 -1
  311. package/dist/lib/services/search.service.js +103 -23
  312. package/dist/lib/services/search.service.js.map +1 -1
  313. package/dist/lib/services/toast.service.d.ts +19 -1
  314. package/dist/lib/services/toast.service.d.ts.map +1 -1
  315. package/dist/lib/services/toast.service.js +45 -9
  316. package/dist/lib/services/toast.service.js.map +1 -1
  317. package/dist/lib/services/ui-command-handler.service.d.ts +16 -2
  318. package/dist/lib/services/ui-command-handler.service.d.ts.map +1 -1
  319. package/dist/lib/services/ui-command-handler.service.js +36 -8
  320. package/dist/lib/services/ui-command-handler.service.js.map +1 -1
  321. package/dist/lib/utils/agent-artifact-summary.d.ts +2 -2
  322. package/dist/lib/utils/agent-artifact-summary.js +3 -3
  323. package/dist/lib/utils/agent-artifact-summary.js.map +1 -1
  324. package/dist/lib/utils/agent-turn-routing.d.ts +69 -0
  325. package/dist/lib/utils/agent-turn-routing.d.ts.map +1 -0
  326. package/dist/lib/utils/agent-turn-routing.js +96 -0
  327. package/dist/lib/utils/agent-turn-routing.js.map +1 -0
  328. package/dist/lib/utils/artifact-panel-action.d.ts +15 -4
  329. package/dist/lib/utils/artifact-panel-action.d.ts.map +1 -1
  330. package/dist/lib/utils/artifact-panel-action.js +10 -2
  331. package/dist/lib/utils/artifact-panel-action.js.map +1 -1
  332. package/dist/lib/utils/distinct-artifacts.d.ts +2 -0
  333. package/dist/lib/utils/distinct-artifacts.d.ts.map +1 -1
  334. package/dist/lib/utils/distinct-artifacts.js +5 -1
  335. package/dist/lib/utils/distinct-artifacts.js.map +1 -1
  336. package/dist/lib/utils/plan-mode-preference.d.ts +2 -2
  337. package/dist/lib/utils/plan-mode-preference.js +6 -6
  338. package/dist/lib/utils/plan-mode-preference.js.map +1 -1
  339. package/dist/public-api.d.ts +3 -0
  340. package/dist/public-api.d.ts.map +1 -1
  341. package/dist/public-api.js +3 -0
  342. package/dist/public-api.js.map +1 -1
  343. package/package.json +32 -32
@@ -17,15 +17,39 @@ export class NotificationService {
17
17
  _notificationItems$ = new BehaviorSubject([]);
18
18
  _changeEvents$ = new Subject();
19
19
  // Public observables
20
- notifications$ = this._notifications$.asObservable();
21
- preferences$ = this._preferences$.asObservable();
22
- notificationItems$ = this._notificationItems$.asObservable();
23
- changeEvents$ = this._changeEvents$.asObservable();
20
+ Notifications$ = this._notifications$.asObservable();
21
+ /** @deprecated Use {@link Notifications$}. */
22
+ get notifications$() {
23
+ return this.Notifications$;
24
+ }
25
+ Preferences$ = this._preferences$.asObservable();
26
+ /** @deprecated Use {@link Preferences$}. */
27
+ get preferences$() {
28
+ return this.Preferences$;
29
+ }
30
+ NotificationItems$ = this._notificationItems$.asObservable();
31
+ /** @deprecated Use {@link NotificationItems$}. */
32
+ get notificationItems$() {
33
+ return this.NotificationItems$;
34
+ }
35
+ ChangeEvents$ = this._changeEvents$.asObservable();
36
+ /** @deprecated Use {@link ChangeEvents$}. */
37
+ get changeEvents$() {
38
+ return this.ChangeEvents$;
39
+ }
24
40
  // Derived observables
25
- totalUnreadCount$ = this.notifications$.pipe(map(notifications => {
41
+ TotalUnreadCount$ = this.Notifications$.pipe(map(notifications => {
26
42
  return Object.values(notifications).reduce((sum, notif) => sum + notif.unreadMessageCount, 0);
27
43
  }), shareReplay(1));
28
- hasAnyNotifications$ = this.totalUnreadCount$.pipe(map(count => count > 0), shareReplay(1));
44
+ /** @deprecated Use {@link TotalUnreadCount$}. */
45
+ get totalUnreadCount$() {
46
+ return this.TotalUnreadCount$;
47
+ }
48
+ HasAnyNotifications$ = this.TotalUnreadCount$.pipe(map(count => count > 0), shareReplay(1));
49
+ /** @deprecated Use {@link HasAnyNotifications$}. */
50
+ get hasAnyNotifications$() {
51
+ return this.HasAnyNotifications$;
52
+ }
29
53
  constructor(ngZone) {
30
54
  this.ngZone = ngZone;
31
55
  this.loadFromStorage();
@@ -34,20 +58,28 @@ export class NotificationService {
34
58
  /**
35
59
  * Gets notification state for a specific conversation
36
60
  */
37
- getConversationNotification(conversationId) {
61
+ GetConversationNotification(conversationId) {
38
62
  return this._notifications$.value[conversationId] || null;
39
63
  }
64
+ /** @deprecated Use {@link GetConversationNotification}. */
65
+ getConversationNotification(conversationId) {
66
+ return this.GetConversationNotification(conversationId);
67
+ }
40
68
  /**
41
69
  * Gets notification observable for a specific conversation
42
70
  */
71
+ GetConversationNotification$(conversationId) {
72
+ return this.Notifications$.pipe(map(notifications => notifications[conversationId] || null), shareReplay(1));
73
+ }
74
+ /** @deprecated Use {@link GetConversationNotification$}. */
43
75
  getConversationNotification$(conversationId) {
44
- return this.notifications$.pipe(map(notifications => notifications[conversationId] || null), shareReplay(1));
76
+ return this.GetConversationNotification$(conversationId);
45
77
  }
46
78
  /**
47
79
  * Gets badge configuration for a conversation
48
80
  */
49
- getBadgeConfig(conversationId) {
50
- const notification = this.getConversationNotification(conversationId);
81
+ GetBadgeConfig(conversationId) {
82
+ const notification = this.GetConversationNotification(conversationId);
51
83
  if (!notification) {
52
84
  return { show: false };
53
85
  }
@@ -84,16 +116,24 @@ export class NotificationService {
84
116
  animate
85
117
  };
86
118
  }
119
+ /** @deprecated Use {@link GetBadgeConfig}. */
120
+ getBadgeConfig(conversationId) {
121
+ return this.GetBadgeConfig(conversationId);
122
+ }
87
123
  /**
88
124
  * Gets badge configuration observable for a conversation
89
125
  */
126
+ GetBadgeConfig$(conversationId) {
127
+ return this.Notifications$.pipe(map(() => this.GetBadgeConfig(conversationId)), shareReplay(1));
128
+ }
129
+ /** @deprecated Use {@link GetBadgeConfig$}. */
90
130
  getBadgeConfig$(conversationId) {
91
- return this.notifications$.pipe(map(() => this.getBadgeConfig(conversationId)), shareReplay(1));
131
+ return this.GetBadgeConfig$(conversationId);
92
132
  }
93
133
  /**
94
134
  * Tracks a new message in a conversation
95
135
  */
96
- trackNewMessage(conversationId, messageTimestamp, priority = 'normal') {
136
+ TrackNewMessage(conversationId, messageTimestamp, priority = 'normal') {
97
137
  const notifications = { ...this._notifications$.value };
98
138
  const existing = notifications[conversationId];
99
139
  if (existing) {
@@ -116,10 +156,14 @@ export class NotificationService {
116
156
  this.emitChangeEvent(conversationId, 'message', 'added');
117
157
  this.playNotificationSound();
118
158
  }
159
+ /** @deprecated Use {@link TrackNewMessage}. */
160
+ trackNewMessage(conversationId, messageTimestamp, priority = 'normal') {
161
+ return this.TrackNewMessage(conversationId, messageTimestamp, priority);
162
+ }
119
163
  /**
120
164
  * Tracks multiple new messages at once (batch operation)
121
165
  */
122
- trackNewMessages(conversationId, count, latestTimestamp, priority = 'normal') {
166
+ TrackNewMessages(conversationId, count, latestTimestamp, priority = 'normal') {
123
167
  const notifications = { ...this._notifications$.value };
124
168
  const existing = notifications[conversationId];
125
169
  if (existing) {
@@ -142,10 +186,14 @@ export class NotificationService {
142
186
  this.emitChangeEvent(conversationId, 'message', 'added');
143
187
  this.playNotificationSound();
144
188
  }
189
+ /** @deprecated Use {@link TrackNewMessages}. */
190
+ trackNewMessages(conversationId, count, latestTimestamp, priority = 'normal') {
191
+ return this.TrackNewMessages(conversationId, count, latestTimestamp, priority);
192
+ }
145
193
  /**
146
194
  * Tracks a new artifact notification
147
195
  */
148
- trackNewArtifact(conversationId) {
196
+ TrackNewArtifact(conversationId) {
149
197
  const notifications = { ...this._notifications$.value };
150
198
  const existing = notifications[conversationId];
151
199
  if (existing) {
@@ -165,10 +213,14 @@ export class NotificationService {
165
213
  this.updateNotifications(notifications);
166
214
  this.emitChangeEvent(conversationId, 'artifact', 'added');
167
215
  }
216
+ /** @deprecated Use {@link TrackNewArtifact}. */
217
+ trackNewArtifact(conversationId) {
218
+ return this.TrackNewArtifact(conversationId);
219
+ }
168
220
  /**
169
221
  * Tracks an active agent process
170
222
  */
171
- trackAgentProcess(conversationId, isActive) {
223
+ TrackAgentProcess(conversationId, isActive) {
172
224
  const notifications = { ...this._notifications$.value };
173
225
  const existing = notifications[conversationId];
174
226
  if (existing) {
@@ -189,10 +241,14 @@ export class NotificationService {
189
241
  this.updateNotifications(notifications);
190
242
  this.emitChangeEvent(conversationId, 'agent_process', isActive ? 'added' : 'cleared');
191
243
  }
244
+ /** @deprecated Use {@link TrackAgentProcess}. */
245
+ trackAgentProcess(conversationId, isActive) {
246
+ return this.TrackAgentProcess(conversationId, isActive);
247
+ }
192
248
  /**
193
249
  * Marks a conversation as read (clears unread message count)
194
250
  */
195
- markConversationAsRead(conversationId) {
251
+ MarkConversationAsRead(conversationId) {
196
252
  const notifications = { ...this._notifications$.value };
197
253
  const existing = notifications[conversationId];
198
254
  if (existing && existing.unreadMessageCount > 0) {
@@ -205,10 +261,14 @@ export class NotificationService {
205
261
  this.emitChangeEvent(conversationId, 'message', 'read');
206
262
  }
207
263
  }
264
+ /** @deprecated Use {@link MarkConversationAsRead}. */
265
+ markConversationAsRead(conversationId) {
266
+ return this.MarkConversationAsRead(conversationId);
267
+ }
208
268
  /**
209
269
  * Clears artifact notifications for a conversation
210
270
  */
211
- clearArtifactNotifications(conversationId) {
271
+ ClearArtifactNotifications(conversationId) {
212
272
  const notifications = { ...this._notifications$.value };
213
273
  const existing = notifications[conversationId];
214
274
  if (existing && (existing.hasNewArtifacts || existing.newArtifactCount > 0)) {
@@ -221,10 +281,14 @@ export class NotificationService {
221
281
  this.emitChangeEvent(conversationId, 'artifact', 'cleared');
222
282
  }
223
283
  }
284
+ /** @deprecated Use {@link ClearArtifactNotifications}. */
285
+ clearArtifactNotifications(conversationId) {
286
+ return this.ClearArtifactNotifications(conversationId);
287
+ }
224
288
  /**
225
289
  * Clears all notifications for a conversation
226
290
  */
227
- clearAllNotifications(conversationId) {
291
+ ClearAllNotifications(conversationId) {
228
292
  const notifications = { ...this._notifications$.value };
229
293
  if (notifications[conversationId]) {
230
294
  delete notifications[conversationId];
@@ -232,51 +296,75 @@ export class NotificationService {
232
296
  this.emitChangeEvent(conversationId, 'message', 'cleared');
233
297
  }
234
298
  }
299
+ /** @deprecated Use {@link ClearAllNotifications}. */
300
+ clearAllNotifications(conversationId) {
301
+ return this.ClearAllNotifications(conversationId);
302
+ }
235
303
  /**
236
304
  * Clears all notifications across all conversations
237
305
  */
238
- clearAllNotificationsGlobal() {
306
+ ClearAllNotificationsGlobal() {
239
307
  this.updateNotifications({});
240
308
  }
309
+ /** @deprecated Use {@link ClearAllNotificationsGlobal}. */
310
+ clearAllNotificationsGlobal() {
311
+ return this.ClearAllNotificationsGlobal();
312
+ }
241
313
  /**
242
314
  * Updates notification preferences
243
315
  */
244
- updatePreferences(preferences) {
316
+ UpdatePreferences(preferences) {
245
317
  const current = this._preferences$.value;
246
318
  const updated = { ...current, ...preferences };
247
319
  this._preferences$.next(updated);
248
320
  this.saveToStorage();
249
321
  }
322
+ /** @deprecated Use {@link UpdatePreferences}. */
323
+ updatePreferences(preferences) {
324
+ return this.UpdatePreferences(preferences);
325
+ }
250
326
  /**
251
327
  * Mutes a conversation
252
328
  */
253
- muteConversation(conversationId) {
329
+ MuteConversation(conversationId) {
254
330
  const prefs = this._preferences$.value;
255
331
  if (!prefs.mutedConversations.includes(conversationId)) {
256
- this.updatePreferences({
332
+ this.UpdatePreferences({
257
333
  mutedConversations: [...prefs.mutedConversations, conversationId]
258
334
  });
259
335
  }
260
336
  }
337
+ /** @deprecated Use {@link MuteConversation}. */
338
+ muteConversation(conversationId) {
339
+ return this.MuteConversation(conversationId);
340
+ }
261
341
  /**
262
342
  * Unmutes a conversation
263
343
  */
264
- unmuteConversation(conversationId) {
344
+ UnmuteConversation(conversationId) {
265
345
  const prefs = this._preferences$.value;
266
- this.updatePreferences({
346
+ this.UpdatePreferences({
267
347
  mutedConversations: prefs.mutedConversations.filter(id => id !== conversationId)
268
348
  });
269
349
  }
350
+ /** @deprecated Use {@link UnmuteConversation}. */
351
+ unmuteConversation(conversationId) {
352
+ return this.UnmuteConversation(conversationId);
353
+ }
270
354
  /**
271
355
  * Checks if a conversation is muted
272
356
  */
273
- isConversationMuted(conversationId) {
357
+ IsConversationMuted(conversationId) {
274
358
  return this._preferences$.value.mutedConversations.includes(conversationId);
275
359
  }
360
+ /** @deprecated Use {@link IsConversationMuted}. */
361
+ isConversationMuted(conversationId) {
362
+ return this.IsConversationMuted(conversationId);
363
+ }
276
364
  /**
277
365
  * Requests desktop notification permission
278
366
  */
279
- async requestDesktopPermission() {
367
+ async RequestDesktopPermission() {
280
368
  if (!('Notification' in window)) {
281
369
  console.warn('Desktop notifications not supported');
282
370
  return false;
@@ -290,10 +378,14 @@ export class NotificationService {
290
378
  }
291
379
  return false;
292
380
  }
381
+ /** @deprecated Use {@link RequestDesktopPermission}. */
382
+ async requestDesktopPermission() {
383
+ return this.RequestDesktopPermission();
384
+ }
293
385
  /**
294
386
  * Shows a desktop notification
295
387
  */
296
- showDesktopNotification(title, body, conversationId) {
388
+ ShowDesktopNotification(title, body, conversationId) {
297
389
  if (!this._preferences$.value.enableDesktopNotifications) {
298
390
  return;
299
391
  }
@@ -311,6 +403,10 @@ export class NotificationService {
311
403
  };
312
404
  }
313
405
  }
406
+ /** @deprecated Use {@link ShowDesktopNotification}. */
407
+ showDesktopNotification(title, body, conversationId) {
408
+ return this.ShowDesktopNotification(title, body, conversationId);
409
+ }
314
410
  // Private helper methods
315
411
  createNewNotification(conversationId, overrides) {
316
412
  return {
@@ -1 +1 @@
1
- {"version":3,"file":"notification.service.js","sourceRoot":"","sources":["../../../src/lib/services/notification.service.ts"],"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K,GAAG;gBACZ,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;gBACrB,IAAI,EAAE,IAAI,CAAC,eAAe,CAAC,KAAK;aACjC,CAAC;YACF,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC,iBAAiB,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC;QACtE,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,KAAK,CAAC,yCAAyC,EAAE,KAAK,CAAC,CAAC;QAClE,CAAC;IACH,CAAC;IAEO,oBAAoB;QAC1B,qCAAqC;QACrC,IAAI,CAAC,MAAM,CAAC,iBAAiB,CAAC,GAAG,EAAE;YACjC,SAAS,CAAe,MAAM,EAAE,SAAS,CAAC;iBACvC,IAAI,CACH,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,GAAG,KAAK,IAAI,CAAC,WAAW,IAAI,KAAK,CAAC,GAAG,KAAK,IAAI,CAAC,iBAAiB,CAAC,CACxF;iBACA,SAAS,CAAC,KAAK,CAAC,EAAE;gBACjB,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE;oBACnB,IAAI,CAAC,eAAe,EAAE,CAAC;gBACzB,CAAC,CAAC,CAAC;YACL,CAAC,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;IACL,CAAC;6GAxeU,mBAAmB;gEAAnB,mBAAmB,WAAnB,mBAAmB,mBAFlB,MAAM;;iFAEP,mBAAmB;cAH/B,UAAU;eAAC;gBACV,UAAU,EAAE,MAAM;aACnB","sourcesContent":["import { Injectable, NgZone } from '@angular/core';\nimport { BehaviorSubject, Observable, Subject, fromEvent } from 'rxjs';\nimport { filter, map, shareReplay } from 'rxjs/operators';\nimport {\n ConversationNotification,\n NotificationItem,\n NotificationPreferences,\n NotificationState,\n NotificationType,\n NotificationPriority,\n NotificationChangeEvent,\n BadgeConfig,\n DEFAULT_NOTIFICATION_PREFERENCES\n} from '../models/notification.model';\n\n/**\n * Service for managing notifications across conversations\n * Provides real-time notification tracking, persistence, and cross-tab synchronization\n */\n@Injectable({\n providedIn: 'root'\n})\nexport class NotificationService {\n private readonly STORAGE_KEY = 'mj_conversation_notifications';\n private readonly STORAGE_EVENT_KEY = 'mj_notification_change';\n\n // Internal state\n private _notifications$ = new BehaviorSubject<Record<string, ConversationNotification>>({});\n private _preferences$ = new BehaviorSubject<NotificationPreferences>(DEFAULT_NOTIFICATION_PREFERENCES);\n private _notificationItems$ = new BehaviorSubject<NotificationItem[]>([]);\n private _changeEvents$ = new Subject<NotificationChangeEvent>();\n\n // Public observables\n public readonly notifications$ = this._notifications$.asObservable();\n public readonly preferences$ = this._preferences$.asObservable();\n public readonly notificationItems$ = this._notificationItems$.asObservable();\n public readonly changeEvents$ = this._changeEvents$.asObservable();\n\n // Derived observables\n public readonly totalUnreadCount$: Observable<number> = this.notifications$.pipe(\n map(notifications => {\n return Object.values(notifications).reduce(\n (sum, notif) => sum + notif.unreadMessageCount,\n 0\n );\n }),\n shareReplay(1)\n );\n\n public readonly hasAnyNotifications$: Observable<boolean> = this.totalUnreadCount$.pipe(\n map(count => count > 0),\n shareReplay(1)\n );\n\n constructor(private ngZone: NgZone) {\n this.loadFromStorage();\n this.setupStorageListener();\n }\n\n /**\n * Gets notification state for a specific conversation\n */\n getConversationNotification(conversationId: string): ConversationNotification | null {\n return this._notifications$.value[conversationId] || null;\n }\n\n /**\n * Gets notification observable for a specific conversation\n */\n getConversationNotification$(conversationId: string): Observable<ConversationNotification | null> {\n return this.notifications$.pipe(\n map(notifications => notifications[conversationId] || null),\n shareReplay(1)\n );\n }\n\n /**\n * Gets badge configuration for a conversation\n */\n getBadgeConfig(conversationId: string): BadgeConfig {\n const notification = this.getConversationNotification(conversationId);\n\n if (!notification) {\n return { show: false };\n }\n\n const prefs = this._preferences$.value;\n if (!prefs.showBadges || prefs.mutedConversations.includes(conversationId)) {\n return { show: false };\n }\n\n // Check if muted temporarily\n if (prefs.muteUntil && new Date() < prefs.muteUntil) {\n return { show: false };\n }\n\n const totalNotifications =\n notification.unreadMessageCount +\n notification.newArtifactCount +\n notification.activeAgentProcessCount;\n\n if (totalNotifications === 0) {\n return { show: false };\n }\n\n // Determine badge type based on notification content\n let type: BadgeConfig['type'] = 'count';\n let animate = false;\n\n if (notification.activeAgentProcessCount > 0) {\n type = 'pulse';\n animate = true;\n } else if (notification.newArtifactCount > 0) {\n type = 'new';\n animate = true;\n }\n\n return {\n show: true,\n count: totalNotifications,\n type,\n priority: notification.highestPriority,\n animate\n };\n }\n\n /**\n * Gets badge configuration observable for a conversation\n */\n getBadgeConfig$(conversationId: string): Observable<BadgeConfig> {\n return this.notifications$.pipe(\n map(() => this.getBadgeConfig(conversationId)),\n shareReplay(1)\n );\n }\n\n /**\n * Tracks a new message in a conversation\n */\n trackNewMessage(conversationId: string, messageTimestamp: Date, priority: NotificationPriority = 'normal'): void {\n const notifications = { ...this._notifications$.value };\n const existing = notifications[conversationId];\n\n if (existing) {\n notifications[conversationId] = {\n ...existing,\n unreadMessageCount: existing.unreadMessageCount + 1,\n lastMessageTimestamp: messageTimestamp,\n lastNotificationTimestamp: new Date(),\n highestPriority: this.getHigherPriority(existing.highestPriority, priority)\n };\n } else {\n notifications[conversationId] = this.createNewNotification(conversationId, {\n unreadMessageCount: 1,\n lastMessageTimestamp: messageTimestamp,\n highestPriority: priority\n });\n }\n\n this.updateNotifications(notifications);\n this.emitChangeEvent(conversationId, 'message', 'added');\n this.playNotificationSound();\n }\n\n /**\n * Tracks multiple new messages at once (batch operation)\n */\n trackNewMessages(conversationId: string, count: number, latestTimestamp: Date, priority: NotificationPriority = 'normal'): void {\n const notifications = { ...this._notifications$.value };\n const existing = notifications[conversationId];\n\n if (existing) {\n notifications[conversationId] = {\n ...existing,\n unreadMessageCount: existing.unreadMessageCount + count,\n lastMessageTimestamp: latestTimestamp,\n lastNotificationTimestamp: new Date(),\n highestPriority: this.getHigherPriority(existing.highestPriority, priority)\n };\n } else {\n notifications[conversationId] = this.createNewNotification(conversationId, {\n unreadMessageCount: count,\n lastMessageTimestamp: latestTimestamp,\n highestPriority: priority\n });\n }\n\n this.updateNotifications(notifications);\n this.emitChangeEvent(conversationId, 'message', 'added');\n this.playNotificationSound();\n }\n\n /**\n * Tracks a new artifact notification\n */\n trackNewArtifact(conversationId: string): void {\n const notifications = { ...this._notifications$.value };\n const existing = notifications[conversationId];\n\n if (existing) {\n notifications[conversationId] = {\n ...existing,\n hasNewArtifacts: true,\n newArtifactCount: existing.newArtifactCount + 1,\n lastNotificationTimestamp: new Date()\n };\n } else {\n notifications[conversationId] = this.createNewNotification(conversationId, {\n hasNewArtifacts: true,\n newArtifactCount: 1\n });\n }\n\n this.updateNotifications(notifications);\n this.emitChangeEvent(conversationId, 'artifact', 'added');\n }\n\n /**\n * Tracks an active agent process\n */\n trackAgentProcess(conversationId: string, isActive: boolean): void {\n const notifications = { ...this._notifications$.value };\n const existing = notifications[conversationId];\n\n if (existing) {\n const countChange = isActive ? 1 : -1;\n notifications[conversationId] = {\n ...existing,\n hasActiveAgentProcesses: isActive ? true : (existing.activeAgentProcessCount - 1) > 0,\n activeAgentProcessCount: Math.max(0, existing.activeAgentProcessCount + countChange),\n lastNotificationTimestamp: new Date()\n };\n } else if (isActive) {\n notifications[conversationId] = this.createNewNotification(conversationId, {\n hasActiveAgentProcesses: true,\n activeAgentProcessCount: 1\n });\n }\n\n this.updateNotifications(notifications);\n this.emitChangeEvent(conversationId, 'agent_process', isActive ? 'added' : 'cleared');\n }\n\n /**\n * Marks a conversation as read (clears unread message count)\n */\n markConversationAsRead(conversationId: string): void {\n const notifications = { ...this._notifications$.value };\n const existing = notifications[conversationId];\n\n if (existing && existing.unreadMessageCount > 0) {\n notifications[conversationId] = {\n ...existing,\n unreadMessageCount: 0,\n lastReadMessageTimestamp: new Date()\n };\n\n this.updateNotifications(notifications);\n this.emitChangeEvent(conversationId, 'message', 'read');\n }\n }\n\n /**\n * Clears artifact notifications for a conversation\n */\n clearArtifactNotifications(conversationId: string): void {\n const notifications = { ...this._notifications$.value };\n const existing = notifications[conversationId];\n\n if (existing && (existing.hasNewArtifacts || existing.newArtifactCount > 0)) {\n notifications[conversationId] = {\n ...existing,\n hasNewArtifacts: false,\n newArtifactCount: 0\n };\n\n this.updateNotifications(notifications);\n this.emitChangeEvent(conversationId, 'artifact', 'cleared');\n }\n }\n\n /**\n * Clears all notifications for a conversation\n */\n clearAllNotifications(conversationId: string): void {\n const notifications = { ...this._notifications$.value };\n\n if (notifications[conversationId]) {\n delete notifications[conversationId];\n this.updateNotifications(notifications);\n this.emitChangeEvent(conversationId, 'message', 'cleared');\n }\n }\n\n /**\n * Clears all notifications across all conversations\n */\n clearAllNotificationsGlobal(): void {\n this.updateNotifications({});\n }\n\n /**\n * Updates notification preferences\n */\n updatePreferences(preferences: Partial<NotificationPreferences>): void {\n const current = this._preferences$.value;\n const updated = { ...current, ...preferences };\n this._preferences$.next(updated);\n this.saveToStorage();\n }\n\n /**\n * Mutes a conversation\n */\n muteConversation(conversationId: string): void {\n const prefs = this._preferences$.value;\n if (!prefs.mutedConversations.includes(conversationId)) {\n this.updatePreferences({\n mutedConversations: [...prefs.mutedConversations, conversationId]\n });\n }\n }\n\n /**\n * Unmutes a conversation\n */\n unmuteConversation(conversationId: string): void {\n const prefs = this._preferences$.value;\n this.updatePreferences({\n mutedConversations: prefs.mutedConversations.filter(id => id !== conversationId)\n });\n }\n\n /**\n * Checks if a conversation is muted\n */\n isConversationMuted(conversationId: string): boolean {\n return this._preferences$.value.mutedConversations.includes(conversationId);\n }\n\n /**\n * Requests desktop notification permission\n */\n async requestDesktopPermission(): Promise<boolean> {\n if (!('Notification' in window)) {\n console.warn('Desktop notifications not supported');\n return false;\n }\n\n if (Notification.permission === 'granted') {\n return true;\n }\n\n if (Notification.permission !== 'denied') {\n const permission = await Notification.requestPermission();\n return permission === 'granted';\n }\n\n return false;\n }\n\n /**\n * Shows a desktop notification\n */\n showDesktopNotification(title: string, body: string, conversationId: string): void {\n if (!this._preferences$.value.enableDesktopNotifications) {\n return;\n }\n\n if ('Notification' in window && Notification.permission === 'granted') {\n const notification = new Notification(title, {\n body,\n icon: '/assets/icons/notification-icon.png',\n badge: '/assets/icons/badge-icon.png',\n tag: conversationId,\n requireInteraction: false\n });\n\n notification.onclick = () => {\n window.focus();\n notification.close();\n };\n }\n }\n\n // Private helper methods\n\n private createNewNotification(\n conversationId: string,\n overrides?: Partial<ConversationNotification>\n ): ConversationNotification {\n return {\n conversationId,\n unreadMessageCount: 0,\n lastReadMessageTimestamp: null,\n lastMessageTimestamp: null,\n hasNewArtifacts: false,\n hasActiveAgentProcesses: false,\n newArtifactCount: 0,\n activeAgentProcessCount: 0,\n lastNotificationTimestamp: new Date(),\n highestPriority: 'normal',\n ...overrides\n };\n }\n\n private updateNotifications(notifications: Record<string, ConversationNotification>): void {\n this._notifications$.next(notifications);\n this.saveToStorage();\n this.broadcastChange();\n }\n\n private emitChangeEvent(conversationId: string, type: NotificationType, action: 'added' | 'read' | 'cleared'): void {\n this._changeEvents$.next({\n conversationId,\n type,\n action,\n timestamp: new Date()\n });\n }\n\n private getHigherPriority(current: NotificationPriority, newPriority: NotificationPriority): NotificationPriority {\n const priorityOrder: NotificationPriority[] = ['low', 'normal', 'high', 'urgent'];\n const currentIndex = priorityOrder.indexOf(current);\n const newIndex = priorityOrder.indexOf(newPriority);\n return newIndex > currentIndex ? newPriority : current;\n }\n\n private playNotificationSound(): void {\n if (!this._preferences$.value.enableSound) {\n return;\n }\n\n // Create and play a subtle notification sound\n const audioContext = new (window.AudioContext || (window as any).webkitAudioContext)();\n const oscillator = audioContext.createOscillator();\n const gainNode = audioContext.createGain();\n\n oscillator.connect(gainNode);\n gainNode.connect(audioContext.destination);\n\n oscillator.frequency.value = 800;\n oscillator.type = 'sine';\n\n gainNode.gain.setValueAtTime(0.1, audioContext.currentTime);\n gainNode.gain.exponentialRampToValueAtTime(0.01, audioContext.currentTime + 0.1);\n\n oscillator.start(audioContext.currentTime);\n oscillator.stop(audioContext.currentTime + 0.1);\n }\n\n private loadFromStorage(): void {\n try {\n const stored = localStorage.getItem(this.STORAGE_KEY);\n if (stored) {\n const state: NotificationState = JSON.parse(stored);\n\n // Restore notifications\n this._notifications$.next(state.conversations || {});\n\n // Restore preferences\n this._preferences$.next({\n ...DEFAULT_NOTIFICATION_PREFERENCES,\n ...state.preferences\n });\n }\n } catch (error) {\n console.error('Error loading notification state from storage:', error);\n }\n }\n\n private saveToStorage(): void {\n try {\n const state: NotificationState = {\n conversations: this._notifications$.value,\n preferences: this._preferences$.value,\n lastUpdated: new Date()\n };\n localStorage.setItem(this.STORAGE_KEY, JSON.stringify(state));\n } catch (error) {\n console.error('Error saving notification state to storage:', error);\n }\n }\n\n private broadcastChange(): void {\n try {\n // Broadcast to other tabs via storage event\n const event = {\n timestamp: Date.now(),\n data: this._notifications$.value\n };\n localStorage.setItem(this.STORAGE_EVENT_KEY, JSON.stringify(event));\n } catch (error) {\n console.error('Error broadcasting notification change:', error);\n }\n }\n\n private setupStorageListener(): void {\n // Listen for changes from other tabs\n this.ngZone.runOutsideAngular(() => {\n fromEvent<StorageEvent>(window, 'storage')\n .pipe(\n filter(event => event.key === this.STORAGE_KEY || event.key === this.STORAGE_EVENT_KEY)\n )\n .subscribe(event => {\n this.ngZone.run(() => {\n this.loadFromStorage();\n });\n });\n });\n }\n}\n"]}
1
+ {"version":3,"file":"notification.service.js","sourceRoot":"","sources":["../../../src/lib/services/notification.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAU,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,eAAe,EAAc,OAAO,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AACvE,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC1D,OAAO,EASL,gCAAgC,EACjC,MAAM,8BAA8B,CAAC;;AAEtC;;;GAGG;AAIH,MAAM,OAAO,mBAAmB;IA8DV;IA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AAC;YACF,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC,iBAAiB,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC;QACtE,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,KAAK,CAAC,yCAAyC,EAAE,KAAK,CAAC,CAAC;QAClE,CAAC;IACH,CAAC;IAEO,oBAAoB;QAC1B,qCAAqC;QACrC,IAAI,CAAC,MAAM,CAAC,iBAAiB,CAAC,GAAG,EAAE;YACjC,SAAS,CAAe,MAAM,EAAE,SAAS,CAAC;iBACvC,IAAI,CACH,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,GAAG,KAAK,IAAI,CAAC,WAAW,IAAI,KAAK,CAAC,GAAG,KAAK,IAAI,CAAC,iBAAiB,CAAC,CACxF;iBACA,SAAS,CAAC,KAAK,CAAC,EAAE;gBACjB,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE;oBACnB,IAAI,CAAC,eAAe,EAAE,CAAC;gBACzB,CAAC,CAAC,CAAC;YACL,CAAC,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;IACL,CAAC;6GAhmBU,mBAAmB;gEAAnB,mBAAmB,WAAnB,mBAAmB,mBAFlB,MAAM;;iFAEP,mBAAmB;cAH/B,UAAU;eAAC;gBACV,UAAU,EAAE,MAAM;aACnB","sourcesContent":["import { Injectable, NgZone } from '@angular/core';\nimport { BehaviorSubject, Observable, Subject, fromEvent } from 'rxjs';\nimport { filter, map, shareReplay } from 'rxjs/operators';\nimport {\n ConversationNotification,\n NotificationItem,\n NotificationPreferences,\n NotificationState,\n NotificationType,\n NotificationPriority,\n NotificationChangeEvent,\n BadgeConfig,\n DEFAULT_NOTIFICATION_PREFERENCES\n} from '../models/notification.model';\n\n/**\n * Service for managing notifications across conversations\n * Provides real-time notification tracking, persistence, and cross-tab synchronization\n */\n@Injectable({\n providedIn: 'root'\n})\nexport class NotificationService {\n private readonly STORAGE_KEY = 'mj_conversation_notifications';\n private readonly STORAGE_EVENT_KEY = 'mj_notification_change';\n\n // Internal state\n private _notifications$ = new BehaviorSubject<Record<string, ConversationNotification>>({});\n private _preferences$ = new BehaviorSubject<NotificationPreferences>(DEFAULT_NOTIFICATION_PREFERENCES);\n private _notificationItems$ = new BehaviorSubject<NotificationItem[]>([]);\n private _changeEvents$ = new Subject<NotificationChangeEvent>();\n\n // Public observables\n public readonly Notifications$ = this._notifications$.asObservable();\n\n /** @deprecated Use {@link Notifications$}. */\n public get notifications$() {\n return this.Notifications$;\n }\n public readonly Preferences$ = this._preferences$.asObservable();\n\n /** @deprecated Use {@link Preferences$}. */\n public get preferences$() {\n return this.Preferences$;\n }\n public readonly NotificationItems$ = this._notificationItems$.asObservable();\n\n /** @deprecated Use {@link NotificationItems$}. */\n public get notificationItems$() {\n return this.NotificationItems$;\n }\n public readonly ChangeEvents$ = this._changeEvents$.asObservable();\n\n /** @deprecated Use {@link ChangeEvents$}. */\n public get changeEvents$() {\n return this.ChangeEvents$;\n }\n\n // Derived observables\n public readonly TotalUnreadCount$: Observable<number> = this.Notifications$.pipe(\n map(notifications => {\n return Object.values(notifications).reduce(\n (sum, notif) => sum + notif.unreadMessageCount,\n 0\n );\n }),\n shareReplay(1)\n );\n\n /** @deprecated Use {@link TotalUnreadCount$}. */\n public get totalUnreadCount$(): Observable<number> {\n return this.TotalUnreadCount$;\n }\n\n public readonly HasAnyNotifications$: Observable<boolean> = this.TotalUnreadCount$.pipe(\n map(count => count > 0),\n shareReplay(1)\n );\n\n /** @deprecated Use {@link HasAnyNotifications$}. */\n public get hasAnyNotifications$(): Observable<boolean> {\n return this.HasAnyNotifications$;\n }\n\n constructor(private ngZone: NgZone) {\n this.loadFromStorage();\n this.setupStorageListener();\n }\n\n /**\n * Gets notification state for a specific conversation\n */\n GetConversationNotification(conversationId: string): ConversationNotification | null {\n return this._notifications$.value[conversationId] || null;\n }\n\n /** @deprecated Use {@link GetConversationNotification}. */\n getConversationNotification(conversationId: string): ConversationNotification | null {\n return this.GetConversationNotification(conversationId);\n }\n\n /**\n * Gets notification observable for a specific conversation\n */\n GetConversationNotification$(conversationId: string): Observable<ConversationNotification | null> {\n return this.Notifications$.pipe(\n map(notifications => notifications[conversationId] || null),\n shareReplay(1)\n );\n }\n\n /** @deprecated Use {@link GetConversationNotification$}. */\n getConversationNotification$(conversationId: string): Observable<ConversationNotification | null> {\n return this.GetConversationNotification$(conversationId);\n }\n\n /**\n * Gets badge configuration for a conversation\n */\n GetBadgeConfig(conversationId: string): BadgeConfig {\n const notification = this.GetConversationNotification(conversationId);\n\n if (!notification) {\n return { show: false };\n }\n\n const prefs = this._preferences$.value;\n if (!prefs.showBadges || prefs.mutedConversations.includes(conversationId)) {\n return { show: false };\n }\n\n // Check if muted temporarily\n if (prefs.muteUntil && new Date() < prefs.muteUntil) {\n return { show: false };\n }\n\n const totalNotifications =\n notification.unreadMessageCount +\n notification.newArtifactCount +\n notification.activeAgentProcessCount;\n\n if (totalNotifications === 0) {\n return { show: false };\n }\n\n // Determine badge type based on notification content\n let type: BadgeConfig['type'] = 'count';\n let animate = false;\n\n if (notification.activeAgentProcessCount > 0) {\n type = 'pulse';\n animate = true;\n } else if (notification.newArtifactCount > 0) {\n type = 'new';\n animate = true;\n }\n\n return {\n show: true,\n count: totalNotifications,\n type,\n priority: notification.highestPriority,\n animate\n };\n }\n\n /** @deprecated Use {@link GetBadgeConfig}. */\n getBadgeConfig(conversationId: string): BadgeConfig {\n return this.GetBadgeConfig(conversationId);\n }\n\n /**\n * Gets badge configuration observable for a conversation\n */\n GetBadgeConfig$(conversationId: string): Observable<BadgeConfig> {\n return this.Notifications$.pipe(\n map(() => this.GetBadgeConfig(conversationId)),\n shareReplay(1)\n );\n }\n\n /** @deprecated Use {@link GetBadgeConfig$}. */\n getBadgeConfig$(conversationId: string): Observable<BadgeConfig> {\n return this.GetBadgeConfig$(conversationId);\n }\n\n /**\n * Tracks a new message in a conversation\n */\n TrackNewMessage(conversationId: string, messageTimestamp: Date, priority: NotificationPriority = 'normal'): void {\n const notifications = { ...this._notifications$.value };\n const existing = notifications[conversationId];\n\n if (existing) {\n notifications[conversationId] = {\n ...existing,\n unreadMessageCount: existing.unreadMessageCount + 1,\n lastMessageTimestamp: messageTimestamp,\n lastNotificationTimestamp: new Date(),\n highestPriority: this.getHigherPriority(existing.highestPriority, priority)\n };\n } else {\n notifications[conversationId] = this.createNewNotification(conversationId, {\n unreadMessageCount: 1,\n lastMessageTimestamp: messageTimestamp,\n highestPriority: priority\n });\n }\n\n this.updateNotifications(notifications);\n this.emitChangeEvent(conversationId, 'message', 'added');\n this.playNotificationSound();\n }\n\n /** @deprecated Use {@link TrackNewMessage}. */\n trackNewMessage(conversationId: string, messageTimestamp: Date, priority: NotificationPriority = 'normal'): void {\n return this.TrackNewMessage(conversationId, messageTimestamp, priority);\n }\n\n /**\n * Tracks multiple new messages at once (batch operation)\n */\n TrackNewMessages(conversationId: string, count: number, latestTimestamp: Date, priority: NotificationPriority = 'normal'): void {\n const notifications = { ...this._notifications$.value };\n const existing = notifications[conversationId];\n\n if (existing) {\n notifications[conversationId] = {\n ...existing,\n unreadMessageCount: existing.unreadMessageCount + count,\n lastMessageTimestamp: latestTimestamp,\n lastNotificationTimestamp: new Date(),\n highestPriority: this.getHigherPriority(existing.highestPriority, priority)\n };\n } else {\n notifications[conversationId] = this.createNewNotification(conversationId, {\n unreadMessageCount: count,\n lastMessageTimestamp: latestTimestamp,\n highestPriority: priority\n });\n }\n\n this.updateNotifications(notifications);\n this.emitChangeEvent(conversationId, 'message', 'added');\n this.playNotificationSound();\n }\n\n /** @deprecated Use {@link TrackNewMessages}. */\n trackNewMessages(conversationId: string, count: number, latestTimestamp: Date, priority: NotificationPriority = 'normal'): void {\n return this.TrackNewMessages(conversationId, count, latestTimestamp, priority);\n }\n\n /**\n * Tracks a new artifact notification\n */\n TrackNewArtifact(conversationId: string): void {\n const notifications = { ...this._notifications$.value };\n const existing = notifications[conversationId];\n\n if (existing) {\n notifications[conversationId] = {\n ...existing,\n hasNewArtifacts: true,\n newArtifactCount: existing.newArtifactCount + 1,\n lastNotificationTimestamp: new Date()\n };\n } else {\n notifications[conversationId] = this.createNewNotification(conversationId, {\n hasNewArtifacts: true,\n newArtifactCount: 1\n });\n }\n\n this.updateNotifications(notifications);\n this.emitChangeEvent(conversationId, 'artifact', 'added');\n }\n\n /** @deprecated Use {@link TrackNewArtifact}. */\n trackNewArtifact(conversationId: string): void {\n return this.TrackNewArtifact(conversationId);\n }\n\n /**\n * Tracks an active agent process\n */\n TrackAgentProcess(conversationId: string, isActive: boolean): void {\n const notifications = { ...this._notifications$.value };\n const existing = notifications[conversationId];\n\n if (existing) {\n const countChange = isActive ? 1 : -1;\n notifications[conversationId] = {\n ...existing,\n hasActiveAgentProcesses: isActive ? true : (existing.activeAgentProcessCount - 1) > 0,\n activeAgentProcessCount: Math.max(0, existing.activeAgentProcessCount + countChange),\n lastNotificationTimestamp: new Date()\n };\n } else if (isActive) {\n notifications[conversationId] = this.createNewNotification(conversationId, {\n hasActiveAgentProcesses: true,\n activeAgentProcessCount: 1\n });\n }\n\n this.updateNotifications(notifications);\n this.emitChangeEvent(conversationId, 'agent_process', isActive ? 'added' : 'cleared');\n }\n\n /** @deprecated Use {@link TrackAgentProcess}. */\n trackAgentProcess(conversationId: string, isActive: boolean): void {\n return this.TrackAgentProcess(conversationId, isActive);\n }\n\n /**\n * Marks a conversation as read (clears unread message count)\n */\n MarkConversationAsRead(conversationId: string): void {\n const notifications = { ...this._notifications$.value };\n const existing = notifications[conversationId];\n\n if (existing && existing.unreadMessageCount > 0) {\n notifications[conversationId] = {\n ...existing,\n unreadMessageCount: 0,\n lastReadMessageTimestamp: new Date()\n };\n\n this.updateNotifications(notifications);\n this.emitChangeEvent(conversationId, 'message', 'read');\n }\n }\n\n /** @deprecated Use {@link MarkConversationAsRead}. */\n markConversationAsRead(conversationId: string): void {\n return this.MarkConversationAsRead(conversationId);\n }\n\n /**\n * Clears artifact notifications for a conversation\n */\n ClearArtifactNotifications(conversationId: string): void {\n const notifications = { ...this._notifications$.value };\n const existing = notifications[conversationId];\n\n if (existing && (existing.hasNewArtifacts || existing.newArtifactCount > 0)) {\n notifications[conversationId] = {\n ...existing,\n hasNewArtifacts: false,\n newArtifactCount: 0\n };\n\n this.updateNotifications(notifications);\n this.emitChangeEvent(conversationId, 'artifact', 'cleared');\n }\n }\n\n /** @deprecated Use {@link ClearArtifactNotifications}. */\n clearArtifactNotifications(conversationId: string): void {\n return this.ClearArtifactNotifications(conversationId);\n }\n\n /**\n * Clears all notifications for a conversation\n */\n ClearAllNotifications(conversationId: string): void {\n const notifications = { ...this._notifications$.value };\n\n if (notifications[conversationId]) {\n delete notifications[conversationId];\n this.updateNotifications(notifications);\n this.emitChangeEvent(conversationId, 'message', 'cleared');\n }\n }\n\n /** @deprecated Use {@link ClearAllNotifications}. */\n clearAllNotifications(conversationId: string): void {\n return this.ClearAllNotifications(conversationId);\n }\n\n /**\n * Clears all notifications across all conversations\n */\n ClearAllNotificationsGlobal(): void {\n this.updateNotifications({});\n }\n\n /** @deprecated Use {@link ClearAllNotificationsGlobal}. */\n clearAllNotificationsGlobal(): void {\n return this.ClearAllNotificationsGlobal();\n }\n\n /**\n * Updates notification preferences\n */\n UpdatePreferences(preferences: Partial<NotificationPreferences>): void {\n const current = this._preferences$.value;\n const updated = { ...current, ...preferences };\n this._preferences$.next(updated);\n this.saveToStorage();\n }\n\n /** @deprecated Use {@link UpdatePreferences}. */\n updatePreferences(preferences: Partial<NotificationPreferences>): void {\n return this.UpdatePreferences(preferences);\n }\n\n /**\n * Mutes a conversation\n */\n MuteConversation(conversationId: string): void {\n const prefs = this._preferences$.value;\n if (!prefs.mutedConversations.includes(conversationId)) {\n this.UpdatePreferences({\n mutedConversations: [...prefs.mutedConversations, conversationId]\n });\n }\n }\n\n /** @deprecated Use {@link MuteConversation}. */\n muteConversation(conversationId: string): void {\n return this.MuteConversation(conversationId);\n }\n\n /**\n * Unmutes a conversation\n */\n UnmuteConversation(conversationId: string): void {\n const prefs = this._preferences$.value;\n this.UpdatePreferences({\n mutedConversations: prefs.mutedConversations.filter(id => id !== conversationId)\n });\n }\n\n /** @deprecated Use {@link UnmuteConversation}. */\n unmuteConversation(conversationId: string): void {\n return this.UnmuteConversation(conversationId);\n }\n\n /**\n * Checks if a conversation is muted\n */\n IsConversationMuted(conversationId: string): boolean {\n return this._preferences$.value.mutedConversations.includes(conversationId);\n }\n\n /** @deprecated Use {@link IsConversationMuted}. */\n isConversationMuted(conversationId: string): boolean {\n return this.IsConversationMuted(conversationId);\n }\n\n /**\n * Requests desktop notification permission\n */\n async RequestDesktopPermission(): Promise<boolean> {\n if (!('Notification' in window)) {\n console.warn('Desktop notifications not supported');\n return false;\n }\n\n if (Notification.permission === 'granted') {\n return true;\n }\n\n if (Notification.permission !== 'denied') {\n const permission = await Notification.requestPermission();\n return permission === 'granted';\n }\n\n return false;\n }\n\n /** @deprecated Use {@link RequestDesktopPermission}. */\n async requestDesktopPermission(): Promise<boolean> {\n return this.RequestDesktopPermission();\n }\n\n /**\n * Shows a desktop notification\n */\n ShowDesktopNotification(title: string, body: string, conversationId: string): void {\n if (!this._preferences$.value.enableDesktopNotifications) {\n return;\n }\n\n if ('Notification' in window && Notification.permission === 'granted') {\n const notification = new Notification(title, {\n body,\n icon: '/assets/icons/notification-icon.png',\n badge: '/assets/icons/badge-icon.png',\n tag: conversationId,\n requireInteraction: false\n });\n\n notification.onclick = () => {\n window.focus();\n notification.close();\n };\n }\n }\n\n /** @deprecated Use {@link ShowDesktopNotification}. */\n showDesktopNotification(title: string, body: string, conversationId: string): void {\n return this.ShowDesktopNotification(title, body, conversationId);\n }\n\n // Private helper methods\n\n private createNewNotification(\n conversationId: string,\n overrides?: Partial<ConversationNotification>\n ): ConversationNotification {\n return {\n conversationId,\n unreadMessageCount: 0,\n lastReadMessageTimestamp: null,\n lastMessageTimestamp: null,\n hasNewArtifacts: false,\n hasActiveAgentProcesses: false,\n newArtifactCount: 0,\n activeAgentProcessCount: 0,\n lastNotificationTimestamp: new Date(),\n highestPriority: 'normal',\n ...overrides\n };\n }\n\n private updateNotifications(notifications: Record<string, ConversationNotification>): void {\n this._notifications$.next(notifications);\n this.saveToStorage();\n this.broadcastChange();\n }\n\n private emitChangeEvent(conversationId: string, type: NotificationType, action: 'added' | 'read' | 'cleared'): void {\n this._changeEvents$.next({\n conversationId,\n type,\n action,\n timestamp: new Date()\n });\n }\n\n private getHigherPriority(current: NotificationPriority, newPriority: NotificationPriority): NotificationPriority {\n const priorityOrder: NotificationPriority[] = ['low', 'normal', 'high', 'urgent'];\n const currentIndex = priorityOrder.indexOf(current);\n const newIndex = priorityOrder.indexOf(newPriority);\n return newIndex > currentIndex ? newPriority : current;\n }\n\n private playNotificationSound(): void {\n if (!this._preferences$.value.enableSound) {\n return;\n }\n\n // Create and play a subtle notification sound\n const audioContext = new (window.AudioContext || (window as any).webkitAudioContext)();\n const oscillator = audioContext.createOscillator();\n const gainNode = audioContext.createGain();\n\n oscillator.connect(gainNode);\n gainNode.connect(audioContext.destination);\n\n oscillator.frequency.value = 800;\n oscillator.type = 'sine';\n\n gainNode.gain.setValueAtTime(0.1, audioContext.currentTime);\n gainNode.gain.exponentialRampToValueAtTime(0.01, audioContext.currentTime + 0.1);\n\n oscillator.start(audioContext.currentTime);\n oscillator.stop(audioContext.currentTime + 0.1);\n }\n\n private loadFromStorage(): void {\n try {\n const stored = localStorage.getItem(this.STORAGE_KEY);\n if (stored) {\n const state: NotificationState = JSON.parse(stored);\n\n // Restore notifications\n this._notifications$.next(state.conversations || {});\n\n // Restore preferences\n this._preferences$.next({\n ...DEFAULT_NOTIFICATION_PREFERENCES,\n ...state.preferences\n });\n }\n } catch (error) {\n console.error('Error loading notification state from storage:', error);\n }\n }\n\n private saveToStorage(): void {\n try {\n const state: NotificationState = {\n conversations: this._notifications$.value,\n preferences: this._preferences$.value,\n lastUpdated: new Date()\n };\n localStorage.setItem(this.STORAGE_KEY, JSON.stringify(state));\n } catch (error) {\n console.error('Error saving notification state to storage:', error);\n }\n }\n\n private broadcastChange(): void {\n try {\n // Broadcast to other tabs via storage event\n const event = {\n timestamp: Date.now(),\n data: this._notifications$.value\n };\n localStorage.setItem(this.STORAGE_EVENT_KEY, JSON.stringify(event));\n } catch (error) {\n console.error('Error broadcasting notification change:', error);\n }\n }\n\n private setupStorageListener(): void {\n // Listen for changes from other tabs\n this.ngZone.runOutsideAngular(() => {\n fromEvent<StorageEvent>(window, 'storage')\n .pipe(\n filter(event => event.key === this.STORAGE_KEY || event.key === this.STORAGE_EVENT_KEY)\n )\n .subscribe(event => {\n this.ngZone.run(() => {\n this.loadFromStorage();\n });\n });\n });\n }\n}\n"]}
@@ -25,13 +25,13 @@
25
25
  */
26
26
  export declare class RealtimeAudioRecorder {
27
27
  /** The container/codec we now produce — a seekable mono 16-bit PCM WAV. */
28
- private static readonly WavMimeType;
28
+ private static readonly wavMimeType;
29
29
  /** Target waveform-peak resolution (buckets) across the whole recording. */
30
- private static readonly PeakBuckets;
30
+ private static readonly peakBuckets;
31
31
  /** PCM frame size for the ScriptProcessor fallback (worklet uses its native 128-frame quantum). */
32
- private static readonly ScriptProcessorBufferSize;
32
+ private static readonly scriptProcessorBufferSize;
33
33
  /** Inline AudioWorklet processor: forwards each 128-frame mono input block to the main thread. */
34
- private static readonly WorkletProcessorSource;
34
+ private static readonly workletProcessorSource;
35
35
  private audioContext;
36
36
  private destination;
37
37
  private workletNode;
@@ -1,4 +1,4 @@
1
- import { encodePcm16Wav, PeakAccumulator } from './realtime-pcm-wav';
1
+ import { EncodePcm16Wav, PeakAccumulator } from './realtime-pcm-wav';
2
2
  /**
3
3
  * Browser-side audio recorder for a CLIENT-DIRECT realtime voice session.
4
4
  *
@@ -26,13 +26,13 @@ import { encodePcm16Wav, PeakAccumulator } from './realtime-pcm-wav';
26
26
  */
27
27
  export class RealtimeAudioRecorder {
28
28
  /** The container/codec we now produce — a seekable mono 16-bit PCM WAV. */
29
- static WavMimeType = 'audio/wav';
29
+ static wavMimeType = 'audio/wav';
30
30
  /** Target waveform-peak resolution (buckets) across the whole recording. */
31
- static PeakBuckets = 600;
31
+ static peakBuckets = 600;
32
32
  /** PCM frame size for the ScriptProcessor fallback (worklet uses its native 128-frame quantum). */
33
- static ScriptProcessorBufferSize = 4096;
33
+ static scriptProcessorBufferSize = 4096;
34
34
  /** Inline AudioWorklet processor: forwards each 128-frame mono input block to the main thread. */
35
- static WorkletProcessorSource = `
35
+ static workletProcessorSource = `
36
36
  class MJPcmCaptureProcessor extends AudioWorkletProcessor {
37
37
  process(inputs) {
38
38
  const input = inputs[0];
@@ -54,7 +54,7 @@ export class RealtimeAudioRecorder {
54
54
  /** Total captured sample count across {@link pcmFrames} (kept in step to avoid re-summing). */
55
55
  totalSamples = 0;
56
56
  /** Streaming waveform-peak accumulator — bounded regardless of recording length. */
57
- peaks = new PeakAccumulator(RealtimeAudioRecorder.PeakBuckets);
57
+ peaks = new PeakAccumulator(RealtimeAudioRecorder.peakBuckets);
58
58
  /** Final normalized peaks, snapshotted at {@link Stop} so {@link GetPeaks} survives cleanup. */
59
59
  finalPeaks = [];
60
60
  recording = false;
@@ -82,7 +82,7 @@ export class RealtimeAudioRecorder {
82
82
  * crash-recovery shards are all 16-bit PCM WAV.
83
83
  */
84
84
  get MimeType() {
85
- return this.recording ? RealtimeAudioRecorder.WavMimeType : '';
85
+ return this.recording ? RealtimeAudioRecorder.wavMimeType : '';
86
86
  }
87
87
  /**
88
88
  * The captured AudioContext sample rate (0 before {@link Start} / when disabled). Exposed so a
@@ -239,7 +239,7 @@ export class RealtimeAudioRecorder {
239
239
  return false;
240
240
  }
241
241
  try {
242
- const moduleUrl = URL.createObjectURL(new Blob([RealtimeAudioRecorder.WorkletProcessorSource], { type: 'application/javascript' }));
242
+ const moduleUrl = URL.createObjectURL(new Blob([RealtimeAudioRecorder.workletProcessorSource], { type: 'application/javascript' }));
243
243
  try {
244
244
  await audioContext.audioWorklet.addModule(moduleUrl);
245
245
  }
@@ -262,7 +262,7 @@ export class RealtimeAudioRecorder {
262
262
  if (typeof audioContext.createScriptProcessor !== 'function') {
263
263
  throw new Error('Neither AudioWorklet nor ScriptProcessor is supported');
264
264
  }
265
- const node = audioContext.createScriptProcessor(RealtimeAudioRecorder.ScriptProcessorBufferSize, 1, 1);
265
+ const node = audioContext.createScriptProcessor(RealtimeAudioRecorder.scriptProcessorBufferSize, 1, 1);
266
266
  node.onaudioprocess = (event) => {
267
267
  // Copy out of the reused input buffer before retaining.
268
268
  this.captureFrame(event.inputBuffer.getChannelData(0).slice(0));
@@ -340,8 +340,8 @@ export class RealtimeAudioRecorder {
340
340
  return null;
341
341
  }
342
342
  const all = this.collectSamples(0, this.totalSamples);
343
- const wav = encodePcm16Wav(all, this.sampleRate);
344
- return new Blob([wav], { type: RealtimeAudioRecorder.WavMimeType });
343
+ const wav = EncodePcm16Wav(all, this.sampleRate);
344
+ return new Blob([wav], { type: RealtimeAudioRecorder.wavMimeType });
345
345
  }
346
346
  /** Releases the audio graph + capture node and resets state. Idempotent. */
347
347
  cleanup() {
@@ -350,7 +350,7 @@ export class RealtimeAudioRecorder {
350
350
  this.totalSamples = 0;
351
351
  this.flushedSampleCount = 0;
352
352
  this.sampleRate = 0;
353
- this.peaks = new PeakAccumulator(RealtimeAudioRecorder.PeakBuckets);
353
+ this.peaks = new PeakAccumulator(RealtimeAudioRecorder.peakBuckets);
354
354
  this.remoteAttached = false;
355
355
  this.pendingRemoteStream = null;
356
356
  if (this.workletNode) {