@memberjunction/ng-dashboards 6.2.0-edge.6 → 6.2.0-edge.7

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 (212) hide show
  1. package/README.md +23 -16
  2. package/dist/AI/components/analytics/agent-runs/agent-run-analysis.component.js +2 -2
  3. package/dist/AI/components/analytics/agent-runs/agent-run-analysis.component.js.map +1 -1
  4. package/dist/AI/components/analytics/realtime/realtime-management.component.d.ts.map +1 -1
  5. package/dist/AI/components/analytics/realtime/realtime-management.component.js +3 -1
  6. package/dist/AI/components/analytics/realtime/realtime-management.component.js.map +1 -1
  7. package/dist/AI/components/analytics/realtime/realtime-overview.component.d.ts +1 -1
  8. package/dist/AI/components/analytics/realtime/realtime-overview.component.js +3 -3
  9. package/dist/AI/components/analytics/realtime/realtime-overview.component.js.map +1 -1
  10. package/dist/AI/components/analytics/realtime/realtime-session-data.d.ts +6 -4
  11. package/dist/AI/components/analytics/realtime/realtime-session-data.d.ts.map +1 -1
  12. package/dist/AI/components/analytics/realtime/realtime-session-data.js +8 -2
  13. package/dist/AI/components/analytics/realtime/realtime-session-data.js.map +1 -1
  14. package/dist/AI/components/autotagging/autotagging-pipeline-resource.component.js +6 -6
  15. package/dist/AI/components/autotagging/autotagging-pipeline-resource.component.js.map +1 -1
  16. package/dist/AI/components/autotagging/components/classify-item-grid.component.js +1 -1
  17. package/dist/AI/components/autotagging/components/classify-item-grid.component.js.map +1 -1
  18. package/dist/AI/components/autotagging/components/classify-org-context-editor.component.d.ts.map +1 -1
  19. package/dist/AI/components/autotagging/components/classify-org-context-editor.component.js +1 -0
  20. package/dist/AI/components/autotagging/components/classify-org-context-editor.component.js.map +1 -1
  21. package/dist/AI/components/autotagging/dialogs/source-type-form.dialog.component.d.ts.map +1 -1
  22. package/dist/AI/components/autotagging/dialogs/source-type-form.dialog.component.js +1 -0
  23. package/dist/AI/components/autotagging/dialogs/source-type-form.dialog.component.js.map +1 -1
  24. package/dist/AI/components/autotagging/tabs/sources-tab.component.d.ts.map +1 -1
  25. package/dist/AI/components/autotagging/tabs/sources-tab.component.js +1 -0
  26. package/dist/AI/components/autotagging/tabs/sources-tab.component.js.map +1 -1
  27. package/dist/AI/components/duplicates/duplicate-detection-resource.component.d.ts.map +1 -1
  28. package/dist/AI/components/duplicates/duplicate-detection-resource.component.js +1 -0
  29. package/dist/AI/components/duplicates/duplicate-detection-resource.component.js.map +1 -1
  30. package/dist/AI/components/prompts/model-prompt-priority-matrix.component.js +2 -2
  31. package/dist/AI/components/tags/tags-resource.component.d.ts.map +1 -1
  32. package/dist/AI/components/tags/tags-resource.component.js +3 -2
  33. package/dist/AI/components/tags/tags-resource.component.js.map +1 -1
  34. package/dist/AI/components/vectors/vector-management-resource.component.d.ts.map +1 -1
  35. package/dist/AI/components/vectors/vector-management-resource.component.js +12 -6
  36. package/dist/AI/components/vectors/vector-management-resource.component.js.map +1 -1
  37. package/dist/AI/services/ai-instrumentation.service.d.ts.map +1 -1
  38. package/dist/AI/services/ai-instrumentation.service.js +4 -2
  39. package/dist/AI/services/ai-instrumentation.service.js.map +1 -1
  40. package/dist/Actions/action-result-code.d.ts +80 -0
  41. package/dist/Actions/action-result-code.d.ts.map +1 -0
  42. package/dist/Actions/action-result-code.js +163 -0
  43. package/dist/Actions/action-result-code.js.map +1 -0
  44. package/dist/Actions/components/actions-overview.component.d.ts +8 -0
  45. package/dist/Actions/components/actions-overview.component.d.ts.map +1 -1
  46. package/dist/Actions/components/actions-overview.component.js +12 -9
  47. package/dist/Actions/components/actions-overview.component.js.map +1 -1
  48. package/dist/Actions/components/execution-monitoring.component.d.ts +29 -9
  49. package/dist/Actions/components/execution-monitoring.component.d.ts.map +1 -1
  50. package/dist/Actions/components/execution-monitoring.component.js +65 -42
  51. package/dist/Actions/components/execution-monitoring.component.js.map +1 -1
  52. package/dist/Actions/components/explorer/action-card.component.d.ts.map +1 -1
  53. package/dist/Actions/components/explorer/action-card.component.js +5 -4
  54. package/dist/Actions/components/explorer/action-card.component.js.map +1 -1
  55. package/dist/ChiefOfStaff/chief-of-staff-agent-context.d.ts +92 -130
  56. package/dist/ChiefOfStaff/chief-of-staff-agent-context.d.ts.map +1 -1
  57. package/dist/ChiefOfStaff/chief-of-staff-agent-context.js +189 -274
  58. package/dist/ChiefOfStaff/chief-of-staff-agent-context.js.map +1 -1
  59. package/dist/ChiefOfStaff/chief-of-staff-approvals.component.d.ts +29 -0
  60. package/dist/ChiefOfStaff/chief-of-staff-approvals.component.d.ts.map +1 -0
  61. package/dist/ChiefOfStaff/chief-of-staff-approvals.component.js +666 -0
  62. package/dist/ChiefOfStaff/chief-of-staff-approvals.component.js.map +1 -0
  63. package/dist/ChiefOfStaff/chief-of-staff-governance.component.d.ts +56 -0
  64. package/dist/ChiefOfStaff/chief-of-staff-governance.component.d.ts.map +1 -0
  65. package/dist/ChiefOfStaff/chief-of-staff-governance.component.js +515 -0
  66. package/dist/ChiefOfStaff/chief-of-staff-governance.component.js.map +1 -0
  67. package/dist/ChiefOfStaff/chief-of-staff-live-refresh.d.ts +14 -0
  68. package/dist/ChiefOfStaff/chief-of-staff-live-refresh.d.ts.map +1 -0
  69. package/dist/ChiefOfStaff/chief-of-staff-live-refresh.js +39 -0
  70. package/dist/ChiefOfStaff/chief-of-staff-live-refresh.js.map +1 -0
  71. package/dist/ChiefOfStaff/chief-of-staff-overview.component.d.ts +17 -0
  72. package/dist/ChiefOfStaff/chief-of-staff-overview.component.d.ts.map +1 -0
  73. package/dist/ChiefOfStaff/chief-of-staff-overview.component.js +485 -0
  74. package/dist/ChiefOfStaff/chief-of-staff-overview.component.js.map +1 -0
  75. package/dist/ChiefOfStaff/chief-of-staff-page-base.d.ts +139 -0
  76. package/dist/ChiefOfStaff/chief-of-staff-page-base.d.ts.map +1 -0
  77. package/dist/ChiefOfStaff/chief-of-staff-page-base.js +602 -0
  78. package/dist/ChiefOfStaff/chief-of-staff-page-base.js.map +1 -0
  79. package/dist/ChiefOfStaff/index.d.ts +4 -1
  80. package/dist/ChiefOfStaff/index.d.ts.map +1 -1
  81. package/dist/ChiefOfStaff/index.js +4 -1
  82. package/dist/ChiefOfStaff/index.js.map +1 -1
  83. package/dist/Communication/communication-monitor-resource.component.js +3 -3
  84. package/dist/Communication/communication-monitor-resource.component.js.map +1 -1
  85. package/dist/Communication/communication-runs-resource.component.js +3 -3
  86. package/dist/Communication/communication-runs-resource.component.js.map +1 -1
  87. package/dist/ComponentStudio/component-studio-dashboard.component.d.ts.map +1 -1
  88. package/dist/ComponentStudio/component-studio-dashboard.component.js +1 -0
  89. package/dist/ComponentStudio/component-studio-dashboard.component.js.map +1 -1
  90. package/dist/ComponentStudio/components/artifact-selection-dialog.component.d.ts.map +1 -1
  91. package/dist/ComponentStudio/components/artifact-selection-dialog.component.js +2 -1
  92. package/dist/ComponentStudio/components/artifact-selection-dialog.component.js.map +1 -1
  93. package/dist/ComponentStudio/services/component-version.service.d.ts.map +1 -1
  94. package/dist/ComponentStudio/services/component-version.service.js +3 -0
  95. package/dist/ComponentStudio/services/component-version.service.js.map +1 -1
  96. package/dist/DataExplorer/data-explorer-dashboard.component.d.ts +21 -2
  97. package/dist/DataExplorer/data-explorer-dashboard.component.d.ts.map +1 -1
  98. package/dist/DataExplorer/data-explorer-dashboard.component.js +32 -5
  99. package/dist/DataExplorer/data-explorer-dashboard.component.js.map +1 -1
  100. package/dist/DevTools/graphql-console.component.js +2 -2
  101. package/dist/DevTools/lazy-module-status.component.js +2 -2
  102. package/dist/FormBuilder/form-builder-resource.component.d.ts.map +1 -1
  103. package/dist/FormBuilder/form-builder-resource.component.js +5 -0
  104. package/dist/FormBuilder/form-builder-resource.component.js.map +1 -1
  105. package/dist/Integration/components/connections/connections.component.js +2 -2
  106. package/dist/Integration/services/integration-data.service.d.ts +1 -1
  107. package/dist/Integration/services/integration-data.service.d.ts.map +1 -1
  108. package/dist/Integration/services/integration-data.service.js +4 -3
  109. package/dist/Integration/services/integration-data.service.js.map +1 -1
  110. package/dist/Lists/components/lists-browse-resource.component.js +1 -1
  111. package/dist/Lists/components/lists-browse-resource.component.js.map +1 -1
  112. package/dist/Lists/components/lists-my-lists-resource.component.js +1 -1
  113. package/dist/Lists/components/lists-my-lists-resource.component.js.map +1 -1
  114. package/dist/LoginStudio/login-studio-resource.component.d.ts.map +1 -1
  115. package/dist/LoginStudio/login-studio-resource.component.js +1 -0
  116. package/dist/LoginStudio/login-studio-resource.component.js.map +1 -1
  117. package/dist/PredictiveStudio/components/ps-experiments.component.d.ts.map +1 -1
  118. package/dist/PredictiveStudio/components/ps-experiments.component.js +1 -0
  119. package/dist/PredictiveStudio/components/ps-experiments.component.js.map +1 -1
  120. package/dist/PredictiveStudio/components/ps-pipeline-wizard.component.js +2 -2
  121. package/dist/PredictiveStudio/components/ps-predictions-grid.component.d.ts.map +1 -1
  122. package/dist/PredictiveStudio/components/ps-predictions-grid.component.js +3 -0
  123. package/dist/PredictiveStudio/components/ps-predictions-grid.component.js.map +1 -1
  124. package/dist/PredictiveStudio/engine/predictive-studio.engine.d.ts.map +1 -1
  125. package/dist/PredictiveStudio/engine/predictive-studio.engine.js +1 -0
  126. package/dist/PredictiveStudio/engine/predictive-studio.engine.js.map +1 -1
  127. package/dist/PredictiveStudio/resources/ps-predictions-resource.component.d.ts.map +1 -1
  128. package/dist/PredictiveStudio/resources/ps-predictions-resource.component.js +1 -0
  129. package/dist/PredictiveStudio/resources/ps-predictions-resource.component.js.map +1 -1
  130. package/dist/QueryBrowser/query-browser-resource.component.d.ts +26 -0
  131. package/dist/QueryBrowser/query-browser-resource.component.d.ts.map +1 -1
  132. package/dist/QueryBrowser/query-browser-resource.component.js +375 -252
  133. package/dist/QueryBrowser/query-browser-resource.component.js.map +1 -1
  134. package/dist/UserRoutines/user-routines-resource.component.d.ts +8 -1
  135. package/dist/UserRoutines/user-routines-resource.component.d.ts.map +1 -1
  136. package/dist/UserRoutines/user-routines-resource.component.js +22 -4
  137. package/dist/UserRoutines/user-routines-resource.component.js.map +1 -1
  138. package/dist/VersionHistory/components/diff-resource.component.d.ts.map +1 -1
  139. package/dist/VersionHistory/components/diff-resource.component.js +1 -0
  140. package/dist/VersionHistory/components/diff-resource.component.js.map +1 -1
  141. package/dist/VideoStudio/components/vs-archetype-editor.component.d.ts +162 -0
  142. package/dist/VideoStudio/components/vs-archetype-editor.component.d.ts.map +1 -0
  143. package/dist/VideoStudio/components/vs-archetype-editor.component.js +1105 -0
  144. package/dist/VideoStudio/components/vs-archetype-editor.component.js.map +1 -0
  145. package/dist/VideoStudio/components/vs-audio-options.component.d.ts +27 -0
  146. package/dist/VideoStudio/components/vs-audio-options.component.d.ts.map +1 -0
  147. package/dist/VideoStudio/components/vs-audio-options.component.js +119 -0
  148. package/dist/VideoStudio/components/vs-audio-options.component.js.map +1 -0
  149. package/dist/VideoStudio/components/vs-copilot-panel.component.d.ts +105 -0
  150. package/dist/VideoStudio/components/vs-copilot-panel.component.d.ts.map +1 -0
  151. package/dist/VideoStudio/components/vs-copilot-panel.component.js +560 -0
  152. package/dist/VideoStudio/components/vs-copilot-panel.component.js.map +1 -0
  153. package/dist/VideoStudio/components/vs-production-brief.component.d.ts +163 -0
  154. package/dist/VideoStudio/components/vs-production-brief.component.d.ts.map +1 -0
  155. package/dist/VideoStudio/components/vs-production-brief.component.js +1054 -0
  156. package/dist/VideoStudio/components/vs-production-brief.component.js.map +1 -0
  157. package/dist/VideoStudio/components/vs-setup-health-card.component.d.ts +43 -0
  158. package/dist/VideoStudio/components/vs-setup-health-card.component.d.ts.map +1 -0
  159. package/dist/VideoStudio/components/vs-setup-health-card.component.js +412 -0
  160. package/dist/VideoStudio/components/vs-setup-health-card.component.js.map +1 -0
  161. package/dist/VideoStudio/components/vs-studio-slide-in.component.d.ts +73 -0
  162. package/dist/VideoStudio/components/vs-studio-slide-in.component.d.ts.map +1 -0
  163. package/dist/VideoStudio/components/vs-studio-slide-in.component.js +271 -0
  164. package/dist/VideoStudio/components/vs-studio-slide-in.component.js.map +1 -0
  165. package/dist/VideoStudio/index.d.ts +12 -0
  166. package/dist/VideoStudio/index.d.ts.map +1 -0
  167. package/dist/VideoStudio/index.js +12 -0
  168. package/dist/VideoStudio/index.js.map +1 -0
  169. package/dist/VideoStudio/resources/video-studio-archetypes-resource.component.d.ts +118 -0
  170. package/dist/VideoStudio/resources/video-studio-archetypes-resource.component.d.ts.map +1 -0
  171. package/dist/VideoStudio/resources/video-studio-archetypes-resource.component.js +964 -0
  172. package/dist/VideoStudio/resources/video-studio-archetypes-resource.component.js.map +1 -0
  173. package/dist/VideoStudio/resources/video-studio-brand-kits-resource.component.d.ts +70 -0
  174. package/dist/VideoStudio/resources/video-studio-brand-kits-resource.component.d.ts.map +1 -0
  175. package/dist/VideoStudio/resources/video-studio-brand-kits-resource.component.js +600 -0
  176. package/dist/VideoStudio/resources/video-studio-brand-kits-resource.component.js.map +1 -0
  177. package/dist/VideoStudio/resources/video-studio-productions-resource.component.d.ts +182 -0
  178. package/dist/VideoStudio/resources/video-studio-productions-resource.component.d.ts.map +1 -0
  179. package/dist/VideoStudio/resources/video-studio-productions-resource.component.js +1481 -0
  180. package/dist/VideoStudio/resources/video-studio-productions-resource.component.js.map +1 -0
  181. package/dist/VideoStudio/services/vs-studio-slide-in-state.service.d.ts +102 -0
  182. package/dist/VideoStudio/services/vs-studio-slide-in-state.service.d.ts.map +1 -0
  183. package/dist/VideoStudio/services/vs-studio-slide-in-state.service.js +240 -0
  184. package/dist/VideoStudio/services/vs-studio-slide-in-state.service.js.map +1 -0
  185. package/dist/VideoStudio/video-studio-agent-context.d.ts +495 -0
  186. package/dist/VideoStudio/video-studio-agent-context.d.ts.map +1 -0
  187. package/dist/VideoStudio/video-studio-agent-context.js +992 -0
  188. package/dist/VideoStudio/video-studio-agent-context.js.map +1 -0
  189. package/dist/ai-dashboards.module.d.ts +25 -22
  190. package/dist/ai-dashboards.module.d.ts.map +1 -1
  191. package/dist/ai-dashboards.module.js +23 -7
  192. package/dist/ai-dashboards.module.js.map +1 -1
  193. package/dist/module.d.ts +13 -12
  194. package/dist/module.d.ts.map +1 -1
  195. package/dist/module.js +7 -0
  196. package/dist/module.js.map +1 -1
  197. package/dist/public-api.d.ts +7 -1
  198. package/dist/public-api.d.ts.map +1 -1
  199. package/dist/public-api.js +9 -2
  200. package/dist/public-api.js.map +1 -1
  201. package/dist/shared/action-scheduled-job.d.ts.map +1 -1
  202. package/dist/shared/action-scheduled-job.js +2 -0
  203. package/dist/shared/action-scheduled-job.js.map +1 -1
  204. package/dist/video-studio-dashboards.module.d.ts +40 -0
  205. package/dist/video-studio-dashboards.module.d.ts.map +1 -0
  206. package/dist/video-studio-dashboards.module.js +159 -0
  207. package/dist/video-studio-dashboards.module.js.map +1 -0
  208. package/package.json +77 -71
  209. package/dist/ChiefOfStaff/chief-of-staff-dashboard.component.d.ts +0 -195
  210. package/dist/ChiefOfStaff/chief-of-staff-dashboard.component.d.ts.map +0 -1
  211. package/dist/ChiefOfStaff/chief-of-staff-dashboard.component.js +0 -2910
  212. package/dist/ChiefOfStaff/chief-of-staff-dashboard.component.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"realtime-session-data.d.ts","sourceRoot":"","sources":["../../../../../src/AI/components/analytics/realtime/realtime-session-data.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,iBAAiB,EAAW,MAAM,sBAAsB,CAAC;AAMlE;;;;GAIG;AACH,MAAM,MAAM,0BAA0B,GAAG,OAAO,GAAG,UAAU,GAAG,SAAS,GAAG,UAAU,CAAC;AAEvF,MAAM,WAAW,qBAAqB;IAClC,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,QAAQ,GAAG,MAAM,GAAG,QAAQ,CAAC;IACrC,cAAc,EAAE,MAAM,GAAG,IAAI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FAAsF;AACtF,wBAAgB,gBAAgB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAQ5D"}
1
+ {"version":3,"file":"realtime-session-data.d.ts","sourceRoot":"","sources":["../../../../../src/AI/components/analytics/realtime/realtime-session-data.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,iBAAiB,EAAW,MAAM,sBAAsB,CAAC;AAClE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAM5E;;;;GAIG;AACH,MAAM,MAAM,0BAA0B,GAAG,WAAW,CAAC,sBAAsB,CAAC,aAAa,CAAC,CAAC,CAAC;AAE5F,MAAM,WAAW,qBAAqB;IAClC,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,QAAQ,GAAG,MAAM,GAAG,QAAQ,CAAC;IACrC,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,WAAW,EAAE,0BAA0B,GAAG,IAAI,CAAC;IAC/C,cAAc,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,4BAA4B;IACzC,EAAE,EAAE,MAAM,CAAC;IACX,cAAc,EAAE,MAAM,CAAC;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,wBAAwB;IACrC,EAAE,EAAE,MAAM,CAAC;IACX,cAAc,E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EAC3B,SAAS,EAAE,MAAM,GAClB,OAAO,CAAC,uBAAuB,CAAC,CAsDlC;AAsFD,6FAA6F;AAC7F,MAAM,WAAW,oBAAoB;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,uGAAuG;IACvG,IAAI,EAAE,MAAM,CAAC;CAChB;AAED;;;;GAIG;AACH,wBAAgB,yBAAyB,CACrC,MAAM,EAAE,qBAAqB,CAAC,QAAQ,CAAC,EACvC,WAAW,EAAE,0BAA0B,GAAG,IAAI,GAC/C,oBAAoB,CAyBtB;AAED,4FAA4F;AAC5F,wBAAgB,qBAAqB,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAQxD;AAED,yCAAyC;AACzC,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAItD;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,SAAI,GAAG,MAAM,CAIrE;AAED,8DAA8D;AAC9D,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,CAWrD;AAED,sFAAsF;AACtF,wBAAgB,gBAAgB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAQ5D"}
@@ -137,7 +137,7 @@ function buildRollup(session, channelMap, runMap, agentNameMap) {
137
137
  DurationMs: durationMs,
138
138
  IsResumed: session.LastSessionID != null,
139
139
  CloseReason: closeReason,
140
- IsJanitorClosed: closeReason === 'Janitor'
140
+ IsJanitorClosed: closeReason === 'Janitor' || closeReason === 'Idle' || closeReason === 'TimeLimit'
141
141
  };
142
142
  }
143
143
  function parseSessionConfig(raw) {
@@ -167,7 +167,13 @@ export function BuildSessionStatusDisplay(status, closeReason) {
167
167
  case 'Explicit':
168
168
  return { Label: 'Closed', Title: 'Closed explicitly (user hang-up / close mutation)', Icon: 'fa-solid fa-circle-stop' };
169
169
  case 'Janitor':
170
- return { Label: 'Closed · janitor', Title: 'Force-closed by the lifecycle janitor (staleness sweep / orphan reconciliation)', Icon: 'fa-solid fa-broom' };
170
+ // Rows closed before TimeLimit and Idle existed keep 'Janitor' for every expiry close, so the title names both meanings.
171
+ return { Label: 'Closed · janitor', Title: 'Closed by the lifecycle janitor: an orphan from an earlier boot, or (for sessions closed before the idle and time-limit reasons existed) an idle or time limit close', Icon: 'fa-solid fa-broom' };
172
+ case 'TimeLimit':
173
+ // The janitor's deadline sweep or the browser's own deadline alarm (a claim the server verified): not always the janitor.
174
+ return { Label: 'Closed · time limit', Title: 'Closed because the session reached its time limit', Icon: 'fa-solid fa-hourglass-end' };
175
+ case 'Idle':
176
+ return { Label: 'Closed · idle — no activity', Title: 'Closed by the janitor staleness sweep after no activity', Icon: 'fa-solid fa-moon' };
171
177
  case 'Shutdown':
172
178
  return { Label: 'Closed · shutdown', Title: 'Closed by the host’s graceful shutdown drain', Icon: 'fa-solid fa-power-off' };
173
179
  case 'Error':
@@ -1 +1 @@
1
- {"version":3,"file":"realtime-session-data.js","sourceRoot":"","sources":["../../../../../src/AI/components/analytics/realtime/realtime-session-data.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAqB,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAClE,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAwG9D,kBAAkB;AAElB,MAAM,cAAc,GAAG;IACnB,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,gBAAgB;IACtE,eAAe,EAAE,gBAAgB,EAAE,QAAQ,EAAE,cAAc,EAAE,UAAU,EAAE,aAAa,EAAE,gBAAgB;CAC3G,CAAC;AAEF,MAAM,sBAAsB,GAAG,CAAC,IAAI,EAAE,gBAAgB,EAAE,SAAS,EAAE,QAAQ,EAAE,gBAAgB,CAAC,CAAC;AAE/F,MAAM,kBAAkB,GAAG,CAAC,IA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B,CAAC;IACjF,IAAI,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC;QAAE,OAAO,qBAAqB,CAAC;IAC3D,IAAI,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC;QAAE,OAAO,mBAAmB,CAAC;IACvD,OAAO,kBAAkB,CAAC;AAC9B,CAAC","sourcesContent":["/**\n * @fileoverview Shared data layer for the Realtime Voice analytics sections.\n *\n * Loads `MJ: AI Agent Sessions`, their `MJ: AI Agent Session Channels` rows,\n * and the delegated `MJ: AI Agent Runs` (linked via `AgentSessionID`) in a\n * single batched `RunViews` call, then aggregates everything client-side into\n * per-session rollups (target agent, channel set, delegated-run count, token /\n * cost totals, duration, close cause from the persisted `CloseReason` column).\n *\n * Used by both `AnalyticsRealtimeOverviewComponent` (KPIs + charts) and\n * `AnalyticsRealtimeSessionsComponent` (management grid) so the two sections\n * share one query shape and one aggregation pass.\n */\n\nimport { IMetadataProvider, RunView } from '@memberjunction/core';\nimport { NormalizeUUID } from '@memberjunction/global';\nimport { AIEngineBase } from '@memberjunction/ai-engine-base';\n\n// ── Raw row shapes (ResultType: 'simple', narrowed Fields) ──\n\n/**\n * Why a session was closed, as stamped server-side by `SessionManager.CloseSession`\n * (mirrors `AIAgentSessionEntity.CloseReason`). `null` means a legacy row closed\n * before the column existed — rendered as \"unknown\".\n */\nexport type RealtimeSessionCloseReason = 'Error' | 'Explicit' | 'Janitor' | 'Shutdown';\n\nexport interface RealtimeSessionRecord {\n ID: string;\n AgentID: string;\n Agent: string | null;\n UserID: string;\n User: string;\n Status: 'Active' | 'Idle' | 'Closed';\n ConversationID: string | null;\n LastSessionID: string | null;\n HostInstanceID: string | null;\n Config: string | null;\n LastActiveAt: string;\n ClosedAt: string | null;\n CloseReason: RealtimeSessionCloseReason | null;\n __mj_CreatedAt: string;\n}\n\nexport interface RealtimeSessionChannelRecord {\n ID: string;\n AgentSessionID: string;\n Channel: string;\n Status: string;\n __mj_CreatedAt: string;\n}\n\nexport interface RealtimeSessionRunRecord {\n ID: string;\n AgentSessionID: string | null;\n AgentID: string;\n Agent: string | null;\n TotalCost: number | null;\n TotalTokensUsed: number | null;\n StartedAt: string;\n}\n\n/** Shape of the run ids the realtime voice stack persists in `AIAgentSession.Config`. */\ninterface RealtimeSessionConfigJson {\n targetAgentID?: string;\n coAgentRunID?: string;\n promptRunID?: string;\n pendingFeedbackRunID?: string;\n}\n\n// ── Aggregated shapes ──\n\n/** One session with everything the admin pages render, pre-aggregated. */\nexport interface RealtimeSessionRollup {\n Record: RealtimeSessionRecord;\n /** Parsed from Config JSON; null when the session carries no target. */\n TargetAgentID: string | null;\n /** Resolved client-side against AIEngineBase's cached agents. */\n TargetAgentName: string | null;\n /** Distinct channel names attached to the session. */\n ChannelNames: string[];\n /** Delegated AIAgentRuns (linked runs excluding the co-agent observability run). */\n DelegatedRunCount: number;\n /** Token total across all linked agent runs (co-agent + delegated). */\n TotalTokens: number;\n /** Cost total across all linked agent runs (co-agent + delegated). */\n TotalCost: number;\n StartedAt: Date;\n /** __mj_CreatedAt → (ClosedAt ?? LastActiveAt). 0 when not derivable. */\n DurationMs: number;\n /** Session resumed from a prior one (LastSessionID set). */\n IsResumed: boolean;\n /**\n * Close cause persisted by the server (`AIAgentSession.CloseReason`).\n * `null` either means the session is still open, or it's a legacy row\n * closed before the column existed (\"unknown\" in the UI).\n */\n CloseReason: RealtimeSessionCloseReason | null;\n /**\n * `CloseReason === 'Janitor'` — the session was force-closed by the\n * lifecycle janitor (startup orphan recovery or staleness sweep) rather\n * than ended explicitly. Derived from the real column; the old\n * ClosedAt−LastActiveAt timing heuristic has been retired, so legacy\n * NULL-reason rows report `false` here and \"unknown\" in the UI.\n */\n IsJanitorClosed: boolean;\n}\n\n/** Result of one load pass — current-window rollups plus trend context. */\nexport interface RealtimeSessionsDataset {\n /** Sessions started in the current window (or still open), newest first. */\n Sessions: RealtimeSessionRollup[];\n /** Every loaded session rollup (covers 2× the window, for trend math). */\n AllSessions: RealtimeSessionRollup[];\n /** Count of sessions started in the prior (equal-length) window. */\n PriorWindowSessionCount: number;\n WindowStart: Date;\n WindowMs: number;\n}\n\n// ── Constants ──\n\nconst SESSION_FIELDS = [\n 'ID', 'AgentID', 'Agent', 'UserID', 'User', 'Status', 'ConversationID',\n 'LastSessionID', 'HostInstanceID', 'Config', 'LastActiveAt', 'ClosedAt', 'CloseReason', '__mj_CreatedAt'\n];\n\nconst SESSION_CHANNEL_FIELDS = ['ID', 'AgentSessionID', 'Channel', 'Status', '__mj_CreatedAt'];\n\nconst SESSION_RUN_FIELDS = ['ID', 'AgentSessionID', 'AgentID', 'Agent', 'TotalCost', 'TotalTokensUsed', 'StartedAt'];\n\n/** Supported time-range keys → milliseconds. */\nconst TIME_RANGE_MS: Record<string, number> = {\n '24h': 86_400_000,\n '7d': 604_800_000,\n '30d': 2_592_000_000\n};\n\nexport function TimeRangeToMs(range: string): number {\n return TIME_RANGE_MS[range] ?? TIME_RANGE_MS['7d'];\n}\n\n// ── Loading + aggregation ──\n\n/**\n * Loads sessions (2× window for trend), their channels, and linked agent runs\n * via one batched RunViews call, then folds them into per-session rollups.\n */\nexport async function LoadRealtimeSessionsDataset(\n provider: IMetadataProvider,\n timeRange: string\n): Promise<RealtimeSessionsDataset> {\n const windowMs = TimeRangeToMs(timeRange);\n const now = Date.now();\n const windowStart = new Date(now - windowMs);\n const doubleWindowStart = new Date(now - windowMs * 2);\n\n const rv = RunView.FromMetadataProvider(provider);\n const [sessionResult, channelResult, runResult] = await rv.RunViews([\n {\n EntityName: 'MJ: AI Agent Sessions',\n ExtraFilter: `__mj_CreatedAt >= '${doubleWindowStart.toISOString()}' OR Status IN ('Active','Idle')`,\n Fields: SESSION_FIELDS,\n OrderBy: '__mj_CreatedAt DESC',\n ResultType: 'simple'\n },\n {\n EntityName: 'MJ: AI Agent Session Channels',\n ExtraFilter: `__mj_CreatedAt >= '${doubleWindowStart.toISOString()}' OR Status = 'Connected'`,\n Fields: SESSION_CHANNEL_FIELDS,\n ResultType: 'simple'\n },\n {\n EntityName: 'MJ: AI Agent Runs',\n ExtraFilter: `AgentSessionID IS NOT NULL AND StartedAt >= '${doubleWindowStart.toISOString()}'`,\n Fields: SESSION_RUN_FIELDS,\n OrderBy: 'StartedAt DESC',\n ResultType: 'simple'\n }\n ]);\n\n const sessions = (sessionResult?.Success ? sessionResult.Results : []) as RealtimeSessionRecord[];\n const channels = (channelResult?.Success ? channelResult.Results : []) as RealtimeSessionChannelRecord[];\n const runs = (runResult?.Success ? runResult.Results : []) as RealtimeSessionRunRecord[];\n\n const agentNameMap = await buildAgentNameMap();\n const channelMap = groupBySessionId(channels, c => c.AgentSessionID);\n const runMap = groupBySessionId(runs, r => r.AgentSessionID);\n\n const allRollups = sessions.map(s => buildRollup(s, channelMap, runMap, agentNameMap));\n\n const currentWindow = allRollups.filter(\n r => r.StartedAt >= windowStart || r.Record.Status !== 'Closed'\n );\n const priorCount = allRollups.filter(\n r => r.StartedAt >= doubleWindowStart && r.StartedAt < windowStart\n ).length;\n\n return {\n Sessions: currentWindow,\n AllSessions: allRollups,\n PriorWindowSessionCount: priorCount,\n WindowStart: windowStart,\n WindowMs: windowMs\n };\n}\n\n/** Loads AIEngineBase (no-op when cached) and maps normalized agent ID → name. */\nasync function buildAgentNameMap(): Promise<Map<string, string>> {\n const map = new Map<string, string>();\n try {\n await AIEngineBase.Instance.Config(false);\n for (const agent of AIEngineBase.Instance.Agents ?? []) {\n map.set(NormalizeUUID(agent.ID), agent.Name ?? '');\n }\n } catch {\n // Tolerate engine load failures — target names degrade to null.\n }\n return map;\n}\n\nfunction groupBySessionId<T>(rows: T[], keyOf: (row: T) => string | null): Map<string, T[]> {\n const map = new Map<string, T[]>();\n for (const row of rows) {\n const raw = keyOf(row);\n if (!raw) continue;\n const key = NormalizeUUID(raw);\n const list = map.get(key);\n if (list) {\n list.push(row);\n } else {\n map.set(key, [row]);\n }\n }\n return map;\n}\n\nfunction buildRollup(\n session: RealtimeSessionRecord,\n channelMap: Map<string, RealtimeSessionChannelRecord[]>,\n runMap: Map<string, RealtimeSessionRunRecord[]>,\n agentNameMap: Map<string, string>\n): RealtimeSessionRollup {\n const key = NormalizeUUID(session.ID);\n const config = parseSessionConfig(session.Config);\n const sessionRuns = runMap.get(key) ?? [];\n const coAgentRunKey = config.coAgentRunID ? NormalizeUUID(config.coAgentRunID) : null;\n\n const delegatedRuns = sessionRuns.filter(r => !coAgentRunKey || NormalizeUUID(r.ID) !== coAgentRunKey);\n const totalTokens = sessionRuns.reduce((s, r) => s + (r.TotalTokensUsed ?? 0), 0);\n const totalCost = sessionRuns.reduce((s, r) => s + (r.TotalCost ?? 0), 0);\n\n const channelNames = Array.from(\n new Set((channelMap.get(key) ?? []).map(c => c.Channel).filter(Boolean))\n );\n\n const startedAt = new Date(session.__mj_CreatedAt);\n const endAt = session.ClosedAt ? new Date(session.ClosedAt) : new Date(session.LastActiveAt);\n const durationMs = Math.max(0, endAt.getTime() - startedAt.getTime());\n\n const closeReason = session.Status === 'Closed' ? session.CloseReason ?? null : null;\n\n const targetAgentID = config.targetAgentID ?? null;\n return {\n Record: session,\n TargetAgentID: targetAgentID,\n TargetAgentName: targetAgentID ? agentNameMap.get(NormalizeUUID(targetAgentID)) ?? null : null,\n ChannelNames: channelNames,\n DelegatedRunCount: delegatedRuns.length,\n TotalTokens: totalTokens,\n TotalCost: totalCost,\n StartedAt: startedAt,\n DurationMs: durationMs,\n IsResumed: session.LastSessionID != null,\n CloseReason: closeReason,\n IsJanitorClosed: closeReason === 'Janitor'\n };\n}\n\nfunction parseSessionConfig(raw: string | null): RealtimeSessionConfigJson {\n if (!raw) return {};\n try {\n const parsed = JSON.parse(raw) as RealtimeSessionConfigJson;\n return parsed && typeof parsed === 'object' ? parsed : {};\n } catch {\n return {};\n }\n}\n\n// ── Formatting helpers (shared by both sections) ──\n\n/** How a session's status pill should render — label, hover title, and Font Awesome icon. */\nexport interface SessionStatusDisplay {\n Label: string;\n Title: string;\n /** Icon class for the pill; empty for `Active` (the template renders the pulsing live dot instead). */\n Icon: string;\n}\n\n/**\n * Builds the status-pill presentation for a session from its `Status` and persisted\n * `CloseReason`. `Closed` sessions surface the real close cause; a `null` reason\n * (legacy rows written before the column existed) renders as \"unknown\".\n */\nexport function BuildSessionStatusDisplay(\n status: RealtimeSessionRecord['Status'],\n closeReason: RealtimeSessionCloseReason | null\n): SessionStatusDisplay {\n if (status === 'Active') {\n return { Label: 'Active', Title: 'Live duplex session', Icon: '' };\n }\n if (status === 'Idle') {\n return { Label: 'Idle', Title: 'Holding — past the idle threshold', Icon: 'fa-solid fa-pause' };\n }\n switch (closeReason) {\n case 'Explicit':\n return { Label: 'Closed', Title: 'Closed explicitly (user hang-up / close mutation)', Icon: 'fa-solid fa-circle-stop' };\n case 'Janitor':\n return { Label: 'Closed · janitor', Title: 'Force-closed by the lifecycle janitor (staleness sweep / orphan reconciliation)', Icon: 'fa-solid fa-broom' };\n case 'Shutdown':\n return { Label: 'Closed · shutdown', Title: 'Closed by the host’s graceful shutdown drain', Icon: 'fa-solid fa-power-off' };\n case 'Error':\n return { Label: 'Closed · error', Title: 'Closed by a failure-path teardown', Icon: 'fa-solid fa-triangle-exclamation' };\n default:\n return { Label: 'Closed · unknown', Title: 'Closed before close-cause tracking existed (legacy row)', Icon: 'fa-solid fa-circle-question' };\n }\n}\n\n/** Formats a duration as m:ss (or h:mm:ss past the hour) like the mockups' 4:51 / 11:18. */\nexport function FormatSessionDuration(ms: number): string {\n if (ms <= 0) return '0:00';\n const totalSeconds = Math.floor(ms / 1000);\n const seconds = totalSeconds % 60;\n const minutes = Math.floor(totalSeconds / 60) % 60;\n const hours = Math.floor(totalSeconds / 3600);\n const pad = (n: number) => n.toString().padStart(2, '0');\n return hours > 0 ? `${hours}:${pad(minutes)}:${pad(seconds)}` : `${minutes}:${pad(seconds)}`;\n}\n\n/** 4200 → \"4.2K\", 1_250_000 → \"1.3M\". */\nexport function FormatTokenCount(value: number): string {\n if (value >= 1_000_000) return (value / 1_000_000).toFixed(1) + 'M';\n if (value >= 1_000) return (value / 1_000).toFixed(1) + 'K';\n return value.toString();\n}\n\nexport function FormatSessionCost(value: number, decimals = 2): string {\n if (value === 0) return '$0.00';\n if (value < 0.01 && decimals < 4) decimals = 4;\n return '$' + value.toFixed(decimals);\n}\n\n/** Today → \"3:40 pm\", yesterday → \"Yesterday\", else \"M/d\". */\nexport function FormatSessionStart(date: Date): string {\n const now = new Date();\n const startOfToday = new Date(now.getFullYear(), now.getMonth(), now.getDate());\n const startOfYesterday = new Date(startOfToday.getTime() - 86_400_000);\n if (date >= startOfToday) {\n return date.toLocaleTimeString([], { hour: 'numeric', minute: '2-digit' }).toLowerCase();\n }\n if (date >= startOfYesterday) {\n return 'Yesterday';\n }\n return date.toLocaleDateString([], { month: 'numeric', day: 'numeric' });\n}\n\n/** Font Awesome icon for a channel name (keyword-mapped, with a generic fallback). */\nexport function ChannelIconClass(channelName: string): string {\n const name = channelName.toLowerCase();\n if (name.includes('voice') || name.includes('audio')) return 'fa-solid fa-microphone-lines';\n if (name.includes('whiteboard') || name.includes('board')) return 'fa-solid fa-chalkboard';\n if (name.includes('text') || name.includes('chat')) return 'fa-solid fa-comment';\n if (name.includes('control')) return 'fa-solid fa-sliders';\n if (name.includes('video')) return 'fa-solid fa-video';\n return 'fa-solid fa-plug';\n}\n"]}
1
+ {"version":3,"file":"realtime-session-data.js","sourceRoot":"","sources":["../../../../../src/AI/components/analytics/realtime/realtime-session-data.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAqB,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAElE,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAyG9D,kBAAkB;AAElB,MAAM,cAAc,GAAG;IACnB,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,gBAAgB;IACtE,eAAe,EAA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AAE,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,EAAE,SAAS,EAAE,CAAC,CAAC;AAC7E,CAAC;AAED,sFAAsF;AACtF,MAAM,UAAU,gBAAgB,CAAC,WAAmB;IAChD,MAAM,IAAI,GAAG,WAAW,CAAC,WAAW,EAAE,CAAC;IACvC,IAAI,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC;QAAE,OAAO,8BAA8B,CAAC;IAC5F,IAAI,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC;QAAE,OAAO,wBAAwB,CAAC;IAC3F,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC;QAAE,OAAO,qBAAqB,CAAC;IACjF,IAAI,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC;QAAE,OAAO,qBAAqB,CAAC;IAC3D,IAAI,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC;QAAE,OAAO,mBAAmB,CAAC;IACvD,OAAO,kBAAkB,CAAC;AAC9B,CAAC","sourcesContent":["/**\n * @fileoverview Shared data layer for the Realtime Voice analytics sections.\n *\n * Loads `MJ: AI Agent Sessions`, their `MJ: AI Agent Session Channels` rows,\n * and the delegated `MJ: AI Agent Runs` (linked via `AgentSessionID`) in a\n * single batched `RunViews` call, then aggregates everything client-side into\n * per-session rollups (target agent, channel set, delegated-run count, token /\n * cost totals, duration, close cause from the persisted `CloseReason` column).\n *\n * Used by both `AnalyticsRealtimeOverviewComponent` (KPIs + charts) and\n * `AnalyticsRealtimeSessionsComponent` (management grid) so the two sections\n * share one query shape and one aggregation pass.\n */\n\nimport { IMetadataProvider, RunView } from '@memberjunction/core';\nimport type { MJAIAgentSessionEntity } from '@memberjunction/core-entities';\nimport { NormalizeUUID } from '@memberjunction/global';\nimport { AIEngineBase } from '@memberjunction/ai-engine-base';\n\n// ── Raw row shapes (ResultType: 'simple', narrowed Fields) ──\n\n/**\n * Why a session was closed, as stamped server-side by `SessionManager.CloseSession`\n * (mirrors `AIAgentSessionEntity.CloseReason`). `null` means a legacy row closed\n * before the column existed — rendered as \"unknown\".\n */\nexport type RealtimeSessionCloseReason = NonNullable<MJAIAgentSessionEntity['CloseReason']>;\n\nexport interface RealtimeSessionRecord {\n ID: string;\n AgentID: string;\n Agent: string | null;\n UserID: string;\n User: string;\n Status: 'Active' | 'Idle' | 'Closed';\n ConversationID: string | null;\n LastSessionID: string | null;\n HostInstanceID: string | null;\n Config: string | null;\n LastActiveAt: string;\n ClosedAt: string | null;\n CloseReason: RealtimeSessionCloseReason | null;\n __mj_CreatedAt: string;\n}\n\nexport interface RealtimeSessionChannelRecord {\n ID: string;\n AgentSessionID: string;\n Channel: string;\n Status: string;\n __mj_CreatedAt: string;\n}\n\nexport interface RealtimeSessionRunRecord {\n ID: string;\n AgentSessionID: string | null;\n AgentID: string;\n Agent: string | null;\n TotalCost: number | null;\n TotalTokensUsed: number | null;\n StartedAt: string;\n}\n\n/** Shape of the run ids the realtime voice stack persists in `AIAgentSession.Config`. */\ninterface RealtimeSessionConfigJson {\n targetAgentID?: string;\n coAgentRunID?: string;\n promptRunID?: string;\n pendingFeedbackRunID?: string;\n}\n\n// ── Aggregated shapes ──\n\n/** One session with everything the admin pages render, pre-aggregated. */\nexport interface RealtimeSessionRollup {\n Record: RealtimeSessionRecord;\n /** Parsed from Config JSON; null when the session carries no target. */\n TargetAgentID: string | null;\n /** Resolved client-side against AIEngineBase's cached agents. */\n TargetAgentName: string | null;\n /** Distinct channel names attached to the session. */\n ChannelNames: string[];\n /** Delegated AIAgentRuns (linked runs excluding the co-agent observability run). */\n DelegatedRunCount: number;\n /** Token total across all linked agent runs (co-agent + delegated). */\n TotalTokens: number;\n /** Cost total across all linked agent runs (co-agent + delegated). */\n TotalCost: number;\n StartedAt: Date;\n /** __mj_CreatedAt → (ClosedAt ?? LastActiveAt). 0 when not derivable. */\n DurationMs: number;\n /** Session resumed from a prior one (LastSessionID set). */\n IsResumed: boolean;\n /**\n * Close cause persisted by the server (`AIAgentSession.CloseReason`).\n * `null` either means the session is still open, or it's a legacy row\n * closed before the column existed (\"unknown\" in the UI).\n */\n CloseReason: RealtimeSessionCloseReason | null;\n /**\n * The session was closed by the system rather than ended by a person: `Idle` (the janitor's staleness sweep),\n * `TimeLimit` (the janitor's deadline sweep, or the browser's deadline alarm once the server verified the claim) or\n * `Janitor` (crash orphan reconciled at startup, and every expiry close recorded before `Idle` and `TimeLimit`\n * existed). All three count toward the \"System closes\" KPI. Derived from the real column; the old\n * ClosedAt−LastActiveAt timing heuristic has been retired, so legacy\n * NULL-reason rows report `false` here and \"unknown\" in the UI.\n */\n IsJanitorClosed: boolean;\n}\n\n/** Result of one load pass — current-window rollups plus trend context. */\nexport interface RealtimeSessionsDataset {\n /** Sessions started in the current window (or still open), newest first. */\n Sessions: RealtimeSessionRollup[];\n /** Every loaded session rollup (covers 2× the window, for trend math). */\n AllSessions: RealtimeSessionRollup[];\n /** Count of sessions started in the prior (equal-length) window. */\n PriorWindowSessionCount: number;\n WindowStart: Date;\n WindowMs: number;\n}\n\n// ── Constants ──\n\nconst SESSION_FIELDS = [\n 'ID', 'AgentID', 'Agent', 'UserID', 'User', 'Status', 'ConversationID',\n 'LastSessionID', 'HostInstanceID', 'Config', 'LastActiveAt', 'ClosedAt', 'CloseReason', '__mj_CreatedAt'\n];\n\nconst SESSION_CHANNEL_FIELDS = ['ID', 'AgentSessionID', 'Channel', 'Status', '__mj_CreatedAt'];\n\nconst SESSION_RUN_FIELDS = ['ID', 'AgentSessionID', 'AgentID', 'Agent', 'TotalCost', 'TotalTokensUsed', 'StartedAt'];\n\n/** Supported time-range keys → milliseconds. */\nconst TIME_RANGE_MS: Record<string, number> = {\n '24h': 86_400_000,\n '7d': 604_800_000,\n '30d': 2_592_000_000\n};\n\nexport function TimeRangeToMs(range: string): number {\n return TIME_RANGE_MS[range] ?? TIME_RANGE_MS['7d'];\n}\n\n// ── Loading + aggregation ──\n\n/**\n * Loads sessions (2× window for trend), their channels, and linked agent runs\n * via one batched RunViews call, then folds them into per-session rollups.\n */\nexport async function LoadRealtimeSessionsDataset(\n provider: IMetadataProvider,\n timeRange: string\n): Promise<RealtimeSessionsDataset> {\n const windowMs = TimeRangeToMs(timeRange);\n const now = Date.now();\n const windowStart = new Date(now - windowMs);\n const doubleWindowStart = new Date(now - windowMs * 2);\n\n const rv = RunView.FromMetadataProvider(provider);\n const [sessionResult, channelResult, runResult] = await rv.RunViews([\n {\n EntityName: 'MJ: AI Agent Sessions',\n ExtraFilter: `__mj_CreatedAt >= '${doubleWindowStart.toISOString()}' OR Status IN ('Active','Idle')`,\n Fields: SESSION_FIELDS,\n OrderBy: '__mj_CreatedAt DESC',\n ResultType: 'simple'\n },\n {\n EntityName: 'MJ: AI Agent Session Channels',\n ExtraFilter: `__mj_CreatedAt >= '${doubleWindowStart.toISOString()}' OR Status = 'Connected'`,\n Fields: SESSION_CHANNEL_FIELDS,\n ResultType: 'simple'\n },\n {\n EntityName: 'MJ: AI Agent Runs',\n ExtraFilter: `AgentSessionID IS NOT NULL AND StartedAt >= '${doubleWindowStart.toISOString()}'`,\n Fields: SESSION_RUN_FIELDS,\n OrderBy: 'StartedAt DESC',\n ResultType: 'simple'\n }\n ]);\n\n const sessions = (sessionResult?.Success ? sessionResult.Results : []) as RealtimeSessionRecord[];\n const channels = (channelResult?.Success ? channelResult.Results : []) as RealtimeSessionChannelRecord[];\n const runs = (runResult?.Success ? runResult.Results : []) as RealtimeSessionRunRecord[];\n\n const agentNameMap = await buildAgentNameMap();\n const channelMap = groupBySessionId(channels, c => c.AgentSessionID);\n const runMap = groupBySessionId(runs, r => r.AgentSessionID);\n\n const allRollups = sessions.map(s => buildRollup(s, channelMap, runMap, agentNameMap));\n\n const currentWindow = allRollups.filter(\n r => r.StartedAt >= windowStart || r.Record.Status !== 'Closed'\n );\n const priorCount = allRollups.filter(\n r => r.StartedAt >= doubleWindowStart && r.StartedAt < windowStart\n ).length;\n\n return {\n Sessions: currentWindow,\n AllSessions: allRollups,\n PriorWindowSessionCount: priorCount,\n WindowStart: windowStart,\n WindowMs: windowMs\n };\n}\n\n/** Loads AIEngineBase (no-op when cached) and maps normalized agent ID → name. */\nasync function buildAgentNameMap(): Promise<Map<string, string>> {\n const map = new Map<string, string>();\n try {\n await AIEngineBase.Instance.Config(false);\n for (const agent of AIEngineBase.Instance.Agents ?? []) {\n map.set(NormalizeUUID(agent.ID), agent.Name ?? '');\n }\n } catch {\n // Tolerate engine load failures — target names degrade to null.\n }\n return map;\n}\n\nfunction groupBySessionId<T>(rows: T[], keyOf: (row: T) => string | null): Map<string, T[]> {\n const map = new Map<string, T[]>();\n for (const row of rows) {\n const raw = keyOf(row);\n if (!raw) continue;\n const key = NormalizeUUID(raw);\n const list = map.get(key);\n if (list) {\n list.push(row);\n } else {\n map.set(key, [row]);\n }\n }\n return map;\n}\n\nfunction buildRollup(\n session: RealtimeSessionRecord,\n channelMap: Map<string, RealtimeSessionChannelRecord[]>,\n runMap: Map<string, RealtimeSessionRunRecord[]>,\n agentNameMap: Map<string, string>\n): RealtimeSessionRollup {\n const key = NormalizeUUID(session.ID);\n const config = parseSessionConfig(session.Config);\n const sessionRuns = runMap.get(key) ?? [];\n const coAgentRunKey = config.coAgentRunID ? NormalizeUUID(config.coAgentRunID) : null;\n\n const delegatedRuns = sessionRuns.filter(r => !coAgentRunKey || NormalizeUUID(r.ID) !== coAgentRunKey);\n const totalTokens = sessionRuns.reduce((s, r) => s + (r.TotalTokensUsed ?? 0), 0);\n const totalCost = sessionRuns.reduce((s, r) => s + (r.TotalCost ?? 0), 0);\n\n const channelNames = Array.from(\n new Set((channelMap.get(key) ?? []).map(c => c.Channel).filter(Boolean))\n );\n\n const startedAt = new Date(session.__mj_CreatedAt);\n const endAt = session.ClosedAt ? new Date(session.ClosedAt) : new Date(session.LastActiveAt);\n const durationMs = Math.max(0, endAt.getTime() - startedAt.getTime());\n\n const closeReason = session.Status === 'Closed' ? session.CloseReason ?? null : null;\n\n const targetAgentID = config.targetAgentID ?? null;\n return {\n Record: session,\n TargetAgentID: targetAgentID,\n TargetAgentName: targetAgentID ? agentNameMap.get(NormalizeUUID(targetAgentID)) ?? null : null,\n ChannelNames: channelNames,\n DelegatedRunCount: delegatedRuns.length,\n TotalTokens: totalTokens,\n TotalCost: totalCost,\n StartedAt: startedAt,\n DurationMs: durationMs,\n IsResumed: session.LastSessionID != null,\n CloseReason: closeReason,\n IsJanitorClosed: closeReason === 'Janitor' || closeReason === 'Idle' || closeReason === 'TimeLimit'\n };\n}\n\nfunction parseSessionConfig(raw: string | null): RealtimeSessionConfigJson {\n if (!raw) return {};\n try {\n const parsed = JSON.parse(raw) as RealtimeSessionConfigJson;\n return parsed && typeof parsed === 'object' ? parsed : {};\n } catch {\n return {};\n }\n}\n\n// ── Formatting helpers (shared by both sections) ──\n\n/** How a session's status pill should render — label, hover title, and Font Awesome icon. */\nexport interface SessionStatusDisplay {\n Label: string;\n Title: string;\n /** Icon class for the pill; empty for `Active` (the template renders the pulsing live dot instead). */\n Icon: string;\n}\n\n/**\n * Builds the status-pill presentation for a session from its `Status` and persisted\n * `CloseReason`. `Closed` sessions surface the real close cause; a `null` reason\n * (legacy rows written before the column existed) renders as \"unknown\".\n */\nexport function BuildSessionStatusDisplay(\n status: RealtimeSessionRecord['Status'],\n closeReason: RealtimeSessionCloseReason | null\n): SessionStatusDisplay {\n if (status === 'Active') {\n return { Label: 'Active', Title: 'Live duplex session', Icon: '' };\n }\n if (status === 'Idle') {\n return { Label: 'Idle', Title: 'Holding — past the idle threshold', Icon: 'fa-solid fa-pause' };\n }\n switch (closeReason) {\n case 'Explicit':\n return { Label: 'Closed', Title: 'Closed explicitly (user hang-up / close mutation)', Icon: 'fa-solid fa-circle-stop' };\n case 'Janitor':\n // Rows closed before TimeLimit and Idle existed keep 'Janitor' for every expiry close, so the title names both meanings.\n return { Label: 'Closed · janitor', Title: 'Closed by the lifecycle janitor: an orphan from an earlier boot, or (for sessions closed before the idle and time-limit reasons existed) an idle or time limit close', Icon: 'fa-solid fa-broom' };\n case 'TimeLimit':\n // The janitor's deadline sweep or the browser's own deadline alarm (a claim the server verified): not always the janitor.\n return { Label: 'Closed · time limit', Title: 'Closed because the session reached its time limit', Icon: 'fa-solid fa-hourglass-end' };\n case 'Idle':\n return { Label: 'Closed · idle — no activity', Title: 'Closed by the janitor staleness sweep after no activity', Icon: 'fa-solid fa-moon' };\n case 'Shutdown':\n return { Label: 'Closed · shutdown', Title: 'Closed by the host’s graceful shutdown drain', Icon: 'fa-solid fa-power-off' };\n case 'Error':\n return { Label: 'Closed · error', Title: 'Closed by a failure-path teardown', Icon: 'fa-solid fa-triangle-exclamation' };\n default:\n return { Label: 'Closed · unknown', Title: 'Closed before close-cause tracking existed (legacy row)', Icon: 'fa-solid fa-circle-question' };\n }\n}\n\n/** Formats a duration as m:ss (or h:mm:ss past the hour) like the mockups' 4:51 / 11:18. */\nexport function FormatSessionDuration(ms: number): string {\n if (ms <= 0) return '0:00';\n const totalSeconds = Math.floor(ms / 1000);\n const seconds = totalSeconds % 60;\n const minutes = Math.floor(totalSeconds / 60) % 60;\n const hours = Math.floor(totalSeconds / 3600);\n const pad = (n: number) => n.toString().padStart(2, '0');\n return hours > 0 ? `${hours}:${pad(minutes)}:${pad(seconds)}` : `${minutes}:${pad(seconds)}`;\n}\n\n/** 4200 → \"4.2K\", 1_250_000 → \"1.3M\". */\nexport function FormatTokenCount(value: number): string {\n if (value >= 1_000_000) return (value / 1_000_000).toFixed(1) + 'M';\n if (value >= 1_000) return (value / 1_000).toFixed(1) + 'K';\n return value.toString();\n}\n\nexport function FormatSessionCost(value: number, decimals = 2): string {\n if (value === 0) return '$0.00';\n if (value < 0.01 && decimals < 4) decimals = 4;\n return '$' + value.toFixed(decimals);\n}\n\n/** Today → \"3:40 pm\", yesterday → \"Yesterday\", else \"M/d\". */\nexport function FormatSessionStart(date: Date): string {\n const now = new Date();\n const startOfToday = new Date(now.getFullYear(), now.getMonth(), now.getDate());\n const startOfYesterday = new Date(startOfToday.getTime() - 86_400_000);\n if (date >= startOfToday) {\n return date.toLocaleTimeString([], { hour: 'numeric', minute: '2-digit' }).toLowerCase();\n }\n if (date >= startOfYesterday) {\n return 'Yesterday';\n }\n return date.toLocaleDateString([], { month: 'numeric', day: 'numeric' });\n}\n\n/** Font Awesome icon for a channel name (keyword-mapped, with a generic fallback). */\nexport function ChannelIconClass(channelName: string): string {\n const name = channelName.toLowerCase();\n if (name.includes('voice') || name.includes('audio')) return 'fa-solid fa-microphone-lines';\n if (name.includes('whiteboard') || name.includes('board')) return 'fa-solid fa-chalkboard';\n if (name.includes('text') || name.includes('chat')) return 'fa-solid fa-comment';\n if (name.includes('control')) return 'fa-solid fa-sliders';\n if (name.includes('video')) return 'fa-solid fa-video';\n return 'fa-solid fa-plug';\n}\n"]}
@@ -890,7 +890,7 @@ let AutotaggingPipelineResourceComponent = class AutotaggingPipelineResourceComp
890
890
  Fields: ['ID'],
891
891
  ResultType: 'count_only',
892
892
  });
893
- this.InboxPendingCount = result.Success ? result.TotalRowCount : 0;
893
+ this.InboxPendingCount = result.Success ? result.TotalRowCount ?? 0 : 0;
894
894
  }
895
895
  /**
896
896
  * Fired by the Inbox tab after a suggestion is approved/merged/rejected.
@@ -918,7 +918,7 @@ let AutotaggingPipelineResourceComponent = class AutotaggingPipelineResourceComp
918
918
  Fields: ['ID'],
919
919
  ResultType: 'count_only',
920
920
  });
921
- this.HealthPendingCount = result.Success ? result.TotalRowCount : 0;
921
+ this.HealthPendingCount = result.Success ? result.TotalRowCount ?? 0 : 0;
922
922
  }
923
923
  /**
924
924
  * Fired by the Health tab after a merge/deprecate/dismiss. Refreshes the
@@ -1023,9 +1023,9 @@ let AutotaggingPipelineResourceComponent = class AutotaggingPipelineResourceComp
1023
1023
  this.contentTypesRaw = contentTypesResult.Success ? contentTypesResult.Results : [];
1024
1024
  // Use TotalRowCount for accurate KPI/badge counts (the Results arrays are
1025
1025
  // capped by MaxRows for feed display, but TotalRowCount reflects the full DB count)
1026
- this.totalContentItemCount = itemsResult.Success ? itemsResult.TotalRowCount : 0;
1027
- this.totalContentTagCount = tagsResult.Success ? tagsResult.TotalRowCount : 0;
1028
- this.totalRunHistoryCount = runsResult.Success ? runsResult.TotalRowCount : 0;
1026
+ this.totalContentItemCount = itemsResult.Success ? itemsResult.TotalRowCount ?? 0 : 0;
1027
+ this.totalContentTagCount = tagsResult.Success ? tagsResult.TotalRowCount ?? 0 : 0;
1028
+ this.totalRunHistoryCount = runsResult.Success ? runsResult.TotalRowCount ?? 0 : 0;
1029
1029
  // Load Scheduled Job entities referenced by sources so cron descriptions are available
1030
1030
  await this.loadScheduledJobsForSources();
1031
1031
  this.buildNavItems();
@@ -1231,7 +1231,7 @@ let AutotaggingPipelineResourceComponent = class AutotaggingPipelineResourceComp
1231
1231
  });
1232
1232
  if (result.Success) {
1233
1233
  this.contentRunsRaw = result.Results;
1234
- this.totalRunHistoryCount = result.TotalRowCount;
1234
+ this.totalRunHistoryCount = result.TotalRowCount ?? 0;
1235
1235
  }
1236
1236
  }
1237
1237
  }