@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.
- package/Models/DatabaseModels/AutoRemediationSuggestion.ts +60 -0
- package/Models/DatabaseModels/CephCluster.ts +213 -0
- package/Models/DatabaseModels/DatabaseServer.ts +213 -0
- package/Models/DatabaseModels/DockerHost.ts +213 -0
- package/Models/DatabaseModels/DockerSwarmCluster.ts +213 -0
- package/Models/DatabaseModels/GlobalConfig.ts +1 -1
- package/Models/DatabaseModels/Host.ts +213 -0
- package/Models/DatabaseModels/Index.ts +2 -0
- package/Models/DatabaseModels/PodmanHost.ts +213 -0
- package/Models/DatabaseModels/ProxmoxCluster.ts +213 -0
- package/Models/DatabaseModels/ResourceAiAgent.ts +419 -0
- package/Models/DatabaseModels/RunnerJob.ts +144 -0
- package/Models/DatabaseModels/VMwareVCenter.ts +213 -0
- package/Server/API/AutoRemediationAPI.ts +392 -1
- package/Server/API/ResourceAiAccessAPI.ts +1669 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1796300000000-AddResourceAiAgents.ts +423 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/Index.ts +2 -0
- package/Server/Infrastructure/Semaphore.ts +22 -0
- package/Server/Middleware/TelemetryIngest.ts +15 -5
- package/Server/Services/AnalyticsDatabaseService.ts +45 -1
- package/Server/Services/AutoRemediationRuleEngineService.ts +940 -112
- package/Server/Services/CephClusterService.ts +109 -1
- package/Server/Services/DatabaseServerService.ts +116 -1
- package/Server/Services/DockerHostService.ts +109 -1
- package/Server/Services/DockerSwarmClusterService.ts +113 -1
- package/Server/Services/HostService.ts +126 -4
- package/Server/Services/MetricRecordingRuleService.ts +47 -0
- package/Server/Services/PodmanHostService.ts +109 -1
- package/Server/Services/ProxmoxClusterService.ts +110 -1
- package/Server/Services/ResourceAiAccessService.ts +1439 -0
- package/Server/Services/ResourceAiAgentJobService.ts +202 -0
- package/Server/Services/ResourceAiAgentService.ts +2432 -0
- package/Server/Services/RunnerJobService.ts +611 -4
- package/Server/Services/TelemetryUsageBillingService.ts +28 -0
- package/Server/Services/TraceRecordingRuleService.ts +33 -0
- package/Server/Services/VMwareVCenterService.ts +110 -1
- package/Server/Utils/AI/Remediation/RemediationCommandTools.ts +1434 -32
- package/Server/Utils/AI/Remediation/RemediationExecutionRunner.ts +935 -21
- package/Server/Utils/AI/Remediation/RemediationPlanRunner.ts +25 -1
- package/Server/Utils/AI/ResourceAccess/InfrastructureInvestigationToolkit.ts +577 -0
- package/Server/Utils/AI/ResourceAccess/ResourceAccessContext.ts +271 -0
- package/Server/Utils/AI/ResourceAccess/ResourceAccessToolNames.ts +45 -0
- package/Server/Utils/AI/ResourceAccess/ResourceAiAccessSettings.ts +964 -0
- package/Server/Utils/AI/ResourceAccess/ResourceAiDeleteCleanup.ts +333 -0
- package/Server/Utils/AI/ResourceAccess/ResourceCommandJobRunner.ts +873 -0
- package/Server/Utils/AI/SRE/AIInvestigationEngine.ts +72 -2
- package/Server/Utils/AI/SRE/AlertInvestigationRunner.ts +72 -5
- package/Server/Utils/AI/SRE/IncidentInvestigationRunner.ts +72 -5
- package/Server/Utils/AutoRemediation/CommandPlanExecutor.ts +396 -13
- package/Server/Utils/AutoRemediation/RemediationVerifier.ts +35 -2
- package/Server/Utils/Database/ProjectScopedReferenceValidator.ts +9 -1
- package/Server/Utils/SessionReplay/SessionReplayBudgetMetrics.ts +920 -0
- package/Server/Utils/SessionReplay/SessionReplayUsage.ts +84 -6
- package/Server/Utils/Workspace/MicrosoftTeams/Actions/Alert.ts +35 -15
- package/Server/Utils/Workspace/MicrosoftTeams/Actions/AlertEpisode.ts +33 -15
- package/Server/Utils/Workspace/MicrosoftTeams/Actions/Auth.ts +21 -1
- package/Server/Utils/Workspace/MicrosoftTeams/Actions/Incident.ts +298 -224
- package/Server/Utils/Workspace/MicrosoftTeams/Actions/IncidentEpisode.ts +35 -15
- package/Server/Utils/Workspace/MicrosoftTeams/Actions/ScheduledMaintenance.ts +389 -175
- package/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeams.ts +366 -143
- package/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeamsActivityDeduplicator.ts +163 -0
- package/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeamsCardChoices.ts +396 -0
- package/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeamsCreateCommands.ts +418 -0
- package/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeamsMessageSize.ts +152 -0
- package/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeamsReplies.ts +251 -0
- package/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeamsTimezone.ts +214 -0
- package/Tests/App/Dashboard/ClusterAccessNotice.test.tsx +93 -0
- package/Tests/App/Dashboard/DatabaseDocumentationMarkdown.test.ts +18 -6
- package/Tests/App/Dashboard/InvestigationInfrastructureTools.test.tsx +506 -0
- package/Tests/App/Dashboard/RemediationSuggestionCardDescription.test.tsx +209 -0
- package/Tests/App/Dashboard/RemediationSuggestionCardResource.test.tsx +317 -0
- package/Tests/App/Dashboard/ResourceAiAccessSettingsUtil.test.ts +921 -0
- package/Tests/App/Dashboard/ResourceAiAgentInstall.test.ts +860 -0
- package/Tests/App/Dashboard/ResourceAiAgentPage.test.tsx +1721 -0
- package/Tests/App/Dashboard/ResourceAiAgentStatus.test.ts +1002 -0
- package/Tests/App/Dashboard/ResourceAiInsightsPage.test.tsx +931 -0
- package/Tests/App/Dashboard/ResourceAiNavigation.test.tsx +575 -0
- package/Tests/App/Dashboard/RunbookStepTypeMaps.test.ts +38 -7
- package/Tests/Models/DatabaseModels/DatabaseServerModels.test.ts +33 -1
- package/Tests/Models/DatabaseModels/ResourceAiAccessColumns.test.ts +738 -0
- package/Tests/Models/DatabaseModels/ResourceAiAgentModel.test.ts +842 -0
- package/Tests/Server/API/AutoRemediationApproveResourceRound.test.ts +835 -0
- package/Tests/Server/API/ResourceAiAccessAPI.test.ts +2730 -0
- package/Tests/Server/Infrastructure/Postgres/AddDatabaseServerTablesMigration.test.ts +60 -0
- package/Tests/Server/Infrastructure/Postgres/AddResourceAiAgentsMigration.test.ts +659 -0
- package/Tests/Server/Infrastructure/SemaphoreMutex.test.ts +31 -0
- package/Tests/Server/Middleware/TelemetryIngestBrowserKey.test.ts +63 -5
- package/Tests/Server/Middleware/TelemetryIngestKubernetesAgentRunnerPinnedKey.test.ts +103 -5
- package/Tests/Server/Middleware/TelemetryIngestKubernetesAgentRunnerRateLimit.test.ts +19 -1
- package/Tests/Server/Services/AutoRemediationResourceRuleEngine.test.ts +1279 -0
- package/Tests/Server/Services/DatabaseServerService.test.ts +55 -0
- package/Tests/Server/Services/GroupTelemetryUsageExcludeNames.test.ts +299 -0
- package/Tests/Server/Services/HostServiceFindOrCreateMemo.test.ts +44 -0
- package/Tests/Server/Services/MonitorProbeServiceIntervalScheduling.test.ts +45 -6
- package/Tests/Server/Services/RecordingRuleReservedMetricName.test.ts +171 -0
- package/Tests/Server/Services/ResourceAiAccessChangeAuthorization.test.ts +256 -0
- package/Tests/Server/Services/ResourceAiAccessService.test.ts +1373 -0
- package/Tests/Server/Services/ResourceAiAgentJobService.test.ts +375 -0
- package/Tests/Server/Services/ResourceAiAgentServiceHelpers.test.ts +1114 -0
- package/Tests/Server/Services/ResourceAiAgentServiceLifecycle.test.ts +1050 -0
- package/Tests/Server/Services/ResourceAiAgentServiceRegister.test.ts +2251 -0
- package/Tests/Server/Services/ResourceAiSettingsCreate.test.ts +373 -0
- package/Tests/Server/Services/ResourceAiSettingsPermission.test.ts +1042 -0
- package/Tests/Server/Services/ResourceServiceDeleteCleansUpAi.test.ts +319 -0
- package/Tests/Server/Services/RunnerJobEnqueueKubectl.test.ts +105 -0
- package/Tests/Server/Services/RunnerJobEnqueueResourceCommand.test.ts +986 -0
- package/Tests/Server/Services/RunnerJobResourceCommandLane.test.ts +211 -0
- package/Tests/Server/Services/RunnerJobResourceCommandTimeoutAndRedaction.test.ts +352 -0
- package/Tests/Server/Services/TelemetryUsageBillingSloExclusion.test.ts +218 -0
- package/Tests/Server/TestingUtils/Services/FakeRunnerJobCount.ts +145 -0
- package/Tests/Server/Utils/AI/InvestigationInfrastructureAccessWiring.test.ts +453 -0
- package/Tests/Server/Utils/AI/InvestigationInfrastructureReport.test.ts +721 -0
- package/Tests/Server/Utils/AI/RemediationCommandTools.test.ts +94 -1
- package/Tests/Server/Utils/AI/RemediationCommandToolsResource.test.ts +1530 -0
- package/Tests/Server/Utils/AI/RemediationExecutionRunnerResourceMode.test.ts +1249 -0
- package/Tests/Server/Utils/AI/RemediationPlanRunner.test.ts +117 -0
- package/Tests/Server/Utils/AI/RemediationResourceCopyParity.test.ts +463 -0
- package/Tests/Server/Utils/AI/ResourceAccess/InfrastructureInvestigationToolkit.test.ts +722 -0
- package/Tests/Server/Utils/AI/ResourceAccess/ResourceAccessContext.test.ts +266 -0
- package/Tests/Server/Utils/AI/ResourceAccess/ResourceAiAccessSettings.test.ts +1220 -0
- package/Tests/Server/Utils/AI/ResourceAccess/ResourceAiDeleteCleanup.test.ts +569 -0
- package/Tests/Server/Utils/AI/ResourceAccess/ResourceCommandJobRunner.test.ts +830 -0
- package/Tests/Server/Utils/AutoRemediation/CommandPlanExecutorResource.test.ts +717 -0
- package/Tests/Server/Utils/AutoRemediation/RemediationVerifierResourceFollowUp.test.ts +338 -0
- package/Tests/Server/Utils/Monitor/Criteria/SessionReplayBudgetTemplateCriteria.test.ts +422 -0
- package/Tests/Server/Utils/SessionReplay/SessionReplayBudgetMetrics.test.ts +1647 -0
- package/Tests/Server/Utils/SessionReplay/SessionReplayUsage.test.ts +143 -1
- package/Tests/Server/Utils/Telemetry/TelemetryIngestionKeyGuard.test.ts +33 -3
- package/Tests/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeamsAccountNotLinked.test.ts +1093 -0
- package/Tests/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeamsActivityDeduplicator.test.ts +1049 -0
- package/Tests/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeamsCardChoices.test.ts +1676 -0
- package/Tests/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeamsCreateCards.test.ts +2884 -0
- package/Tests/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeamsCreateCommands.test.ts +2490 -0
- package/Tests/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeamsCreateSubmit.test.ts +2293 -0
- package/Tests/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeamsCreateSubmitServerTimezone.test.ts +386 -0
- package/Tests/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeamsMessageSize.test.ts +1477 -0
- package/Tests/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeamsReplies.test.ts +1967 -0
- package/Tests/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeamsStripHtmlTags.test.ts +92 -0
- package/Tests/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeamsSubmittedFormRemoval.test.ts +1819 -0
- package/Tests/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeamsTimezone.test.ts +1033 -0
- package/Tests/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeamsTimezoneServerZone.test.ts +610 -0
- package/Tests/Server/Utils/Workspace/MicrosoftTeamsBotMessageHandling.test.ts +2610 -0
- package/Tests/Server/Utils/Workspace/MicrosoftTeamsCreateCommandsEndToEnd.test.ts +4672 -0
- package/Tests/Server/Utils/Workspace/WorkspaceCreateProjectReferences.test.ts +190 -65
- package/Tests/Types/AutoRemediation/AiRemediationCommandPlan.test.ts +10 -4
- package/Tests/Types/AutoRemediation/AiRemediationCommandPlanResourceCommand.test.ts +305 -0
- package/Tests/Types/Monitor/Recommendation/MonitorRecommendationCatalog.test.ts +277 -13
- package/Tests/Types/Monitor/Recommendation/MonitorRecommendationUtil.test.ts +113 -0
- package/Tests/Types/Monitor/RumAlertTemplates.test.ts +773 -2
- package/Tests/Types/ResourceAiAgent/AiResourceType.test.ts +419 -0
- package/Tests/Types/ResourceAiAgent/ResourceAiAccess.test.ts +517 -0
- package/Tests/Types/Runbook/RunbookStepType.test.ts +147 -8
- package/Tests/UI/Rum/RecordingHealthDashboard.test.tsx +769 -1
- package/Tests/Utils/AiRemediation/Resource/CephCommandPolicy.test.ts +1653 -0
- package/Tests/Utils/AiRemediation/Resource/CephOutputRedaction.test.ts +204 -0
- package/Tests/Utils/AiRemediation/Resource/DatabaseCommandPolicy.test.ts +1077 -0
- package/Tests/Utils/AiRemediation/Resource/DatabaseDiagnosticCatalog.test.ts +558 -0
- package/Tests/Utils/AiRemediation/Resource/DatabaseQueryRedactor.test.ts +834 -0
- package/Tests/Utils/AiRemediation/Resource/DockerCliGrammar.test.ts +747 -0
- package/Tests/Utils/AiRemediation/Resource/DockerEngineCommandPolicy.test.ts +1259 -0
- package/Tests/Utils/AiRemediation/Resource/DockerOutputRedaction.test.ts +386 -0
- package/Tests/Utils/AiRemediation/Resource/DockerSwarmCommandPolicy.test.ts +782 -0
- package/Tests/Utils/AiRemediation/Resource/GovcCommandPolicy.test.ts +2259 -0
- package/Tests/Utils/AiRemediation/Resource/HostCommandPolicy.test.ts +2019 -0
- package/Tests/Utils/AiRemediation/Resource/ProxmoxCommandPolicy.test.ts +2497 -0
- package/Tests/Utils/AiRemediation/Resource/ResourceCommandPolicy.test.ts +1305 -0
- package/Tests/Utils/AiRemediation/Resource/ResourceCommandPolicyCore.test.ts +585 -0
- package/Tests/Utils/AiRemediation/Resource/ResourceOutputRedactor.test.ts +334 -0
- package/Tests/Utils/AiRemediation/Resource/ResourceOutputRedactorCopyParity.test.ts +98 -0
- package/Tests/Utils/AiRemediation/Resource/ResourcePolicyImportClosure.test.ts +391 -0
- package/Tests/Utils/AiRemediation/ResourceAiAgentPolicyCopyParity.test.ts +497 -0
- package/Tests/Utils/SessionReplay/SessionReplayBudgetMetricType.test.ts +383 -0
- package/Types/AI/ResourceAiAccessApi.ts +140 -0
- package/Types/AI/ResourceAiAccessPermissions.ts +126 -0
- package/Types/AutoRemediation/AiRemediationCommandPlan.ts +183 -2
- package/Types/Monitor/Recommendation/MonitorRecommendationCatalog.ts +55 -22
- package/Types/Monitor/Recommendation/MonitorRecommendationTypes.ts +35 -3
- package/Types/Monitor/RumAlertTemplates.ts +351 -4
- package/Types/ResourceAiAgent/AiResourceType.ts +310 -0
- package/Types/ResourceAiAgent/ResourceAiAccess.ts +574 -0
- package/Types/Rum/SessionReplayBudgetMetricType.ts +47 -0
- package/Types/Runbook/RunbookStepType.ts +29 -0
- package/Types/Telemetry/TelemetryIngestSurface.ts +14 -2
- package/Utils/AI/InvestigationReport.ts +121 -15
- package/Utils/AiRemediation/Resource/CephCommandPolicy.ts +1936 -0
- package/Utils/AiRemediation/Resource/DatabaseCommandPolicy.ts +166 -0
- package/Utils/AiRemediation/Resource/DatabaseDiagnosticCatalog.ts +1532 -0
- package/Utils/AiRemediation/Resource/DatabaseQueryRedactor.ts +1394 -0
- package/Utils/AiRemediation/Resource/DockerCliGrammar.ts +1839 -0
- package/Utils/AiRemediation/Resource/DockerEngineCommandPolicy.ts +490 -0
- package/Utils/AiRemediation/Resource/DockerSwarmCommandPolicy.ts +687 -0
- package/Utils/AiRemediation/Resource/GovcCommandPolicy.ts +2096 -0
- package/Utils/AiRemediation/Resource/HostCommandPolicy.ts +2982 -0
- package/Utils/AiRemediation/Resource/ProxmoxCommandPolicy.ts +1679 -0
- package/Utils/AiRemediation/Resource/ResourceCommandPolicy.ts +851 -0
- package/Utils/AiRemediation/Resource/ResourceCommandPolicyCore.ts +593 -0
- package/Utils/AiRemediation/Resource/ResourceOutputRedactor.ts +2812 -0
- package/Utils/SessionReplay/SessionReplayBudgetMetricType.ts +184 -0
- package/build/dist/Models/DatabaseModels/AutoRemediationSuggestion.js +62 -0
- package/build/dist/Models/DatabaseModels/AutoRemediationSuggestion.js.map +1 -1
- package/build/dist/Models/DatabaseModels/CephCluster.js +219 -0
- package/build/dist/Models/DatabaseModels/CephCluster.js.map +1 -1
- package/build/dist/Models/DatabaseModels/DatabaseServer.js +219 -0
- package/build/dist/Models/DatabaseModels/DatabaseServer.js.map +1 -1
- package/build/dist/Models/DatabaseModels/DockerHost.js +219 -0
- package/build/dist/Models/DatabaseModels/DockerHost.js.map +1 -1
- package/build/dist/Models/DatabaseModels/DockerSwarmCluster.js +219 -0
- package/build/dist/Models/DatabaseModels/DockerSwarmCluster.js.map +1 -1
- package/build/dist/Models/DatabaseModels/GlobalConfig.js +1 -1
- package/build/dist/Models/DatabaseModels/GlobalConfig.js.map +1 -1
- package/build/dist/Models/DatabaseModels/Host.js +219 -0
- package/build/dist/Models/DatabaseModels/Host.js.map +1 -1
- package/build/dist/Models/DatabaseModels/Index.js +2 -0
- package/build/dist/Models/DatabaseModels/Index.js.map +1 -1
- package/build/dist/Models/DatabaseModels/PodmanHost.js +219 -0
- package/build/dist/Models/DatabaseModels/PodmanHost.js.map +1 -1
- package/build/dist/Models/DatabaseModels/ProxmoxCluster.js +219 -0
- package/build/dist/Models/DatabaseModels/ProxmoxCluster.js.map +1 -1
- package/build/dist/Models/DatabaseModels/ResourceAiAgent.js +439 -0
- package/build/dist/Models/DatabaseModels/ResourceAiAgent.js.map +1 -0
- package/build/dist/Models/DatabaseModels/RunnerJob.js +145 -0
- package/build/dist/Models/DatabaseModels/RunnerJob.js.map +1 -1
- package/build/dist/Models/DatabaseModels/VMwareVCenter.js +219 -0
- package/build/dist/Models/DatabaseModels/VMwareVCenter.js.map +1 -1
- package/build/dist/Server/API/AutoRemediationAPI.js +231 -1
- package/build/dist/Server/API/AutoRemediationAPI.js.map +1 -1
- package/build/dist/Server/API/ResourceAiAccessAPI.js +1119 -0
- package/build/dist/Server/API/ResourceAiAccessAPI.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1796300000000-AddResourceAiAgents.js +168 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1796300000000-AddResourceAiAgents.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js +2 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js.map +1 -1
- package/build/dist/Server/Infrastructure/Semaphore.js +6 -0
- package/build/dist/Server/Infrastructure/Semaphore.js.map +1 -1
- package/build/dist/Server/Middleware/TelemetryIngest.js +12 -5
- package/build/dist/Server/Middleware/TelemetryIngest.js.map +1 -1
- package/build/dist/Server/Services/AnalyticsDatabaseService.js +26 -1
- package/build/dist/Server/Services/AnalyticsDatabaseService.js.map +1 -1
- package/build/dist/Server/Services/AutoRemediationRuleEngineService.js +601 -3
- package/build/dist/Server/Services/AutoRemediationRuleEngineService.js.map +1 -1
- package/build/dist/Server/Services/CephClusterService.js +104 -0
- package/build/dist/Server/Services/CephClusterService.js.map +1 -1
- package/build/dist/Server/Services/DatabaseServerService.js +99 -0
- package/build/dist/Server/Services/DatabaseServerService.js.map +1 -1
- package/build/dist/Server/Services/DockerHostService.js +104 -0
- package/build/dist/Server/Services/DockerHostService.js.map +1 -1
- package/build/dist/Server/Services/DockerSwarmClusterService.js +104 -0
- package/build/dist/Server/Services/DockerSwarmClusterService.js.map +1 -1
- package/build/dist/Server/Services/HostService.js +114 -2
- package/build/dist/Server/Services/HostService.js.map +1 -1
- package/build/dist/Server/Services/MetricRecordingRuleService.js +46 -0
- package/build/dist/Server/Services/MetricRecordingRuleService.js.map +1 -1
- package/build/dist/Server/Services/PodmanHostService.js +104 -0
- package/build/dist/Server/Services/PodmanHostService.js.map +1 -1
- package/build/dist/Server/Services/ProxmoxClusterService.js +104 -0
- package/build/dist/Server/Services/ProxmoxClusterService.js.map +1 -1
- package/build/dist/Server/Services/ResourceAiAccessService.js +1028 -0
- package/build/dist/Server/Services/ResourceAiAccessService.js.map +1 -0
- package/build/dist/Server/Services/ResourceAiAgentJobService.js +173 -0
- package/build/dist/Server/Services/ResourceAiAgentJobService.js.map +1 -0
- package/build/dist/Server/Services/ResourceAiAgentService.js +1687 -0
- package/build/dist/Server/Services/ResourceAiAgentService.js.map +1 -0
- package/build/dist/Server/Services/RunnerJobService.js +344 -5
- package/build/dist/Server/Services/RunnerJobService.js.map +1 -1
- package/build/dist/Server/Services/TelemetryUsageBillingService.js +26 -0
- package/build/dist/Server/Services/TelemetryUsageBillingService.js.map +1 -1
- package/build/dist/Server/Services/TraceRecordingRuleService.js +37 -0
- package/build/dist/Server/Services/TraceRecordingRuleService.js.map +1 -1
- package/build/dist/Server/Services/VMwareVCenterService.js +104 -0
- package/build/dist/Server/Services/VMwareVCenterService.js.map +1 -1
- package/build/dist/Server/Utils/AI/Remediation/RemediationCommandTools.js +1029 -30
- package/build/dist/Server/Utils/AI/Remediation/RemediationCommandTools.js.map +1 -1
- package/build/dist/Server/Utils/AI/Remediation/RemediationExecutionRunner.js +633 -28
- package/build/dist/Server/Utils/AI/Remediation/RemediationExecutionRunner.js.map +1 -1
- package/build/dist/Server/Utils/AI/Remediation/RemediationPlanRunner.js +21 -1
- package/build/dist/Server/Utils/AI/Remediation/RemediationPlanRunner.js.map +1 -1
- package/build/dist/Server/Utils/AI/ResourceAccess/InfrastructureInvestigationToolkit.js +330 -0
- package/build/dist/Server/Utils/AI/ResourceAccess/InfrastructureInvestigationToolkit.js.map +1 -0
- package/build/dist/Server/Utils/AI/ResourceAccess/ResourceAccessContext.js +160 -0
- package/build/dist/Server/Utils/AI/ResourceAccess/ResourceAccessContext.js.map +1 -0
- package/build/dist/Server/Utils/AI/ResourceAccess/ResourceAccessToolNames.js +33 -0
- package/build/dist/Server/Utils/AI/ResourceAccess/ResourceAccessToolNames.js.map +1 -0
- package/build/dist/Server/Utils/AI/ResourceAccess/ResourceAiAccessSettings.js +640 -0
- package/build/dist/Server/Utils/AI/ResourceAccess/ResourceAiAccessSettings.js.map +1 -0
- package/build/dist/Server/Utils/AI/ResourceAccess/ResourceAiDeleteCleanup.js +226 -0
- package/build/dist/Server/Utils/AI/ResourceAccess/ResourceAiDeleteCleanup.js.map +1 -0
- package/build/dist/Server/Utils/AI/ResourceAccess/ResourceCommandJobRunner.js +600 -0
- package/build/dist/Server/Utils/AI/ResourceAccess/ResourceCommandJobRunner.js.map +1 -0
- package/build/dist/Server/Utils/AI/SRE/AIInvestigationEngine.js +50 -4
- package/build/dist/Server/Utils/AI/SRE/AIInvestigationEngine.js.map +1 -1
- package/build/dist/Server/Utils/AI/SRE/AlertInvestigationRunner.js +55 -4
- package/build/dist/Server/Utils/AI/SRE/AlertInvestigationRunner.js.map +1 -1
- package/build/dist/Server/Utils/AI/SRE/IncidentInvestigationRunner.js +55 -4
- package/build/dist/Server/Utils/AI/SRE/IncidentInvestigationRunner.js.map +1 -1
- package/build/dist/Server/Utils/AutoRemediation/CommandPlanExecutor.js +290 -13
- package/build/dist/Server/Utils/AutoRemediation/CommandPlanExecutor.js.map +1 -1
- package/build/dist/Server/Utils/AutoRemediation/RemediationVerifier.js +29 -1
- package/build/dist/Server/Utils/AutoRemediation/RemediationVerifier.js.map +1 -1
- package/build/dist/Server/Utils/Database/ProjectScopedReferenceValidator.js +9 -1
- package/build/dist/Server/Utils/Database/ProjectScopedReferenceValidator.js.map +1 -1
- package/build/dist/Server/Utils/SessionReplay/SessionReplayBudgetMetrics.js +627 -0
- package/build/dist/Server/Utils/SessionReplay/SessionReplayBudgetMetrics.js.map +1 -0
- package/build/dist/Server/Utils/SessionReplay/SessionReplayUsage.js +60 -5
- package/build/dist/Server/Utils/SessionReplay/SessionReplayUsage.js.map +1 -1
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/Alert.js +19 -15
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/Alert.js.map +1 -1
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/AlertEpisode.js +19 -15
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/AlertEpisode.js.map +1 -1
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/Auth.js +17 -1
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/Auth.js.map +1 -1
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/Incident.js +183 -209
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/Incident.js.map +1 -1
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/IncidentEpisode.js +19 -15
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/IncidentEpisode.js.map +1 -1
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/ScheduledMaintenance.js +233 -167
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/ScheduledMaintenance.js.map +1 -1
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeams.js +263 -110
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeams.js.map +1 -1
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeamsActivityDeduplicator.js +129 -0
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeamsActivityDeduplicator.js.map +1 -0
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeamsCardChoices.js +266 -0
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeamsCardChoices.js.map +1 -0
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeamsCreateCommands.js +258 -0
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeamsCreateCommands.js.map +1 -0
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeamsMessageSize.js +104 -0
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeamsMessageSize.js.map +1 -0
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeamsReplies.js +183 -0
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeamsReplies.js.map +1 -0
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeamsTimezone.js +123 -0
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeamsTimezone.js.map +1 -0
- package/build/dist/Types/AI/ResourceAiAccessApi.js +30 -0
- package/build/dist/Types/AI/ResourceAiAccessApi.js.map +1 -0
- package/build/dist/Types/AI/ResourceAiAccessPermissions.js +98 -0
- package/build/dist/Types/AI/ResourceAiAccessPermissions.js.map +1 -0
- package/build/dist/Types/AutoRemediation/AiRemediationCommandPlan.js +116 -29
- package/build/dist/Types/AutoRemediation/AiRemediationCommandPlan.js.map +1 -1
- package/build/dist/Types/Monitor/Recommendation/MonitorRecommendationCatalog.js +47 -21
- package/build/dist/Types/Monitor/Recommendation/MonitorRecommendationCatalog.js.map +1 -1
- package/build/dist/Types/Monitor/Recommendation/MonitorRecommendationTypes.js +5 -0
- package/build/dist/Types/Monitor/Recommendation/MonitorRecommendationTypes.js.map +1 -1
- package/build/dist/Types/Monitor/RumAlertTemplates.js +199 -3
- package/build/dist/Types/Monitor/RumAlertTemplates.js.map +1 -1
- package/build/dist/Types/ResourceAiAgent/AiResourceType.js +242 -0
- package/build/dist/Types/ResourceAiAgent/AiResourceType.js.map +1 -0
- package/build/dist/Types/ResourceAiAgent/ResourceAiAccess.js +275 -0
- package/build/dist/Types/ResourceAiAgent/ResourceAiAccess.js.map +1 -0
- package/build/dist/Types/Rum/SessionReplayBudgetMetricType.js +45 -0
- package/build/dist/Types/Rum/SessionReplayBudgetMetricType.js.map +1 -0
- package/build/dist/Types/Runbook/RunbookStepType.js +27 -0
- package/build/dist/Types/Runbook/RunbookStepType.js.map +1 -1
- package/build/dist/Types/Telemetry/TelemetryIngestSurface.js +13 -2
- package/build/dist/Types/Telemetry/TelemetryIngestSurface.js.map +1 -1
- package/build/dist/Utils/AI/InvestigationReport.js +71 -11
- package/build/dist/Utils/AI/InvestigationReport.js.map +1 -1
- package/build/dist/Utils/AiRemediation/Resource/CephCommandPolicy.js +1462 -0
- package/build/dist/Utils/AiRemediation/Resource/CephCommandPolicy.js.map +1 -0
- package/build/dist/Utils/AiRemediation/Resource/DatabaseCommandPolicy.js +122 -0
- package/build/dist/Utils/AiRemediation/Resource/DatabaseCommandPolicy.js.map +1 -0
- package/build/dist/Utils/AiRemediation/Resource/DatabaseDiagnosticCatalog.js +1139 -0
- package/build/dist/Utils/AiRemediation/Resource/DatabaseDiagnosticCatalog.js.map +1 -0
- package/build/dist/Utils/AiRemediation/Resource/DatabaseQueryRedactor.js +1060 -0
- package/build/dist/Utils/AiRemediation/Resource/DatabaseQueryRedactor.js.map +1 -0
- package/build/dist/Utils/AiRemediation/Resource/DockerCliGrammar.js +1301 -0
- package/build/dist/Utils/AiRemediation/Resource/DockerCliGrammar.js.map +1 -0
- package/build/dist/Utils/AiRemediation/Resource/DockerEngineCommandPolicy.js +370 -0
- package/build/dist/Utils/AiRemediation/Resource/DockerEngineCommandPolicy.js.map +1 -0
- package/build/dist/Utils/AiRemediation/Resource/DockerSwarmCommandPolicy.js +498 -0
- package/build/dist/Utils/AiRemediation/Resource/DockerSwarmCommandPolicy.js.map +1 -0
- package/build/dist/Utils/AiRemediation/Resource/GovcCommandPolicy.js +1565 -0
- package/build/dist/Utils/AiRemediation/Resource/GovcCommandPolicy.js.map +1 -0
- package/build/dist/Utils/AiRemediation/Resource/HostCommandPolicy.js +2206 -0
- package/build/dist/Utils/AiRemediation/Resource/HostCommandPolicy.js.map +1 -0
- package/build/dist/Utils/AiRemediation/Resource/ProxmoxCommandPolicy.js +1129 -0
- package/build/dist/Utils/AiRemediation/Resource/ProxmoxCommandPolicy.js.map +1 -0
- package/build/dist/Utils/AiRemediation/Resource/ResourceCommandPolicy.js +565 -0
- package/build/dist/Utils/AiRemediation/Resource/ResourceCommandPolicy.js.map +1 -0
- package/build/dist/Utils/AiRemediation/Resource/ResourceCommandPolicyCore.js +408 -0
- package/build/dist/Utils/AiRemediation/Resource/ResourceCommandPolicyCore.js.map +1 -0
- package/build/dist/Utils/AiRemediation/Resource/ResourceOutputRedactor.js +1910 -0
- package/build/dist/Utils/AiRemediation/Resource/ResourceOutputRedactor.js.map +1 -0
- package/build/dist/Utils/SessionReplay/SessionReplayBudgetMetricType.js +160 -0
- package/build/dist/Utils/SessionReplay/SessionReplayBudgetMetricType.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,383 @@
|
|
|
1
|
+
import AggregationType from "../../../Types/BaseDatabase/AggregationType";
|
|
2
|
+
import SessionReplayBudgetMetricType from "../../../Types/Rum/SessionReplayBudgetMetricType";
|
|
3
|
+
import SessionReplayBudgetMetricTypeUtil, {
|
|
4
|
+
SESSION_REPLAY_BUDGET_METRIC_INTERVAL_MINUTES,
|
|
5
|
+
SESSION_REPLAY_BUDGET_METRIC_PROJECT_ID_ATTRIBUTE,
|
|
6
|
+
SESSION_REPLAY_BUDGET_METRIC_RUM_APPLICATION_ID_ATTRIBUTE,
|
|
7
|
+
SESSION_REPLAY_BUDGET_METRIC_RUM_APPLICATION_NAME_ATTRIBUTE,
|
|
8
|
+
SESSION_REPLAY_METRIC_NAME_PREFIX,
|
|
9
|
+
} from "../../../Utils/SessionReplay/SessionReplayBudgetMetricType";
|
|
10
|
+
import MetricUnitUtil from "../../../Utils/MetricUnitUtil";
|
|
11
|
+
import { MutableMetricService } from "../../../Server/Services/MutableMetricService";
|
|
12
|
+
import { describe, expect, test } from "@jest/globals";
|
|
13
|
+
|
|
14
|
+
/*
|
|
15
|
+
* SessionReplayBudgetMetricTypeUtil is the one table every side of the
|
|
16
|
+
* session replay budget metrics reads: the sweep registers each name's unit
|
|
17
|
+
* and description from it, the alert templates read the names, billing
|
|
18
|
+
* excludes by getAll(), and OTLP ingest refuses isReservedMetricName(). Two
|
|
19
|
+
* kinds of test, as in SloMetricType.test.ts:
|
|
20
|
+
*
|
|
21
|
+
* - Targeted: the exact name / unit / aggregation per member, because a
|
|
22
|
+
* stored row, a monitor threshold or a chart depends on each.
|
|
23
|
+
* - Invariant: every lookup resolves for EVERY enum member. The switches
|
|
24
|
+
* throw on an unknown value, so a member added to the enum and forgotten
|
|
25
|
+
* in one switch fails here instead of inside the worker.
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
const ALL_BUDGET_METRIC_TYPES: Array<SessionReplayBudgetMetricType> =
|
|
29
|
+
Object.values(SessionReplayBudgetMetricType);
|
|
30
|
+
|
|
31
|
+
// A value outside the enum, to drive the throwing default branches.
|
|
32
|
+
const UNKNOWN_METRIC_TYPE: SessionReplayBudgetMetricType =
|
|
33
|
+
"oneuptime.rum.session.replay.budget.not.a.metric" as SessionReplayBudgetMetricType;
|
|
34
|
+
|
|
35
|
+
describe("SessionReplayBudgetMetricType names", () => {
|
|
36
|
+
/*
|
|
37
|
+
* The names are an append-only contract: every point already stored and
|
|
38
|
+
* every monitor already watching one is keyed on the exact string.
|
|
39
|
+
*/
|
|
40
|
+
test("are exactly the four published names", () => {
|
|
41
|
+
expect(SessionReplayBudgetMetricType.ProjectDailyUsedBytes).toBe(
|
|
42
|
+
"oneuptime.rum.session.replay.budget.project.daily.used.bytes",
|
|
43
|
+
);
|
|
44
|
+
expect(SessionReplayBudgetMetricType.ProjectDailyUsedPercent).toBe(
|
|
45
|
+
"oneuptime.rum.session.replay.budget.project.daily.used.percent",
|
|
46
|
+
);
|
|
47
|
+
expect(SessionReplayBudgetMetricType.ApplicationMonthlyUsedBytes).toBe(
|
|
48
|
+
"oneuptime.rum.session.replay.budget.application.monthly.used.bytes",
|
|
49
|
+
);
|
|
50
|
+
expect(SessionReplayBudgetMetricType.ApplicationMonthlyUsedPercent).toBe(
|
|
51
|
+
"oneuptime.rum.session.replay.budget.application.monthly.used.percent",
|
|
52
|
+
);
|
|
53
|
+
expect(ALL_BUDGET_METRIC_TYPES).toHaveLength(4);
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
test.each(ALL_BUDGET_METRIC_TYPES)(
|
|
57
|
+
"%s lives under the reserved prefix, in lower case, within the catalog's name length",
|
|
58
|
+
(metricType: SessionReplayBudgetMetricType) => {
|
|
59
|
+
expect(metricType.startsWith(SESSION_REPLAY_METRIC_NAME_PREFIX)).toBe(
|
|
60
|
+
true,
|
|
61
|
+
);
|
|
62
|
+
// OTLP ingest lowercases names; a mixed-case name could never match one.
|
|
63
|
+
expect(metricType).toBe(metricType.toLowerCase());
|
|
64
|
+
expect(metricType).not.toMatch(/\s/);
|
|
65
|
+
// MetricType.name is a ShortText column (100 characters).
|
|
66
|
+
expect(metricType.length).toBeLessThanOrEqual(100);
|
|
67
|
+
// "budget" is how the product names this, and the picker searches names.
|
|
68
|
+
expect(metricType).toContain(".budget.");
|
|
69
|
+
},
|
|
70
|
+
);
|
|
71
|
+
|
|
72
|
+
test.each(ALL_BUDGET_METRIC_TYPES)(
|
|
73
|
+
"%s is read from the immutable metric table, where the sweep writes it",
|
|
74
|
+
(metricType: SessionReplayBudgetMetricType) => {
|
|
75
|
+
expect(MutableMetricService.isMutableMetricName(metricType)).toBe(false);
|
|
76
|
+
},
|
|
77
|
+
);
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
describe("SessionReplayBudgetMetricTypeUtil.getAll", () => {
|
|
81
|
+
test("lists every member exactly once - the sweep and billing only see what is listed", () => {
|
|
82
|
+
const all: Array<SessionReplayBudgetMetricType> =
|
|
83
|
+
SessionReplayBudgetMetricTypeUtil.getAll();
|
|
84
|
+
|
|
85
|
+
expect([...all].sort()).toEqual([...ALL_BUDGET_METRIC_TYPES].sort());
|
|
86
|
+
expect(new Set(all).size).toBe(all.length);
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
test("lists the project series first", () => {
|
|
90
|
+
expect(SessionReplayBudgetMetricTypeUtil.getAll()).toEqual([
|
|
91
|
+
SessionReplayBudgetMetricType.ProjectDailyUsedBytes,
|
|
92
|
+
SessionReplayBudgetMetricType.ProjectDailyUsedPercent,
|
|
93
|
+
SessionReplayBudgetMetricType.ApplicationMonthlyUsedBytes,
|
|
94
|
+
SessionReplayBudgetMetricType.ApplicationMonthlyUsedPercent,
|
|
95
|
+
]);
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
test("returns a fresh array, so one caller reordering it cannot reorder another's", () => {
|
|
99
|
+
const first: Array<SessionReplayBudgetMetricType> =
|
|
100
|
+
SessionReplayBudgetMetricTypeUtil.getAll();
|
|
101
|
+
first.reverse();
|
|
102
|
+
|
|
103
|
+
expect(SessionReplayBudgetMetricTypeUtil.getAll()[0]).toBe(
|
|
104
|
+
SessionReplayBudgetMetricType.ProjectDailyUsedBytes,
|
|
105
|
+
);
|
|
106
|
+
});
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
describe("SessionReplayBudgetMetricTypeUtil.isReservedMetricName", () => {
|
|
110
|
+
test.each(ALL_BUDGET_METRIC_TYPES)(
|
|
111
|
+
"reserves %s",
|
|
112
|
+
(metricType: SessionReplayBudgetMetricType) => {
|
|
113
|
+
expect(
|
|
114
|
+
SessionReplayBudgetMetricTypeUtil.isReservedMetricName(metricType),
|
|
115
|
+
).toBe(true);
|
|
116
|
+
},
|
|
117
|
+
);
|
|
118
|
+
|
|
119
|
+
test("reserves the whole session replay namespace, not only today's names", () => {
|
|
120
|
+
expect(
|
|
121
|
+
SessionReplayBudgetMetricTypeUtil.isReservedMetricName(
|
|
122
|
+
"oneuptime.rum.session.replay.anything.new",
|
|
123
|
+
),
|
|
124
|
+
).toBe(true);
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
test("is case-insensitive, because ingest lowercases names onto the same series", () => {
|
|
128
|
+
expect(
|
|
129
|
+
SessionReplayBudgetMetricTypeUtil.isReservedMetricName(
|
|
130
|
+
"OneUptime.RUM.Session.Replay.Budget.Project.Daily.Used.Percent",
|
|
131
|
+
),
|
|
132
|
+
).toBe(true);
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
test.each([
|
|
136
|
+
"oneuptime.rum.application.id",
|
|
137
|
+
"oneuptime.llm.budget.percent.used",
|
|
138
|
+
"oneuptime.monitor.response.time",
|
|
139
|
+
"oneuptime.host.heartbeat",
|
|
140
|
+
"web_vital.lcp",
|
|
141
|
+
"session.replay.budget",
|
|
142
|
+
// No separator: a different namespace, however close.
|
|
143
|
+
"oneuptime.rum.session.replayed",
|
|
144
|
+
"oneuptime.rum.session.replay",
|
|
145
|
+
" oneuptime.rum.session.replay.budget.project.daily.used.bytes",
|
|
146
|
+
])("leaves %p alone", (name: string) => {
|
|
147
|
+
expect(SessionReplayBudgetMetricTypeUtil.isReservedMetricName(name)).toBe(
|
|
148
|
+
false,
|
|
149
|
+
);
|
|
150
|
+
});
|
|
151
|
+
|
|
152
|
+
test("answers false for a missing name instead of throwing", () => {
|
|
153
|
+
expect(SessionReplayBudgetMetricTypeUtil.isReservedMetricName("")).toBe(
|
|
154
|
+
false,
|
|
155
|
+
);
|
|
156
|
+
expect(SessionReplayBudgetMetricTypeUtil.isReservedMetricName(null)).toBe(
|
|
157
|
+
false,
|
|
158
|
+
);
|
|
159
|
+
expect(
|
|
160
|
+
SessionReplayBudgetMetricTypeUtil.isReservedMetricName(undefined),
|
|
161
|
+
).toBe(false);
|
|
162
|
+
});
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
describe("units", () => {
|
|
166
|
+
test("bytes series are 'By', which charts scale as bytes", () => {
|
|
167
|
+
for (const metricType of [
|
|
168
|
+
SessionReplayBudgetMetricType.ProjectDailyUsedBytes,
|
|
169
|
+
SessionReplayBudgetMetricType.ApplicationMonthlyUsedBytes,
|
|
170
|
+
]) {
|
|
171
|
+
const unit: string =
|
|
172
|
+
SessionReplayBudgetMetricTypeUtil.getUnit(metricType);
|
|
173
|
+
|
|
174
|
+
expect(unit).toBe("By");
|
|
175
|
+
expect(MetricUnitUtil.getFamilyBaseUnit(unit)).toBe("B");
|
|
176
|
+
}
|
|
177
|
+
});
|
|
178
|
+
|
|
179
|
+
test("percent series are '%', never '1' (which the chart formatter would multiply by 100)", () => {
|
|
180
|
+
for (const metricType of [
|
|
181
|
+
SessionReplayBudgetMetricType.ProjectDailyUsedPercent,
|
|
182
|
+
SessionReplayBudgetMetricType.ApplicationMonthlyUsedPercent,
|
|
183
|
+
]) {
|
|
184
|
+
const unit: string =
|
|
185
|
+
SessionReplayBudgetMetricTypeUtil.getUnit(metricType);
|
|
186
|
+
|
|
187
|
+
expect(unit).toBe("%");
|
|
188
|
+
expect(MetricUnitUtil.getFamilyBaseUnit(unit)).toBe("%");
|
|
189
|
+
}
|
|
190
|
+
});
|
|
191
|
+
});
|
|
192
|
+
|
|
193
|
+
describe("aggregation, titles, descriptions and scope", () => {
|
|
194
|
+
test.each(ALL_BUDGET_METRIC_TYPES)(
|
|
195
|
+
"%s aggregates with Max - Sum would multiply the shared project value",
|
|
196
|
+
(metricType: SessionReplayBudgetMetricType) => {
|
|
197
|
+
expect(
|
|
198
|
+
SessionReplayBudgetMetricTypeUtil.getAggregationType(metricType),
|
|
199
|
+
).toBe(AggregationType.Max);
|
|
200
|
+
},
|
|
201
|
+
);
|
|
202
|
+
|
|
203
|
+
test("titles match the Health page's own labels", () => {
|
|
204
|
+
expect(
|
|
205
|
+
SessionReplayBudgetMetricTypeUtil.getTitle(
|
|
206
|
+
SessionReplayBudgetMetricType.ProjectDailyUsedBytes,
|
|
207
|
+
),
|
|
208
|
+
).toBe("Project Bytes Today");
|
|
209
|
+
expect(
|
|
210
|
+
SessionReplayBudgetMetricTypeUtil.getTitle(
|
|
211
|
+
SessionReplayBudgetMetricType.ProjectDailyUsedPercent,
|
|
212
|
+
),
|
|
213
|
+
).toBe("Project Daily Budget Used");
|
|
214
|
+
expect(
|
|
215
|
+
SessionReplayBudgetMetricTypeUtil.getTitle(
|
|
216
|
+
SessionReplayBudgetMetricType.ApplicationMonthlyUsedBytes,
|
|
217
|
+
),
|
|
218
|
+
).toBe("Application Bytes This Month");
|
|
219
|
+
expect(
|
|
220
|
+
SessionReplayBudgetMetricTypeUtil.getTitle(
|
|
221
|
+
SessionReplayBudgetMetricType.ApplicationMonthlyUsedPercent,
|
|
222
|
+
),
|
|
223
|
+
).toBe("Application Monthly Budget Used");
|
|
224
|
+
});
|
|
225
|
+
|
|
226
|
+
test.each(ALL_BUDGET_METRIC_TYPES)(
|
|
227
|
+
"%s has a catalog description that says how often it is written and that zero is not",
|
|
228
|
+
(metricType: SessionReplayBudgetMetricType) => {
|
|
229
|
+
const description: string =
|
|
230
|
+
SessionReplayBudgetMetricTypeUtil.getDescription(metricType);
|
|
231
|
+
|
|
232
|
+
expect(description.length).toBeGreaterThan(80);
|
|
233
|
+
expect(description).toContain(
|
|
234
|
+
`every ${SESSION_REPLAY_BUDGET_METRIC_INTERVAL_MINUTES} minutes`,
|
|
235
|
+
);
|
|
236
|
+
/*
|
|
237
|
+
* "Usage", not the value: a percent point goes out with its bytes point
|
|
238
|
+
* even when it rounds down to 0.00.
|
|
239
|
+
*/
|
|
240
|
+
expect(description).toContain("while usage is above zero");
|
|
241
|
+
},
|
|
242
|
+
);
|
|
243
|
+
|
|
244
|
+
test("the project series warn against Sum, and say which applications carry them", () => {
|
|
245
|
+
for (const metricType of ALL_BUDGET_METRIC_TYPES) {
|
|
246
|
+
const description: string =
|
|
247
|
+
SessionReplayBudgetMetricTypeUtil.getDescription(metricType);
|
|
248
|
+
const projectScoped: boolean =
|
|
249
|
+
SessionReplayBudgetMetricTypeUtil.isProjectScoped(metricType);
|
|
250
|
+
|
|
251
|
+
expect(description.includes("never Sum")).toBe(projectScoped);
|
|
252
|
+
expect(
|
|
253
|
+
description.includes(
|
|
254
|
+
"every application that records (session replay on)",
|
|
255
|
+
),
|
|
256
|
+
).toBe(projectScoped);
|
|
257
|
+
}
|
|
258
|
+
});
|
|
259
|
+
|
|
260
|
+
/*
|
|
261
|
+
* The crossing upload is refused but stays counted, so the bytes were not
|
|
262
|
+
* all "let through" - they are what the limit was charged.
|
|
263
|
+
*/
|
|
264
|
+
test("the daily bytes are what the limit was charged, not what was let through", () => {
|
|
265
|
+
const description: string =
|
|
266
|
+
SessionReplayBudgetMetricTypeUtil.getDescription(
|
|
267
|
+
SessionReplayBudgetMetricType.ProjectDailyUsedBytes,
|
|
268
|
+
);
|
|
269
|
+
|
|
270
|
+
expect(description).toContain("counted against the project's daily limit");
|
|
271
|
+
expect(description).not.toContain("let through");
|
|
272
|
+
});
|
|
273
|
+
|
|
274
|
+
test("the percent descriptions say what 100 means and that the value is rounded down", () => {
|
|
275
|
+
for (const metricType of [
|
|
276
|
+
SessionReplayBudgetMetricType.ProjectDailyUsedPercent,
|
|
277
|
+
SessionReplayBudgetMetricType.ApplicationMonthlyUsedPercent,
|
|
278
|
+
]) {
|
|
279
|
+
const description: string =
|
|
280
|
+
SessionReplayBudgetMetricTypeUtil.getDescription(metricType);
|
|
281
|
+
|
|
282
|
+
expect(description).toContain("rounded down to 0.01");
|
|
283
|
+
expect(description).toContain("At 100 or more");
|
|
284
|
+
}
|
|
285
|
+
});
|
|
286
|
+
|
|
287
|
+
test("the monthly descriptions say the series only exists with a budget", () => {
|
|
288
|
+
for (const metricType of [
|
|
289
|
+
SessionReplayBudgetMetricType.ApplicationMonthlyUsedBytes,
|
|
290
|
+
SessionReplayBudgetMetricType.ApplicationMonthlyUsedPercent,
|
|
291
|
+
]) {
|
|
292
|
+
expect(
|
|
293
|
+
SessionReplayBudgetMetricTypeUtil.getDescription(metricType),
|
|
294
|
+
).toContain("only for applications with a monthly budget");
|
|
295
|
+
}
|
|
296
|
+
});
|
|
297
|
+
|
|
298
|
+
test("only the daily series are project-scoped", () => {
|
|
299
|
+
expect(
|
|
300
|
+
ALL_BUDGET_METRIC_TYPES.filter(
|
|
301
|
+
(metricType: SessionReplayBudgetMetricType) => {
|
|
302
|
+
return SessionReplayBudgetMetricTypeUtil.isProjectScoped(metricType);
|
|
303
|
+
},
|
|
304
|
+
).sort(),
|
|
305
|
+
).toEqual(
|
|
306
|
+
[
|
|
307
|
+
SessionReplayBudgetMetricType.ProjectDailyUsedBytes,
|
|
308
|
+
SessionReplayBudgetMetricType.ProjectDailyUsedPercent,
|
|
309
|
+
].sort(),
|
|
310
|
+
);
|
|
311
|
+
});
|
|
312
|
+
});
|
|
313
|
+
|
|
314
|
+
describe("every lookup resolves for every member and refuses an unknown one", () => {
|
|
315
|
+
const lookups: Array<{
|
|
316
|
+
name: string;
|
|
317
|
+
run: (metricType: SessionReplayBudgetMetricType) => unknown;
|
|
318
|
+
}> = [
|
|
319
|
+
{
|
|
320
|
+
name: "getTitle",
|
|
321
|
+
run: (metricType: SessionReplayBudgetMetricType): unknown => {
|
|
322
|
+
return SessionReplayBudgetMetricTypeUtil.getTitle(metricType);
|
|
323
|
+
},
|
|
324
|
+
},
|
|
325
|
+
{
|
|
326
|
+
name: "getDescription",
|
|
327
|
+
run: (metricType: SessionReplayBudgetMetricType): unknown => {
|
|
328
|
+
return SessionReplayBudgetMetricTypeUtil.getDescription(metricType);
|
|
329
|
+
},
|
|
330
|
+
},
|
|
331
|
+
{
|
|
332
|
+
name: "getUnit",
|
|
333
|
+
run: (metricType: SessionReplayBudgetMetricType): unknown => {
|
|
334
|
+
return SessionReplayBudgetMetricTypeUtil.getUnit(metricType);
|
|
335
|
+
},
|
|
336
|
+
},
|
|
337
|
+
{
|
|
338
|
+
name: "getAggregationType",
|
|
339
|
+
run: (metricType: SessionReplayBudgetMetricType): unknown => {
|
|
340
|
+
return SessionReplayBudgetMetricTypeUtil.getAggregationType(metricType);
|
|
341
|
+
},
|
|
342
|
+
},
|
|
343
|
+
{
|
|
344
|
+
name: "isProjectScoped",
|
|
345
|
+
run: (metricType: SessionReplayBudgetMetricType): unknown => {
|
|
346
|
+
return SessionReplayBudgetMetricTypeUtil.isProjectScoped(metricType);
|
|
347
|
+
},
|
|
348
|
+
},
|
|
349
|
+
];
|
|
350
|
+
|
|
351
|
+
test.each(lookups)(
|
|
352
|
+
"$name",
|
|
353
|
+
(lookup: {
|
|
354
|
+
name: string;
|
|
355
|
+
run: (metricType: SessionReplayBudgetMetricType) => unknown;
|
|
356
|
+
}) => {
|
|
357
|
+
for (const metricType of ALL_BUDGET_METRIC_TYPES) {
|
|
358
|
+
expect(lookup.run(metricType)).not.toBeUndefined();
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
expect(() => {
|
|
362
|
+
return lookup.run(UNKNOWN_METRIC_TYPE);
|
|
363
|
+
}).toThrow("Invalid SessionReplayBudgetMetricType value");
|
|
364
|
+
},
|
|
365
|
+
);
|
|
366
|
+
});
|
|
367
|
+
|
|
368
|
+
describe("attribute keys and cadence", () => {
|
|
369
|
+
test("use the bare keys the other internal metrics use", () => {
|
|
370
|
+
expect(SESSION_REPLAY_BUDGET_METRIC_PROJECT_ID_ATTRIBUTE).toBe("projectId");
|
|
371
|
+
expect(SESSION_REPLAY_BUDGET_METRIC_RUM_APPLICATION_ID_ATTRIBUTE).toBe(
|
|
372
|
+
"rumApplicationId",
|
|
373
|
+
);
|
|
374
|
+
expect(SESSION_REPLAY_BUDGET_METRIC_RUM_APPLICATION_NAME_ATTRIBUTE).toBe(
|
|
375
|
+
"rumApplicationName",
|
|
376
|
+
);
|
|
377
|
+
});
|
|
378
|
+
|
|
379
|
+
test("the sweep posts every five minutes", () => {
|
|
380
|
+
// The alert templates' 15-minute window is three of these.
|
|
381
|
+
expect(SESSION_REPLAY_BUDGET_METRIC_INTERVAL_MINUTES).toBe(5);
|
|
382
|
+
});
|
|
383
|
+
});
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import AiResourceType from "../ResourceAiAgent/AiResourceType";
|
|
2
|
+
import { ResourceAiAccessStatus } from "../ResourceAiAgent/ResourceAiAccess";
|
|
3
|
+
|
|
4
|
+
/*
|
|
5
|
+
* The dashboard-facing calls behind an infrastructure resource's AI pages
|
|
6
|
+
* (AI → Insights and AI → AI agent) for every resource a resource AI agent
|
|
7
|
+
* serves — Common/Server/API/ResourceAiAccessAPI.ts. Everything else on
|
|
8
|
+
* those pages is ordinary CRUD on the resource model (the investigation
|
|
9
|
+
* switch, the remediation mode, the command allowlist).
|
|
10
|
+
*
|
|
11
|
+
* Every route is POST under /api and takes a ResourceAiAccessRequest body.
|
|
12
|
+
*/
|
|
13
|
+
export const RESOURCE_AI_ACCESS_STATUS_PATH: string =
|
|
14
|
+
"/resource-ai-access/status";
|
|
15
|
+
export const RESOURCE_AI_ACCESS_TEST_PATH: string = "/resource-ai-access/test";
|
|
16
|
+
export const RESOURCE_AI_ACCESS_RESET_AGENT_PATH: string =
|
|
17
|
+
"/resource-ai-access/reset-agent";
|
|
18
|
+
export const RESOURCE_AI_ACCESS_INSIGHTS_PATH: string =
|
|
19
|
+
"/resource-ai-access/insights";
|
|
20
|
+
|
|
21
|
+
export interface ResourceAiAccessRequest {
|
|
22
|
+
// An AiResourceType value (an agent alias such as "docker" is accepted too).
|
|
23
|
+
resourceType: AiResourceType | string;
|
|
24
|
+
resourceId: string;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/*
|
|
28
|
+
* POST /resource-ai-access/test runs the type's test commands
|
|
29
|
+
* (AI_RESOURCE_TYPE_INFO[type].testCommands) through the resource's AI agent
|
|
30
|
+
* and answers with one of these per command it ran — it stops at the first
|
|
31
|
+
* that did not succeed.
|
|
32
|
+
*/
|
|
33
|
+
export interface ResourceAiAccessTestCommandResult {
|
|
34
|
+
command: string;
|
|
35
|
+
succeeded: boolean;
|
|
36
|
+
exitCode: number | null;
|
|
37
|
+
// Redacted and capped, the way every AI resource command's output is.
|
|
38
|
+
output: string;
|
|
39
|
+
errorMessage: string | null;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export interface ResourceAiAccessTestResponse {
|
|
43
|
+
ok: boolean;
|
|
44
|
+
message: string;
|
|
45
|
+
results: Array<ResourceAiAccessTestCommandResult>;
|
|
46
|
+
// The status after the test (it may have changed "Last verified").
|
|
47
|
+
status: ResourceAiAccessStatus;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// POST /resource-ai-access/reset-agent.
|
|
51
|
+
export interface ResourceAiAccessResetAgentResponse {
|
|
52
|
+
ok: boolean;
|
|
53
|
+
message: string;
|
|
54
|
+
status?: ResourceAiAccessStatus | undefined;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/*
|
|
58
|
+
* POST /resource-ai-access/insights: what OneUptime AI investigated and
|
|
59
|
+
* changed on one resource, as summaries. Nothing here carries command
|
|
60
|
+
* output, a prompt or a command plan: the route is readable by everyone who
|
|
61
|
+
* may read the resource, a wider audience than the AI runs, suggestions and
|
|
62
|
+
* jobs it summarises. So an investigation whose incident or alert the
|
|
63
|
+
* caller cannot read is left out, a TL;DR is there only with a readable
|
|
64
|
+
* subject (or, for a run with none, for a caller who may read AIRun), and a
|
|
65
|
+
* fix's rationale only for a caller who may read that suggestion.
|
|
66
|
+
*/
|
|
67
|
+
|
|
68
|
+
// How many investigations, and how many fixes, the route returns (newest).
|
|
69
|
+
export const RESOURCE_AI_INSIGHTS_LIMIT: number = 25;
|
|
70
|
+
|
|
71
|
+
// The window commandCounts covers.
|
|
72
|
+
export const RESOURCE_AI_INSIGHTS_COMMAND_WINDOW_IN_DAYS: number = 30;
|
|
73
|
+
|
|
74
|
+
// How much of a fix's rationale the route returns.
|
|
75
|
+
export const RESOURCE_AI_INSIGHTS_RATIONALE_MAX_LENGTH: number = 300;
|
|
76
|
+
|
|
77
|
+
/*
|
|
78
|
+
* One investigation that concerns the resource: it ran a command on it
|
|
79
|
+
* through the resource's AI agent, or it investigated an incident or alert
|
|
80
|
+
* linked to it.
|
|
81
|
+
*/
|
|
82
|
+
export interface ResourceAiInsightInvestigation {
|
|
83
|
+
aiRunId: string;
|
|
84
|
+
// AIRunStatus.
|
|
85
|
+
status?: string | undefined;
|
|
86
|
+
analysisTldr?: string | undefined;
|
|
87
|
+
// ISO dates.
|
|
88
|
+
createdAt?: string | undefined;
|
|
89
|
+
completedAt?: string | undefined;
|
|
90
|
+
incident?:
|
|
91
|
+
| {
|
|
92
|
+
id: string;
|
|
93
|
+
title?: string | undefined;
|
|
94
|
+
number?: number | undefined;
|
|
95
|
+
}
|
|
96
|
+
| undefined;
|
|
97
|
+
alert?:
|
|
98
|
+
| {
|
|
99
|
+
id: string;
|
|
100
|
+
title?: string | undefined;
|
|
101
|
+
}
|
|
102
|
+
| undefined;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/*
|
|
106
|
+
* One fix AI proposed or ran on the resource: a round the resource's own
|
|
107
|
+
* AI remediation setting produced (AutoRemediationSuggestion.resourceType /
|
|
108
|
+
* resourceId), or any suggestion whose commands ran on the resource.
|
|
109
|
+
*/
|
|
110
|
+
export interface ResourceAiInsightFix {
|
|
111
|
+
id: string;
|
|
112
|
+
// AutoRemediationSuggestionStatus.
|
|
113
|
+
status?: string | undefined;
|
|
114
|
+
// AutoRemediationExecutionMode.
|
|
115
|
+
executionMode?: string | undefined;
|
|
116
|
+
// AutoRemediationSuggestionType.
|
|
117
|
+
suggestionType?: string | undefined;
|
|
118
|
+
// The first RESOURCE_AI_INSIGHTS_RATIONALE_MAX_LENGTH characters.
|
|
119
|
+
rationale?: string | undefined;
|
|
120
|
+
createdAt?: string | undefined;
|
|
121
|
+
approvedAt?: string | undefined;
|
|
122
|
+
incidentId?: string | undefined;
|
|
123
|
+
alertId?: string | undefined;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
export interface ResourceAiInsights {
|
|
127
|
+
resourceType: AiResourceType;
|
|
128
|
+
resourceId: string;
|
|
129
|
+
investigations: Array<ResourceAiInsightInvestigation>;
|
|
130
|
+
fixes: Array<ResourceAiInsightFix>;
|
|
131
|
+
/*
|
|
132
|
+
* Commands AI ran on the resource through its AI agent in the last
|
|
133
|
+
* RESOURCE_AI_INSIGHTS_COMMAND_WINDOW_IN_DAYS days, by kind. The AI agent
|
|
134
|
+
* page's "Test connection" checks are not counted.
|
|
135
|
+
*/
|
|
136
|
+
commandCounts: {
|
|
137
|
+
investigation: number;
|
|
138
|
+
remediation: number;
|
|
139
|
+
};
|
|
140
|
+
}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import Permission, { PermissionHelper } from "../Permission";
|
|
2
|
+
import AiResourceType, {
|
|
3
|
+
AI_RESOURCE_TYPE_INFO,
|
|
4
|
+
} from "../ResourceAiAgent/AiResourceType";
|
|
5
|
+
import { ResourceAiRemediationMode } from "../ResourceAiAgent/ResourceAiAccess";
|
|
6
|
+
|
|
7
|
+
/*
|
|
8
|
+
* Who may change what OneUptime AI is allowed to do on an infrastructure
|
|
9
|
+
* resource reached through a resource AI agent (a Docker, Podman or Docker
|
|
10
|
+
* Swarm host, a Proxmox cluster, a VMware vCenter, a Ceph cluster, a
|
|
11
|
+
* database server or a host), and the words the server and the dashboard
|
|
12
|
+
* use for it.
|
|
13
|
+
*
|
|
14
|
+
* Kept apart from Types/ResourceAiAgent, which the resource AI agent carries
|
|
15
|
+
* a byte-identical copy of and which therefore stays free of the permission
|
|
16
|
+
* catalog.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
/*
|
|
20
|
+
* Who may LOOSEN a resource's AI access: turn AI fixes on (any move up from
|
|
21
|
+
* Off, Ask for approval included) or give them more autonomy (Automatic,
|
|
22
|
+
* Bypass approval), add a command allowlist pattern, and reset the
|
|
23
|
+
* resource's AI agent. A resource's AI mode does the job of a FullAuto
|
|
24
|
+
* AutoRemediationRule without a rule row, so it takes the same set a
|
|
25
|
+
* Kubernetes cluster's AI access takes (KUBERNETES_AI_ACCESS_ADMIN_
|
|
26
|
+
* PERMISSIONS — a Common test pins the two together).
|
|
27
|
+
*
|
|
28
|
+
* Tightening (Off, moving down, removing allowlist patterns or clearing the
|
|
29
|
+
* list) and the investigation switch stay open to anyone who may edit the
|
|
30
|
+
* resource: making AI do less never needs more privilege than the resource
|
|
31
|
+
* itself.
|
|
32
|
+
*/
|
|
33
|
+
export const RESOURCE_AI_ACCESS_ADMIN_PERMISSIONS: Array<Permission> = [
|
|
34
|
+
Permission.ProjectOwner,
|
|
35
|
+
Permission.ProjectAdmin,
|
|
36
|
+
Permission.EditAutoRemediationRule,
|
|
37
|
+
];
|
|
38
|
+
|
|
39
|
+
/*
|
|
40
|
+
* How each resource type is named inside a sentence ("on this Docker host",
|
|
41
|
+
* "on this database server"). AI_RESOURCE_TYPE_INFO's displayName starts
|
|
42
|
+
* every name with a capital, which reads wrong mid-sentence for the two
|
|
43
|
+
* types whose name is a common noun.
|
|
44
|
+
*/
|
|
45
|
+
const RESOURCE_SENTENCE_NAMES: Readonly<Record<AiResourceType, string>> = {
|
|
46
|
+
[AiResourceType.DockerHost]: "Docker host",
|
|
47
|
+
[AiResourceType.PodmanHost]: "Podman host",
|
|
48
|
+
[AiResourceType.DockerSwarmCluster]: "Docker Swarm cluster",
|
|
49
|
+
[AiResourceType.ProxmoxCluster]: "Proxmox cluster",
|
|
50
|
+
[AiResourceType.VMwareVCenter]: "VMware vCenter",
|
|
51
|
+
[AiResourceType.CephCluster]: "Ceph cluster",
|
|
52
|
+
[AiResourceType.DatabaseServer]: "database server",
|
|
53
|
+
[AiResourceType.Host]: "host",
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
export function getResourceSentenceName(resourceType: AiResourceType): string {
|
|
57
|
+
return RESOURCE_SENTENCE_NAMES[resourceType] || "resource";
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// The name of the resource type's AI agent, for sentences ("the Docker AI agent").
|
|
61
|
+
export function getResourceAgentName(resourceType: AiResourceType): string {
|
|
62
|
+
return AI_RESOURCE_TYPE_INFO[resourceType]?.agentDisplayName || "AI agent";
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/*
|
|
66
|
+
* The AI agent page's short name for each remediation mode, used on the
|
|
67
|
+
* resource feed and in messages — the same words a Kubernetes cluster's
|
|
68
|
+
* page uses.
|
|
69
|
+
*/
|
|
70
|
+
export const RESOURCE_AI_REMEDIATION_MODE_LABELS: Readonly<
|
|
71
|
+
Record<ResourceAiRemediationMode, string>
|
|
72
|
+
> = {
|
|
73
|
+
[ResourceAiRemediationMode.Disabled]: "Off",
|
|
74
|
+
[ResourceAiRemediationMode.RequireApproval]: "Ask for approval",
|
|
75
|
+
[ResourceAiRemediationMode.Automatic]: "Automatic",
|
|
76
|
+
[ResourceAiRemediationMode.BypassApproval]: "Bypass approval",
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
/*
|
|
80
|
+
* One valid allowlist entry per resource type — a change that needs
|
|
81
|
+
* approval unless allowlisted — shown as the example in the refusal of a
|
|
82
|
+
* malformed allowlist and usable as the dashboard field's placeholder. A
|
|
83
|
+
* Common test checks each one against the resource command policy.
|
|
84
|
+
*/
|
|
85
|
+
export const RESOURCE_AI_ALLOWLIST_EXAMPLES: Readonly<
|
|
86
|
+
Record<AiResourceType, string>
|
|
87
|
+
> = {
|
|
88
|
+
[AiResourceType.DockerHost]: "docker stop web",
|
|
89
|
+
[AiResourceType.PodmanHost]: "docker stop web",
|
|
90
|
+
[AiResourceType.DockerSwarmCluster]:
|
|
91
|
+
"docker service update --image nginx:1.27 web",
|
|
92
|
+
[AiResourceType.ProxmoxCluster]:
|
|
93
|
+
"pvesh create /nodes/pve1/qemu/100/status/shutdown",
|
|
94
|
+
[AiResourceType.VMwareVCenter]: "govc vm.power -off web-01",
|
|
95
|
+
[AiResourceType.CephCluster]: "ceph osd out 3",
|
|
96
|
+
[AiResourceType.DatabaseServer]: "db terminate-session 12345",
|
|
97
|
+
[AiResourceType.Host]: "systemctl stop nginx",
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
/*
|
|
101
|
+
* The refusal for a caller who tried to make AI do more on a resource
|
|
102
|
+
* without one of RESOURCE_AI_ACCESS_ADMIN_PERMISSIONS: what needs them, who
|
|
103
|
+
* has them, and what stays open to every editor of the resource.
|
|
104
|
+
*/
|
|
105
|
+
export function getResourceAiAccessAdminRefusal(
|
|
106
|
+
resourceType: AiResourceType,
|
|
107
|
+
): string {
|
|
108
|
+
const name: string = getResourceSentenceName(resourceType);
|
|
109
|
+
|
|
110
|
+
return `You need one of these permissions to let OneUptime AI do more on a ${name} (turn AI fixes on or give them more autonomy, or add command allowlist patterns): ${PermissionHelper.getPermissionTitles(
|
|
111
|
+
RESOURCE_AI_ACCESS_ADMIN_PERMISSIONS,
|
|
112
|
+
).join(
|
|
113
|
+
", ",
|
|
114
|
+
)}. Anyone who may edit the ${name} can still turn AI fixes off or down to Ask for approval, and remove allowlist patterns.`;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
// The refusal for a caller who may not reset the resource's AI agent.
|
|
118
|
+
export function getResourceAiAgentResetRefusal(
|
|
119
|
+
resourceType: AiResourceType,
|
|
120
|
+
): string {
|
|
121
|
+
return `You need one of these permissions to reset this ${getResourceSentenceName(
|
|
122
|
+
resourceType,
|
|
123
|
+
)}'s ${getResourceAgentName(resourceType)}: ${PermissionHelper.getPermissionTitles(
|
|
124
|
+
RESOURCE_AI_ACCESS_ADMIN_PERMISSIONS,
|
|
125
|
+
).join(", ")}.`;
|
|
126
|
+
}
|