@oneuptime/common 11.4.0 → 11.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (473) hide show
  1. package/Models/DatabaseModels/AIRun.ts +50 -0
  2. package/Models/DatabaseModels/AlertSeverity.ts +6 -0
  3. package/Models/DatabaseModels/IncidentSeverity.ts +6 -0
  4. package/Models/DatabaseModels/Index.ts +16 -0
  5. package/Models/DatabaseModels/IoTDeviceCredential.ts +471 -0
  6. package/Models/DatabaseModels/LlmLog.ts +56 -0
  7. package/Models/DatabaseModels/LlmProvider.ts +33 -0
  8. package/Models/DatabaseModels/NetworkDevice.ts +1385 -0
  9. package/Models/DatabaseModels/NetworkDeviceDiscoveryScan.ts +717 -0
  10. package/Models/DatabaseModels/NetworkDeviceLabelRule.ts +514 -0
  11. package/Models/DatabaseModels/NetworkDeviceOwnerRule.ts +596 -0
  12. package/Models/DatabaseModels/NetworkDeviceOwnerTeam.ts +487 -0
  13. package/Models/DatabaseModels/NetworkDeviceOwnerUser.ts +486 -0
  14. package/Models/DatabaseModels/NetworkInterface.ts +563 -0
  15. package/Models/DatabaseModels/Project.ts +145 -0
  16. package/Models/DatabaseModels/TelemetryEntityRelationship.ts +54 -0
  17. package/Server/API/AIAgentTaskAPI.ts +10 -24
  18. package/Server/API/AIInvestigationAPI.ts +131 -63
  19. package/Server/API/AlertAPI.ts +5 -0
  20. package/Server/API/IncidentAPI.ts +10 -0
  21. package/Server/API/IncidentEpisodeAPI.ts +5 -0
  22. package/Server/API/LlmProviderAPI.ts +4 -0
  23. package/Server/API/ScheduledMaintenanceAPI.ts +5 -0
  24. package/Server/API/TelemetryAPI.ts +4 -3
  25. package/Server/Infrastructure/Postgres/SchemaMigrations/1783650000000-AddAdditionalParamsToLlmProvider.ts +19 -0
  26. package/Server/Infrastructure/Postgres/SchemaMigrations/1783695782697-AddCacheTokenColumnsToLlmLog.ts +25 -0
  27. package/Server/Infrastructure/Postgres/SchemaMigrations/1783701585317-AddAlertInvestigationGating.ts +31 -0
  28. package/Server/Infrastructure/Postgres/SchemaMigrations/1783702431535-AddAiDailyAutonomousTokenLimitToProject.ts +19 -0
  29. package/Server/Infrastructure/Postgres/SchemaMigrations/1783720000000-AddNetworkDeviceTables.ts +105 -0
  30. package/Server/Infrastructure/Postgres/SchemaMigrations/1783721121260-AddAttemptCountToAIRun.ts +15 -0
  31. package/Server/Infrastructure/Postgres/SchemaMigrations/1783730000000-AddNetworkDeviceOwnersAndRules.ts +192 -0
  32. package/Server/Infrastructure/Postgres/SchemaMigrations/1783740000000-AddNetworkDeviceDiscoveryScan.ts +37 -0
  33. package/Server/Infrastructure/Postgres/SchemaMigrations/1783750000000-AddLldpNeighborsToNetworkDevice.ts +19 -0
  34. package/Server/Infrastructure/Postgres/SchemaMigrations/1783760576655-AddInvestigationTuningToProject.ts +25 -0
  35. package/Server/Infrastructure/Postgres/SchemaMigrations/1783762505482-AddTelemetryEntityRelationshipMetrics.ts +31 -0
  36. package/Server/Infrastructure/Postgres/SchemaMigrations/1783780000000-AddIoTDeviceCredentialTable.ts +79 -0
  37. package/Server/Infrastructure/Postgres/SchemaMigrations/1783790000000-AddSnmpV3AuthColumnsToNetworkDevice.ts +49 -0
  38. package/Server/Infrastructure/Postgres/SchemaMigrations/Index.ts +24 -0
  39. package/Server/Services/AIAgentTaskService.ts +62 -0
  40. package/Server/Services/AIRunService.ts +58 -0
  41. package/Server/Services/AIService.ts +101 -0
  42. package/Server/Services/AnalyticsDatabaseService.ts +27 -0
  43. package/Server/Services/IncidentService.ts +14 -41
  44. package/Server/Services/Index.ts +14 -0
  45. package/Server/Services/IoTDeviceCredentialService.ts +351 -0
  46. package/Server/Services/IoTDeviceService.ts +64 -21
  47. package/Server/Services/LlmLogService.ts +26 -0
  48. package/Server/Services/LlmProviderService.ts +3 -0
  49. package/Server/Services/LogAggregationService.ts +29 -11
  50. package/Server/Services/MetricService.ts +603 -13
  51. package/Server/Services/MonitorService.ts +4 -1
  52. package/Server/Services/NetworkDeviceDiscoveryScanService.ts +10 -0
  53. package/Server/Services/NetworkDeviceLabelRuleEngineService.ts +204 -0
  54. package/Server/Services/NetworkDeviceLabelRuleService.ts +14 -0
  55. package/Server/Services/NetworkDeviceOwnerRuleEngineService.ts +222 -0
  56. package/Server/Services/NetworkDeviceOwnerRuleService.ts +14 -0
  57. package/Server/Services/NetworkDeviceOwnerTeamService.ts +10 -0
  58. package/Server/Services/NetworkDeviceOwnerUserService.ts +10 -0
  59. package/Server/Services/NetworkDeviceService.ts +50 -0
  60. package/Server/Services/NetworkInterfaceService.ts +10 -0
  61. package/Server/Services/TelemetryEntityRelationshipService.ts +23 -0
  62. package/Server/Services/TelemetryEntityService.ts +72 -2
  63. package/Server/Utils/AI/Sentinel/AlertInvestigationRunner.ts +244 -12
  64. package/Server/Utils/AI/Sentinel/IncidentInvestigationRunner.ts +92 -19
  65. package/Server/Utils/AI/Sentinel/InvestigationQueue.ts +493 -0
  66. package/Server/Utils/AI/Sentinel/README.md +10 -0
  67. package/Server/Utils/AI/Sentinel/SentinelInvestigationEngine.ts +88 -68
  68. package/Server/Utils/AI/Toolbox/Index.ts +2 -1
  69. package/Server/Utils/AI/Toolbox/MetricTools.ts +391 -0
  70. package/Server/Utils/LLM/LLMService.ts +21 -0
  71. package/Server/Utils/Monitor/Criteria/APIRequestCriteria.ts +44 -0
  72. package/Server/Utils/Monitor/Criteria/SnmpMonitorCriteria.ts +170 -2
  73. package/Server/Utils/Monitor/IoTDeviceAbsenceSeries.ts +101 -0
  74. package/Server/Utils/Monitor/MonitorAlert.ts +15 -3
  75. package/Server/Utils/Monitor/MonitorCriteriaEvaluator.ts +1 -1
  76. package/Server/Utils/Monitor/MonitorIncident.ts +19 -3
  77. package/Server/Utils/Monitor/MonitorMetricUtil.ts +195 -2
  78. package/Server/Utils/Monitor/MonitorResource.ts +77 -21
  79. package/Server/Utils/Monitor/MonitorTemplateUtil.ts +1 -1
  80. package/Server/Utils/Monitor/NetworkDeviceHydrationUtil.ts +201 -0
  81. package/Server/Utils/Monitor/NetworkInventoryUtil.ts +215 -0
  82. package/Server/Utils/Monitor/SnmpInterfaceRateUtil.ts +169 -0
  83. package/Tests/Server/Services/AIAgentTaskServiceClaim.test.ts +146 -0
  84. package/Tests/Server/Services/AIServiceDailyBudget.test.ts +173 -0
  85. package/Tests/Server/Services/IncidentInternalNoteAnnouncement.test.ts +97 -0
  86. package/Tests/Server/Services/IoTDeviceService.test.ts +54 -0
  87. package/Tests/Server/Services/LogAggregationService.test.ts +22 -0
  88. package/Tests/Server/Services/MetricServiceAggregate.test.ts +194 -0
  89. package/Tests/Server/Utils/AI/BaselineAnomalyTool.test.ts +253 -0
  90. package/Tests/Server/Utils/AI/LLMServiceToolCalling.test.ts +44 -0
  91. package/Tests/Server/Utils/AI/SentinelAlertGating.test.ts +360 -0
  92. package/Tests/Server/Utils/AI/SentinelInvestigationQueue.test.ts +295 -0
  93. package/Tests/Server/Utils/Monitor/Criteria/SnmpMonitorCriteria.test.ts +59 -0
  94. package/Tests/Server/Utils/Monitor/IoTDeviceAbsenceSeries.test.ts +113 -0
  95. package/Tests/Server/Utils/Monitor/PerSeriesRecoveryResolution.test.ts +198 -0
  96. package/Tests/Types/AI/AIAgentTaskStatus.test.ts +86 -0
  97. package/Tests/Types/BaseDatabase/AggregationIntervalUtil.test.ts +127 -0
  98. package/Tests/Types/BaseDatabase/DatabaseCommonInteractionPropsUtil.test.ts +152 -0
  99. package/Tests/Types/Monitor/MonitorType.test.ts +1 -1
  100. package/Tests/Types/Trace/TraceRecordingRuleDefinition.test.ts +308 -0
  101. package/Tests/UI/Components/Dropdown.test.tsx +17 -0
  102. package/Tests/UI/Components/EntityDropdown.test.tsx +130 -0
  103. package/Tests/UI/Components/Modal.test.tsx +144 -2
  104. package/Tests/UI/Components/TelemetrySearchBar.test.tsx +90 -0
  105. package/Tests/UI/Utils/Theme.test.ts +161 -0
  106. package/Tests/Utils/Monitor/LatencyMatrixUtil.test.ts +111 -0
  107. package/Types/AI/AIRunStatus.ts +9 -0
  108. package/Types/BaseDatabase/AggregateBy.ts +12 -0
  109. package/Types/Dashboard/DashboardComponentType.ts +1 -0
  110. package/Types/Dashboard/DashboardComponents/DashboardLogChartComponent.ts +24 -0
  111. package/Types/Dashboard/DashboardTemplates.ts +9 -1
  112. package/Types/LlmLogStatus.ts +1 -0
  113. package/Types/Monitor/CriteriaFilter.ts +9 -0
  114. package/Types/Monitor/HttpPhaseTimings.ts +16 -0
  115. package/Types/Monitor/IotAlertTemplates.ts +22 -3
  116. package/Types/Monitor/LatencyMatrix.ts +27 -0
  117. package/Types/Monitor/MonitorCriteriaInstance.ts +2 -2
  118. package/Types/Monitor/MonitorMetricType.ts +27 -0
  119. package/Types/Monitor/MonitorStep.ts +36 -11
  120. package/Types/Monitor/MonitorStepNetworkDeviceMonitor.ts +55 -0
  121. package/Types/Monitor/MonitorStepSnmpMonitor.ts +8 -0
  122. package/Types/Monitor/MonitorType.ts +14 -9
  123. package/Types/Monitor/PingMonitor/PingMonitorResponse.ts +20 -0
  124. package/Types/Monitor/SnmpMonitor/LldpNeighbor.ts +12 -0
  125. package/Types/Monitor/SnmpMonitor/NetworkDeviceAlertPack.ts +116 -0
  126. package/Types/Monitor/SnmpMonitor/NetworkTopology.ts +29 -0
  127. package/Types/Monitor/SnmpMonitor/SnmpInterface.ts +31 -0
  128. package/Types/Monitor/SnmpMonitor/SnmpMonitorResponse.ts +24 -0
  129. package/Types/Monitor/SnmpMonitor/SnmpTrap.ts +20 -0
  130. package/Types/Monitor/SnmpMonitor/SnmpVendorTemplate.ts +173 -0
  131. package/Types/Permission.ts +314 -0
  132. package/Types/Probe/ProbeMonitorResponse.ts +22 -0
  133. package/UI/Components/Charts/ChartLibrary/AreaChart/AreaChart.tsx +8 -5
  134. package/UI/Components/Charts/ChartLibrary/BarChart/BarChart.tsx +4 -1
  135. package/UI/Components/Charts/ChartLibrary/LineChart/LineChart.tsx +6 -3
  136. package/UI/Components/CodeBlock/CodeBlock.tsx +2 -1
  137. package/UI/Components/CodeEditor/CodeEditor.tsx +3 -0
  138. package/UI/Components/Divider/Divider.tsx +1 -1
  139. package/UI/Components/Dropdown/Dropdown.tsx +13 -4
  140. package/UI/Components/EntityDropdown/EntityDropdown.tsx +110 -2
  141. package/UI/Components/ErrorBoundary.tsx +2 -1
  142. package/UI/Components/EventItem/EventItem.tsx +2 -2
  143. package/UI/Components/GanttChart/Bar/Index.tsx +1 -1
  144. package/UI/Components/Graphs/UptimeBarTooltip.tsx +30 -23
  145. package/UI/Components/Header/Header.tsx +7 -0
  146. package/UI/Components/Header/HeaderIconDropdownButton.tsx +2 -0
  147. package/UI/Components/Icon/Icon.tsx +8 -6
  148. package/UI/Components/Label/Label.tsx +2 -2
  149. package/UI/Components/LogsViewer/components/LogsAnalyticsView.tsx +22 -10
  150. package/UI/Components/LogsViewer/components/LogsHistogram.tsx +9 -3
  151. package/UI/Components/Markdown.tsx/MarkdownEditor.tsx +8 -8
  152. package/UI/Components/Markdown.tsx/MarkdownViewer.tsx +44 -20
  153. package/UI/Components/Modal/ConfirmModal.tsx +1 -1
  154. package/UI/Components/Modal/Modal.tsx +213 -121
  155. package/UI/Components/Modal/ModalFooter.tsx +33 -22
  156. package/UI/Components/ModelTable/TableView.tsx +1 -1
  157. package/UI/Components/MonitorGraphs/UptimeBarDayModal.tsx +20 -12
  158. package/UI/Components/MonitorTemplateVariables/TemplateVariablesCatalog.ts +2 -2
  159. package/UI/Components/Pill/Pill.tsx +21 -13
  160. package/UI/Components/StatusBubble/StatusBubble.tsx +3 -3
  161. package/UI/Components/Tabs/Tabs.tsx +10 -1
  162. package/UI/Components/TelemetryViewer/TelemetryViewer.tsx +7 -1
  163. package/UI/Components/TelemetryViewer/components/TelemetryHistogram.tsx +9 -3
  164. package/UI/Components/TelemetryViewer/components/TelemetrySearchBar.tsx +62 -4
  165. package/UI/Components/Workflow/Component.tsx +53 -33
  166. package/UI/Components/Workflow/ComponentPortViewer.tsx +6 -6
  167. package/UI/Components/Workflow/ComponentReturnValueViewer.tsx +8 -8
  168. package/UI/Components/Workflow/ComponentsModal.tsx +16 -9
  169. package/UI/Components/Workflow/Workflow.tsx +13 -11
  170. package/UI/Utils/Navigation.ts +10 -1
  171. package/UI/Utils/Theme.ts +140 -0
  172. package/Utils/Dashboard/Components/DashboardLogChartComponent.ts +99 -0
  173. package/Utils/Dashboard/Components/Index.ts +7 -0
  174. package/Utils/Monitor/LatencyMatrixUtil.ts +162 -0
  175. package/Utils/Monitor/MonitorMetricType.ts +141 -3
  176. package/Utils/Monitor/NetworkTopologyUtil.ts +159 -0
  177. package/Utils/Telemetry/EntityRelationship.ts +11 -0
  178. package/build/dist/Models/DatabaseModels/AIRun.js +52 -0
  179. package/build/dist/Models/DatabaseModels/AIRun.js.map +1 -1
  180. package/build/dist/Models/DatabaseModels/AlertSeverity.js +6 -0
  181. package/build/dist/Models/DatabaseModels/AlertSeverity.js.map +1 -1
  182. package/build/dist/Models/DatabaseModels/IncidentSeverity.js +6 -0
  183. package/build/dist/Models/DatabaseModels/IncidentSeverity.js.map +1 -1
  184. package/build/dist/Models/DatabaseModels/Index.js +16 -0
  185. package/build/dist/Models/DatabaseModels/Index.js.map +1 -1
  186. package/build/dist/Models/DatabaseModels/IoTDeviceCredential.js +493 -0
  187. package/build/dist/Models/DatabaseModels/IoTDeviceCredential.js.map +1 -0
  188. package/build/dist/Models/DatabaseModels/LlmLog.js +58 -0
  189. package/build/dist/Models/DatabaseModels/LlmLog.js.map +1 -1
  190. package/build/dist/Models/DatabaseModels/LlmProvider.js +33 -0
  191. package/build/dist/Models/DatabaseModels/LlmProvider.js.map +1 -1
  192. package/build/dist/Models/DatabaseModels/NetworkDevice.js +1426 -0
  193. package/build/dist/Models/DatabaseModels/NetworkDevice.js.map +1 -0
  194. package/build/dist/Models/DatabaseModels/NetworkDeviceDiscoveryScan.js +738 -0
  195. package/build/dist/Models/DatabaseModels/NetworkDeviceDiscoveryScan.js.map +1 -0
  196. package/build/dist/Models/DatabaseModels/NetworkDeviceLabelRule.js +522 -0
  197. package/build/dist/Models/DatabaseModels/NetworkDeviceLabelRule.js.map +1 -0
  198. package/build/dist/Models/DatabaseModels/NetworkDeviceOwnerRule.js +603 -0
  199. package/build/dist/Models/DatabaseModels/NetworkDeviceOwnerRule.js.map +1 -0
  200. package/build/dist/Models/DatabaseModels/NetworkDeviceOwnerTeam.js +503 -0
  201. package/build/dist/Models/DatabaseModels/NetworkDeviceOwnerTeam.js.map +1 -0
  202. package/build/dist/Models/DatabaseModels/NetworkDeviceOwnerUser.js +502 -0
  203. package/build/dist/Models/DatabaseModels/NetworkDeviceOwnerUser.js.map +1 -0
  204. package/build/dist/Models/DatabaseModels/NetworkInterface.js +589 -0
  205. package/build/dist/Models/DatabaseModels/NetworkInterface.js.map +1 -0
  206. package/build/dist/Models/DatabaseModels/Project.js +147 -0
  207. package/build/dist/Models/DatabaseModels/Project.js.map +1 -1
  208. package/build/dist/Models/DatabaseModels/TelemetryEntityRelationship.js +57 -0
  209. package/build/dist/Models/DatabaseModels/TelemetryEntityRelationship.js.map +1 -1
  210. package/build/dist/Server/API/AIAgentTaskAPI.js +8 -23
  211. package/build/dist/Server/API/AIAgentTaskAPI.js.map +1 -1
  212. package/build/dist/Server/API/AIInvestigationAPI.js +95 -55
  213. package/build/dist/Server/API/AIInvestigationAPI.js.map +1 -1
  214. package/build/dist/Server/API/AlertAPI.js +5 -0
  215. package/build/dist/Server/API/AlertAPI.js.map +1 -1
  216. package/build/dist/Server/API/IncidentAPI.js +10 -0
  217. package/build/dist/Server/API/IncidentAPI.js.map +1 -1
  218. package/build/dist/Server/API/IncidentEpisodeAPI.js +5 -0
  219. package/build/dist/Server/API/IncidentEpisodeAPI.js.map +1 -1
  220. package/build/dist/Server/API/LlmProviderAPI.js +5 -7
  221. package/build/dist/Server/API/LlmProviderAPI.js.map +1 -1
  222. package/build/dist/Server/API/ScheduledMaintenanceAPI.js +5 -0
  223. package/build/dist/Server/API/ScheduledMaintenanceAPI.js.map +1 -1
  224. package/build/dist/Server/API/TelemetryAPI.js.map +1 -1
  225. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783650000000-AddAdditionalParamsToLlmProvider.js +12 -0
  226. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783650000000-AddAdditionalParamsToLlmProvider.js.map +1 -0
  227. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783695782697-AddCacheTokenColumnsToLlmLog.js +14 -0
  228. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783695782697-AddCacheTokenColumnsToLlmLog.js.map +1 -0
  229. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783701585317-AddAlertInvestigationGating.js +18 -0
  230. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783701585317-AddAlertInvestigationGating.js.map +1 -0
  231. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783702431535-AddAiDailyAutonomousTokenLimitToProject.js +12 -0
  232. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783702431535-AddAiDailyAutonomousTokenLimitToProject.js.map +1 -0
  233. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783720000000-AddNetworkDeviceTables.js +51 -0
  234. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783720000000-AddNetworkDeviceTables.js.map +1 -0
  235. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783721121260-AddAttemptCountToAIRun.js +12 -0
  236. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783721121260-AddAttemptCountToAIRun.js.map +1 -0
  237. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783730000000-AddNetworkDeviceOwnersAndRules.js +101 -0
  238. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783730000000-AddNetworkDeviceOwnersAndRules.js.map +1 -0
  239. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783740000000-AddNetworkDeviceDiscoveryScan.js +18 -0
  240. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783740000000-AddNetworkDeviceDiscoveryScan.js.map +1 -0
  241. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783750000000-AddLldpNeighborsToNetworkDevice.js +12 -0
  242. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783750000000-AddLldpNeighborsToNetworkDevice.js.map +1 -0
  243. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783760576655-AddInvestigationTuningToProject.js +14 -0
  244. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783760576655-AddInvestigationTuningToProject.js.map +1 -0
  245. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783762505482-AddTelemetryEntityRelationshipMetrics.js +16 -0
  246. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783762505482-AddTelemetryEntityRelationshipMetrics.js.map +1 -0
  247. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783780000000-AddIoTDeviceCredentialTable.js +38 -0
  248. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783780000000-AddIoTDeviceCredentialTable.js.map +1 -0
  249. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783790000000-AddSnmpV3AuthColumnsToNetworkDevice.js +22 -0
  250. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783790000000-AddSnmpV3AuthColumnsToNetworkDevice.js.map +1 -0
  251. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js +24 -0
  252. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js.map +1 -1
  253. package/build/dist/Server/Services/AIAgentTaskService.js +59 -0
  254. package/build/dist/Server/Services/AIAgentTaskService.js.map +1 -1
  255. package/build/dist/Server/Services/AIRunService.js +33 -0
  256. package/build/dist/Server/Services/AIRunService.js.map +1 -1
  257. package/build/dist/Server/Services/AIService.js +82 -9
  258. package/build/dist/Server/Services/AIService.js.map +1 -1
  259. package/build/dist/Server/Services/AnalyticsDatabaseService.js +19 -0
  260. package/build/dist/Server/Services/AnalyticsDatabaseService.js.map +1 -1
  261. package/build/dist/Server/Services/IncidentService.js +14 -25
  262. package/build/dist/Server/Services/IncidentService.js.map +1 -1
  263. package/build/dist/Server/Services/Index.js +14 -0
  264. package/build/dist/Server/Services/Index.js.map +1 -1
  265. package/build/dist/Server/Services/IoTDeviceCredentialService.js +321 -0
  266. package/build/dist/Server/Services/IoTDeviceCredentialService.js.map +1 -0
  267. package/build/dist/Server/Services/IoTDeviceService.js +49 -15
  268. package/build/dist/Server/Services/IoTDeviceService.js.map +1 -1
  269. package/build/dist/Server/Services/LlmLogService.js +29 -0
  270. package/build/dist/Server/Services/LlmLogService.js.map +1 -1
  271. package/build/dist/Server/Services/LlmProviderService.js +3 -0
  272. package/build/dist/Server/Services/LlmProviderService.js.map +1 -1
  273. package/build/dist/Server/Services/LogAggregationService.js +21 -7
  274. package/build/dist/Server/Services/LogAggregationService.js.map +1 -1
  275. package/build/dist/Server/Services/MetricService.js +449 -7
  276. package/build/dist/Server/Services/MetricService.js.map +1 -1
  277. package/build/dist/Server/Services/MonitorService.js +2 -1
  278. package/build/dist/Server/Services/MonitorService.js.map +1 -1
  279. package/build/dist/Server/Services/NetworkDeviceDiscoveryScanService.js +9 -0
  280. package/build/dist/Server/Services/NetworkDeviceDiscoveryScanService.js.map +1 -0
  281. package/build/dist/Server/Services/NetworkDeviceLabelRuleEngineService.js +166 -0
  282. package/build/dist/Server/Services/NetworkDeviceLabelRuleEngineService.js.map +1 -0
  283. package/build/dist/Server/Services/NetworkDeviceLabelRuleService.js +13 -0
  284. package/build/dist/Server/Services/NetworkDeviceLabelRuleService.js.map +1 -0
  285. package/build/dist/Server/Services/NetworkDeviceOwnerRuleEngineService.js +186 -0
  286. package/build/dist/Server/Services/NetworkDeviceOwnerRuleEngineService.js.map +1 -0
  287. package/build/dist/Server/Services/NetworkDeviceOwnerRuleService.js +13 -0
  288. package/build/dist/Server/Services/NetworkDeviceOwnerRuleService.js.map +1 -0
  289. package/build/dist/Server/Services/NetworkDeviceOwnerTeamService.js +9 -0
  290. package/build/dist/Server/Services/NetworkDeviceOwnerTeamService.js.map +1 -0
  291. package/build/dist/Server/Services/NetworkDeviceOwnerUserService.js +9 -0
  292. package/build/dist/Server/Services/NetworkDeviceOwnerUserService.js.map +1 -0
  293. package/build/dist/Server/Services/NetworkDeviceService.js +52 -0
  294. package/build/dist/Server/Services/NetworkDeviceService.js.map +1 -0
  295. package/build/dist/Server/Services/NetworkInterfaceService.js +9 -0
  296. package/build/dist/Server/Services/NetworkInterfaceService.js.map +1 -0
  297. package/build/dist/Server/Services/TelemetryEntityRelationshipService.js +22 -0
  298. package/build/dist/Server/Services/TelemetryEntityRelationshipService.js.map +1 -1
  299. package/build/dist/Server/Services/TelemetryEntityService.js +64 -2
  300. package/build/dist/Server/Services/TelemetryEntityService.js.map +1 -1
  301. package/build/dist/Server/Utils/AI/Sentinel/AlertInvestigationRunner.js +189 -9
  302. package/build/dist/Server/Utils/AI/Sentinel/AlertInvestigationRunner.js.map +1 -1
  303. package/build/dist/Server/Utils/AI/Sentinel/IncidentInvestigationRunner.js +84 -17
  304. package/build/dist/Server/Utils/AI/Sentinel/IncidentInvestigationRunner.js.map +1 -1
  305. package/build/dist/Server/Utils/AI/Sentinel/InvestigationQueue.js +428 -0
  306. package/build/dist/Server/Utils/AI/Sentinel/InvestigationQueue.js.map +1 -0
  307. package/build/dist/Server/Utils/AI/Sentinel/SentinelInvestigationEngine.js +63 -47
  308. package/build/dist/Server/Utils/AI/Sentinel/SentinelInvestigationEngine.js.map +1 -1
  309. package/build/dist/Server/Utils/AI/Toolbox/Index.js +2 -1
  310. package/build/dist/Server/Utils/AI/Toolbox/Index.js.map +1 -1
  311. package/build/dist/Server/Utils/AI/Toolbox/MetricTools.js +300 -0
  312. package/build/dist/Server/Utils/AI/Toolbox/MetricTools.js.map +1 -1
  313. package/build/dist/Server/Utils/LLM/LLMService.js +16 -0
  314. package/build/dist/Server/Utils/LLM/LLMService.js.map +1 -1
  315. package/build/dist/Server/Utils/Monitor/Criteria/APIRequestCriteria.js +29 -0
  316. package/build/dist/Server/Utils/Monitor/Criteria/APIRequestCriteria.js.map +1 -1
  317. package/build/dist/Server/Utils/Monitor/Criteria/SnmpMonitorCriteria.js +130 -2
  318. package/build/dist/Server/Utils/Monitor/Criteria/SnmpMonitorCriteria.js.map +1 -1
  319. package/build/dist/Server/Utils/Monitor/IoTDeviceAbsenceSeries.js +81 -0
  320. package/build/dist/Server/Utils/Monitor/IoTDeviceAbsenceSeries.js.map +1 -0
  321. package/build/dist/Server/Utils/Monitor/MonitorAlert.js +18 -7
  322. package/build/dist/Server/Utils/Monitor/MonitorAlert.js.map +1 -1
  323. package/build/dist/Server/Utils/Monitor/MonitorCriteriaEvaluator.js +1 -1
  324. package/build/dist/Server/Utils/Monitor/MonitorCriteriaEvaluator.js.map +1 -1
  325. package/build/dist/Server/Utils/Monitor/MonitorIncident.js +25 -10
  326. package/build/dist/Server/Utils/Monitor/MonitorIncident.js.map +1 -1
  327. package/build/dist/Server/Utils/Monitor/MonitorMetricUtil.js +155 -5
  328. package/build/dist/Server/Utils/Monitor/MonitorMetricUtil.js.map +1 -1
  329. package/build/dist/Server/Utils/Monitor/MonitorResource.js +76 -30
  330. package/build/dist/Server/Utils/Monitor/MonitorResource.js.map +1 -1
  331. package/build/dist/Server/Utils/Monitor/MonitorTemplateUtil.js +1 -1
  332. package/build/dist/Server/Utils/Monitor/MonitorTemplateUtil.js.map +1 -1
  333. package/build/dist/Server/Utils/Monitor/NetworkDeviceHydrationUtil.js +147 -0
  334. package/build/dist/Server/Utils/Monitor/NetworkDeviceHydrationUtil.js.map +1 -0
  335. package/build/dist/Server/Utils/Monitor/NetworkInventoryUtil.js +167 -0
  336. package/build/dist/Server/Utils/Monitor/NetworkInventoryUtil.js.map +1 -0
  337. package/build/dist/Server/Utils/Monitor/SnmpInterfaceRateUtil.js +93 -0
  338. package/build/dist/Server/Utils/Monitor/SnmpInterfaceRateUtil.js.map +1 -0
  339. package/build/dist/Types/AI/AIRunStatus.js +9 -0
  340. package/build/dist/Types/AI/AIRunStatus.js.map +1 -1
  341. package/build/dist/Types/Dashboard/DashboardComponentType.js +1 -0
  342. package/build/dist/Types/Dashboard/DashboardComponentType.js.map +1 -1
  343. package/build/dist/Types/Dashboard/DashboardComponents/DashboardLogChartComponent.js +2 -0
  344. package/build/dist/Types/Dashboard/DashboardComponents/DashboardLogChartComponent.js.map +1 -0
  345. package/build/dist/Types/Dashboard/DashboardTemplates.js +9 -1
  346. package/build/dist/Types/Dashboard/DashboardTemplates.js.map +1 -1
  347. package/build/dist/Types/LlmLogStatus.js +1 -0
  348. package/build/dist/Types/LlmLogStatus.js.map +1 -1
  349. package/build/dist/Types/Monitor/CriteriaFilter.js +9 -0
  350. package/build/dist/Types/Monitor/CriteriaFilter.js.map +1 -1
  351. package/build/dist/Types/Monitor/HttpPhaseTimings.js +2 -0
  352. package/build/dist/Types/Monitor/HttpPhaseTimings.js.map +1 -0
  353. package/build/dist/Types/Monitor/IotAlertTemplates.js +7 -7
  354. package/build/dist/Types/Monitor/IotAlertTemplates.js.map +1 -1
  355. package/build/dist/Types/Monitor/LatencyMatrix.js +2 -0
  356. package/build/dist/Types/Monitor/LatencyMatrix.js.map +1 -0
  357. package/build/dist/Types/Monitor/MonitorCriteriaInstance.js +2 -2
  358. package/build/dist/Types/Monitor/MonitorCriteriaInstance.js.map +1 -1
  359. package/build/dist/Types/Monitor/MonitorMetricType.js +24 -0
  360. package/build/dist/Types/Monitor/MonitorMetricType.js.map +1 -1
  361. package/build/dist/Types/Monitor/MonitorStep.js +22 -9
  362. package/build/dist/Types/Monitor/MonitorStep.js.map +1 -1
  363. package/build/dist/Types/Monitor/MonitorStepNetworkDeviceMonitor.js +36 -0
  364. package/build/dist/Types/Monitor/MonitorStepNetworkDeviceMonitor.js.map +1 -0
  365. package/build/dist/Types/Monitor/MonitorStepSnmpMonitor.js +3 -0
  366. package/build/dist/Types/Monitor/MonitorStepSnmpMonitor.js.map +1 -1
  367. package/build/dist/Types/Monitor/MonitorType.js +14 -9
  368. package/build/dist/Types/Monitor/MonitorType.js.map +1 -1
  369. package/build/dist/Types/Monitor/PingMonitor/PingMonitorResponse.js +2 -0
  370. package/build/dist/Types/Monitor/PingMonitor/PingMonitorResponse.js.map +1 -0
  371. package/build/dist/Types/Monitor/SnmpMonitor/LldpNeighbor.js +2 -0
  372. package/build/dist/Types/Monitor/SnmpMonitor/LldpNeighbor.js.map +1 -0
  373. package/build/dist/Types/Monitor/SnmpMonitor/NetworkDeviceAlertPack.js +89 -0
  374. package/build/dist/Types/Monitor/SnmpMonitor/NetworkDeviceAlertPack.js.map +1 -0
  375. package/build/dist/Types/Monitor/SnmpMonitor/NetworkTopology.js +2 -0
  376. package/build/dist/Types/Monitor/SnmpMonitor/NetworkTopology.js.map +1 -0
  377. package/build/dist/Types/Monitor/SnmpMonitor/SnmpInterface.js +2 -0
  378. package/build/dist/Types/Monitor/SnmpMonitor/SnmpInterface.js.map +1 -0
  379. package/build/dist/Types/Monitor/SnmpMonitor/SnmpTrap.js +2 -0
  380. package/build/dist/Types/Monitor/SnmpMonitor/SnmpTrap.js.map +1 -0
  381. package/build/dist/Types/Monitor/SnmpMonitor/SnmpVendorTemplate.js +137 -0
  382. package/build/dist/Types/Monitor/SnmpMonitor/SnmpVendorTemplate.js.map +1 -0
  383. package/build/dist/Types/Permission.js +280 -0
  384. package/build/dist/Types/Permission.js.map +1 -1
  385. package/build/dist/UI/Components/Charts/ChartLibrary/AreaChart/AreaChart.js +7 -4
  386. package/build/dist/UI/Components/Charts/ChartLibrary/AreaChart/AreaChart.js.map +1 -1
  387. package/build/dist/UI/Components/Charts/ChartLibrary/BarChart/BarChart.js +4 -1
  388. package/build/dist/UI/Components/Charts/ChartLibrary/BarChart/BarChart.js.map +1 -1
  389. package/build/dist/UI/Components/Charts/ChartLibrary/LineChart/LineChart.js +6 -3
  390. package/build/dist/UI/Components/Charts/ChartLibrary/LineChart/LineChart.js.map +1 -1
  391. package/build/dist/UI/Components/CodeBlock/CodeBlock.js +1 -1
  392. package/build/dist/UI/Components/CodeBlock/CodeBlock.js.map +1 -1
  393. package/build/dist/UI/Components/CodeEditor/CodeEditor.js +3 -1
  394. package/build/dist/UI/Components/CodeEditor/CodeEditor.js.map +1 -1
  395. package/build/dist/UI/Components/Divider/Divider.js +1 -1
  396. package/build/dist/UI/Components/Divider/Divider.js.map +1 -1
  397. package/build/dist/UI/Components/Dropdown/Dropdown.js +10 -4
  398. package/build/dist/UI/Components/Dropdown/Dropdown.js.map +1 -1
  399. package/build/dist/UI/Components/EntityDropdown/EntityDropdown.js +76 -3
  400. package/build/dist/UI/Components/EntityDropdown/EntityDropdown.js.map +1 -1
  401. package/build/dist/UI/Components/ErrorBoundary.js +2 -1
  402. package/build/dist/UI/Components/ErrorBoundary.js.map +1 -1
  403. package/build/dist/UI/Components/EventItem/EventItem.js +2 -2
  404. package/build/dist/UI/Components/EventItem/EventItem.js.map +1 -1
  405. package/build/dist/UI/Components/GanttChart/Bar/Index.js +1 -1
  406. package/build/dist/UI/Components/GanttChart/Bar/Index.js.map +1 -1
  407. package/build/dist/UI/Components/Graphs/UptimeBarTooltip.js +29 -23
  408. package/build/dist/UI/Components/Graphs/UptimeBarTooltip.js.map +1 -1
  409. package/build/dist/UI/Components/Header/Header.js +1 -0
  410. package/build/dist/UI/Components/Header/Header.js.map +1 -1
  411. package/build/dist/UI/Components/Header/HeaderIconDropdownButton.js +1 -1
  412. package/build/dist/UI/Components/Header/HeaderIconDropdownButton.js.map +1 -1
  413. package/build/dist/UI/Components/Icon/Icon.js +8 -6
  414. package/build/dist/UI/Components/Icon/Icon.js.map +1 -1
  415. package/build/dist/UI/Components/Label/Label.js +2 -2
  416. package/build/dist/UI/Components/Label/Label.js.map +1 -1
  417. package/build/dist/UI/Components/LogsViewer/components/LogsAnalyticsView.js +20 -8
  418. package/build/dist/UI/Components/LogsViewer/components/LogsAnalyticsView.js.map +1 -1
  419. package/build/dist/UI/Components/LogsViewer/components/LogsHistogram.js +8 -2
  420. package/build/dist/UI/Components/LogsViewer/components/LogsHistogram.js.map +1 -1
  421. package/build/dist/UI/Components/Markdown.tsx/MarkdownEditor.js +8 -8
  422. package/build/dist/UI/Components/Markdown.tsx/MarkdownViewer.js +40 -20
  423. package/build/dist/UI/Components/Markdown.tsx/MarkdownViewer.js.map +1 -1
  424. package/build/dist/UI/Components/Modal/ConfirmModal.js +1 -1
  425. package/build/dist/UI/Components/Modal/ConfirmModal.js.map +1 -1
  426. package/build/dist/UI/Components/Modal/Modal.js +109 -51
  427. package/build/dist/UI/Components/Modal/Modal.js.map +1 -1
  428. package/build/dist/UI/Components/Modal/ModalFooter.js +13 -10
  429. package/build/dist/UI/Components/Modal/ModalFooter.js.map +1 -1
  430. package/build/dist/UI/Components/ModelTable/TableView.js +1 -1
  431. package/build/dist/UI/Components/ModelTable/TableView.js.map +1 -1
  432. package/build/dist/UI/Components/MonitorGraphs/UptimeBarDayModal.js +17 -12
  433. package/build/dist/UI/Components/MonitorGraphs/UptimeBarDayModal.js.map +1 -1
  434. package/build/dist/UI/Components/MonitorTemplateVariables/TemplateVariablesCatalog.js +2 -2
  435. package/build/dist/UI/Components/MonitorTemplateVariables/TemplateVariablesCatalog.js.map +1 -1
  436. package/build/dist/UI/Components/Pill/Pill.js +12 -13
  437. package/build/dist/UI/Components/Pill/Pill.js.map +1 -1
  438. package/build/dist/UI/Components/StatusBubble/StatusBubble.js +3 -3
  439. package/build/dist/UI/Components/StatusBubble/StatusBubble.js.map +1 -1
  440. package/build/dist/UI/Components/Tabs/Tabs.js +3 -1
  441. package/build/dist/UI/Components/Tabs/Tabs.js.map +1 -1
  442. package/build/dist/UI/Components/TelemetryViewer/TelemetryViewer.js +1 -1
  443. package/build/dist/UI/Components/TelemetryViewer/TelemetryViewer.js.map +1 -1
  444. package/build/dist/UI/Components/TelemetryViewer/components/TelemetryHistogram.js +8 -2
  445. package/build/dist/UI/Components/TelemetryViewer/components/TelemetryHistogram.js.map +1 -1
  446. package/build/dist/UI/Components/TelemetryViewer/components/TelemetrySearchBar.js +36 -6
  447. package/build/dist/UI/Components/TelemetryViewer/components/TelemetrySearchBar.js.map +1 -1
  448. package/build/dist/UI/Components/Workflow/Component.js +43 -33
  449. package/build/dist/UI/Components/Workflow/Component.js.map +1 -1
  450. package/build/dist/UI/Components/Workflow/ComponentPortViewer.js +6 -6
  451. package/build/dist/UI/Components/Workflow/ComponentPortViewer.js.map +1 -1
  452. package/build/dist/UI/Components/Workflow/ComponentReturnValueViewer.js +8 -8
  453. package/build/dist/UI/Components/Workflow/ComponentReturnValueViewer.js.map +1 -1
  454. package/build/dist/UI/Components/Workflow/ComponentsModal.js +15 -9
  455. package/build/dist/UI/Components/Workflow/ComponentsModal.js.map +1 -1
  456. package/build/dist/UI/Components/Workflow/Workflow.js +13 -11
  457. package/build/dist/UI/Components/Workflow/Workflow.js.map +1 -1
  458. package/build/dist/UI/Utils/Navigation.js +11 -1
  459. package/build/dist/UI/Utils/Navigation.js.map +1 -1
  460. package/build/dist/UI/Utils/Theme.js +106 -0
  461. package/build/dist/UI/Utils/Theme.js.map +1 -0
  462. package/build/dist/Utils/Dashboard/Components/DashboardLogChartComponent.js +89 -0
  463. package/build/dist/Utils/Dashboard/Components/DashboardLogChartComponent.js.map +1 -0
  464. package/build/dist/Utils/Dashboard/Components/Index.js +4 -0
  465. package/build/dist/Utils/Dashboard/Components/Index.js.map +1 -1
  466. package/build/dist/Utils/Monitor/LatencyMatrixUtil.js +89 -0
  467. package/build/dist/Utils/Monitor/LatencyMatrixUtil.js.map +1 -0
  468. package/build/dist/Utils/Monitor/MonitorMetricType.js +138 -4
  469. package/build/dist/Utils/Monitor/MonitorMetricType.js.map +1 -1
  470. package/build/dist/Utils/Monitor/NetworkTopologyUtil.js +112 -0
  471. package/build/dist/Utils/Monitor/NetworkTopologyUtil.js.map +1 -0
  472. package/build/dist/Utils/Telemetry/EntityRelationship.js.map +1 -1
  473. package/package.json +1 -1
@@ -207,6 +207,65 @@ describe("SnmpMonitorCriteria.isMonitorInstanceCriteriaFilterMet", () => {
207
207
  expect(result).toBeTruthy();
208
208
  expect(result).toContain("equal to OK");
209
209
  });
210
+
211
+ test("empty OctetString is NOT coerced to numeric 0 for an 'equal to 0' filter", async () => {
212
+ /*
213
+ * Regression: Number("") === 0, so an empty value used to spuriously
214
+ * satisfy a numeric "== 0" criterion. It must fall through to a string
215
+ * comparison ("" !== "0") and not match.
216
+ */
217
+ const criteriaFilter: CriteriaFilter = {
218
+ checkOn: CheckOn.SnmpOidValue,
219
+ filterType: FilterType.EqualTo,
220
+ value: "0",
221
+ snmpMonitorOptions: { oid: PSU_OID },
222
+ };
223
+
224
+ const dataToProcess: ProbeMonitorResponse = buildDataToProcess({
225
+ oidResponses: [
226
+ {
227
+ oid: PSU_OID,
228
+ value: "",
229
+ type: SnmpDataType.OctetString,
230
+ },
231
+ ],
232
+ });
233
+
234
+ const result: string | null =
235
+ await SnmpMonitorCriteria.isMonitorInstanceCriteriaFilterMet({
236
+ dataToProcess,
237
+ criteriaFilter,
238
+ });
239
+
240
+ expect(result).toBeNull();
241
+ });
242
+
243
+ test("whitespace-only OctetString is NOT coerced to numeric 0", async () => {
244
+ const criteriaFilter: CriteriaFilter = {
245
+ checkOn: CheckOn.SnmpOidValue,
246
+ filterType: FilterType.EqualTo,
247
+ value: "0",
248
+ snmpMonitorOptions: { oid: PSU_OID },
249
+ };
250
+
251
+ const dataToProcess: ProbeMonitorResponse = buildDataToProcess({
252
+ oidResponses: [
253
+ {
254
+ oid: PSU_OID,
255
+ value: " ",
256
+ type: SnmpDataType.OctetString,
257
+ },
258
+ ],
259
+ });
260
+
261
+ const result: string | null =
262
+ await SnmpMonitorCriteria.isMonitorInstanceCriteriaFilterMet({
263
+ dataToProcess,
264
+ criteriaFilter,
265
+ });
266
+
267
+ expect(result).toBeNull();
268
+ });
210
269
  });
211
270
 
212
271
  describe("SnmpOidValue guards", () => {
@@ -0,0 +1,113 @@
1
+ import {
2
+ IOT_DEVICE_ID_ATTRIBUTE_KEY,
3
+ buildAbsentIoTDeviceSeries,
4
+ getIoTDeviceAbsenceGroupByKey,
5
+ } from "../../../../Server/Utils/Monitor/IoTDeviceAbsenceSeries";
6
+ import MetricSeriesResult from "../../../../Types/Monitor/MetricMonitor/MetricSeriesResult";
7
+ import MetricSeriesFingerprint from "../../../../Utils/Metrics/MetricSeriesFingerprint";
8
+ import { describe, expect, test } from "@jest/globals";
9
+
10
+ /*
11
+ * The absence-series helpers are what turn a silent registered device
12
+ * into a per-device offline incident — pin down the gating and the
13
+ * synthetic-series shape (which must match what the device's real
14
+ * series would carry so incidents dedupe and auto-resolve).
15
+ */
16
+
17
+ function presentSeries(deviceIds: Array<string>): Array<MetricSeriesResult> {
18
+ return deviceIds.map((id: string) => {
19
+ return {
20
+ fingerprint: MetricSeriesFingerprint.computeFingerprint({
21
+ [IOT_DEVICE_ID_ATTRIBUTE_KEY]: id,
22
+ }),
23
+ labels: { [IOT_DEVICE_ID_ATTRIBUTE_KEY]: id },
24
+ // present series carry samples; the builder only reads labels.
25
+ aggregatedResults: [],
26
+ };
27
+ });
28
+ }
29
+
30
+ describe("getIoTDeviceAbsenceGroupByKey", () => {
31
+ test("returns the key only for a pure device.id group-by", () => {
32
+ expect(getIoTDeviceAbsenceGroupByKey(["device.id"])).toBe("device.id");
33
+ });
34
+
35
+ test.each([
36
+ [[]],
37
+ [["iot.device.type"]],
38
+ [["device.id", "iot.device.type"]],
39
+ [["resource.iot.fleet.name"]],
40
+ ])("returns null for %j", (keys: Array<string>) => {
41
+ expect(getIoTDeviceAbsenceGroupByKey(keys)).toBeNull();
42
+ });
43
+ });
44
+
45
+ describe("buildAbsentIoTDeviceSeries", () => {
46
+ test("emits one empty series per registered-but-absent device", () => {
47
+ const absent: Array<MetricSeriesResult> = buildAbsentIoTDeviceSeries({
48
+ presentSeries: presentSeries(["sensor-1"]),
49
+ expectedDeviceExternalIds: ["sensor-1", "sensor-2", "sensor-3"],
50
+ deviceKey: IOT_DEVICE_ID_ATTRIBUTE_KEY,
51
+ slotCount: 2,
52
+ });
53
+
54
+ expect(absent).toHaveLength(2);
55
+ const ids: Array<string> = absent.map((s: MetricSeriesResult) => {
56
+ return String(s.labels["device.id"]);
57
+ });
58
+ expect(ids.sort()).toEqual(["sensor-2", "sensor-3"]);
59
+
60
+ for (const series of absent) {
61
+ // One empty slot per query+formula so criteria alias resolution lines up.
62
+ expect(series.aggregatedResults).toHaveLength(2);
63
+ for (const slot of series.aggregatedResults) {
64
+ expect(slot.data).toEqual([]);
65
+ }
66
+ // Fingerprint must match what the device's REAL series would carry.
67
+ expect(series.fingerprint).toBe(
68
+ MetricSeriesFingerprint.computeFingerprint(series.labels),
69
+ );
70
+ }
71
+ });
72
+
73
+ test("device ids are compared byte-exact — no canonicalization", () => {
74
+ /*
75
+ * device.id labels are stored verbatim (unlike host.name). A
76
+ * registered id differing only in case is a DIFFERENT device and
77
+ * must be treated as absent; lowercasing would fork the
78
+ * fingerprint from the real series and break dedupe.
79
+ */
80
+ const absent: Array<MetricSeriesResult> = buildAbsentIoTDeviceSeries({
81
+ presentSeries: presentSeries(["Sensor-A"]),
82
+ expectedDeviceExternalIds: ["Sensor-A", "sensor-a"],
83
+ deviceKey: IOT_DEVICE_ID_ATTRIBUTE_KEY,
84
+ slotCount: 1,
85
+ });
86
+
87
+ expect(absent).toHaveLength(1);
88
+ expect(absent[0]?.labels["device.id"]).toBe("sensor-a");
89
+ });
90
+
91
+ test("dedupes duplicate registered ids and skips empties", () => {
92
+ const absent: Array<MetricSeriesResult> = buildAbsentIoTDeviceSeries({
93
+ presentSeries: [],
94
+ expectedDeviceExternalIds: ["sensor-1", "sensor-1", ""],
95
+ deviceKey: IOT_DEVICE_ID_ATTRIBUTE_KEY,
96
+ slotCount: 0, // clamps to 1
97
+ });
98
+
99
+ expect(absent).toHaveLength(1);
100
+ expect(absent[0]?.aggregatedResults).toHaveLength(1);
101
+ });
102
+
103
+ test("returns nothing when every registered device is present", () => {
104
+ const absent: Array<MetricSeriesResult> = buildAbsentIoTDeviceSeries({
105
+ presentSeries: presentSeries(["a", "b"]),
106
+ expectedDeviceExternalIds: ["a", "b"],
107
+ deviceKey: IOT_DEVICE_ID_ATTRIBUTE_KEY,
108
+ slotCount: 1,
109
+ });
110
+
111
+ expect(absent).toHaveLength(0);
112
+ });
113
+ });
@@ -0,0 +1,198 @@
1
+ import MonitorIncident from "../../../../Server/Utils/Monitor/MonitorIncident";
2
+ import MonitorAlert from "../../../../Server/Utils/Monitor/MonitorAlert";
3
+ import Incident from "../../../../Models/DatabaseModels/Incident";
4
+ import Alert from "../../../../Models/DatabaseModels/Alert";
5
+ import MonitorCriteriaInstance from "../../../../Types/Monitor/MonitorCriteriaInstance";
6
+ import Dictionary from "../../../../Types/Dictionary";
7
+ import { describe, expect, it } from "@jest/globals";
8
+
9
+ /*
10
+ * Regression tests for per-series offline/online auto-resolve.
11
+ *
12
+ * Per-series offline monitors (Host / Proxmox / Ceph / IoTDevice) pair
13
+ * an OFFLINE criteria that creates incidents (e.g. Min(device_up) < 1)
14
+ * with a RECOVERY criteria that does not (Min(device_up) >= 1), grouped
15
+ * by a device/host key. Exactly one criteria wins per evaluation tick,
16
+ * and the breaching-series set handed to shouldClose{Incident,Alert} is
17
+ * that winning criteria's per-series matches.
18
+ *
19
+ * On the recovery tick the RECOVERY criteria wins, so its matches are
20
+ * the healthy series — NOT breaches. The bug: membership in that set was
21
+ * treated as "still breaching", so the open offline incident's own
22
+ * fingerprint kept it pinned open forever once no other series was down.
23
+ * The fix only counts membership when the matched criteria actually
24
+ * creates incidents/alerts.
25
+ */
26
+
27
+ const CREATED_CRITERIA_ID: string = "offline-criteria";
28
+ const TEMPLATE_ID: string = "template-1";
29
+ const DEVICE_FP: string = "fp-device-1";
30
+
31
+ const INCIDENT_AUTO_RESOLVE: Dictionary<Array<string>> = {
32
+ [CREATED_CRITERIA_ID]: [TEMPLATE_ID],
33
+ };
34
+ const ALERT_AUTO_RESOLVE: Dictionary<Array<string>> = {
35
+ [CREATED_CRITERIA_ID]: [TEMPLATE_ID],
36
+ };
37
+
38
+ function incident(fingerprint: string): Incident {
39
+ const i: Incident = new Incident();
40
+ i.createdCriteriaId = CREATED_CRITERIA_ID;
41
+ i.createdIncidentTemplateId = TEMPLATE_ID;
42
+ i.seriesFingerprint = fingerprint;
43
+ return i;
44
+ }
45
+
46
+ function alert(fingerprint: string): Alert {
47
+ const a: Alert = new Alert();
48
+ a.createdCriteriaId = CREATED_CRITERIA_ID;
49
+ a.seriesFingerprint = fingerprint;
50
+ return a;
51
+ }
52
+
53
+ function criteria(id: string, creates: boolean): MonitorCriteriaInstance {
54
+ const c: MonitorCriteriaInstance = new MonitorCriteriaInstance();
55
+ c.data!.id = id;
56
+ // Same flag drives both — the templates set createIncidents/createAlerts together.
57
+ c.data!.createIncidents = creates;
58
+ c.data!.createAlerts = creates;
59
+ return c;
60
+ }
61
+
62
+ function shouldCloseIncident(input: Record<string, unknown>): boolean {
63
+ return (
64
+ MonitorIncident as unknown as {
65
+ shouldCloseIncident: (i: Record<string, unknown>) => boolean;
66
+ }
67
+ ).shouldCloseIncident(input);
68
+ }
69
+ function shouldCloseAlert(input: Record<string, unknown>): boolean {
70
+ return (
71
+ MonitorAlert as unknown as {
72
+ shouldCloseAlert: (i: Record<string, unknown>) => boolean;
73
+ }
74
+ ).shouldCloseAlert(input);
75
+ }
76
+
77
+ describe("Per-series offline/online auto-resolve", () => {
78
+ describe("MonitorIncident.shouldCloseIncident", () => {
79
+ it("RESOLVES on the recovery tick even though the recovered series is in the matched (recovery) criteria's set", () => {
80
+ /*
81
+ * The device is back up: the RECOVERY criteria won, its match set
82
+ * contains the now-healthy device. It must NOT keep the incident open.
83
+ */
84
+ expect(
85
+ shouldCloseIncident({
86
+ openIncident: incident(DEVICE_FP),
87
+ autoResolveCriteriaInstanceIdIncidentIdsDictionary:
88
+ INCIDENT_AUTO_RESOLVE,
89
+ criteriaInstance: criteria("recovery-criteria", false),
90
+ breachingSeriesFingerprints: new Set<string>([DEVICE_FP]),
91
+ disableSeriesAbsenceResolution: false,
92
+ }),
93
+ ).toBe(true);
94
+ });
95
+
96
+ it("keeps the incident open while the device is still down (offline criteria won, series still breaching)", () => {
97
+ expect(
98
+ shouldCloseIncident({
99
+ openIncident: incident(DEVICE_FP),
100
+ autoResolveCriteriaInstanceIdIncidentIdsDictionary:
101
+ INCIDENT_AUTO_RESOLVE,
102
+ criteriaInstance: criteria(CREATED_CRITERIA_ID, true),
103
+ breachingSeriesFingerprints: new Set<string>([DEVICE_FP]),
104
+ disableSeriesAbsenceResolution: false,
105
+ }),
106
+ ).toBe(false);
107
+ });
108
+
109
+ it("resolves when this device recovered but another device is still down (offline criteria won, fp absent)", () => {
110
+ expect(
111
+ shouldCloseIncident({
112
+ openIncident: incident(DEVICE_FP),
113
+ autoResolveCriteriaInstanceIdIncidentIdsDictionary:
114
+ INCIDENT_AUTO_RESOLVE,
115
+ criteriaInstance: criteria(CREATED_CRITERIA_ID, true),
116
+ // Only some OTHER device is still breaching the offline criteria.
117
+ breachingSeriesFingerprints: new Set<string>(["fp-device-2"]),
118
+ disableSeriesAbsenceResolution: false,
119
+ }),
120
+ ).toBe(true);
121
+ });
122
+
123
+ it("does not resolve on recovery when the creating criteria did not opt into auto-resolve", () => {
124
+ expect(
125
+ shouldCloseIncident({
126
+ openIncident: incident(DEVICE_FP),
127
+ autoResolveCriteriaInstanceIdIncidentIdsDictionary: {}, // not configured
128
+ criteriaInstance: criteria("recovery-criteria", false),
129
+ breachingSeriesFingerprints: new Set<string>([DEVICE_FP]),
130
+ disableSeriesAbsenceResolution: false,
131
+ }),
132
+ ).toBe(false);
133
+ });
134
+
135
+ it("still respects the event-driven guard (incoming-request) over recovery resolution", () => {
136
+ expect(
137
+ shouldCloseIncident({
138
+ openIncident: incident(DEVICE_FP),
139
+ autoResolveCriteriaInstanceIdIncidentIdsDictionary:
140
+ INCIDENT_AUTO_RESOLVE,
141
+ criteriaInstance: criteria("recovery-criteria", false),
142
+ breachingSeriesFingerprints: new Set<string>([DEVICE_FP]),
143
+ disableSeriesAbsenceResolution: true,
144
+ }),
145
+ ).toBe(false);
146
+ });
147
+ });
148
+
149
+ describe("MonitorAlert.shouldCloseAlert", () => {
150
+ it("RESOLVES on the recovery tick even though the recovered series is in the matched (recovery) criteria's set", () => {
151
+ expect(
152
+ shouldCloseAlert({
153
+ openAlert: alert(DEVICE_FP),
154
+ autoResolveCriteriaInstanceIdAlertIdsDictionary: ALERT_AUTO_RESOLVE,
155
+ criteriaInstance: criteria("recovery-criteria", false),
156
+ breachingSeriesFingerprints: new Set<string>([DEVICE_FP]),
157
+ disableSeriesAbsenceResolution: false,
158
+ }),
159
+ ).toBe(true);
160
+ });
161
+
162
+ it("keeps the alert open while the device is still down", () => {
163
+ expect(
164
+ shouldCloseAlert({
165
+ openAlert: alert(DEVICE_FP),
166
+ autoResolveCriteriaInstanceIdAlertIdsDictionary: ALERT_AUTO_RESOLVE,
167
+ criteriaInstance: criteria(CREATED_CRITERIA_ID, true),
168
+ breachingSeriesFingerprints: new Set<string>([DEVICE_FP]),
169
+ disableSeriesAbsenceResolution: false,
170
+ }),
171
+ ).toBe(false);
172
+ });
173
+
174
+ it("resolves when this device recovered but another is still down", () => {
175
+ expect(
176
+ shouldCloseAlert({
177
+ openAlert: alert(DEVICE_FP),
178
+ autoResolveCriteriaInstanceIdAlertIdsDictionary: ALERT_AUTO_RESOLVE,
179
+ criteriaInstance: criteria(CREATED_CRITERIA_ID, true),
180
+ breachingSeriesFingerprints: new Set<string>(["fp-device-2"]),
181
+ disableSeriesAbsenceResolution: false,
182
+ }),
183
+ ).toBe(true);
184
+ });
185
+
186
+ it("still respects the event-driven guard over recovery resolution", () => {
187
+ expect(
188
+ shouldCloseAlert({
189
+ openAlert: alert(DEVICE_FP),
190
+ autoResolveCriteriaInstanceIdAlertIdsDictionary: ALERT_AUTO_RESOLVE,
191
+ criteriaInstance: criteria("recovery-criteria", false),
192
+ breachingSeriesFingerprints: new Set<string>([DEVICE_FP]),
193
+ disableSeriesAbsenceResolution: true,
194
+ }),
195
+ ).toBe(false);
196
+ });
197
+ });
198
+ });
@@ -0,0 +1,86 @@
1
+ import AIAgentTaskStatus, {
2
+ AIAgentTaskStatusHelper,
3
+ AIAgentTaskStatusProps,
4
+ } from "../../../Types/AI/AIAgentTaskStatus";
5
+
6
+ describe("AIAgentTaskStatusHelper", () => {
7
+ describe("getAllStatusProps", () => {
8
+ test("returns one entry per status with a title and description", () => {
9
+ const props: Array<AIAgentTaskStatusProps> =
10
+ AIAgentTaskStatusHelper.getAllStatusProps();
11
+
12
+ const statuses: Array<AIAgentTaskStatus> =
13
+ Object.values(AIAgentTaskStatus);
14
+ expect(props.length).toBe(statuses.length);
15
+
16
+ for (const prop of props) {
17
+ expect(typeof prop.title).toBe("string");
18
+ expect(prop.title.length).toBeGreaterThan(0);
19
+ expect(typeof prop.description).toBe("string");
20
+ expect(prop.description.length).toBeGreaterThan(0);
21
+ }
22
+ });
23
+
24
+ test("covers every status in the enum exactly once", () => {
25
+ const seen: Set<AIAgentTaskStatus> = new Set<AIAgentTaskStatus>();
26
+ for (const prop of AIAgentTaskStatusHelper.getAllStatusProps()) {
27
+ expect(seen.has(prop.status)).toBe(false);
28
+ seen.add(prop.status);
29
+ }
30
+
31
+ for (const status of Object.values(AIAgentTaskStatus)) {
32
+ expect(seen.has(status)).toBe(true);
33
+ }
34
+ });
35
+ });
36
+
37
+ describe("getTitle", () => {
38
+ test("returns the configured title for a known status", () => {
39
+ expect(
40
+ AIAgentTaskStatusHelper.getTitle(AIAgentTaskStatus.InProgress),
41
+ ).toBe("In Progress");
42
+ expect(
43
+ AIAgentTaskStatusHelper.getTitle(AIAgentTaskStatus.Completed),
44
+ ).toBe("Completed");
45
+ });
46
+
47
+ test("returns an empty string for an unknown status", () => {
48
+ expect(
49
+ AIAgentTaskStatusHelper.getTitle("NonExistent" as AIAgentTaskStatus),
50
+ ).toBe("");
51
+ });
52
+ });
53
+
54
+ describe("getDescription", () => {
55
+ test("returns a non-empty description for a known status", () => {
56
+ expect(
57
+ AIAgentTaskStatusHelper.getDescription(AIAgentTaskStatus.Scheduled)
58
+ .length,
59
+ ).toBeGreaterThan(0);
60
+ });
61
+
62
+ test("returns an empty string for an unknown status", () => {
63
+ expect(
64
+ AIAgentTaskStatusHelper.getDescription(
65
+ "NonExistent" as AIAgentTaskStatus,
66
+ ),
67
+ ).toBe("");
68
+ });
69
+ });
70
+
71
+ describe("isTerminalStatus", () => {
72
+ test.each([AIAgentTaskStatus.Completed, AIAgentTaskStatus.Error])(
73
+ "returns true for terminal status %s",
74
+ (status: AIAgentTaskStatus) => {
75
+ expect(AIAgentTaskStatusHelper.isTerminalStatus(status)).toBe(true);
76
+ },
77
+ );
78
+
79
+ test.each([AIAgentTaskStatus.Scheduled, AIAgentTaskStatus.InProgress])(
80
+ "returns false for non-terminal status %s",
81
+ (status: AIAgentTaskStatus) => {
82
+ expect(AIAgentTaskStatusHelper.isTerminalStatus(status)).toBe(false);
83
+ },
84
+ );
85
+ });
86
+ });
@@ -0,0 +1,127 @@
1
+ import AggregationInterval from "../../../Types/BaseDatabase/AggregationInterval";
2
+ import AggregationIntervalUtil from "../../../Types/BaseDatabase/AggregationIntervalUtil";
3
+
4
+ describe("AggregationIntervalUtil", () => {
5
+ const SECOND: number = 1000;
6
+ const HOUR: number = SECOND * 60 * 60;
7
+ const DAY: number = HOUR * 24;
8
+
9
+ const windowOf: (durationMs: number) => { startDate: Date; endDate: Date } = (
10
+ durationMs: number,
11
+ ): { startDate: Date; endDate: Date } => {
12
+ const startDate: Date = new Date(Date.UTC(2020, 0, 1, 0, 0, 0));
13
+ const endDate: Date = new Date(startDate.getTime() + durationMs);
14
+ return { startDate, endDate };
15
+ };
16
+
17
+ describe("getAggregationIntervalForWindow", () => {
18
+ const cases: Array<[string, number, AggregationInterval]> = [
19
+ ["2 hours -> Minute", 2 * HOUR, AggregationInterval.Minute],
20
+ [
21
+ "exactly 3 hours -> Minute (inclusive bound)",
22
+ 3 * HOUR,
23
+ AggregationInterval.Minute,
24
+ ],
25
+ ["3 hours + 1ms -> Hour", 3 * HOUR + 1, AggregationInterval.Hour],
26
+ ["1 day -> Hour", DAY, AggregationInterval.Hour],
27
+ [
28
+ "exactly 7 days -> Hour (inclusive bound)",
29
+ 7 * DAY,
30
+ AggregationInterval.Hour,
31
+ ],
32
+ ["7 days + 1ms -> Day", 7 * DAY + 1, AggregationInterval.Day],
33
+ ["14 days -> Day", 14 * DAY, AggregationInterval.Day],
34
+ [
35
+ "exactly 6 weeks -> Day (inclusive bound)",
36
+ 42 * DAY,
37
+ AggregationInterval.Day,
38
+ ],
39
+ ["6 weeks + 1ms -> Week", 42 * DAY + 1, AggregationInterval.Week],
40
+ ["60 days -> Week", 60 * DAY, AggregationInterval.Week],
41
+ ["200 days -> Month", 200 * DAY, AggregationInterval.Month],
42
+ ["8 years -> Year", 8 * 365 * DAY, AggregationInterval.Year],
43
+ ];
44
+
45
+ test.each(cases)(
46
+ "%s",
47
+ (_label: string, durationMs: number, expected: AggregationInterval) => {
48
+ expect(
49
+ AggregationIntervalUtil.getAggregationIntervalForWindow(
50
+ windowOf(durationMs),
51
+ ),
52
+ ).toBe(expected);
53
+ },
54
+ );
55
+
56
+ test("returns the widest interval as the window grows", () => {
57
+ const order: Array<AggregationInterval> = [
58
+ AggregationInterval.Minute,
59
+ AggregationInterval.Hour,
60
+ AggregationInterval.Day,
61
+ AggregationInterval.Week,
62
+ AggregationInterval.Month,
63
+ AggregationInterval.Year,
64
+ ];
65
+ const durations: Array<number> = [
66
+ HOUR,
67
+ 2 * DAY,
68
+ 30 * DAY,
69
+ 90 * DAY,
70
+ 365 * DAY,
71
+ 10 * 365 * DAY,
72
+ ];
73
+
74
+ const results: Array<AggregationInterval> = durations.map(
75
+ (d: number): AggregationInterval => {
76
+ return AggregationIntervalUtil.getAggregationIntervalForWindow(
77
+ windowOf(d),
78
+ );
79
+ },
80
+ );
81
+
82
+ // Each larger window is at least as wide an interval as the previous.
83
+ for (let i: number = 1; i < results.length; i++) {
84
+ expect(order.indexOf(results[i]!)).toBeGreaterThanOrEqual(
85
+ order.indexOf(results[i - 1]!),
86
+ );
87
+ }
88
+ });
89
+ });
90
+
91
+ describe("getAggregationIntervalMs", () => {
92
+ test.each([
93
+ [AggregationInterval.Minute, 1000 * 60],
94
+ [AggregationInterval.Hour, 1000 * 60 * 60],
95
+ [AggregationInterval.Day, 1000 * 60 * 60 * 24],
96
+ [AggregationInterval.Week, 1000 * 60 * 60 * 24 * 7],
97
+ [AggregationInterval.Month, 1000 * 60 * 60 * 24 * 30],
98
+ [AggregationInterval.Year, 1000 * 60 * 60 * 24 * 365],
99
+ ])(
100
+ "maps %s to its nominal width",
101
+ (interval: AggregationInterval, expectedMs: number) => {
102
+ expect(AggregationIntervalUtil.getAggregationIntervalMs(interval)).toBe(
103
+ expectedMs,
104
+ );
105
+ },
106
+ );
107
+
108
+ test("intervals are strictly increasing in width", () => {
109
+ const ordered: Array<AggregationInterval> = [
110
+ AggregationInterval.Minute,
111
+ AggregationInterval.Hour,
112
+ AggregationInterval.Day,
113
+ AggregationInterval.Week,
114
+ AggregationInterval.Month,
115
+ AggregationInterval.Year,
116
+ ];
117
+
118
+ for (let i: number = 1; i < ordered.length; i++) {
119
+ expect(
120
+ AggregationIntervalUtil.getAggregationIntervalMs(ordered[i]!),
121
+ ).toBeGreaterThan(
122
+ AggregationIntervalUtil.getAggregationIntervalMs(ordered[i - 1]!),
123
+ );
124
+ }
125
+ });
126
+ });
127
+ });