@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,721 @@
|
|
|
1
|
+
import AIInvestigationEngine, {
|
|
2
|
+
InvestigationRequest,
|
|
3
|
+
} from "../../../../Server/Utils/AI/SRE/AIInvestigationEngine";
|
|
4
|
+
import ObservabilityAssistant, {
|
|
5
|
+
ObservabilityAssistantRequest,
|
|
6
|
+
ObservabilityAssistantResult,
|
|
7
|
+
} from "../../../../Server/Utils/AI/Chat/ObservabilityAssistant";
|
|
8
|
+
import AIConfidenceSignal from "../../../../Server/Utils/AI/SRE/ConfidenceSignal";
|
|
9
|
+
import {
|
|
10
|
+
LIST_INFRASTRUCTURE_ACCESS_TOOL_NAME,
|
|
11
|
+
RUN_INFRASTRUCTURE_COMMAND_TOOL_NAME,
|
|
12
|
+
} from "../../../../Server/Utils/AI/ResourceAccess/ResourceAccessToolNames";
|
|
13
|
+
import AIRunEventService from "../../../../Server/Services/AIRunEventService";
|
|
14
|
+
import AIRunService from "../../../../Server/Services/AIRunService";
|
|
15
|
+
import AIRunEvent from "../../../../Models/DatabaseModels/AIRunEvent";
|
|
16
|
+
import { AIChatCitation } from "../../../../Types/AI/AIChatTypes";
|
|
17
|
+
import {
|
|
18
|
+
LIST_CLUSTER_ACCESS_TOOL_NAME,
|
|
19
|
+
RUN_KUBECTL_TOOL_NAME,
|
|
20
|
+
} from "../../../../Types/Kubernetes/KubernetesClusterAiAccessToolNames";
|
|
21
|
+
import ObjectID from "../../../../Types/ObjectID";
|
|
22
|
+
import PositiveNumber from "../../../../Types/PositiveNumber";
|
|
23
|
+
import {
|
|
24
|
+
InvestigationEvidenceCheckedEntry,
|
|
25
|
+
ParsedInvestigationReport,
|
|
26
|
+
parseInvestigationReport,
|
|
27
|
+
} from "../../../../Utils/AI/InvestigationReport";
|
|
28
|
+
import { afterEach, describe, expect, it, test } from "@jest/globals";
|
|
29
|
+
|
|
30
|
+
/*
|
|
31
|
+
* Contract under test — the posted report and its parser, for commands run
|
|
32
|
+
* on infrastructure resources through their AI agents
|
|
33
|
+
* (run_infrastructure_command, list_infrastructure_access):
|
|
34
|
+
*
|
|
35
|
+
* - such a call is described as what it was ("succeeded", "command
|
|
36
|
+
* returned an error", "N resource(s)"), never in rows, and never counted
|
|
37
|
+
* as a query run across the customer's telemetry;
|
|
38
|
+
* - the footer appends "N infrastructure commands run on your
|
|
39
|
+
* infrastructure" ONLY when the run used those tools, so every report of
|
|
40
|
+
* a run that did not is byte-for-byte what it was (pinned against the
|
|
41
|
+
* engine's previous implementation, copied below);
|
|
42
|
+
* - the dashboard's parser reads every new shape back as the server's
|
|
43
|
+
* block, with the infrastructure count, and still rejects a block the
|
|
44
|
+
* footer's counts show the model wrote.
|
|
45
|
+
*/
|
|
46
|
+
|
|
47
|
+
const aiRunId: ObjectID = ObjectID.generate();
|
|
48
|
+
const projectId: ObjectID = ObjectID.generate();
|
|
49
|
+
|
|
50
|
+
function citation(
|
|
51
|
+
id: string,
|
|
52
|
+
toolName: string,
|
|
53
|
+
rowCount: number,
|
|
54
|
+
label: string,
|
|
55
|
+
): AIChatCitation {
|
|
56
|
+
return { id, toolName, label, rowCount, queryArguments: {} };
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// A null model name is a run that reported none.
|
|
60
|
+
function result(
|
|
61
|
+
citations: Array<AIChatCitation>,
|
|
62
|
+
toolCallCount: number,
|
|
63
|
+
modelName: string | null = "gpt-4.1-mini",
|
|
64
|
+
): ObservabilityAssistantResult {
|
|
65
|
+
return {
|
|
66
|
+
contentInMarkdown: "**Summary** — web-1 is restarting [C1].",
|
|
67
|
+
citations,
|
|
68
|
+
totalTokens: 100,
|
|
69
|
+
llmCallCount: 2,
|
|
70
|
+
toolCallCount,
|
|
71
|
+
...(modelName ? { modelName } : {}),
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/*
|
|
76
|
+
* The engine's buildBrandedMarkdown before infrastructure tools existed,
|
|
77
|
+
* verbatim but for its helper inlined — every run that uses none of them
|
|
78
|
+
* must still post exactly this.
|
|
79
|
+
*/
|
|
80
|
+
function legacyBuildBrandedMarkdown(
|
|
81
|
+
res: ObservabilityAssistantResult,
|
|
82
|
+
analysisMarkdown: string,
|
|
83
|
+
clusterToolCallCount: number = 0,
|
|
84
|
+
): string {
|
|
85
|
+
const describeClusterCitationOutcome: (
|
|
86
|
+
cited: AIChatCitation,
|
|
87
|
+
) => string | null = (cited: AIChatCitation): string | null => {
|
|
88
|
+
if (cited.toolName === RUN_KUBECTL_TOOL_NAME) {
|
|
89
|
+
return cited.rowCount > 0 ? "succeeded" : "kubectl returned an error";
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
if (cited.toolName === LIST_CLUSTER_ACCESS_TOOL_NAME) {
|
|
93
|
+
return `${cited.rowCount} cluster(s)`;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
return null;
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
let markdown: string = `## 🧠 AI — Automated Root Cause Analysis\n\n${analysisMarkdown}`;
|
|
100
|
+
|
|
101
|
+
const citations: Array<AIChatCitation> = res.citations || [];
|
|
102
|
+
|
|
103
|
+
if (citations.length > 0) {
|
|
104
|
+
markdown += `\n\n**Evidence checked**`;
|
|
105
|
+
for (const cited of citations.slice(0, 15)) {
|
|
106
|
+
const clusterOutcome: string | null =
|
|
107
|
+
describeClusterCitationOutcome(cited);
|
|
108
|
+
|
|
109
|
+
if (clusterOutcome !== null) {
|
|
110
|
+
markdown += `\n- **[${cited.id}]** ${cited.label} — ${clusterOutcome}`;
|
|
111
|
+
continue;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
markdown += `\n- **[${cited.id}]** ${cited.label} — ${cited.rowCount} row(s)`;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
if (clusterToolCallCount <= 0) {
|
|
119
|
+
markdown += `\n\n---\n*Investigated automatically by OneUptime AI — read-only, ${res.toolCallCount} quer${
|
|
120
|
+
res.toolCallCount === 1 ? "y" : "ies"
|
|
121
|
+
} run across your own telemetry${
|
|
122
|
+
res.modelName ? ` using ${res.modelName}` : ""
|
|
123
|
+
}. This is an AI-generated first pass; verify before acting.*`;
|
|
124
|
+
|
|
125
|
+
return markdown;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
const telemetryQueryCount: number = Math.max(
|
|
129
|
+
0,
|
|
130
|
+
res.toolCallCount - clusterToolCallCount,
|
|
131
|
+
);
|
|
132
|
+
const kubectlCommandCount: number = citations.filter(
|
|
133
|
+
(cited: AIChatCitation): boolean => {
|
|
134
|
+
return cited.toolName === RUN_KUBECTL_TOOL_NAME;
|
|
135
|
+
},
|
|
136
|
+
).length;
|
|
137
|
+
const counts: Array<string> = [];
|
|
138
|
+
|
|
139
|
+
if (telemetryQueryCount > 0) {
|
|
140
|
+
counts.push(
|
|
141
|
+
`${telemetryQueryCount} quer${
|
|
142
|
+
telemetryQueryCount === 1 ? "y" : "ies"
|
|
143
|
+
} run across your own telemetry`,
|
|
144
|
+
);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
if (kubectlCommandCount > 0) {
|
|
148
|
+
counts.push(
|
|
149
|
+
`${kubectlCommandCount} kubectl ${
|
|
150
|
+
kubectlCommandCount === 1 ? "command" : "commands"
|
|
151
|
+
} run on your Kubernetes clusters`,
|
|
152
|
+
);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
if (counts.length === 0) {
|
|
156
|
+
counts.push("no telemetry queries or kubectl commands run");
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
markdown += `\n\n---\n*Investigated automatically by OneUptime AI — read-only, ${counts.join(
|
|
160
|
+
" and ",
|
|
161
|
+
)}${
|
|
162
|
+
res.modelName ? ` using ${res.modelName}` : ""
|
|
163
|
+
}. This is an AI-generated first pass; verify before acting.*`;
|
|
164
|
+
|
|
165
|
+
return markdown;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
const INFRA_CITATIONS: Array<AIChatCitation> = [
|
|
169
|
+
citation("C1", "query_metrics", 5, "Max(restarts)"),
|
|
170
|
+
citation(
|
|
171
|
+
"C2",
|
|
172
|
+
RUN_INFRASTRUCTURE_COMMAND_TOOL_NAME,
|
|
173
|
+
1,
|
|
174
|
+
'`docker ps -a` on Docker host "web-1"',
|
|
175
|
+
),
|
|
176
|
+
citation(
|
|
177
|
+
"C3",
|
|
178
|
+
RUN_INFRASTRUCTURE_COMMAND_TOOL_NAME,
|
|
179
|
+
0,
|
|
180
|
+
'`docker logs --tail 200 web` on Docker host "web-1"',
|
|
181
|
+
),
|
|
182
|
+
citation(
|
|
183
|
+
"C4",
|
|
184
|
+
LIST_INFRASTRUCTURE_ACCESS_TOOL_NAME,
|
|
185
|
+
2,
|
|
186
|
+
"Infrastructure OneUptime AI can inspect",
|
|
187
|
+
),
|
|
188
|
+
];
|
|
189
|
+
|
|
190
|
+
describe("AIInvestigationEngine.buildBrandedMarkdown and infrastructure commands", () => {
|
|
191
|
+
it("describes each infrastructure citation by its outcome, never in rows", () => {
|
|
192
|
+
const markdown: string = AIInvestigationEngine.buildBrandedMarkdown(
|
|
193
|
+
result(INFRA_CITATIONS, 5),
|
|
194
|
+
"**Summary** — x.",
|
|
195
|
+
0,
|
|
196
|
+
4,
|
|
197
|
+
);
|
|
198
|
+
|
|
199
|
+
expect(markdown).toContain(
|
|
200
|
+
'- **[C2]** `docker ps -a` on Docker host "web-1" — succeeded',
|
|
201
|
+
);
|
|
202
|
+
expect(markdown).toContain(
|
|
203
|
+
'- **[C3]** `docker logs --tail 200 web` on Docker host "web-1" — command returned an error',
|
|
204
|
+
);
|
|
205
|
+
expect(markdown).toContain(
|
|
206
|
+
"- **[C4]** Infrastructure OneUptime AI can inspect — 2 resource(s)",
|
|
207
|
+
);
|
|
208
|
+
expect(markdown).toContain("- **[C1]** Max(restarts) — 5 row(s)");
|
|
209
|
+
expect(markdown).not.toMatch(/docker[^\n]*row\(s\)/);
|
|
210
|
+
});
|
|
211
|
+
|
|
212
|
+
it("counts telemetry queries and infrastructure commands apart", () => {
|
|
213
|
+
const markdown: string = AIInvestigationEngine.buildBrandedMarkdown(
|
|
214
|
+
result(INFRA_CITATIONS, 5),
|
|
215
|
+
"**Summary** — x.",
|
|
216
|
+
0,
|
|
217
|
+
4,
|
|
218
|
+
);
|
|
219
|
+
|
|
220
|
+
expect(markdown).toContain(
|
|
221
|
+
"*Investigated automatically by OneUptime AI — read-only, 1 query run across your own telemetry and 2 infrastructure commands run on your infrastructure using gpt-4.1-mini. This is an AI-generated first pass; verify before acting.*",
|
|
222
|
+
);
|
|
223
|
+
});
|
|
224
|
+
|
|
225
|
+
it("joins three counts as A, B and C", () => {
|
|
226
|
+
const markdown: string = AIInvestigationEngine.buildBrandedMarkdown(
|
|
227
|
+
result(
|
|
228
|
+
[
|
|
229
|
+
citation("C1", "search_logs", 3, "Logs"),
|
|
230
|
+
citation("C2", RUN_KUBECTL_TOOL_NAME, 1, "kubectl get pods"),
|
|
231
|
+
citation(
|
|
232
|
+
"C3",
|
|
233
|
+
RUN_INFRASTRUCTURE_COMMAND_TOOL_NAME,
|
|
234
|
+
1,
|
|
235
|
+
'`uptime` on Host "db"',
|
|
236
|
+
),
|
|
237
|
+
],
|
|
238
|
+
4,
|
|
239
|
+
),
|
|
240
|
+
"**Summary** — x.",
|
|
241
|
+
1,
|
|
242
|
+
1,
|
|
243
|
+
);
|
|
244
|
+
|
|
245
|
+
expect(markdown).toContain(
|
|
246
|
+
"— read-only, 2 queries run across your own telemetry, 1 kubectl command run on your Kubernetes clusters and 1 infrastructure command run on your infrastructure using gpt-4.1-mini.",
|
|
247
|
+
);
|
|
248
|
+
});
|
|
249
|
+
|
|
250
|
+
it("names only infrastructure when that is all that ran", () => {
|
|
251
|
+
const markdown: string = AIInvestigationEngine.buildBrandedMarkdown(
|
|
252
|
+
result(
|
|
253
|
+
[
|
|
254
|
+
citation(
|
|
255
|
+
"C1",
|
|
256
|
+
RUN_INFRASTRUCTURE_COMMAND_TOOL_NAME,
|
|
257
|
+
1,
|
|
258
|
+
'`ceph health detail` on Ceph cluster "ceph"',
|
|
259
|
+
),
|
|
260
|
+
],
|
|
261
|
+
1,
|
|
262
|
+
),
|
|
263
|
+
"**Summary** — x.",
|
|
264
|
+
0,
|
|
265
|
+
1,
|
|
266
|
+
);
|
|
267
|
+
|
|
268
|
+
expect(markdown).toContain(
|
|
269
|
+
"— read-only, 1 infrastructure command run on your infrastructure using gpt-4.1-mini.",
|
|
270
|
+
);
|
|
271
|
+
expect(markdown).not.toContain("quer");
|
|
272
|
+
});
|
|
273
|
+
|
|
274
|
+
it("says nothing ran when the infrastructure calls ran nothing", () => {
|
|
275
|
+
expect(
|
|
276
|
+
AIInvestigationEngine.buildBrandedMarkdown(
|
|
277
|
+
result(
|
|
278
|
+
[citation("C1", LIST_INFRASTRUCTURE_ACCESS_TOOL_NAME, 1, "Infra")],
|
|
279
|
+
2,
|
|
280
|
+
),
|
|
281
|
+
"**Summary** — x.",
|
|
282
|
+
0,
|
|
283
|
+
2,
|
|
284
|
+
),
|
|
285
|
+
).toContain(
|
|
286
|
+
"— read-only, no telemetry queries or infrastructure commands run using gpt-4.1-mini.",
|
|
287
|
+
);
|
|
288
|
+
|
|
289
|
+
expect(
|
|
290
|
+
AIInvestigationEngine.buildBrandedMarkdown(
|
|
291
|
+
result([], 3),
|
|
292
|
+
"**Summary** — x.",
|
|
293
|
+
1,
|
|
294
|
+
2,
|
|
295
|
+
),
|
|
296
|
+
).toContain(
|
|
297
|
+
"— read-only, no telemetry queries, kubectl commands or infrastructure commands run using gpt-4.1-mini.",
|
|
298
|
+
);
|
|
299
|
+
});
|
|
300
|
+
|
|
301
|
+
it("writes no model name when the run has none", () => {
|
|
302
|
+
expect(
|
|
303
|
+
AIInvestigationEngine.buildBrandedMarkdown(
|
|
304
|
+
result(INFRA_CITATIONS, 5, null),
|
|
305
|
+
"**Summary** — x.",
|
|
306
|
+
0,
|
|
307
|
+
4,
|
|
308
|
+
),
|
|
309
|
+
).toContain(
|
|
310
|
+
"and 2 infrastructure commands run on your infrastructure. This is an AI-generated first pass; verify before acting.*",
|
|
311
|
+
);
|
|
312
|
+
});
|
|
313
|
+
|
|
314
|
+
/*
|
|
315
|
+
* Byte identity: a run that never used an infrastructure tool posts
|
|
316
|
+
* exactly what the engine posted before those tools existed.
|
|
317
|
+
*/
|
|
318
|
+
const LEGACY_SHAPES: Array<
|
|
319
|
+
[string, Array<AIChatCitation>, number, number, string | null]
|
|
320
|
+
> = [
|
|
321
|
+
["telemetry only", [citation("C1", "search_logs", 3, "Logs")], 1, 0, "m"],
|
|
322
|
+
["telemetry, plural", [citation("C1", "query_metrics", 5, "M")], 7, 0, "m"],
|
|
323
|
+
["no citations", [], 0, 0, "m"],
|
|
324
|
+
["no model", [citation("C1", "search_logs", 1, "Logs")], 1, 0, null],
|
|
325
|
+
[
|
|
326
|
+
"kubectl and telemetry",
|
|
327
|
+
[
|
|
328
|
+
citation("C1", "query_metrics", 5, "Max(latency)"),
|
|
329
|
+
citation("C2", RUN_KUBECTL_TOOL_NAME, 0, "kubectl get pods"),
|
|
330
|
+
citation("C3", RUN_KUBECTL_TOOL_NAME, 1, "kubectl describe pod"),
|
|
331
|
+
citation("C4", LIST_CLUSTER_ACCESS_TOOL_NAME, 2, "Clusters"),
|
|
332
|
+
],
|
|
333
|
+
6,
|
|
334
|
+
4,
|
|
335
|
+
"gpt-4.1-mini",
|
|
336
|
+
],
|
|
337
|
+
[
|
|
338
|
+
"kubectl only",
|
|
339
|
+
[citation("C1", RUN_KUBECTL_TOOL_NAME, 1, "kubectl get pods")],
|
|
340
|
+
1,
|
|
341
|
+
1,
|
|
342
|
+
"gpt-4.1-mini",
|
|
343
|
+
],
|
|
344
|
+
[
|
|
345
|
+
"a cluster listing only",
|
|
346
|
+
[citation("C1", LIST_CLUSTER_ACCESS_TOOL_NAME, 1, "Clusters")],
|
|
347
|
+
2,
|
|
348
|
+
2,
|
|
349
|
+
"gpt-4.1-mini",
|
|
350
|
+
],
|
|
351
|
+
[
|
|
352
|
+
"more than 15 citations",
|
|
353
|
+
Array.from({ length: 20 }, (_value: unknown, index: number) => {
|
|
354
|
+
return citation(`C${index + 1}`, "search_logs", index, `Logs ${index}`);
|
|
355
|
+
}),
|
|
356
|
+
20,
|
|
357
|
+
0,
|
|
358
|
+
"m",
|
|
359
|
+
],
|
|
360
|
+
];
|
|
361
|
+
|
|
362
|
+
test.each(LEGACY_SHAPES)(
|
|
363
|
+
"posts exactly what it always has for %s",
|
|
364
|
+
(
|
|
365
|
+
_label: string,
|
|
366
|
+
citations: Array<AIChatCitation>,
|
|
367
|
+
toolCallCount: number,
|
|
368
|
+
clusterToolCallCount: number,
|
|
369
|
+
modelName: string | null,
|
|
370
|
+
) => {
|
|
371
|
+
const res: ObservabilityAssistantResult = result(
|
|
372
|
+
citations,
|
|
373
|
+
toolCallCount,
|
|
374
|
+
modelName,
|
|
375
|
+
);
|
|
376
|
+
const expected: string = legacyBuildBrandedMarkdown(
|
|
377
|
+
res,
|
|
378
|
+
"**Summary** — x.",
|
|
379
|
+
clusterToolCallCount,
|
|
380
|
+
);
|
|
381
|
+
|
|
382
|
+
expect(
|
|
383
|
+
AIInvestigationEngine.buildBrandedMarkdown(
|
|
384
|
+
res,
|
|
385
|
+
"**Summary** — x.",
|
|
386
|
+
clusterToolCallCount,
|
|
387
|
+
),
|
|
388
|
+
).toBe(expected);
|
|
389
|
+
expect(
|
|
390
|
+
AIInvestigationEngine.buildBrandedMarkdown(
|
|
391
|
+
res,
|
|
392
|
+
"**Summary** — x.",
|
|
393
|
+
clusterToolCallCount,
|
|
394
|
+
0,
|
|
395
|
+
),
|
|
396
|
+
).toBe(expected);
|
|
397
|
+
},
|
|
398
|
+
);
|
|
399
|
+
});
|
|
400
|
+
|
|
401
|
+
describe("parseInvestigationReport reads the infrastructure footer and evidence", () => {
|
|
402
|
+
function parse(
|
|
403
|
+
citations: Array<AIChatCitation>,
|
|
404
|
+
toolCallCount: number,
|
|
405
|
+
clusterToolCallCount: number,
|
|
406
|
+
infrastructureToolCallCount: number,
|
|
407
|
+
): ParsedInvestigationReport {
|
|
408
|
+
return parseInvestigationReport(
|
|
409
|
+
AIInvestigationEngine.buildBrandedMarkdown(
|
|
410
|
+
result(citations, toolCallCount),
|
|
411
|
+
"**Summary** — web-1 is restarting.\n\n**Most likely root cause** — x.",
|
|
412
|
+
clusterToolCallCount,
|
|
413
|
+
infrastructureToolCallCount,
|
|
414
|
+
),
|
|
415
|
+
);
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
function ids(report: ParsedInvestigationReport): Array<string> {
|
|
419
|
+
return report.evidenceChecked.map(
|
|
420
|
+
(entry: InvestigationEvidenceCheckedEntry): string => {
|
|
421
|
+
return entry.citationId;
|
|
422
|
+
},
|
|
423
|
+
);
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
test.each<[string, Array<AIChatCitation>, number, number, number]>([
|
|
427
|
+
["telemetry and infrastructure", INFRA_CITATIONS, 5, 0, 4],
|
|
428
|
+
[
|
|
429
|
+
"infrastructure only",
|
|
430
|
+
[
|
|
431
|
+
citation(
|
|
432
|
+
"C1",
|
|
433
|
+
RUN_INFRASTRUCTURE_COMMAND_TOOL_NAME,
|
|
434
|
+
1,
|
|
435
|
+
'`a` on Host "h"',
|
|
436
|
+
),
|
|
437
|
+
citation(
|
|
438
|
+
"C2",
|
|
439
|
+
RUN_INFRASTRUCTURE_COMMAND_TOOL_NAME,
|
|
440
|
+
0,
|
|
441
|
+
'`b` on Host "h"',
|
|
442
|
+
),
|
|
443
|
+
],
|
|
444
|
+
2,
|
|
445
|
+
0,
|
|
446
|
+
2,
|
|
447
|
+
],
|
|
448
|
+
[
|
|
449
|
+
"a resource listing only",
|
|
450
|
+
[citation("C1", LIST_INFRASTRUCTURE_ACCESS_TOOL_NAME, 1, "Infra")],
|
|
451
|
+
1,
|
|
452
|
+
0,
|
|
453
|
+
1,
|
|
454
|
+
],
|
|
455
|
+
[
|
|
456
|
+
"all three",
|
|
457
|
+
[
|
|
458
|
+
citation("C1", "search_logs", 3, "Logs"),
|
|
459
|
+
citation("C2", RUN_KUBECTL_TOOL_NAME, 1, "kubectl get pods"),
|
|
460
|
+
citation("C3", RUN_KUBECTL_TOOL_NAME, 0, "kubectl get nodes"),
|
|
461
|
+
citation(
|
|
462
|
+
"C4",
|
|
463
|
+
RUN_INFRASTRUCTURE_COMMAND_TOOL_NAME,
|
|
464
|
+
1,
|
|
465
|
+
'`uptime` on Host "h"',
|
|
466
|
+
),
|
|
467
|
+
citation("C5", LIST_CLUSTER_ACCESS_TOOL_NAME, 1, "Clusters"),
|
|
468
|
+
citation("C6", LIST_INFRASTRUCTURE_ACCESS_TOOL_NAME, 1, "Infra"),
|
|
469
|
+
],
|
|
470
|
+
7,
|
|
471
|
+
3,
|
|
472
|
+
2,
|
|
473
|
+
],
|
|
474
|
+
])(
|
|
475
|
+
"keeps the %s evidence block the server's",
|
|
476
|
+
(
|
|
477
|
+
_label: string,
|
|
478
|
+
citations: Array<AIChatCitation>,
|
|
479
|
+
toolCallCount: number,
|
|
480
|
+
clusterToolCallCount: number,
|
|
481
|
+
infrastructureToolCallCount: number,
|
|
482
|
+
) => {
|
|
483
|
+
const report: ParsedInvestigationReport = parse(
|
|
484
|
+
citations,
|
|
485
|
+
toolCallCount,
|
|
486
|
+
clusterToolCallCount,
|
|
487
|
+
infrastructureToolCallCount,
|
|
488
|
+
);
|
|
489
|
+
|
|
490
|
+
expect(report.bodyMarkdown).not.toContain("Evidence checked");
|
|
491
|
+
expect(report.footer?.modelName).toBe("gpt-4.1-mini");
|
|
492
|
+
expect(ids(report)).toEqual(
|
|
493
|
+
citations.map((cited: AIChatCitation): string => {
|
|
494
|
+
return cited.id;
|
|
495
|
+
}),
|
|
496
|
+
);
|
|
497
|
+
},
|
|
498
|
+
);
|
|
499
|
+
|
|
500
|
+
it("reads the footer's counts", () => {
|
|
501
|
+
const report: ParsedInvestigationReport = parse(INFRA_CITATIONS, 5, 0, 4);
|
|
502
|
+
|
|
503
|
+
expect(report.footer?.queryCount).toBe(1);
|
|
504
|
+
expect(report.footer?.infrastructureCommandCount).toBe(2);
|
|
505
|
+
expect(report.footer?.kubectlCommandCount).toBeUndefined();
|
|
506
|
+
});
|
|
507
|
+
|
|
508
|
+
it("reads the three-part footer", () => {
|
|
509
|
+
const report: ParsedInvestigationReport = parse(
|
|
510
|
+
[
|
|
511
|
+
citation("C1", "search_logs", 3, "Logs"),
|
|
512
|
+
citation("C2", RUN_KUBECTL_TOOL_NAME, 1, "kubectl get pods"),
|
|
513
|
+
citation(
|
|
514
|
+
"C3",
|
|
515
|
+
RUN_INFRASTRUCTURE_COMMAND_TOOL_NAME,
|
|
516
|
+
1,
|
|
517
|
+
'`uptime` on Host "h"',
|
|
518
|
+
),
|
|
519
|
+
],
|
|
520
|
+
4,
|
|
521
|
+
1,
|
|
522
|
+
1,
|
|
523
|
+
);
|
|
524
|
+
|
|
525
|
+
expect(report.footer?.queryCount).toBe(2);
|
|
526
|
+
expect(report.footer?.kubectlCommandCount).toBe(1);
|
|
527
|
+
expect(report.footer?.infrastructureCommandCount).toBe(1);
|
|
528
|
+
});
|
|
529
|
+
|
|
530
|
+
it("reads the nothing-run footers as zero counts", () => {
|
|
531
|
+
const infraOnly: ParsedInvestigationReport = parse(
|
|
532
|
+
[citation("C1", LIST_INFRASTRUCTURE_ACCESS_TOOL_NAME, 1, "Infra")],
|
|
533
|
+
2,
|
|
534
|
+
0,
|
|
535
|
+
2,
|
|
536
|
+
);
|
|
537
|
+
|
|
538
|
+
expect(infraOnly.footer?.queryCount).toBe(0);
|
|
539
|
+
expect(infraOnly.footer?.infrastructureCommandCount).toBe(0);
|
|
540
|
+
expect(infraOnly.footer?.kubectlCommandCount).toBeUndefined();
|
|
541
|
+
expect(ids(infraOnly)).toEqual(["C1"]);
|
|
542
|
+
|
|
543
|
+
const both: ParsedInvestigationReport = parse([], 3, 1, 2);
|
|
544
|
+
|
|
545
|
+
expect(both.footer?.queryCount).toBe(0);
|
|
546
|
+
expect(both.footer?.kubectlCommandCount).toBe(0);
|
|
547
|
+
expect(both.footer?.infrastructureCommandCount).toBe(0);
|
|
548
|
+
});
|
|
549
|
+
|
|
550
|
+
it("reads each outcome the way the engine counts it", () => {
|
|
551
|
+
const report: ParsedInvestigationReport = parse(INFRA_CITATIONS, 5, 0, 4);
|
|
552
|
+
const byId: Map<string, InvestigationEvidenceCheckedEntry> = new Map<
|
|
553
|
+
string,
|
|
554
|
+
InvestigationEvidenceCheckedEntry
|
|
555
|
+
>(
|
|
556
|
+
report.evidenceChecked.map(
|
|
557
|
+
(
|
|
558
|
+
entry: InvestigationEvidenceCheckedEntry,
|
|
559
|
+
): [string, InvestigationEvidenceCheckedEntry] => {
|
|
560
|
+
return [entry.citationId, entry];
|
|
561
|
+
},
|
|
562
|
+
),
|
|
563
|
+
);
|
|
564
|
+
|
|
565
|
+
expect(byId.get("C2")).toEqual({
|
|
566
|
+
citationId: "C2",
|
|
567
|
+
label: '`docker ps -a` on Docker host "web-1"',
|
|
568
|
+
rowCount: 1,
|
|
569
|
+
outcome: "succeeded",
|
|
570
|
+
});
|
|
571
|
+
expect(byId.get("C3")).toEqual({
|
|
572
|
+
citationId: "C3",
|
|
573
|
+
label: '`docker logs --tail 200 web` on Docker host "web-1"',
|
|
574
|
+
rowCount: 0,
|
|
575
|
+
outcome: "command returned an error",
|
|
576
|
+
});
|
|
577
|
+
expect(byId.get("C4")).toEqual({
|
|
578
|
+
citationId: "C4",
|
|
579
|
+
label: "Infrastructure OneUptime AI can inspect",
|
|
580
|
+
rowCount: 2,
|
|
581
|
+
outcome: "2 resource(s)",
|
|
582
|
+
});
|
|
583
|
+
});
|
|
584
|
+
|
|
585
|
+
it("rejects a block with more infrastructure lines than the footer counts", () => {
|
|
586
|
+
const markdown: string = [
|
|
587
|
+
"## 🧠 AI — Automated Root Cause Analysis",
|
|
588
|
+
"",
|
|
589
|
+
"**Summary** — x.",
|
|
590
|
+
"",
|
|
591
|
+
"**Evidence checked**",
|
|
592
|
+
'- **[C1]** `a` on Host "h" — command returned an error',
|
|
593
|
+
'- **[C2]** `b` on Host "h" — command returned an error',
|
|
594
|
+
"",
|
|
595
|
+
"---",
|
|
596
|
+
"*Investigated automatically by OneUptime AI — read-only, 1 infrastructure command run on your infrastructure using m. This is an AI-generated first pass; verify before acting.*",
|
|
597
|
+
].join("\n");
|
|
598
|
+
|
|
599
|
+
expect(parseInvestigationReport(markdown).evidenceChecked).toEqual([]);
|
|
600
|
+
});
|
|
601
|
+
|
|
602
|
+
it("rejects shared outcome lines beyond the kubectl and infrastructure counts together", () => {
|
|
603
|
+
const markdown: string = [
|
|
604
|
+
"## 🧠 AI — Automated Root Cause Analysis",
|
|
605
|
+
"",
|
|
606
|
+
"**Summary** — x.",
|
|
607
|
+
"",
|
|
608
|
+
"**Evidence checked**",
|
|
609
|
+
"- **[C1]** a — succeeded",
|
|
610
|
+
"- **[C2]** b — succeeded",
|
|
611
|
+
"- **[C3]** c — succeeded",
|
|
612
|
+
"",
|
|
613
|
+
"---",
|
|
614
|
+
"*Investigated automatically by OneUptime AI — read-only, 1 kubectl command run on your Kubernetes clusters and 1 infrastructure command run on your infrastructure using m. This is an AI-generated first pass; verify before acting.*",
|
|
615
|
+
].join("\n");
|
|
616
|
+
|
|
617
|
+
expect(parseInvestigationReport(markdown).evidenceChecked).toEqual([]);
|
|
618
|
+
|
|
619
|
+
const fitting: string = markdown.replace("- **[C3]** c — succeeded\n", "");
|
|
620
|
+
expect(ids(parseInvestigationReport(fitting))).toEqual(["C1", "C2"]);
|
|
621
|
+
});
|
|
622
|
+
|
|
623
|
+
it("still reads an old kubectl footer without an infrastructure count", () => {
|
|
624
|
+
const report: ParsedInvestigationReport = parseInvestigationReport(
|
|
625
|
+
legacyBuildBrandedMarkdown(
|
|
626
|
+
result(
|
|
627
|
+
[
|
|
628
|
+
citation("C1", "query_metrics", 5, "M"),
|
|
629
|
+
citation("C2", RUN_KUBECTL_TOOL_NAME, 1, "kubectl get pods"),
|
|
630
|
+
],
|
|
631
|
+
2,
|
|
632
|
+
),
|
|
633
|
+
"**Summary** — x.",
|
|
634
|
+
1,
|
|
635
|
+
),
|
|
636
|
+
);
|
|
637
|
+
|
|
638
|
+
expect(report.footer?.queryCount).toBe(1);
|
|
639
|
+
expect(report.footer?.kubectlCommandCount).toBe(1);
|
|
640
|
+
expect(report.footer?.infrastructureCommandCount).toBeUndefined();
|
|
641
|
+
expect(ids(report)).toEqual(["C1", "C2"]);
|
|
642
|
+
});
|
|
643
|
+
});
|
|
644
|
+
|
|
645
|
+
describe("AIInvestigationEngine counts the infrastructure calls a run started", () => {
|
|
646
|
+
afterEach(() => {
|
|
647
|
+
jest.restoreAllMocks();
|
|
648
|
+
});
|
|
649
|
+
|
|
650
|
+
it("posts the report with the infrastructure calls apart from telemetry", async () => {
|
|
651
|
+
jest
|
|
652
|
+
.spyOn(AIRunEventService, "countBy")
|
|
653
|
+
.mockResolvedValue(new PositiveNumber(0));
|
|
654
|
+
jest
|
|
655
|
+
.spyOn(AIRunEventService, "create")
|
|
656
|
+
.mockResolvedValue({} as unknown as AIRunEvent);
|
|
657
|
+
jest.spyOn(AIRunService, "attemptStatusTransition").mockResolvedValue(1);
|
|
658
|
+
jest
|
|
659
|
+
.spyOn(AIConfidenceSignal, "computeConfidenceSignal")
|
|
660
|
+
.mockResolvedValue({
|
|
661
|
+
confident: true,
|
|
662
|
+
codeFixRecommended: false,
|
|
663
|
+
source: "classification",
|
|
664
|
+
});
|
|
665
|
+
jest
|
|
666
|
+
.spyOn(ObservabilityAssistant, "answerQuestion")
|
|
667
|
+
.mockImplementation(
|
|
668
|
+
async (
|
|
669
|
+
data: ObservabilityAssistantRequest,
|
|
670
|
+
): Promise<ObservabilityAssistantResult> => {
|
|
671
|
+
for (const toolName of [
|
|
672
|
+
"query_metrics",
|
|
673
|
+
LIST_INFRASTRUCTURE_ACCESS_TOOL_NAME,
|
|
674
|
+
RUN_INFRASTRUCTURE_COMMAND_TOOL_NAME,
|
|
675
|
+
RUN_INFRASTRUCTURE_COMMAND_TOOL_NAME,
|
|
676
|
+
RUN_KUBECTL_TOOL_NAME,
|
|
677
|
+
]) {
|
|
678
|
+
await data.onStep!({ type: "tool_started", toolName });
|
|
679
|
+
}
|
|
680
|
+
return result(
|
|
681
|
+
[
|
|
682
|
+
citation("C1", "query_metrics", 5, "Max(restarts)"),
|
|
683
|
+
citation(
|
|
684
|
+
"C2",
|
|
685
|
+
RUN_INFRASTRUCTURE_COMMAND_TOOL_NAME,
|
|
686
|
+
1,
|
|
687
|
+
'`docker ps -a` on Docker host "web-1"',
|
|
688
|
+
),
|
|
689
|
+
citation("C3", RUN_KUBECTL_TOOL_NAME, 1, "kubectl get pods"),
|
|
690
|
+
],
|
|
691
|
+
5,
|
|
692
|
+
);
|
|
693
|
+
},
|
|
694
|
+
);
|
|
695
|
+
const postAnalysis: jest.Mock = jest.fn(async (): Promise<void> => {});
|
|
696
|
+
|
|
697
|
+
await AIInvestigationEngine.executeRun({
|
|
698
|
+
aiRunId,
|
|
699
|
+
projectId,
|
|
700
|
+
attemptCount: 1,
|
|
701
|
+
request: {
|
|
702
|
+
feature: "Test Investigation",
|
|
703
|
+
contextSummary: "# Subject",
|
|
704
|
+
postAnalysis:
|
|
705
|
+
postAnalysis as unknown as InvestigationRequest["postAnalysis"],
|
|
706
|
+
},
|
|
707
|
+
});
|
|
708
|
+
|
|
709
|
+
expect(postAnalysis).toHaveBeenCalledTimes(1);
|
|
710
|
+
const posted: string = (
|
|
711
|
+
postAnalysis.mock.calls[0]![0] as { analysisMarkdown: string }
|
|
712
|
+
).analysisMarkdown;
|
|
713
|
+
|
|
714
|
+
expect(posted).toContain(
|
|
715
|
+
"read-only, 1 query run across your own telemetry, 1 kubectl command run on your Kubernetes clusters and 1 infrastructure command run on your infrastructure",
|
|
716
|
+
);
|
|
717
|
+
expect(posted).toContain(
|
|
718
|
+
'- **[C2]** `docker ps -a` on Docker host "web-1" — succeeded',
|
|
719
|
+
);
|
|
720
|
+
});
|
|
721
|
+
});
|