@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,640 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var __metadata = (this && this.__metadata) || function (k, v) {
8
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
+ };
10
+ import UserService from "../../../Services/UserService";
11
+ import QueryHelper from "../../../Types/Database/QueryHelper";
12
+ import logger from "../../Logger";
13
+ import { holdsAnyPermission } from "../../Runbook/RunbookExecutePermission";
14
+ import CaptureSpan from "../../Telemetry/CaptureSpan";
15
+ import { RESOURCE_AI_ACCESS_ADMIN_PERMISSIONS, RESOURCE_AI_ALLOWLIST_EXAMPLES, RESOURCE_AI_REMEDIATION_MODE_LABELS, getResourceAiAccessAdminRefusal, getResourceSentenceName, } from "../../../../Types/AI/ResourceAiAccessPermissions";
16
+ import { Gray500, Yellow500 } from "../../../../Types/BrandColors";
17
+ import LIMIT_MAX from "../../../../Types/Database/LimitMax";
18
+ import OneUptimeDate from "../../../../Types/Date";
19
+ import BadDataException from "../../../../Types/Exception/BadDataException";
20
+ import NotAuthorizedException from "../../../../Types/Exception/NotAuthorizedException";
21
+ import { AI_RESOURCE_TYPE_INFO, } from "../../../../Types/ResourceAiAgent/AiResourceType";
22
+ import { ResourceAiRemediationMode } from "../../../../Types/ResourceAiAgent/ResourceAiAccess";
23
+ import ResourceCommandPolicy, { RESOURCE_ALLOWLIST_MAX_PATTERNS, } from "../../../../Utils/AiRemediation/Resource/ResourceCommandPolicy";
24
+ /*
25
+ * The rules for an operator's write of a resource's OneUptime AI access
26
+ * settings — shared by every resource a resource AI agent serves (Docker,
27
+ * Podman and Docker Swarm hosts, Proxmox clusters, VMware vCenters, Ceph
28
+ * clusters, database servers and hosts), whose services call it from their
29
+ * create and update hooks. The same rules KubernetesClusterService applies
30
+ * to a cluster (getAiAccessLoosening and friends), minus the Runner and
31
+ * credential bindings a resource AI agent never has:
32
+ *
33
+ * - validation: the remediation mode must be a ResourceAiRemediationMode
34
+ * value, and the command allowlist a list of at most
35
+ * RESOURCE_ALLOWLIST_MAX_PATTERNS entries that
36
+ * ResourceCommandPolicy.describeAllowlistPatternProblem accepts for the
37
+ * resource's type (the ONE definition of a valid entry, which the matcher
38
+ * and the dashboard share). Refused rather than stored: every reader fails
39
+ * safe on an unusable value, so storing one would answer an API or
40
+ * Terraform write with success for a setting that never takes effect;
41
+ * - who may make AI do MORE (any move of the mode up — Off to anything, up to
42
+ * Automatic or Bypass approval — or adding an allowlist pattern): the
43
+ * holders of RESOURCE_AI_ACCESS_ADMIN_PERMISSIONS, the people who may
44
+ * author a FullAuto auto-remediation rule. Making AI do less, and the
45
+ * investigation switch, stay open to every editor of the resource;
46
+ * - the aiAccess* columns (aiAccessConfiguredAt, aiAccessLastVerifiedAt,
47
+ * aiAccessLastError) are the server's own and refused on every write but
48
+ * the server's (root);
49
+ * - after an operator's write of any AI setting succeeded: the resource is
50
+ * marked AI-configured (aiAccessConfiguredAt, never cleared — a resource
51
+ * AI agent registering later then leaves every setting as chosen) and the
52
+ * change is recorded on the resource's feed.
53
+ *
54
+ * Root writes — an agent's first-connection defaults, the outcome
55
+ * bookkeeping after each command — are the server's own and are validated
56
+ * but never gated, marked or recorded here.
57
+ */
58
+ // Every AI access setting an operator can write (dashboard, API, Terraform).
59
+ export const RESOURCE_AI_ACCESS_SETTING_KEYS = [
60
+ "isAiInvestigationEnabled",
61
+ "aiRemediationMode",
62
+ "aiCommandAllowlist",
63
+ ];
64
+ // Written only by the server: refused on every write that is not root.
65
+ export const RESOURCE_AI_ACCESS_SERVER_ONLY_KEYS = [
66
+ "aiAccessConfiguredAt",
67
+ "aiAccessLastVerifiedAt",
68
+ "aiAccessLastError",
69
+ ];
70
+ /*
71
+ * How much each remediation mode lets OneUptime AI do without a human,
72
+ * least first. Automatic runs a strict subset of what Bypass approval runs
73
+ * (safe changes and allowlisted shapes, never an unlisted riskier change),
74
+ * so moving from Bypass approval to Automatic is a tightening.
75
+ */
76
+ export const RESOURCE_REMEDIATION_MODES_BY_AUTONOMY = [
77
+ ResourceAiRemediationMode.Disabled,
78
+ ResourceAiRemediationMode.RequireApproval,
79
+ ResourceAiRemediationMode.Automatic,
80
+ ResourceAiRemediationMode.BypassApproval,
81
+ ];
82
+ /*
83
+ * What a resource that was never AI-configured has: the column defaults
84
+ * (investigation off, remediation Disabled, no allowlist).
85
+ */
86
+ export const NEVER_CONFIGURED_RESOURCE_AI_ACCESS = {
87
+ isAiInvestigationEnabled: false,
88
+ aiRemediationMode: ResourceAiRemediationMode.Disabled,
89
+ aiCommandAllowlist: [],
90
+ };
91
+ // The columns the settings snapshot reads off a resource row.
92
+ const SETTINGS_SELECT = {
93
+ _id: true,
94
+ projectId: true,
95
+ isAiInvestigationEnabled: true,
96
+ aiRemediationMode: true,
97
+ aiCommandAllowlist: true,
98
+ };
99
+ // Undefined is an omitted property; null is an explicit clear, so a write.
100
+ function isAnyKeyWritten(data, keys) {
101
+ return keys.some((key) => {
102
+ return data[key] !== undefined;
103
+ });
104
+ }
105
+ function describePatternCount(count) {
106
+ if (count === 0) {
107
+ return "none";
108
+ }
109
+ return `${count} pattern${count === 1 ? "" : "s"}`;
110
+ }
111
+ function isSameAllowlist(left, right) {
112
+ return (left.length === right.length &&
113
+ left.every((pattern, index) => {
114
+ return pattern === right[index];
115
+ }));
116
+ }
117
+ export default class ResourceAiAccessSettings {
118
+ // Whether a write carries any AI access setting (null counts: it clears).
119
+ static isSettingWritten(data) {
120
+ return isAnyKeyWritten(data, RESOURCE_AI_ACCESS_SETTING_KEYS);
121
+ }
122
+ /*
123
+ * Why a write that is not the server's may not carry one of the aiAccess*
124
+ * columns, or null when it carries none. The column ACLs already refuse
125
+ * them to every role; this also covers the callers those checks let
126
+ * through (a master admin, an API that skips them), because a hand-set
127
+ * aiAccessConfiguredAt would make an agent skip its first-connection
128
+ * defaults and a hand-set "Last verified" would claim access nobody saw
129
+ * work.
130
+ */
131
+ static getServerOnlyColumnRefusal(data) {
132
+ const written = RESOURCE_AI_ACCESS_SERVER_ONLY_KEYS.filter((key) => {
133
+ return data[key] !== undefined;
134
+ });
135
+ if (written.length === 0) {
136
+ return null;
137
+ }
138
+ return `${written.join(", ")} ${written.length === 1 ? "is" : "are"} written by OneUptime itself and cannot be set through the API.`;
139
+ }
140
+ // A mode as the readers see it: anything unknown is Disabled.
141
+ static readStoredMode(value) {
142
+ return RESOURCE_REMEDIATION_MODES_BY_AUTONOMY.includes(value)
143
+ ? value
144
+ : ResourceAiRemediationMode.Disabled;
145
+ }
146
+ /*
147
+ * A stored allowlist as the readers see it: trimmed non-empty strings, a
148
+ * JSON-encoded array accepted, anything else empty.
149
+ */
150
+ static readStoredAllowlist(value) {
151
+ let raw = value;
152
+ if (typeof raw === "string") {
153
+ try {
154
+ raw = JSON.parse(raw);
155
+ }
156
+ catch (_a) {
157
+ raw = [value];
158
+ }
159
+ }
160
+ if (!Array.isArray(raw)) {
161
+ return [];
162
+ }
163
+ return raw
164
+ .filter((pattern) => {
165
+ return typeof pattern === "string" && pattern.trim().length > 0;
166
+ })
167
+ .map((pattern) => {
168
+ return pattern.trim();
169
+ });
170
+ }
171
+ static getAllowlistShapeHint(resourceType) {
172
+ var _a;
173
+ const programs = (((_a = AI_RESOURCE_TYPE_INFO[resourceType]) === null || _a === void 0 ? void 0 : _a.programs) || []).join(", ");
174
+ return `The AI command allowlist must be a JSON array of command patterns for this ${getResourceSentenceName(resourceType)}'s AI agent (${programs}), for example ["${RESOURCE_AI_ALLOWLIST_EXAMPLES[resourceType] || ""}"].`;
175
+ }
176
+ /*
177
+ * What an operator's allowlist write stores: null (no allowlist) or an
178
+ * array of trimmed patterns the matcher can actually use. Refused, with the
179
+ * entry and the rule it broke:
180
+ *
181
+ * - anything but an array (a JSON-encoded array in a string is accepted,
182
+ * the form the readers already understand, and stored as the array);
183
+ * - an entry that is not text;
184
+ * - more than RESOURCE_ALLOWLIST_MAX_PATTERNS entries — the matcher skips
185
+ * every pattern past that silently;
186
+ * - an entry ResourceCommandPolicy.describeAllowlistPatternProblem says
187
+ * can never pre-approve a change on this resource type (blank, too long,
188
+ * not one command, another program, a read, a Denied command, ...).
189
+ */
190
+ static normalizeAllowlistForWrite(data) {
191
+ let raw = data.value;
192
+ if (raw === null) {
193
+ return null;
194
+ }
195
+ if (typeof raw === "string") {
196
+ if (raw.trim().length === 0) {
197
+ return null;
198
+ }
199
+ try {
200
+ raw = JSON.parse(raw);
201
+ }
202
+ catch (_a) {
203
+ throw new BadDataException(ResourceAiAccessSettings.getAllowlistShapeHint(data.resourceType));
204
+ }
205
+ }
206
+ if (!Array.isArray(raw)) {
207
+ throw new BadDataException(ResourceAiAccessSettings.getAllowlistShapeHint(data.resourceType));
208
+ }
209
+ if (raw.length > RESOURCE_ALLOWLIST_MAX_PATTERNS) {
210
+ throw new BadDataException(`The AI command allowlist can hold at most ${RESOURCE_ALLOWLIST_MAX_PATTERNS} patterns (got ${raw.length}).`);
211
+ }
212
+ return raw.map((entry, index) => {
213
+ const position = `Pattern ${index + 1} of the AI command allowlist`;
214
+ if (typeof entry !== "string") {
215
+ throw new BadDataException(`${position} must be text (got ${entry === null ? "null" : typeof entry}). ${ResourceAiAccessSettings.getAllowlistShapeHint(data.resourceType)}`);
216
+ }
217
+ // Stored trimmed, so it is judged exactly as it will be read.
218
+ const pattern = entry.trim();
219
+ const problem = ResourceCommandPolicy.describeAllowlistPatternProblem({
220
+ resourceType: data.resourceType,
221
+ pattern,
222
+ });
223
+ if (problem) {
224
+ throw new BadDataException(`${position} cannot be used: ${problem.endsWith(".") ? problem : `${problem}.`} Patterns are compared with the command word by word; * stands for exactly one whole word.`);
225
+ }
226
+ return pattern;
227
+ });
228
+ }
229
+ /*
230
+ * Refuse an unknown mode and store the allowlist in the one shape its
231
+ * readers expect. Runs on every write, the server's included, and
232
+ * normalizes `data` in place.
233
+ */
234
+ static validateSettings(data) {
235
+ const mode = data.data["aiRemediationMode"];
236
+ if (mode !== undefined &&
237
+ !RESOURCE_REMEDIATION_MODES_BY_AUTONOMY.includes(mode)) {
238
+ throw new BadDataException(`AI remediation mode must be one of ${RESOURCE_REMEDIATION_MODES_BY_AUTONOMY.join(", ")} (got ${JSON.stringify(mode)}).`);
239
+ }
240
+ if (data.data["aiCommandAllowlist"] !== undefined) {
241
+ data.data["aiCommandAllowlist"] =
242
+ ResourceAiAccessSettings.normalizeAllowlistForWrite({
243
+ resourceType: data.resourceType,
244
+ value: data.data["aiCommandAllowlist"],
245
+ });
246
+ }
247
+ }
248
+ /*
249
+ * Does this write let AI do more on a resource whose settings are
250
+ * `current`? Only a real change counts: the AI agent page posts every
251
+ * field of its form, so an editor who only flips the investigation switch
252
+ * re-posts an unchanged mode and allowlist, and must not be refused for
253
+ * settings someone else chose.
254
+ *
255
+ * - mode: ANY move up — turning fixes on from Off (even to Ask for
256
+ * approval: that is the step that lets AI change the resource at all),
257
+ * or up to Automatic or Bypass approval. Moving down (Bypass approval ->
258
+ * Automatic, anything -> Off) tightens;
259
+ * - allowlist: adding a pattern the resource did not already have
260
+ * (removing patterns, or clearing the list, tightens).
261
+ *
262
+ * `data` has been through validateSettings, so the mode is a known value
263
+ * and the allowlist a trimmed array or null.
264
+ */
265
+ static getLoosening(data) {
266
+ let loosens = false;
267
+ const mode = data.data["aiRemediationMode"];
268
+ if (mode !== undefined &&
269
+ mode !== null &&
270
+ RESOURCE_REMEDIATION_MODES_BY_AUTONOMY.indexOf(ResourceAiAccessSettings.readStoredMode(mode)) >
271
+ RESOURCE_REMEDIATION_MODES_BY_AUTONOMY.indexOf(data.current.aiRemediationMode)) {
272
+ loosens = true;
273
+ }
274
+ if (data.data["aiCommandAllowlist"] !== undefined) {
275
+ const patterns = ResourceAiAccessSettings.readStoredAllowlist(data.data["aiCommandAllowlist"]);
276
+ if (patterns.some((pattern) => {
277
+ return !data.current.aiCommandAllowlist.includes(pattern);
278
+ })) {
279
+ loosens = true;
280
+ }
281
+ }
282
+ return { loosens };
283
+ }
284
+ /*
285
+ * Why this caller may not make this write, or null when they may. A
286
+ * resource's AI mode does the job of a FullAuto AutoRemediationRule with
287
+ * no rule row, so making AI do MORE takes the same permissions as
288
+ * authoring such a rule (RESOURCE_AI_ACCESS_ADMIN_PERMISSIONS). The
289
+ * column ACLs stay open to every editor of the resource on purpose: a
290
+ * column ACL cannot say "tightening is free", and turning AI remediation
291
+ * off must never need more than editing the resource.
292
+ *
293
+ * `current` holds the settings of every resource the write reaches, and
294
+ * the permission must be held in each one's own project. When it matched
295
+ * none, the write is judged against the never-configured defaults in the
296
+ * caller's tenant, so the answer does not depend on whether the id exists;
297
+ * with no project to check against at all it fails closed.
298
+ *
299
+ * Root and master admins are the caller's business (see checkUpdate).
300
+ */
301
+ static getLooseningRefusal(data) {
302
+ const baselines = data.current.length > 0
303
+ ? data.current
304
+ : [
305
+ Object.assign(Object.assign({}, NEVER_CONFIGURED_RESOURCE_AI_ACCESS), { projectId: data.props.tenantId }),
306
+ ];
307
+ for (const baseline of baselines) {
308
+ if (!ResourceAiAccessSettings.getLoosening({
309
+ data: data.data,
310
+ current: baseline,
311
+ }).loosens) {
312
+ continue;
313
+ }
314
+ if (!baseline.projectId ||
315
+ !holdsAnyPermission({
316
+ props: data.props,
317
+ projectId: baseline.projectId,
318
+ allowed: RESOURCE_AI_ACCESS_ADMIN_PERMISSIONS,
319
+ })) {
320
+ return getResourceAiAccessAdminRefusal(data.resourceType);
321
+ }
322
+ }
323
+ return null;
324
+ }
325
+ /*
326
+ * The whole update-hook rule, for a resource service's onBeforeUpdate:
327
+ * validate (every caller), refuse the server-only columns and gate a
328
+ * loosening (every caller but root; a master admin is not gated on who
329
+ * may loosen, as on a Kubernetes cluster). Returns the carry-forward for
330
+ * onUpdateSuccess — the settings as they stood — for an operator's write
331
+ * of an AI setting, else null.
332
+ */
333
+ static async checkUpdate(data) {
334
+ const updateData = (data.updateBy.data ||
335
+ {});
336
+ ResourceAiAccessSettings.validateSettings({
337
+ resourceType: data.resourceType,
338
+ data: updateData,
339
+ });
340
+ if (data.updateBy.props.isRoot) {
341
+ return null;
342
+ }
343
+ const serverOnlyRefusal = ResourceAiAccessSettings.getServerOnlyColumnRefusal(updateData);
344
+ if (serverOnlyRefusal) {
345
+ throw new NotAuthorizedException(serverOnlyRefusal);
346
+ }
347
+ if (!ResourceAiAccessSettings.isSettingWritten(updateData)) {
348
+ return null;
349
+ }
350
+ const previousResourceAiAccessSettings = await ResourceAiAccessSettings.readSettingsForUpdateQuery({
351
+ service: data.service,
352
+ updateBy: data.updateBy,
353
+ });
354
+ if (!data.updateBy.props.isMasterAdmin) {
355
+ const refusal = ResourceAiAccessSettings.getLooseningRefusal({
356
+ resourceType: data.resourceType,
357
+ data: updateData,
358
+ props: data.updateBy.props,
359
+ current: Object.values(previousResourceAiAccessSettings),
360
+ });
361
+ if (refusal) {
362
+ throw new NotAuthorizedException(refusal);
363
+ }
364
+ }
365
+ return {
366
+ resourceType: data.resourceType,
367
+ previousResourceAiAccessSettings,
368
+ };
369
+ }
370
+ /*
371
+ * The same rule for a resource service's onBeforeCreate, judged against
372
+ * the never-configured defaults a new resource starts from (as
373
+ * KubernetesClusterService.onBeforeCreate judges a new cluster): validate
374
+ * (every caller, root included), refuse the server-only columns (every
375
+ * caller but root — a master admin included, whom the create column ACLs
376
+ * never check) and gate a loosening (every caller but root and master
377
+ * admins). The create column ACLs of the AI columns are empty, so a
378
+ * user's create cannot carry them today and the gate is defence in depth.
379
+ * Normalizes the allowlist in `createBy.data` in place.
380
+ */
381
+ static checkCreate(data) {
382
+ const createData = (data.createBy.data ||
383
+ {});
384
+ const props = data.createBy.props;
385
+ ResourceAiAccessSettings.validateSettings({
386
+ resourceType: data.resourceType,
387
+ data: createData,
388
+ });
389
+ if (props.isRoot) {
390
+ return;
391
+ }
392
+ const serverOnlyRefusal = ResourceAiAccessSettings.getServerOnlyColumnRefusal(createData);
393
+ if (serverOnlyRefusal) {
394
+ throw new NotAuthorizedException(serverOnlyRefusal);
395
+ }
396
+ if (props.isMasterAdmin ||
397
+ !ResourceAiAccessSettings.isSettingWritten(createData)) {
398
+ return;
399
+ }
400
+ // The tenant column is stamped from props.tenantId before this hook.
401
+ const projectId = props.tenantId ||
402
+ createData["projectId"] ||
403
+ undefined;
404
+ const refusal = ResourceAiAccessSettings.getLooseningRefusal({
405
+ resourceType: data.resourceType,
406
+ data: createData,
407
+ props,
408
+ current: [Object.assign(Object.assign({}, NEVER_CONFIGURED_RESOURCE_AI_ACCESS), { projectId })],
409
+ });
410
+ if (refusal) {
411
+ throw new NotAuthorizedException(refusal);
412
+ }
413
+ }
414
+ /*
415
+ * The AI access settings of every resource an operator's update reaches,
416
+ * read before the write. onBeforeUpdate runs before the framework scopes
417
+ * the query to the caller's project, so scope it here: a caller must
418
+ * never learn anything about, or be judged against, another project's
419
+ * resource.
420
+ */
421
+ static async readSettingsForUpdateQuery(data) {
422
+ var _a, _b;
423
+ const rows = await data.service.findBy({
424
+ query: Object.assign(Object.assign({}, data.updateBy.query), (data.updateBy.props.tenantId
425
+ ? { projectId: data.updateBy.props.tenantId }
426
+ : {})),
427
+ select: SETTINGS_SELECT,
428
+ limit: LIMIT_MAX,
429
+ skip: 0,
430
+ props: {
431
+ isRoot: true,
432
+ },
433
+ });
434
+ const settings = {};
435
+ for (const row of rows) {
436
+ const record = row;
437
+ const resourceId = ((_a = row.id) === null || _a === void 0 ? void 0 : _a.toString()) || ((_b = row._id) === null || _b === void 0 ? void 0 : _b.toString());
438
+ if (!resourceId) {
439
+ continue;
440
+ }
441
+ settings[resourceId] = {
442
+ projectId: record["projectId"],
443
+ isAiInvestigationEnabled: record["isAiInvestigationEnabled"] === true,
444
+ aiRemediationMode: ResourceAiAccessSettings.readStoredMode(record["aiRemediationMode"]),
445
+ aiCommandAllowlist: ResourceAiAccessSettings.readStoredAllowlist(record["aiCommandAllowlist"]),
446
+ };
447
+ }
448
+ return settings;
449
+ }
450
+ static getWriteCarryForward(carryForward) {
451
+ if (carryForward &&
452
+ typeof carryForward === "object" &&
453
+ "previousResourceAiAccessSettings" in carryForward) {
454
+ return carryForward;
455
+ }
456
+ return null;
457
+ }
458
+ /*
459
+ * For a resource service's onUpdateSuccess: after an operator's write of
460
+ * an AI setting, record it on the resource's feed (fire and forget: the
461
+ * write has committed, so who changed what AI may do is recorded even
462
+ * when the marker write below fails) and mark each updated resource
463
+ * AI-configured (awaited: a registering agent reads the marker to tell an
464
+ * operator's "off" from a resource nobody ever configured, so a save that
465
+ * could not record it must not look like one that did).
466
+ *
467
+ * The service supplies its feed: how its resources are linked in
468
+ * markdown, and how an item is written (its own "updated" event type).
469
+ */
470
+ static async afterUpdate(data) {
471
+ const carryForward = ResourceAiAccessSettings.getWriteCarryForward(data.onUpdate.carryForward);
472
+ if (!carryForward || data.updatedItemIds.length === 0) {
473
+ return;
474
+ }
475
+ ResourceAiAccessSettings.writeSettingsChangedFeed({
476
+ service: data.service,
477
+ carryForward,
478
+ updateData: (data.onUpdate.updateBy.data || {}),
479
+ updatedByUserId: data.onUpdate.updateBy.props.userId || undefined,
480
+ updatedItemIds: data.updatedItemIds,
481
+ getResourceMarkdownLink: data.getResourceMarkdownLink,
482
+ createFeedItem: data.createFeedItem,
483
+ }).catch((error) => {
484
+ logger.error(error);
485
+ });
486
+ await ResourceAiAccessSettings.markConfigured({
487
+ service: data.service,
488
+ resourceIds: data.updatedItemIds,
489
+ });
490
+ }
491
+ /*
492
+ * Set aiAccessConfiguredAt on each resource that does not have it yet, and
493
+ * never touch one that does: the marker records when AI access was FIRST
494
+ * configured. A server-only column, so it is written here, as root, after
495
+ * the operator's own write succeeded, rather than slipped into that write.
496
+ */
497
+ static async markConfigured(data) {
498
+ if (data.resourceIds.length === 0) {
499
+ return;
500
+ }
501
+ await data.service.updateBy({
502
+ query: {
503
+ _id: QueryHelper.any(data.resourceIds),
504
+ aiAccessConfiguredAt: QueryHelper.isNull(),
505
+ },
506
+ data: {
507
+ aiAccessConfiguredAt: OneUptimeDate.getCurrentDate(),
508
+ },
509
+ limit: LIMIT_MAX,
510
+ skip: 0,
511
+ props: {
512
+ isRoot: true,
513
+ },
514
+ });
515
+ }
516
+ /*
517
+ * One line per AI access setting this write actually changed, old -> new.
518
+ * With no `previous` (the resource was not among those read before the
519
+ * write) every written setting is reported as set, without a "from".
520
+ */
521
+ static describeChanges(data) {
522
+ const changes = [];
523
+ const { updateData, previous } = data;
524
+ if (updateData["isAiInvestigationEnabled"] !== undefined) {
525
+ const isEnabled = updateData["isAiInvestigationEnabled"] === true;
526
+ if (!previous || previous.isAiInvestigationEnabled !== isEnabled) {
527
+ changes.push(`AI investigation with read-only commands turned **${isEnabled ? "on" : "off"}**`);
528
+ }
529
+ }
530
+ if (updateData["aiRemediationMode"] !== undefined) {
531
+ const mode = ResourceAiAccessSettings.readStoredMode(updateData["aiRemediationMode"]);
532
+ if (!previous) {
533
+ changes.push(`AI remediation set to **${RESOURCE_AI_REMEDIATION_MODE_LABELS[mode]}**`);
534
+ }
535
+ else if (previous.aiRemediationMode !== mode) {
536
+ changes.push(`AI remediation changed from **${RESOURCE_AI_REMEDIATION_MODE_LABELS[previous.aiRemediationMode]}** to **${RESOURCE_AI_REMEDIATION_MODE_LABELS[mode]}**`);
537
+ }
538
+ }
539
+ if (updateData["aiCommandAllowlist"] !== undefined) {
540
+ const patterns = ResourceAiAccessSettings.readStoredAllowlist(updateData["aiCommandAllowlist"]);
541
+ if (!previous ||
542
+ !isSameAllowlist(previous.aiCommandAllowlist, patterns)) {
543
+ changes.push(patterns.length === 0
544
+ ? "AI command allowlist cleared"
545
+ : `AI command allowlist changed to ${describePatternCount(patterns.length)}${previous
546
+ ? ` (was ${describePatternCount(previous.aiCommandAllowlist.length)})`
547
+ : ""}`);
548
+ }
549
+ }
550
+ return changes;
551
+ }
552
+ /*
553
+ * Who changed what OneUptime AI may do on a resource, and when. The
554
+ * generic "was updated" feed item only covers MEANINGFUL_UPDATE_COLUMNS
555
+ * (shared by every resource type and deliberately left alone), so
556
+ * without this an operator switching a production host to Bypass
557
+ * approval — or back off — left no trace.
558
+ *
559
+ * One item per resource that actually changed; a save that re-posts
560
+ * unchanged values (the AI page posts its whole form) records nothing.
561
+ * API-key and Terraform writes carry no user and are attributed to an API
562
+ * key rather than dropped.
563
+ */
564
+ static async writeSettingsChangedFeed(data) {
565
+ var _a;
566
+ for (const resourceId of data.updatedItemIds) {
567
+ const previous = data.carryForward.previousResourceAiAccessSettings[resourceId.toString()];
568
+ const changes = ResourceAiAccessSettings.describeChanges({
569
+ updateData: data.updateData,
570
+ previous,
571
+ });
572
+ if (changes.length === 0) {
573
+ continue;
574
+ }
575
+ const projectId = (previous === null || previous === void 0 ? void 0 : previous.projectId) ||
576
+ ((_a = ((await data.service.findOneById({
577
+ id: resourceId,
578
+ select: { projectId: true },
579
+ props: { isRoot: true },
580
+ })))) === null || _a === void 0 ? void 0 : _a["projectId"]);
581
+ if (!projectId) {
582
+ continue;
583
+ }
584
+ const userMarkdown = data.updatedByUserId
585
+ ? (await UserService.getUserMarkdownString({
586
+ userId: data.updatedByUserId,
587
+ projectId,
588
+ })) || "A user"
589
+ : "";
590
+ const actor = userMarkdown ? `**${userMarkdown}**` : "An API key";
591
+ /*
592
+ * Yellow when the change lets AI do more (the same test the permission
593
+ * check applies), grey when it tightens or only flips investigation.
594
+ */
595
+ const displayColor = ResourceAiAccessSettings.getLoosening({
596
+ data: data.updateData,
597
+ current: previous || NEVER_CONFIGURED_RESOURCE_AI_ACCESS,
598
+ }).loosens
599
+ ? Yellow500
600
+ : Gray500;
601
+ const moreInformation = [
602
+ `**Changed by**: ${userMarkdown || "An API key (no user)"}`,
603
+ ];
604
+ const allowlist = ResourceAiAccessSettings.readStoredAllowlist(data.updateData["aiCommandAllowlist"]);
605
+ if (data.updateData["aiCommandAllowlist"] !== undefined &&
606
+ allowlist.length > 0) {
607
+ moreInformation.push(`**AI command allowlist**:\n\n${allowlist
608
+ .map((pattern) => {
609
+ return `- \`${pattern.replace(/`/g, "'")}\``;
610
+ })
611
+ .join("\n")}`);
612
+ }
613
+ await data.createFeedItem({
614
+ resourceId,
615
+ projectId,
616
+ displayColor,
617
+ feedInfoInMarkdown: `🤖 ${actor} changed what OneUptime AI may do on ${await data.getResourceMarkdownLink(projectId, resourceId)}:\n\n${changes
618
+ .map((change) => {
619
+ return `- ${change}`;
620
+ })
621
+ .join("\n")}`,
622
+ moreInformationInMarkdown: moreInformation.join("\n\n"),
623
+ userId: data.updatedByUserId,
624
+ });
625
+ }
626
+ }
627
+ }
628
+ __decorate([
629
+ CaptureSpan(),
630
+ __metadata("design:type", Function),
631
+ __metadata("design:paramtypes", [Object]),
632
+ __metadata("design:returntype", Promise)
633
+ ], ResourceAiAccessSettings, "checkUpdate", null);
634
+ __decorate([
635
+ CaptureSpan(),
636
+ __metadata("design:type", Function),
637
+ __metadata("design:paramtypes", [Object]),
638
+ __metadata("design:returntype", Promise)
639
+ ], ResourceAiAccessSettings, "afterUpdate", null);
640
+ //# sourceMappingURL=ResourceAiAccessSettings.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ResourceAiAccessSettings.js","sourceRoot":"","sources":["../../../../../../Server/Utils/AI/ResourceAccess/ResourceAiAccessSettings.ts"],"names":[],"mappings":";;;;;;;;;AACA,OAAO,WAAW,MAAM,+BAA+B,CAAC;AAGxD,OAAO,WAAW,MAAM,qCAAqC,CAAC;AAE9D,OAAO,MAAM,MAAM,cAAc,CAAC;AAClC,OAAO,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAC;AAC5E,OAAO,WAAW,MAAM,6BAA6B,CAAC;AAEtD,OAAO,EACL,oCAAoC,EACpC,8BAA8B,EAC9B,mCAAmC,EACnC,+BAA+B,EAC/B,uBAAuB,GACxB,MAAM,kDAAkD,CAAC;AAE1D,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAEnE,OAAO,SAAS,MAAM,qCAAqC,CAAC;AAC5D,OAAO,aA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