@oneuptime/common 14.0.9 → 14.0.10

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 (383) hide show
  1. package/Models/DatabaseModels/AutoRemediationSuggestion.ts +60 -0
  2. package/Models/DatabaseModels/CephCluster.ts +213 -0
  3. package/Models/DatabaseModels/DatabaseServer.ts +213 -0
  4. package/Models/DatabaseModels/DockerHost.ts +213 -0
  5. package/Models/DatabaseModels/DockerSwarmCluster.ts +213 -0
  6. package/Models/DatabaseModels/GlobalConfig.ts +1 -1
  7. package/Models/DatabaseModels/Host.ts +213 -0
  8. package/Models/DatabaseModels/Index.ts +2 -0
  9. package/Models/DatabaseModels/PodmanHost.ts +213 -0
  10. package/Models/DatabaseModels/ProxmoxCluster.ts +213 -0
  11. package/Models/DatabaseModels/ResourceAiAgent.ts +419 -0
  12. package/Models/DatabaseModels/RunnerJob.ts +144 -0
  13. package/Models/DatabaseModels/VMwareVCenter.ts +213 -0
  14. package/Server/API/AutoRemediationAPI.ts +392 -1
  15. package/Server/API/ResourceAiAccessAPI.ts +1669 -0
  16. package/Server/Infrastructure/Postgres/SchemaMigrations/1796300000000-AddResourceAiAgents.ts +423 -0
  17. package/Server/Infrastructure/Postgres/SchemaMigrations/Index.ts +2 -0
  18. package/Server/Infrastructure/Semaphore.ts +22 -0
  19. package/Server/Middleware/TelemetryIngest.ts +15 -5
  20. package/Server/Services/AnalyticsDatabaseService.ts +45 -1
  21. package/Server/Services/AutoRemediationRuleEngineService.ts +940 -112
  22. package/Server/Services/CephClusterService.ts +109 -1
  23. package/Server/Services/DatabaseServerService.ts +116 -1
  24. package/Server/Services/DockerHostService.ts +109 -1
  25. package/Server/Services/DockerSwarmClusterService.ts +113 -1
  26. package/Server/Services/HostService.ts +126 -4
  27. package/Server/Services/MetricRecordingRuleService.ts +47 -0
  28. package/Server/Services/PodmanHostService.ts +109 -1
  29. package/Server/Services/ProxmoxClusterService.ts +110 -1
  30. package/Server/Services/ResourceAiAccessService.ts +1439 -0
  31. package/Server/Services/ResourceAiAgentJobService.ts +202 -0
  32. package/Server/Services/ResourceAiAgentService.ts +2432 -0
  33. package/Server/Services/RunnerJobService.ts +611 -4
  34. package/Server/Services/TelemetryUsageBillingService.ts +28 -0
  35. package/Server/Services/TraceRecordingRuleService.ts +33 -0
  36. package/Server/Services/VMwareVCenterService.ts +110 -1
  37. package/Server/Utils/AI/Remediation/RemediationCommandTools.ts +1434 -32
  38. package/Server/Utils/AI/Remediation/RemediationExecutionRunner.ts +935 -21
  39. package/Server/Utils/AI/Remediation/RemediationPlanRunner.ts +25 -1
  40. package/Server/Utils/AI/ResourceAccess/InfrastructureInvestigationToolkit.ts +577 -0
  41. package/Server/Utils/AI/ResourceAccess/ResourceAccessContext.ts +271 -0
  42. package/Server/Utils/AI/ResourceAccess/ResourceAccessToolNames.ts +45 -0
  43. package/Server/Utils/AI/ResourceAccess/ResourceAiAccessSettings.ts +964 -0
  44. package/Server/Utils/AI/ResourceAccess/ResourceAiDeleteCleanup.ts +333 -0
  45. package/Server/Utils/AI/ResourceAccess/ResourceCommandJobRunner.ts +873 -0
  46. package/Server/Utils/AI/SRE/AIInvestigationEngine.ts +72 -2
  47. package/Server/Utils/AI/SRE/AlertInvestigationRunner.ts +72 -5
  48. package/Server/Utils/AI/SRE/IncidentInvestigationRunner.ts +72 -5
  49. package/Server/Utils/AutoRemediation/CommandPlanExecutor.ts +396 -13
  50. package/Server/Utils/AutoRemediation/RemediationVerifier.ts +35 -2
  51. package/Server/Utils/Database/ProjectScopedReferenceValidator.ts +9 -1
  52. package/Server/Utils/SessionReplay/SessionReplayBudgetMetrics.ts +920 -0
  53. package/Server/Utils/SessionReplay/SessionReplayUsage.ts +84 -6
  54. package/Server/Utils/Workspace/MicrosoftTeams/Actions/Alert.ts +35 -15
  55. package/Server/Utils/Workspace/MicrosoftTeams/Actions/AlertEpisode.ts +33 -15
  56. package/Server/Utils/Workspace/MicrosoftTeams/Actions/Auth.ts +21 -1
  57. package/Server/Utils/Workspace/MicrosoftTeams/Actions/Incident.ts +298 -224
  58. package/Server/Utils/Workspace/MicrosoftTeams/Actions/IncidentEpisode.ts +35 -15
  59. package/Server/Utils/Workspace/MicrosoftTeams/Actions/ScheduledMaintenance.ts +389 -175
  60. package/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeams.ts +366 -143
  61. package/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeamsActivityDeduplicator.ts +163 -0
  62. package/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeamsCardChoices.ts +396 -0
  63. package/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeamsCreateCommands.ts +418 -0
  64. package/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeamsMessageSize.ts +152 -0
  65. package/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeamsReplies.ts +251 -0
  66. package/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeamsTimezone.ts +214 -0
  67. package/Tests/App/Dashboard/ClusterAccessNotice.test.tsx +93 -0
  68. package/Tests/App/Dashboard/DatabaseDocumentationMarkdown.test.ts +18 -6
  69. package/Tests/App/Dashboard/InvestigationInfrastructureTools.test.tsx +506 -0
  70. package/Tests/App/Dashboard/RemediationSuggestionCardDescription.test.tsx +209 -0
  71. package/Tests/App/Dashboard/RemediationSuggestionCardResource.test.tsx +317 -0
  72. package/Tests/App/Dashboard/ResourceAiAccessSettingsUtil.test.ts +921 -0
  73. package/Tests/App/Dashboard/ResourceAiAgentInstall.test.ts +860 -0
  74. package/Tests/App/Dashboard/ResourceAiAgentPage.test.tsx +1721 -0
  75. package/Tests/App/Dashboard/ResourceAiAgentStatus.test.ts +1002 -0
  76. package/Tests/App/Dashboard/ResourceAiInsightsPage.test.tsx +931 -0
  77. package/Tests/App/Dashboard/ResourceAiNavigation.test.tsx +575 -0
  78. package/Tests/App/Dashboard/RunbookStepTypeMaps.test.ts +38 -7
  79. package/Tests/Models/DatabaseModels/DatabaseServerModels.test.ts +33 -1
  80. package/Tests/Models/DatabaseModels/ResourceAiAccessColumns.test.ts +738 -0
  81. package/Tests/Models/DatabaseModels/ResourceAiAgentModel.test.ts +842 -0
  82. package/Tests/Server/API/AutoRemediationApproveResourceRound.test.ts +835 -0
  83. package/Tests/Server/API/ResourceAiAccessAPI.test.ts +2730 -0
  84. package/Tests/Server/Infrastructure/Postgres/AddDatabaseServerTablesMigration.test.ts +60 -0
  85. package/Tests/Server/Infrastructure/Postgres/AddResourceAiAgentsMigration.test.ts +659 -0
  86. package/Tests/Server/Infrastructure/SemaphoreMutex.test.ts +31 -0
  87. package/Tests/Server/Middleware/TelemetryIngestBrowserKey.test.ts +63 -5
  88. package/Tests/Server/Middleware/TelemetryIngestKubernetesAgentRunnerPinnedKey.test.ts +103 -5
  89. package/Tests/Server/Middleware/TelemetryIngestKubernetesAgentRunnerRateLimit.test.ts +19 -1
  90. package/Tests/Server/Services/AutoRemediationResourceRuleEngine.test.ts +1279 -0
  91. package/Tests/Server/Services/DatabaseServerService.test.ts +55 -0
  92. package/Tests/Server/Services/GroupTelemetryUsageExcludeNames.test.ts +299 -0
  93. package/Tests/Server/Services/HostServiceFindOrCreateMemo.test.ts +44 -0
  94. package/Tests/Server/Services/MonitorProbeServiceIntervalScheduling.test.ts +45 -6
  95. package/Tests/Server/Services/RecordingRuleReservedMetricName.test.ts +171 -0
  96. package/Tests/Server/Services/ResourceAiAccessChangeAuthorization.test.ts +256 -0
  97. package/Tests/Server/Services/ResourceAiAccessService.test.ts +1373 -0
  98. package/Tests/Server/Services/ResourceAiAgentJobService.test.ts +375 -0
  99. package/Tests/Server/Services/ResourceAiAgentServiceHelpers.test.ts +1114 -0
  100. package/Tests/Server/Services/ResourceAiAgentServiceLifecycle.test.ts +1050 -0
  101. package/Tests/Server/Services/ResourceAiAgentServiceRegister.test.ts +2251 -0
  102. package/Tests/Server/Services/ResourceAiSettingsCreate.test.ts +373 -0
  103. package/Tests/Server/Services/ResourceAiSettingsPermission.test.ts +1042 -0
  104. package/Tests/Server/Services/ResourceServiceDeleteCleansUpAi.test.ts +319 -0
  105. package/Tests/Server/Services/RunnerJobEnqueueKubectl.test.ts +105 -0
  106. package/Tests/Server/Services/RunnerJobEnqueueResourceCommand.test.ts +986 -0
  107. package/Tests/Server/Services/RunnerJobResourceCommandLane.test.ts +211 -0
  108. package/Tests/Server/Services/RunnerJobResourceCommandTimeoutAndRedaction.test.ts +352 -0
  109. package/Tests/Server/Services/TelemetryUsageBillingSloExclusion.test.ts +218 -0
  110. package/Tests/Server/TestingUtils/Services/FakeRunnerJobCount.ts +145 -0
  111. package/Tests/Server/Utils/AI/InvestigationInfrastructureAccessWiring.test.ts +453 -0
  112. package/Tests/Server/Utils/AI/InvestigationInfrastructureReport.test.ts +721 -0
  113. package/Tests/Server/Utils/AI/RemediationCommandTools.test.ts +94 -1
  114. package/Tests/Server/Utils/AI/RemediationCommandToolsResource.test.ts +1530 -0
  115. package/Tests/Server/Utils/AI/RemediationExecutionRunnerResourceMode.test.ts +1249 -0
  116. package/Tests/Server/Utils/AI/RemediationPlanRunner.test.ts +117 -0
  117. package/Tests/Server/Utils/AI/RemediationResourceCopyParity.test.ts +463 -0
  118. package/Tests/Server/Utils/AI/ResourceAccess/InfrastructureInvestigationToolkit.test.ts +722 -0
  119. package/Tests/Server/Utils/AI/ResourceAccess/ResourceAccessContext.test.ts +266 -0
  120. package/Tests/Server/Utils/AI/ResourceAccess/ResourceAiAccessSettings.test.ts +1220 -0
  121. package/Tests/Server/Utils/AI/ResourceAccess/ResourceAiDeleteCleanup.test.ts +569 -0
  122. package/Tests/Server/Utils/AI/ResourceAccess/ResourceCommandJobRunner.test.ts +830 -0
  123. package/Tests/Server/Utils/AutoRemediation/CommandPlanExecutorResource.test.ts +717 -0
  124. package/Tests/Server/Utils/AutoRemediation/RemediationVerifierResourceFollowUp.test.ts +338 -0
  125. package/Tests/Server/Utils/Monitor/Criteria/SessionReplayBudgetTemplateCriteria.test.ts +422 -0
  126. package/Tests/Server/Utils/SessionReplay/SessionReplayBudgetMetrics.test.ts +1647 -0
  127. package/Tests/Server/Utils/SessionReplay/SessionReplayUsage.test.ts +143 -1
  128. package/Tests/Server/Utils/Telemetry/TelemetryIngestionKeyGuard.test.ts +33 -3
  129. package/Tests/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeamsAccountNotLinked.test.ts +1093 -0
  130. package/Tests/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeamsActivityDeduplicator.test.ts +1049 -0
  131. package/Tests/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeamsCardChoices.test.ts +1676 -0
  132. package/Tests/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeamsCreateCards.test.ts +2884 -0
  133. package/Tests/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeamsCreateCommands.test.ts +2490 -0
  134. package/Tests/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeamsCreateSubmit.test.ts +2293 -0
  135. package/Tests/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeamsCreateSubmitServerTimezone.test.ts +386 -0
  136. package/Tests/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeamsMessageSize.test.ts +1477 -0
  137. package/Tests/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeamsReplies.test.ts +1967 -0
  138. package/Tests/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeamsStripHtmlTags.test.ts +92 -0
  139. package/Tests/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeamsSubmittedFormRemoval.test.ts +1819 -0
  140. package/Tests/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeamsTimezone.test.ts +1033 -0
  141. package/Tests/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeamsTimezoneServerZone.test.ts +610 -0
  142. package/Tests/Server/Utils/Workspace/MicrosoftTeamsBotMessageHandling.test.ts +2610 -0
  143. package/Tests/Server/Utils/Workspace/MicrosoftTeamsCreateCommandsEndToEnd.test.ts +4672 -0
  144. package/Tests/Server/Utils/Workspace/WorkspaceCreateProjectReferences.test.ts +190 -65
  145. package/Tests/Types/AutoRemediation/AiRemediationCommandPlan.test.ts +10 -4
  146. package/Tests/Types/AutoRemediation/AiRemediationCommandPlanResourceCommand.test.ts +305 -0
  147. package/Tests/Types/Monitor/Recommendation/MonitorRecommendationCatalog.test.ts +277 -13
  148. package/Tests/Types/Monitor/Recommendation/MonitorRecommendationUtil.test.ts +113 -0
  149. package/Tests/Types/Monitor/RumAlertTemplates.test.ts +773 -2
  150. package/Tests/Types/ResourceAiAgent/AiResourceType.test.ts +419 -0
  151. package/Tests/Types/ResourceAiAgent/ResourceAiAccess.test.ts +517 -0
  152. package/Tests/Types/Runbook/RunbookStepType.test.ts +147 -8
  153. package/Tests/UI/Rum/RecordingHealthDashboard.test.tsx +769 -1
  154. package/Tests/Utils/AiRemediation/Resource/CephCommandPolicy.test.ts +1653 -0
  155. package/Tests/Utils/AiRemediation/Resource/CephOutputRedaction.test.ts +204 -0
  156. package/Tests/Utils/AiRemediation/Resource/DatabaseCommandPolicy.test.ts +1077 -0
  157. package/Tests/Utils/AiRemediation/Resource/DatabaseDiagnosticCatalog.test.ts +558 -0
  158. package/Tests/Utils/AiRemediation/Resource/DatabaseQueryRedactor.test.ts +834 -0
  159. package/Tests/Utils/AiRemediation/Resource/DockerCliGrammar.test.ts +747 -0
  160. package/Tests/Utils/AiRemediation/Resource/DockerEngineCommandPolicy.test.ts +1259 -0
  161. package/Tests/Utils/AiRemediation/Resource/DockerOutputRedaction.test.ts +386 -0
  162. package/Tests/Utils/AiRemediation/Resource/DockerSwarmCommandPolicy.test.ts +782 -0
  163. package/Tests/Utils/AiRemediation/Resource/GovcCommandPolicy.test.ts +2259 -0
  164. package/Tests/Utils/AiRemediation/Resource/HostCommandPolicy.test.ts +2019 -0
  165. package/Tests/Utils/AiRemediation/Resource/ProxmoxCommandPolicy.test.ts +2497 -0
  166. package/Tests/Utils/AiRemediation/Resource/ResourceCommandPolicy.test.ts +1305 -0
  167. package/Tests/Utils/AiRemediation/Resource/ResourceCommandPolicyCore.test.ts +585 -0
  168. package/Tests/Utils/AiRemediation/Resource/ResourceOutputRedactor.test.ts +334 -0
  169. package/Tests/Utils/AiRemediation/Resource/ResourceOutputRedactorCopyParity.test.ts +98 -0
  170. package/Tests/Utils/AiRemediation/Resource/ResourcePolicyImportClosure.test.ts +391 -0
  171. package/Tests/Utils/AiRemediation/ResourceAiAgentPolicyCopyParity.test.ts +497 -0
  172. package/Tests/Utils/SessionReplay/SessionReplayBudgetMetricType.test.ts +383 -0
  173. package/Types/AI/ResourceAiAccessApi.ts +140 -0
  174. package/Types/AI/ResourceAiAccessPermissions.ts +126 -0
  175. package/Types/AutoRemediation/AiRemediationCommandPlan.ts +183 -2
  176. package/Types/Monitor/Recommendation/MonitorRecommendationCatalog.ts +55 -22
  177. package/Types/Monitor/Recommendation/MonitorRecommendationTypes.ts +35 -3
  178. package/Types/Monitor/RumAlertTemplates.ts +351 -4
  179. package/Types/ResourceAiAgent/AiResourceType.ts +310 -0
  180. package/Types/ResourceAiAgent/ResourceAiAccess.ts +574 -0
  181. package/Types/Rum/SessionReplayBudgetMetricType.ts +47 -0
  182. package/Types/Runbook/RunbookStepType.ts +29 -0
  183. package/Types/Telemetry/TelemetryIngestSurface.ts +14 -2
  184. package/Utils/AI/InvestigationReport.ts +121 -15
  185. package/Utils/AiRemediation/Resource/CephCommandPolicy.ts +1936 -0
  186. package/Utils/AiRemediation/Resource/DatabaseCommandPolicy.ts +166 -0
  187. package/Utils/AiRemediation/Resource/DatabaseDiagnosticCatalog.ts +1532 -0
  188. package/Utils/AiRemediation/Resource/DatabaseQueryRedactor.ts +1394 -0
  189. package/Utils/AiRemediation/Resource/DockerCliGrammar.ts +1839 -0
  190. package/Utils/AiRemediation/Resource/DockerEngineCommandPolicy.ts +490 -0
  191. package/Utils/AiRemediation/Resource/DockerSwarmCommandPolicy.ts +687 -0
  192. package/Utils/AiRemediation/Resource/GovcCommandPolicy.ts +2096 -0
  193. package/Utils/AiRemediation/Resource/HostCommandPolicy.ts +2982 -0
  194. package/Utils/AiRemediation/Resource/ProxmoxCommandPolicy.ts +1679 -0
  195. package/Utils/AiRemediation/Resource/ResourceCommandPolicy.ts +851 -0
  196. package/Utils/AiRemediation/Resource/ResourceCommandPolicyCore.ts +593 -0
  197. package/Utils/AiRemediation/Resource/ResourceOutputRedactor.ts +2812 -0
  198. package/Utils/SessionReplay/SessionReplayBudgetMetricType.ts +184 -0
  199. package/build/dist/Models/DatabaseModels/AutoRemediationSuggestion.js +62 -0
  200. package/build/dist/Models/DatabaseModels/AutoRemediationSuggestion.js.map +1 -1
  201. package/build/dist/Models/DatabaseModels/CephCluster.js +219 -0
  202. package/build/dist/Models/DatabaseModels/CephCluster.js.map +1 -1
  203. package/build/dist/Models/DatabaseModels/DatabaseServer.js +219 -0
  204. package/build/dist/Models/DatabaseModels/DatabaseServer.js.map +1 -1
  205. package/build/dist/Models/DatabaseModels/DockerHost.js +219 -0
  206. package/build/dist/Models/DatabaseModels/DockerHost.js.map +1 -1
  207. package/build/dist/Models/DatabaseModels/DockerSwarmCluster.js +219 -0
  208. package/build/dist/Models/DatabaseModels/DockerSwarmCluster.js.map +1 -1
  209. package/build/dist/Models/DatabaseModels/GlobalConfig.js +1 -1
  210. package/build/dist/Models/DatabaseModels/GlobalConfig.js.map +1 -1
  211. package/build/dist/Models/DatabaseModels/Host.js +219 -0
  212. package/build/dist/Models/DatabaseModels/Host.js.map +1 -1
  213. package/build/dist/Models/DatabaseModels/Index.js +2 -0
  214. package/build/dist/Models/DatabaseModels/Index.js.map +1 -1
  215. package/build/dist/Models/DatabaseModels/PodmanHost.js +219 -0
  216. package/build/dist/Models/DatabaseModels/PodmanHost.js.map +1 -1
  217. package/build/dist/Models/DatabaseModels/ProxmoxCluster.js +219 -0
  218. package/build/dist/Models/DatabaseModels/ProxmoxCluster.js.map +1 -1
  219. package/build/dist/Models/DatabaseModels/ResourceAiAgent.js +439 -0
  220. package/build/dist/Models/DatabaseModels/ResourceAiAgent.js.map +1 -0
  221. package/build/dist/Models/DatabaseModels/RunnerJob.js +145 -0
  222. package/build/dist/Models/DatabaseModels/RunnerJob.js.map +1 -1
  223. package/build/dist/Models/DatabaseModels/VMwareVCenter.js +219 -0
  224. package/build/dist/Models/DatabaseModels/VMwareVCenter.js.map +1 -1
  225. package/build/dist/Server/API/AutoRemediationAPI.js +231 -1
  226. package/build/dist/Server/API/AutoRemediationAPI.js.map +1 -1
  227. package/build/dist/Server/API/ResourceAiAccessAPI.js +1119 -0
  228. package/build/dist/Server/API/ResourceAiAccessAPI.js.map +1 -0
  229. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1796300000000-AddResourceAiAgents.js +168 -0
  230. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1796300000000-AddResourceAiAgents.js.map +1 -0
  231. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js +2 -0
  232. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js.map +1 -1
  233. package/build/dist/Server/Infrastructure/Semaphore.js +6 -0
  234. package/build/dist/Server/Infrastructure/Semaphore.js.map +1 -1
  235. package/build/dist/Server/Middleware/TelemetryIngest.js +12 -5
  236. package/build/dist/Server/Middleware/TelemetryIngest.js.map +1 -1
  237. package/build/dist/Server/Services/AnalyticsDatabaseService.js +26 -1
  238. package/build/dist/Server/Services/AnalyticsDatabaseService.js.map +1 -1
  239. package/build/dist/Server/Services/AutoRemediationRuleEngineService.js +601 -3
  240. package/build/dist/Server/Services/AutoRemediationRuleEngineService.js.map +1 -1
  241. package/build/dist/Server/Services/CephClusterService.js +104 -0
  242. package/build/dist/Server/Services/CephClusterService.js.map +1 -1
  243. package/build/dist/Server/Services/DatabaseServerService.js +99 -0
  244. package/build/dist/Server/Services/DatabaseServerService.js.map +1 -1
  245. package/build/dist/Server/Services/DockerHostService.js +104 -0
  246. package/build/dist/Server/Services/DockerHostService.js.map +1 -1
  247. package/build/dist/Server/Services/DockerSwarmClusterService.js +104 -0
  248. package/build/dist/Server/Services/DockerSwarmClusterService.js.map +1 -1
  249. package/build/dist/Server/Services/HostService.js +114 -2
  250. package/build/dist/Server/Services/HostService.js.map +1 -1
  251. package/build/dist/Server/Services/MetricRecordingRuleService.js +46 -0
  252. package/build/dist/Server/Services/MetricRecordingRuleService.js.map +1 -1
  253. package/build/dist/Server/Services/PodmanHostService.js +104 -0
  254. package/build/dist/Server/Services/PodmanHostService.js.map +1 -1
  255. package/build/dist/Server/Services/ProxmoxClusterService.js +104 -0
  256. package/build/dist/Server/Services/ProxmoxClusterService.js.map +1 -1
  257. package/build/dist/Server/Services/ResourceAiAccessService.js +1028 -0
  258. package/build/dist/Server/Services/ResourceAiAccessService.js.map +1 -0
  259. package/build/dist/Server/Services/ResourceAiAgentJobService.js +173 -0
  260. package/build/dist/Server/Services/ResourceAiAgentJobService.js.map +1 -0
  261. package/build/dist/Server/Services/ResourceAiAgentService.js +1687 -0
  262. package/build/dist/Server/Services/ResourceAiAgentService.js.map +1 -0
  263. package/build/dist/Server/Services/RunnerJobService.js +344 -5
  264. package/build/dist/Server/Services/RunnerJobService.js.map +1 -1
  265. package/build/dist/Server/Services/TelemetryUsageBillingService.js +26 -0
  266. package/build/dist/Server/Services/TelemetryUsageBillingService.js.map +1 -1
  267. package/build/dist/Server/Services/TraceRecordingRuleService.js +37 -0
  268. package/build/dist/Server/Services/TraceRecordingRuleService.js.map +1 -1
  269. package/build/dist/Server/Services/VMwareVCenterService.js +104 -0
  270. package/build/dist/Server/Services/VMwareVCenterService.js.map +1 -1
  271. package/build/dist/Server/Utils/AI/Remediation/RemediationCommandTools.js +1029 -30
  272. package/build/dist/Server/Utils/AI/Remediation/RemediationCommandTools.js.map +1 -1
  273. package/build/dist/Server/Utils/AI/Remediation/RemediationExecutionRunner.js +633 -28
  274. package/build/dist/Server/Utils/AI/Remediation/RemediationExecutionRunner.js.map +1 -1
  275. package/build/dist/Server/Utils/AI/Remediation/RemediationPlanRunner.js +21 -1
  276. package/build/dist/Server/Utils/AI/Remediation/RemediationPlanRunner.js.map +1 -1
  277. package/build/dist/Server/Utils/AI/ResourceAccess/InfrastructureInvestigationToolkit.js +330 -0
  278. package/build/dist/Server/Utils/AI/ResourceAccess/InfrastructureInvestigationToolkit.js.map +1 -0
  279. package/build/dist/Server/Utils/AI/ResourceAccess/ResourceAccessContext.js +160 -0
  280. package/build/dist/Server/Utils/AI/ResourceAccess/ResourceAccessContext.js.map +1 -0
  281. package/build/dist/Server/Utils/AI/ResourceAccess/ResourceAccessToolNames.js +33 -0
  282. package/build/dist/Server/Utils/AI/ResourceAccess/ResourceAccessToolNames.js.map +1 -0
  283. package/build/dist/Server/Utils/AI/ResourceAccess/ResourceAiAccessSettings.js +640 -0
  284. package/build/dist/Server/Utils/AI/ResourceAccess/ResourceAiAccessSettings.js.map +1 -0
  285. package/build/dist/Server/Utils/AI/ResourceAccess/ResourceAiDeleteCleanup.js +226 -0
  286. package/build/dist/Server/Utils/AI/ResourceAccess/ResourceAiDeleteCleanup.js.map +1 -0
  287. package/build/dist/Server/Utils/AI/ResourceAccess/ResourceCommandJobRunner.js +600 -0
  288. package/build/dist/Server/Utils/AI/ResourceAccess/ResourceCommandJobRunner.js.map +1 -0
  289. package/build/dist/Server/Utils/AI/SRE/AIInvestigationEngine.js +50 -4
  290. package/build/dist/Server/Utils/AI/SRE/AIInvestigationEngine.js.map +1 -1
  291. package/build/dist/Server/Utils/AI/SRE/AlertInvestigationRunner.js +55 -4
  292. package/build/dist/Server/Utils/AI/SRE/AlertInvestigationRunner.js.map +1 -1
  293. package/build/dist/Server/Utils/AI/SRE/IncidentInvestigationRunner.js +55 -4
  294. package/build/dist/Server/Utils/AI/SRE/IncidentInvestigationRunner.js.map +1 -1
  295. package/build/dist/Server/Utils/AutoRemediation/CommandPlanExecutor.js +290 -13
  296. package/build/dist/Server/Utils/AutoRemediation/CommandPlanExecutor.js.map +1 -1
  297. package/build/dist/Server/Utils/AutoRemediation/RemediationVerifier.js +29 -1
  298. package/build/dist/Server/Utils/AutoRemediation/RemediationVerifier.js.map +1 -1
  299. package/build/dist/Server/Utils/Database/ProjectScopedReferenceValidator.js +9 -1
  300. package/build/dist/Server/Utils/Database/ProjectScopedReferenceValidator.js.map +1 -1
  301. package/build/dist/Server/Utils/SessionReplay/SessionReplayBudgetMetrics.js +627 -0
  302. package/build/dist/Server/Utils/SessionReplay/SessionReplayBudgetMetrics.js.map +1 -0
  303. package/build/dist/Server/Utils/SessionReplay/SessionReplayUsage.js +60 -5
  304. package/build/dist/Server/Utils/SessionReplay/SessionReplayUsage.js.map +1 -1
  305. package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/Alert.js +19 -15
  306. package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/Alert.js.map +1 -1
  307. package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/AlertEpisode.js +19 -15
  308. package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/AlertEpisode.js.map +1 -1
  309. package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/Auth.js +17 -1
  310. package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/Auth.js.map +1 -1
  311. package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/Incident.js +183 -209
  312. package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/Incident.js.map +1 -1
  313. package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/IncidentEpisode.js +19 -15
  314. package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/IncidentEpisode.js.map +1 -1
  315. package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/ScheduledMaintenance.js +233 -167
  316. package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/ScheduledMaintenance.js.map +1 -1
  317. package/build/dist/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeams.js +263 -110
  318. package/build/dist/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeams.js.map +1 -1
  319. package/build/dist/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeamsActivityDeduplicator.js +129 -0
  320. package/build/dist/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeamsActivityDeduplicator.js.map +1 -0
  321. package/build/dist/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeamsCardChoices.js +266 -0
  322. package/build/dist/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeamsCardChoices.js.map +1 -0
  323. package/build/dist/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeamsCreateCommands.js +258 -0
  324. package/build/dist/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeamsCreateCommands.js.map +1 -0
  325. package/build/dist/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeamsMessageSize.js +104 -0
  326. package/build/dist/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeamsMessageSize.js.map +1 -0
  327. package/build/dist/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeamsReplies.js +183 -0
  328. package/build/dist/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeamsReplies.js.map +1 -0
  329. package/build/dist/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeamsTimezone.js +123 -0
  330. package/build/dist/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeamsTimezone.js.map +1 -0
  331. package/build/dist/Types/AI/ResourceAiAccessApi.js +30 -0
  332. package/build/dist/Types/AI/ResourceAiAccessApi.js.map +1 -0
  333. package/build/dist/Types/AI/ResourceAiAccessPermissions.js +98 -0
  334. package/build/dist/Types/AI/ResourceAiAccessPermissions.js.map +1 -0
  335. package/build/dist/Types/AutoRemediation/AiRemediationCommandPlan.js +116 -29
  336. package/build/dist/Types/AutoRemediation/AiRemediationCommandPlan.js.map +1 -1
  337. package/build/dist/Types/Monitor/Recommendation/MonitorRecommendationCatalog.js +47 -21
  338. package/build/dist/Types/Monitor/Recommendation/MonitorRecommendationCatalog.js.map +1 -1
  339. package/build/dist/Types/Monitor/Recommendation/MonitorRecommendationTypes.js +5 -0
  340. package/build/dist/Types/Monitor/Recommendation/MonitorRecommendationTypes.js.map +1 -1
  341. package/build/dist/Types/Monitor/RumAlertTemplates.js +199 -3
  342. package/build/dist/Types/Monitor/RumAlertTemplates.js.map +1 -1
  343. package/build/dist/Types/ResourceAiAgent/AiResourceType.js +242 -0
  344. package/build/dist/Types/ResourceAiAgent/AiResourceType.js.map +1 -0
  345. package/build/dist/Types/ResourceAiAgent/ResourceAiAccess.js +275 -0
  346. package/build/dist/Types/ResourceAiAgent/ResourceAiAccess.js.map +1 -0
  347. package/build/dist/Types/Rum/SessionReplayBudgetMetricType.js +45 -0
  348. package/build/dist/Types/Rum/SessionReplayBudgetMetricType.js.map +1 -0
  349. package/build/dist/Types/Runbook/RunbookStepType.js +27 -0
  350. package/build/dist/Types/Runbook/RunbookStepType.js.map +1 -1
  351. package/build/dist/Types/Telemetry/TelemetryIngestSurface.js +13 -2
  352. package/build/dist/Types/Telemetry/TelemetryIngestSurface.js.map +1 -1
  353. package/build/dist/Utils/AI/InvestigationReport.js +71 -11
  354. package/build/dist/Utils/AI/InvestigationReport.js.map +1 -1
  355. package/build/dist/Utils/AiRemediation/Resource/CephCommandPolicy.js +1462 -0
  356. package/build/dist/Utils/AiRemediation/Resource/CephCommandPolicy.js.map +1 -0
  357. package/build/dist/Utils/AiRemediation/Resource/DatabaseCommandPolicy.js +122 -0
  358. package/build/dist/Utils/AiRemediation/Resource/DatabaseCommandPolicy.js.map +1 -0
  359. package/build/dist/Utils/AiRemediation/Resource/DatabaseDiagnosticCatalog.js +1139 -0
  360. package/build/dist/Utils/AiRemediation/Resource/DatabaseDiagnosticCatalog.js.map +1 -0
  361. package/build/dist/Utils/AiRemediation/Resource/DatabaseQueryRedactor.js +1060 -0
  362. package/build/dist/Utils/AiRemediation/Resource/DatabaseQueryRedactor.js.map +1 -0
  363. package/build/dist/Utils/AiRemediation/Resource/DockerCliGrammar.js +1301 -0
  364. package/build/dist/Utils/AiRemediation/Resource/DockerCliGrammar.js.map +1 -0
  365. package/build/dist/Utils/AiRemediation/Resource/DockerEngineCommandPolicy.js +370 -0
  366. package/build/dist/Utils/AiRemediation/Resource/DockerEngineCommandPolicy.js.map +1 -0
  367. package/build/dist/Utils/AiRemediation/Resource/DockerSwarmCommandPolicy.js +498 -0
  368. package/build/dist/Utils/AiRemediation/Resource/DockerSwarmCommandPolicy.js.map +1 -0
  369. package/build/dist/Utils/AiRemediation/Resource/GovcCommandPolicy.js +1565 -0
  370. package/build/dist/Utils/AiRemediation/Resource/GovcCommandPolicy.js.map +1 -0
  371. package/build/dist/Utils/AiRemediation/Resource/HostCommandPolicy.js +2206 -0
  372. package/build/dist/Utils/AiRemediation/Resource/HostCommandPolicy.js.map +1 -0
  373. package/build/dist/Utils/AiRemediation/Resource/ProxmoxCommandPolicy.js +1129 -0
  374. package/build/dist/Utils/AiRemediation/Resource/ProxmoxCommandPolicy.js.map +1 -0
  375. package/build/dist/Utils/AiRemediation/Resource/ResourceCommandPolicy.js +565 -0
  376. package/build/dist/Utils/AiRemediation/Resource/ResourceCommandPolicy.js.map +1 -0
  377. package/build/dist/Utils/AiRemediation/Resource/ResourceCommandPolicyCore.js +408 -0
  378. package/build/dist/Utils/AiRemediation/Resource/ResourceCommandPolicyCore.js.map +1 -0
  379. package/build/dist/Utils/AiRemediation/Resource/ResourceOutputRedactor.js +1910 -0
  380. package/build/dist/Utils/AiRemediation/Resource/ResourceOutputRedactor.js.map +1 -0
  381. package/build/dist/Utils/SessionReplay/SessionReplayBudgetMetricType.js +160 -0
  382. package/build/dist/Utils/SessionReplay/SessionReplayBudgetMetricType.js.map +1 -0
  383. package/package.json +1 -1
@@ -0,0 +1,423 @@
1
+ import { MigrationInterface, QueryRunner } from "typeorm";
2
+
3
+ /*
4
+ * Resource AI agents: OneUptime AI access to Docker and Podman hosts, Docker
5
+ * Swarm, Proxmox and Ceph clusters, VMware vCenters, database servers and
6
+ * hosts, through the AI agent installed next to each one — the same
7
+ * strategy as the Kubernetes AI agent, whose tables this does not touch.
8
+ *
9
+ * Schema only (generated):
10
+ * - ResourceAiAgent: one row per resource for its AI agent (its own
11
+ * identity, never a Runner). Polymorphic: keyed by (resourceType,
12
+ * resourceId) with NO foreign key on resourceId, which points into a
13
+ * different table for every resource type; unique per live resource;
14
+ * cascades with its project.
15
+ * - RunnerJob.targetResourceAiAgentId: the agent an AI resource command
16
+ * (step type ResourceCommand) is targeted at (SET NULL when the agent
17
+ * row goes), and RunnerJob.resourceType / resourceId: the resource it
18
+ * ran against, for the resource's AI page.
19
+ * - AutoRemediationSuggestion.resourceType / resourceId: the resource
20
+ * whose AI remediation mode produced a suggestion (no rule).
21
+ * - The AI access columns of DockerHost, PodmanHost, CephCluster,
22
+ * ProxmoxCluster, DockerSwarmCluster, VMwareVCenter, Host and
23
+ * DatabaseServer: isAiInvestigationEnabled (default false),
24
+ * aiRemediationMode (default Disabled), aiCommandAllowlist and the
25
+ * server-written aiAccessLastVerifiedAt, aiAccessLastError and
26
+ * aiAccessConfiguredAt.
27
+ *
28
+ * No data is rewritten: every existing resource starts with AI switched
29
+ * off, exactly like a new one. down() reverses the schema.
30
+ */
31
+ export class AddResourceAiAgents1796300000000 implements MigrationInterface {
32
+ public name: string = "AddResourceAiAgents1796300000000";
33
+
34
+ public async up(queryRunner: QueryRunner): Promise<void> {
35
+ await queryRunner.query(
36
+ `CREATE TABLE "ResourceAiAgent" ("_id" uuid NOT NULL DEFAULT uuid_generate_v4(), "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "deletedAt" TIMESTAMP WITH TIME ZONE, "version" integer NOT NULL, "projectId" uuid NOT NULL, "resourceType" character varying(100) NOT NULL, "resourceId" uuid NOT NULL, "resourceIdentifier" character varying(500), "keyHash" character varying(100), "agentVersion" character varying(100), "posture" jsonb, "lastAliveAt" TIMESTAMP WITH TIME ZONE, "connectionStatus" character varying(100) NOT NULL DEFAULT 'disconnected', "lastRegisteredAt" TIMESTAMP WITH TIME ZONE, "registeredWithIngestionKeyId" uuid, "lastRefusedRegistrationAt" TIMESTAMP WITH TIME ZONE, "lastRefusedRegistrationReason" character varying(100), CONSTRAINT "PK_b24310cc7f12a4385d678d49eea" PRIMARY KEY ("_id"))`,
37
+ );
38
+ await queryRunner.query(
39
+ `CREATE INDEX "IDX_e61bd0e258b87311cc21cbaa95" ON "ResourceAiAgent" ("projectId") `,
40
+ );
41
+ await queryRunner.query(
42
+ `CREATE INDEX "IDX_06d7eb39aceb586c3c5565882b" ON "ResourceAiAgent" ("resourceType") `,
43
+ );
44
+ await queryRunner.query(
45
+ `CREATE INDEX "IDX_b5a1c152c918d42ef96c6a9a1c" ON "ResourceAiAgent" ("resourceId") `,
46
+ );
47
+ await queryRunner.query(
48
+ `CREATE UNIQUE INDEX "IDX_ResourceAiAgent_projectId_resourceType_resourceId" ON "ResourceAiAgent" ("projectId", "resourceType", "resourceId") WHERE "deletedAt" IS NULL`,
49
+ );
50
+ await queryRunner.query(
51
+ `ALTER TABLE "DockerHost" ADD "isAiInvestigationEnabled" boolean NOT NULL DEFAULT false`,
52
+ );
53
+ await queryRunner.query(
54
+ `ALTER TABLE "DockerHost" ADD "aiRemediationMode" character varying(100) NOT NULL DEFAULT 'Disabled'`,
55
+ );
56
+ await queryRunner.query(
57
+ `ALTER TABLE "DockerHost" ADD "aiCommandAllowlist" jsonb`,
58
+ );
59
+ await queryRunner.query(
60
+ `ALTER TABLE "DockerHost" ADD "aiAccessLastVerifiedAt" TIMESTAMP WITH TIME ZONE`,
61
+ );
62
+ await queryRunner.query(
63
+ `ALTER TABLE "DockerHost" ADD "aiAccessLastError" character varying`,
64
+ );
65
+ await queryRunner.query(
66
+ `ALTER TABLE "DockerHost" ADD "aiAccessConfiguredAt" TIMESTAMP WITH TIME ZONE`,
67
+ );
68
+ await queryRunner.query(
69
+ `ALTER TABLE "PodmanHost" ADD "isAiInvestigationEnabled" boolean NOT NULL DEFAULT false`,
70
+ );
71
+ await queryRunner.query(
72
+ `ALTER TABLE "PodmanHost" ADD "aiRemediationMode" character varying(100) NOT NULL DEFAULT 'Disabled'`,
73
+ );
74
+ await queryRunner.query(
75
+ `ALTER TABLE "PodmanHost" ADD "aiCommandAllowlist" jsonb`,
76
+ );
77
+ await queryRunner.query(
78
+ `ALTER TABLE "PodmanHost" ADD "aiAccessLastVerifiedAt" TIMESTAMP WITH TIME ZONE`,
79
+ );
80
+ await queryRunner.query(
81
+ `ALTER TABLE "PodmanHost" ADD "aiAccessLastError" character varying`,
82
+ );
83
+ await queryRunner.query(
84
+ `ALTER TABLE "PodmanHost" ADD "aiAccessConfiguredAt" TIMESTAMP WITH TIME ZONE`,
85
+ );
86
+ await queryRunner.query(
87
+ `ALTER TABLE "CephCluster" ADD "isAiInvestigationEnabled" boolean NOT NULL DEFAULT false`,
88
+ );
89
+ await queryRunner.query(
90
+ `ALTER TABLE "CephCluster" ADD "aiRemediationMode" character varying(100) NOT NULL DEFAULT 'Disabled'`,
91
+ );
92
+ await queryRunner.query(
93
+ `ALTER TABLE "CephCluster" ADD "aiCommandAllowlist" jsonb`,
94
+ );
95
+ await queryRunner.query(
96
+ `ALTER TABLE "CephCluster" ADD "aiAccessLastVerifiedAt" TIMESTAMP WITH TIME ZONE`,
97
+ );
98
+ await queryRunner.query(
99
+ `ALTER TABLE "CephCluster" ADD "aiAccessLastError" character varying`,
100
+ );
101
+ await queryRunner.query(
102
+ `ALTER TABLE "CephCluster" ADD "aiAccessConfiguredAt" TIMESTAMP WITH TIME ZONE`,
103
+ );
104
+ await queryRunner.query(
105
+ `ALTER TABLE "ProxmoxCluster" ADD "isAiInvestigationEnabled" boolean NOT NULL DEFAULT false`,
106
+ );
107
+ await queryRunner.query(
108
+ `ALTER TABLE "ProxmoxCluster" ADD "aiRemediationMode" character varying(100) NOT NULL DEFAULT 'Disabled'`,
109
+ );
110
+ await queryRunner.query(
111
+ `ALTER TABLE "ProxmoxCluster" ADD "aiCommandAllowlist" jsonb`,
112
+ );
113
+ await queryRunner.query(
114
+ `ALTER TABLE "ProxmoxCluster" ADD "aiAccessLastVerifiedAt" TIMESTAMP WITH TIME ZONE`,
115
+ );
116
+ await queryRunner.query(
117
+ `ALTER TABLE "ProxmoxCluster" ADD "aiAccessLastError" character varying`,
118
+ );
119
+ await queryRunner.query(
120
+ `ALTER TABLE "ProxmoxCluster" ADD "aiAccessConfiguredAt" TIMESTAMP WITH TIME ZONE`,
121
+ );
122
+ await queryRunner.query(
123
+ `ALTER TABLE "DockerSwarmCluster" ADD "isAiInvestigationEnabled" boolean NOT NULL DEFAULT false`,
124
+ );
125
+ await queryRunner.query(
126
+ `ALTER TABLE "DockerSwarmCluster" ADD "aiRemediationMode" character varying(100) NOT NULL DEFAULT 'Disabled'`,
127
+ );
128
+ await queryRunner.query(
129
+ `ALTER TABLE "DockerSwarmCluster" ADD "aiCommandAllowlist" jsonb`,
130
+ );
131
+ await queryRunner.query(
132
+ `ALTER TABLE "DockerSwarmCluster" ADD "aiAccessLastVerifiedAt" TIMESTAMP WITH TIME ZONE`,
133
+ );
134
+ await queryRunner.query(
135
+ `ALTER TABLE "DockerSwarmCluster" ADD "aiAccessLastError" character varying`,
136
+ );
137
+ await queryRunner.query(
138
+ `ALTER TABLE "DockerSwarmCluster" ADD "aiAccessConfiguredAt" TIMESTAMP WITH TIME ZONE`,
139
+ );
140
+ await queryRunner.query(
141
+ `ALTER TABLE "VMwareVCenter" ADD "isAiInvestigationEnabled" boolean NOT NULL DEFAULT false`,
142
+ );
143
+ await queryRunner.query(
144
+ `ALTER TABLE "VMwareVCenter" ADD "aiRemediationMode" character varying(100) NOT NULL DEFAULT 'Disabled'`,
145
+ );
146
+ await queryRunner.query(
147
+ `ALTER TABLE "VMwareVCenter" ADD "aiCommandAllowlist" jsonb`,
148
+ );
149
+ await queryRunner.query(
150
+ `ALTER TABLE "VMwareVCenter" ADD "aiAccessLastVerifiedAt" TIMESTAMP WITH TIME ZONE`,
151
+ );
152
+ await queryRunner.query(
153
+ `ALTER TABLE "VMwareVCenter" ADD "aiAccessLastError" character varying`,
154
+ );
155
+ await queryRunner.query(
156
+ `ALTER TABLE "VMwareVCenter" ADD "aiAccessConfiguredAt" TIMESTAMP WITH TIME ZONE`,
157
+ );
158
+ await queryRunner.query(
159
+ `ALTER TABLE "Host" ADD "isAiInvestigationEnabled" boolean NOT NULL DEFAULT false`,
160
+ );
161
+ await queryRunner.query(
162
+ `ALTER TABLE "Host" ADD "aiRemediationMode" character varying(100) NOT NULL DEFAULT 'Disabled'`,
163
+ );
164
+ await queryRunner.query(
165
+ `ALTER TABLE "Host" ADD "aiCommandAllowlist" jsonb`,
166
+ );
167
+ await queryRunner.query(
168
+ `ALTER TABLE "Host" ADD "aiAccessLastVerifiedAt" TIMESTAMP WITH TIME ZONE`,
169
+ );
170
+ await queryRunner.query(
171
+ `ALTER TABLE "Host" ADD "aiAccessLastError" character varying`,
172
+ );
173
+ await queryRunner.query(
174
+ `ALTER TABLE "Host" ADD "aiAccessConfiguredAt" TIMESTAMP WITH TIME ZONE`,
175
+ );
176
+ await queryRunner.query(
177
+ `ALTER TABLE "DatabaseServer" ADD "isAiInvestigationEnabled" boolean NOT NULL DEFAULT false`,
178
+ );
179
+ await queryRunner.query(
180
+ `ALTER TABLE "DatabaseServer" ADD "aiRemediationMode" character varying(100) NOT NULL DEFAULT 'Disabled'`,
181
+ );
182
+ await queryRunner.query(
183
+ `ALTER TABLE "DatabaseServer" ADD "aiCommandAllowlist" jsonb`,
184
+ );
185
+ await queryRunner.query(
186
+ `ALTER TABLE "DatabaseServer" ADD "aiAccessLastVerifiedAt" TIMESTAMP WITH TIME ZONE`,
187
+ );
188
+ await queryRunner.query(
189
+ `ALTER TABLE "DatabaseServer" ADD "aiAccessLastError" character varying`,
190
+ );
191
+ await queryRunner.query(
192
+ `ALTER TABLE "DatabaseServer" ADD "aiAccessConfiguredAt" TIMESTAMP WITH TIME ZONE`,
193
+ );
194
+ await queryRunner.query(
195
+ `ALTER TABLE "RunnerJob" ADD "resourceType" character varying(100)`,
196
+ );
197
+ await queryRunner.query(`ALTER TABLE "RunnerJob" ADD "resourceId" uuid`);
198
+ await queryRunner.query(
199
+ `ALTER TABLE "RunnerJob" ADD "targetResourceAiAgentId" uuid`,
200
+ );
201
+ await queryRunner.query(
202
+ `ALTER TABLE "AutoRemediationSuggestion" ADD "resourceType" character varying(100)`,
203
+ );
204
+ await queryRunner.query(
205
+ `ALTER TABLE "AutoRemediationSuggestion" ADD "resourceId" uuid`,
206
+ );
207
+ await queryRunner.query(
208
+ `CREATE INDEX "IDX_78a02785a95c03f9c7d542f21d" ON "RunnerJob" ("resourceType") `,
209
+ );
210
+ await queryRunner.query(
211
+ `CREATE INDEX "IDX_223854e59d60c3d9ece3cce60a" ON "RunnerJob" ("resourceId") `,
212
+ );
213
+ await queryRunner.query(
214
+ `CREATE INDEX "IDX_82b8db95070bbd7b3bbe3fb850" ON "RunnerJob" ("targetResourceAiAgentId") `,
215
+ );
216
+ await queryRunner.query(
217
+ `CREATE INDEX "IDX_ebdb04eb0e2b9cbdc7d0b664ff" ON "AutoRemediationSuggestion" ("resourceType") `,
218
+ );
219
+ await queryRunner.query(
220
+ `CREATE INDEX "IDX_2ecbd56658be5035f3bdfe6937" ON "AutoRemediationSuggestion" ("resourceId") `,
221
+ );
222
+ await queryRunner.query(
223
+ `ALTER TABLE "ResourceAiAgent" ADD CONSTRAINT "FK_e61bd0e258b87311cc21cbaa95b" FOREIGN KEY ("projectId") REFERENCES "Project"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
224
+ );
225
+ await queryRunner.query(
226
+ `ALTER TABLE "RunnerJob" ADD CONSTRAINT "FK_82b8db95070bbd7b3bbe3fb8509" FOREIGN KEY ("targetResourceAiAgentId") REFERENCES "ResourceAiAgent"("_id") ON DELETE SET NULL ON UPDATE NO ACTION`,
227
+ );
228
+ }
229
+
230
+ public async down(queryRunner: QueryRunner): Promise<void> {
231
+ await queryRunner.query(
232
+ `ALTER TABLE "RunnerJob" DROP CONSTRAINT "FK_82b8db95070bbd7b3bbe3fb8509"`,
233
+ );
234
+ await queryRunner.query(
235
+ `ALTER TABLE "ResourceAiAgent" DROP CONSTRAINT "FK_e61bd0e258b87311cc21cbaa95b"`,
236
+ );
237
+ await queryRunner.query(
238
+ `DROP INDEX "public"."IDX_2ecbd56658be5035f3bdfe6937"`,
239
+ );
240
+ await queryRunner.query(
241
+ `DROP INDEX "public"."IDX_ebdb04eb0e2b9cbdc7d0b664ff"`,
242
+ );
243
+ await queryRunner.query(
244
+ `DROP INDEX "public"."IDX_82b8db95070bbd7b3bbe3fb850"`,
245
+ );
246
+ await queryRunner.query(
247
+ `DROP INDEX "public"."IDX_223854e59d60c3d9ece3cce60a"`,
248
+ );
249
+ await queryRunner.query(
250
+ `DROP INDEX "public"."IDX_78a02785a95c03f9c7d542f21d"`,
251
+ );
252
+ await queryRunner.query(
253
+ `ALTER TABLE "AutoRemediationSuggestion" DROP COLUMN "resourceId"`,
254
+ );
255
+ await queryRunner.query(
256
+ `ALTER TABLE "AutoRemediationSuggestion" DROP COLUMN "resourceType"`,
257
+ );
258
+ await queryRunner.query(
259
+ `ALTER TABLE "RunnerJob" DROP COLUMN "targetResourceAiAgentId"`,
260
+ );
261
+ await queryRunner.query(`ALTER TABLE "RunnerJob" DROP COLUMN "resourceId"`);
262
+ await queryRunner.query(
263
+ `ALTER TABLE "RunnerJob" DROP COLUMN "resourceType"`,
264
+ );
265
+ await queryRunner.query(
266
+ `ALTER TABLE "DatabaseServer" DROP COLUMN "aiAccessConfiguredAt"`,
267
+ );
268
+ await queryRunner.query(
269
+ `ALTER TABLE "DatabaseServer" DROP COLUMN "aiAccessLastError"`,
270
+ );
271
+ await queryRunner.query(
272
+ `ALTER TABLE "DatabaseServer" DROP COLUMN "aiAccessLastVerifiedAt"`,
273
+ );
274
+ await queryRunner.query(
275
+ `ALTER TABLE "DatabaseServer" DROP COLUMN "aiCommandAllowlist"`,
276
+ );
277
+ await queryRunner.query(
278
+ `ALTER TABLE "DatabaseServer" DROP COLUMN "aiRemediationMode"`,
279
+ );
280
+ await queryRunner.query(
281
+ `ALTER TABLE "DatabaseServer" DROP COLUMN "isAiInvestigationEnabled"`,
282
+ );
283
+ await queryRunner.query(
284
+ `ALTER TABLE "Host" DROP COLUMN "aiAccessConfiguredAt"`,
285
+ );
286
+ await queryRunner.query(
287
+ `ALTER TABLE "Host" DROP COLUMN "aiAccessLastError"`,
288
+ );
289
+ await queryRunner.query(
290
+ `ALTER TABLE "Host" DROP COLUMN "aiAccessLastVerifiedAt"`,
291
+ );
292
+ await queryRunner.query(
293
+ `ALTER TABLE "Host" DROP COLUMN "aiCommandAllowlist"`,
294
+ );
295
+ await queryRunner.query(
296
+ `ALTER TABLE "Host" DROP COLUMN "aiRemediationMode"`,
297
+ );
298
+ await queryRunner.query(
299
+ `ALTER TABLE "Host" DROP COLUMN "isAiInvestigationEnabled"`,
300
+ );
301
+ await queryRunner.query(
302
+ `ALTER TABLE "VMwareVCenter" DROP COLUMN "aiAccessConfiguredAt"`,
303
+ );
304
+ await queryRunner.query(
305
+ `ALTER TABLE "VMwareVCenter" DROP COLUMN "aiAccessLastError"`,
306
+ );
307
+ await queryRunner.query(
308
+ `ALTER TABLE "VMwareVCenter" DROP COLUMN "aiAccessLastVerifiedAt"`,
309
+ );
310
+ await queryRunner.query(
311
+ `ALTER TABLE "VMwareVCenter" DROP COLUMN "aiCommandAllowlist"`,
312
+ );
313
+ await queryRunner.query(
314
+ `ALTER TABLE "VMwareVCenter" DROP COLUMN "aiRemediationMode"`,
315
+ );
316
+ await queryRunner.query(
317
+ `ALTER TABLE "VMwareVCenter" DROP COLUMN "isAiInvestigationEnabled"`,
318
+ );
319
+ await queryRunner.query(
320
+ `ALTER TABLE "DockerSwarmCluster" DROP COLUMN "aiAccessConfiguredAt"`,
321
+ );
322
+ await queryRunner.query(
323
+ `ALTER TABLE "DockerSwarmCluster" DROP COLUMN "aiAccessLastError"`,
324
+ );
325
+ await queryRunner.query(
326
+ `ALTER TABLE "DockerSwarmCluster" DROP COLUMN "aiAccessLastVerifiedAt"`,
327
+ );
328
+ await queryRunner.query(
329
+ `ALTER TABLE "DockerSwarmCluster" DROP COLUMN "aiCommandAllowlist"`,
330
+ );
331
+ await queryRunner.query(
332
+ `ALTER TABLE "DockerSwarmCluster" DROP COLUMN "aiRemediationMode"`,
333
+ );
334
+ await queryRunner.query(
335
+ `ALTER TABLE "DockerSwarmCluster" DROP COLUMN "isAiInvestigationEnabled"`,
336
+ );
337
+ await queryRunner.query(
338
+ `ALTER TABLE "ProxmoxCluster" DROP COLUMN "aiAccessConfiguredAt"`,
339
+ );
340
+ await queryRunner.query(
341
+ `ALTER TABLE "ProxmoxCluster" DROP COLUMN "aiAccessLastError"`,
342
+ );
343
+ await queryRunner.query(
344
+ `ALTER TABLE "ProxmoxCluster" DROP COLUMN "aiAccessLastVerifiedAt"`,
345
+ );
346
+ await queryRunner.query(
347
+ `ALTER TABLE "ProxmoxCluster" DROP COLUMN "aiCommandAllowlist"`,
348
+ );
349
+ await queryRunner.query(
350
+ `ALTER TABLE "ProxmoxCluster" DROP COLUMN "aiRemediationMode"`,
351
+ );
352
+ await queryRunner.query(
353
+ `ALTER TABLE "ProxmoxCluster" DROP COLUMN "isAiInvestigationEnabled"`,
354
+ );
355
+ await queryRunner.query(
356
+ `ALTER TABLE "CephCluster" DROP COLUMN "aiAccessConfiguredAt"`,
357
+ );
358
+ await queryRunner.query(
359
+ `ALTER TABLE "CephCluster" DROP COLUMN "aiAccessLastError"`,
360
+ );
361
+ await queryRunner.query(
362
+ `ALTER TABLE "CephCluster" DROP COLUMN "aiAccessLastVerifiedAt"`,
363
+ );
364
+ await queryRunner.query(
365
+ `ALTER TABLE "CephCluster" DROP COLUMN "aiCommandAllowlist"`,
366
+ );
367
+ await queryRunner.query(
368
+ `ALTER TABLE "CephCluster" DROP COLUMN "aiRemediationMode"`,
369
+ );
370
+ await queryRunner.query(
371
+ `ALTER TABLE "CephCluster" DROP COLUMN "isAiInvestigationEnabled"`,
372
+ );
373
+ await queryRunner.query(
374
+ `ALTER TABLE "PodmanHost" DROP COLUMN "aiAccessConfiguredAt"`,
375
+ );
376
+ await queryRunner.query(
377
+ `ALTER TABLE "PodmanHost" DROP COLUMN "aiAccessLastError"`,
378
+ );
379
+ await queryRunner.query(
380
+ `ALTER TABLE "PodmanHost" DROP COLUMN "aiAccessLastVerifiedAt"`,
381
+ );
382
+ await queryRunner.query(
383
+ `ALTER TABLE "PodmanHost" DROP COLUMN "aiCommandAllowlist"`,
384
+ );
385
+ await queryRunner.query(
386
+ `ALTER TABLE "PodmanHost" DROP COLUMN "aiRemediationMode"`,
387
+ );
388
+ await queryRunner.query(
389
+ `ALTER TABLE "PodmanHost" DROP COLUMN "isAiInvestigationEnabled"`,
390
+ );
391
+ await queryRunner.query(
392
+ `ALTER TABLE "DockerHost" DROP COLUMN "aiAccessConfiguredAt"`,
393
+ );
394
+ await queryRunner.query(
395
+ `ALTER TABLE "DockerHost" DROP COLUMN "aiAccessLastError"`,
396
+ );
397
+ await queryRunner.query(
398
+ `ALTER TABLE "DockerHost" DROP COLUMN "aiAccessLastVerifiedAt"`,
399
+ );
400
+ await queryRunner.query(
401
+ `ALTER TABLE "DockerHost" DROP COLUMN "aiCommandAllowlist"`,
402
+ );
403
+ await queryRunner.query(
404
+ `ALTER TABLE "DockerHost" DROP COLUMN "aiRemediationMode"`,
405
+ );
406
+ await queryRunner.query(
407
+ `ALTER TABLE "DockerHost" DROP COLUMN "isAiInvestigationEnabled"`,
408
+ );
409
+ await queryRunner.query(
410
+ `DROP INDEX "public"."IDX_ResourceAiAgent_projectId_resourceType_resourceId"`,
411
+ );
412
+ await queryRunner.query(
413
+ `DROP INDEX "public"."IDX_b5a1c152c918d42ef96c6a9a1c"`,
414
+ );
415
+ await queryRunner.query(
416
+ `DROP INDEX "public"."IDX_06d7eb39aceb586c3c5565882b"`,
417
+ );
418
+ await queryRunner.query(
419
+ `DROP INDEX "public"."IDX_e61bd0e258b87311cc21cbaa95"`,
420
+ );
421
+ await queryRunner.query(`DROP TABLE "ResourceAiAgent"`);
422
+ }
423
+ }
@@ -23,6 +23,7 @@ import { AddSubscriberNotificationClaimedAt1795900000000 } from "./1795900000000
23
23
  import { AddTeamComplianceRuleScope1796000000000 } from "./1796000000000-AddTeamComplianceRuleScope";
24
24
  import { AddKubernetesAiAgentAndAiDefaults1796100000000 } from "./1796100000000-AddKubernetesAiAgentAndAiDefaults";
25
25
  import { AddProxmoxResourceNativePushColumns1796200000000 } from "./1796200000000-AddProxmoxResourceNativePushColumns";
26
+ import { AddResourceAiAgents1796300000000 } from "./1796300000000-AddResourceAiAgents";
26
27
  import { AddConfigurableRuleCriteria1792500000000 } from "./1792500000000-AddConfigurableRuleCriteria";
27
28
  import { AddGoogleSecOpsDiagnostics1792300000000 } from "./1792300000000-AddGoogleSecOpsDiagnostics";
28
29
  import { AddIncomingCallPolicyPhoneNumbers1792600000000 } from "./1792600000000-AddIncomingCallPolicyPhoneNumbers";
@@ -1246,4 +1247,5 @@ export default [
1246
1247
  AddTeamComplianceRuleScope1796000000000,
1247
1248
  AddKubernetesAiAgentAndAiDefaults1796100000000,
1248
1249
  AddProxmoxResourceNativePushColumns1796200000000,
1250
+ AddResourceAiAgents1796300000000,
1249
1251
  ];
@@ -21,6 +21,20 @@ export default class Semaphore {
21
21
  acquireTimeout?: number | undefined;
22
22
  acquireAttemptsLimit?: number | undefined;
23
23
  retryInterval?: number | undefined;
24
+ /*
25
+ * How often a held lock is re-asserted. redis-semaphore defaults to 80%
26
+ * of lockTimeout, which is also how long `mutex.isAcquired` can go on
27
+ * reading true after the lock was lost (a Valkey restart, an eviction):
28
+ * it only changes when a refresh fails. A holder that polls isAcquired
29
+ * between steps wants this well under lockTimeout.
30
+ */
31
+ refreshInterval?: number | undefined;
32
+ /*
33
+ * Called when a refresh finds the lock gone. By default redis-semaphore
34
+ * throws from its refresh timer, which nothing can catch and which ends
35
+ * up as an unhandled rejection; a long-running holder should pass one.
36
+ */
37
+ onLockLost?: ((err: Error) => void) | undefined;
24
38
  }): Promise<SemaphoreMutex> {
25
39
  if (!data.lockTimeout) {
26
40
  data.lockTimeout = 5000;
@@ -52,6 +66,14 @@ export default class Semaphore {
52
66
  lockOptions.retryInterval = data.retryInterval;
53
67
  }
54
68
 
69
+ if (data.refreshInterval) {
70
+ lockOptions.refreshInterval = data.refreshInterval;
71
+ }
72
+
73
+ if (data.onLockLost) {
74
+ lockOptions.onLockLost = data.onLockLost;
75
+ }
76
+
55
77
  const mutex: SemaphoreMutex = new Mutex(
56
78
  client,
57
79
  data.namespace + "-" + key,
@@ -74,8 +74,9 @@ const UNNAMED_SURFACE_READABLE_NAME: string = "this ingest endpoint";
74
74
 
75
75
  /*
76
76
  * The ceiling a server key gets on an identity registration surface
77
- * (IDENTITY_REGISTRATION_SURFACES: the Kubernetes agent Runner and the
78
- * Kubernetes AI agent) when its policy names none. Registration is a handful
77
+ * (IDENTITY_REGISTRATION_SURFACES: the Kubernetes agent Runner, the
78
+ * Kubernetes AI agent and the resource AI agents) when its policy names
79
+ * none. Registration is a handful
79
80
  * of calls per pod lifetime (start-up, then heartbeats through the minted
80
81
  * identity's own key), so a leaked ingestion key hammering it is abuse, not
81
82
  * traffic - unlike OTLP ingest, where "no limit" is the historical contract
@@ -90,11 +91,19 @@ export const DEFAULT_KUBERNETES_AGENT_RUNNER_REQUESTS_PER_MINUTE: number =
90
91
  /*
91
92
  * The refusal a service-pinned key gets on an identity registration surface.
92
93
  * Worded for whichever identity the surface mints, and it never names the
93
- * key, its pinned service or anything else about it.
94
+ * key, its pinned service or anything else about it. The Kubernetes
95
+ * surfaces keep their wording exactly; a resource AI agent (Docker, Proxmox,
96
+ * a database, a host, ...) is told about infrastructure instead.
94
97
  */
95
98
  export const getPinnedKeyRegistrationRefusalMessage: (
96
99
  surface: TelemetryIngestSurface,
97
100
  ) => string = (surface: TelemetryIngestSurface): string => {
101
+ if (surface === TelemetryIngestSurface.ResourceAiAgent) {
102
+ return `This telemetry ingestion key is pinned to a single service, so it cannot be used for ${getIngestSurfaceReadableName(
103
+ surface,
104
+ )}: that grants access to your infrastructure, not to one service's telemetry. Use an unpinned server ingestion key for the AI agent.`;
105
+ }
106
+
98
107
  return `This telemetry ingestion key is pinned to a single service, so it cannot be used for ${getIngestSurfaceReadableName(
99
108
  surface,
100
109
  )}: that grants access to a Kubernetes cluster, not to one service's telemetry. Use an unpinned server ingestion key for the Kubernetes agent.`;
@@ -121,8 +130,9 @@ type GetEffectiveRequestsPerMinuteLimitFunction = (
121
130
  * did not configure a limit" cannot be allowed to mean "unlimited" there.
122
131
  *
123
132
  * The one surface-dependent case is identity registration
124
- * (IDENTITY_REGISTRATION_SURFACES: the Kubernetes agent Runner and the
125
- * Kubernetes AI agent): a server key with no configured limit is held to a
133
+ * (IDENTITY_REGISTRATION_SURFACES: the Kubernetes agent Runner, the
134
+ * Kubernetes AI agent and the resource AI agents): a server key with no
135
+ * configured limit is held to a
126
136
  * conservative default there (see
127
137
  * DEFAULT_IDENTITY_REGISTRATION_REQUESTS_PER_MINUTE), because those
128
138
  * endpoints mint identities rather than accepting telemetry. Every other
@@ -685,6 +685,16 @@ export default class AnalyticsDatabaseService<
685
685
  timestampColumnName: keyof TBaseModel | string;
686
686
  startDate: Date;
687
687
  endDate: Date;
688
+ /*
689
+ * Row names left out of the scan entirely, for a table where OneUptime
690
+ * writes its own rows under the same (primaryEntityId, primaryEntityType)
691
+ * as the customer's, so the grouping cannot tell them apart and the
692
+ * caller's entity-type exclusion cannot either - the session replay
693
+ * budget series sit next to a RUM application's web vitals (see
694
+ * TELEMETRY_BILLING_EXCLUDED_METRIC_NAMES). Empty or absent leaves the
695
+ * statement exactly as it was.
696
+ */
697
+ excludeNames?: Array<string> | undefined;
688
698
  }): Promise<
689
699
  Array<{
690
700
  primaryEntityId: string;
@@ -701,6 +711,24 @@ export default class AnalyticsDatabaseService<
701
711
  );
702
712
  }
703
713
 
714
+ const excludeNames: Array<string> = data.excludeNames || [];
715
+
716
+ /*
717
+ * Names can only be excluded from a table whose `name` is a required
718
+ * column. Without one ClickHouse fails on the unknown column mid-billing
719
+ * run; with a Nullable one (Span's), `NULL NOT IN (...)` is not true, so
720
+ * every unnamed row would silently drop out of the bill. Either way the
721
+ * caller has a bug, so refuse before the scan.
722
+ */
723
+ if (
724
+ excludeNames.length > 0 &&
725
+ !this.model.getTableColumn("name")?.required
726
+ ) {
727
+ throw new BadDataException(
728
+ `excludeNames needs a required name column, and ${this.model.tableName} has none`,
729
+ );
730
+ }
731
+
704
732
  if (!this.database) {
705
733
  this.useDefaultDatabase();
706
734
  }
@@ -716,7 +744,23 @@ export default class AnalyticsDatabaseService<
716
744
  }} AND ${timestampColumnName} <= ${{
717
745
  type: TableColumnType.DateTime64,
718
746
  value: data.endDate,
719
- }} GROUP BY primaryEntityId, primaryEntityType`;
747
+ }}`;
748
+
749
+ /*
750
+ * Inside the WHERE, before the grouping, so an excluded row is never
751
+ * counted or sized. The names travel as one Array(String) parameter,
752
+ * never as SQL text.
753
+ */
754
+ if (excludeNames.length > 0) {
755
+ statement.append(
756
+ SQL` AND name NOT IN ${{
757
+ type: TableColumnType.ArrayText,
758
+ value: excludeNames,
759
+ }}`,
760
+ );
761
+ }
762
+
763
+ statement.append(SQL` GROUP BY primaryEntityId, primaryEntityType`);
720
764
 
721
765
  /*
722
766
  * Billing scan: deliberately NO timeout_overflow_mode='break'. A