@oneuptime/common 11.5.8 → 11.5.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/AnalyticsModels/Index.ts +13 -0
- package/Models/AnalyticsModels/MetricItemAggMV1mByContainer.ts +178 -0
- package/Models/AnalyticsModels/MetricItemAggMV1mByK8sCluster.ts +179 -0
- package/Models/AnalyticsModels/MetricItemAggMV1mByService.ts +179 -0
- package/Models/AnalyticsModels/NetworkFlow.ts +397 -0
- package/Models/DatabaseModels/AIAgentTaskPullRequest.ts +15 -6
- package/Models/DatabaseModels/AIRun.ts +37 -0
- package/Models/DatabaseModels/AIRunEvent.ts +34 -1
- package/Models/DatabaseModels/EnterpriseLicenseInstance.ts +18 -0
- package/Models/DatabaseModels/GlobalConfig.ts +36 -0
- package/Models/DatabaseModels/Index.ts +2 -0
- package/Models/DatabaseModels/MarketingConversion.ts +198 -0
- package/Models/DatabaseModels/MetricSavedView.ts +34 -0
- package/Models/DatabaseModels/MetricType.ts +74 -0
- package/Models/DatabaseModels/NetworkDevice.ts +332 -0
- package/Models/DatabaseModels/NetworkDeviceDiscoveryScan.ts +328 -0
- package/Models/DatabaseModels/NetworkInterface.ts +58 -0
- package/Models/DatabaseModels/Project.ts +62 -0
- package/Models/DatabaseModels/StatusPage.ts +42 -0
- package/Models/DatabaseModels/User.ts +37 -0
- package/Server/API/AIAgentTaskAPI.ts +38 -12
- package/Server/API/AIAgentTaskLogAPI.ts +49 -0
- package/Server/API/AIChatAPI.ts +16 -0
- package/Server/API/AIReadinessAPI.ts +84 -0
- package/Server/API/BaseAnalyticsAPI.ts +23 -0
- package/Server/API/CodeFixRunAPI.ts +182 -0
- package/Server/API/EnterpriseLicenseAPI.ts +14 -0
- package/Server/API/TelemetryExceptionAPI.ts +6 -1
- package/Server/EnvironmentConfig.ts +84 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1784124919694-AddAITaskNumberAndRunTranscript.ts +95 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1784135099754-AllowNullAiAgentOnPullRequest.ts +52 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1784137457184-AddEnableMcpServerToStatusPage.ts +30 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1784191414522-AddCounterSemanticsToMetricType.ts +38 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1784191414600-AddViewTypeToMetricSavedView.ts +28 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1784200000000-AddSnmpV3ColumnsToNetworkDeviceDiscoveryScan.ts +49 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1784211212164-AddNetworkDeviceInventoryAndDiscoverySchedule.ts +108 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1784218257664-AddEnterpriseLicenseNotificationColumns.ts +31 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1784293516000-AddAttributionColumnsToUserAndProject.ts +29 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1784298000000-AddMarketingConversionTable.ts +35 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/Index.ts +20 -0
- package/Server/Services/AIRunEventService.ts +15 -1
- package/Server/Services/AIRunService.ts +38 -1
- package/Server/Services/AnalyticsDatabaseService.ts +70 -1
- package/Server/Services/IncidentService.ts +13 -0
- package/Server/Services/Index.ts +10 -0
- package/Server/Services/LlmProviderService.ts +2 -0
- package/Server/Services/MarketingConversionService.ts +10 -0
- package/Server/Services/MetricItemAggMV1mByContainerService.ts +31 -0
- package/Server/Services/MetricItemAggMV1mByK8sClusterService.ts +31 -0
- package/Server/Services/MetricItemAggMV1mByServiceService.ts +31 -0
- package/Server/Services/MetricService.ts +970 -122
- package/Server/Services/MonitorService.ts +14 -0
- package/Server/Services/NetworkDeviceOwnerTeamService.ts +42 -0
- package/Server/Services/NetworkDeviceOwnerUserService.ts +106 -0
- package/Server/Services/NetworkFlowService.ts +11 -0
- package/Server/Services/OnCallDutyPolicyService.ts +11 -1
- package/Server/Services/ProjectService.ts +178 -0
- package/Server/Services/SpanService.ts +13 -9
- package/Server/Services/StatusPageService.ts +97 -0
- package/Server/Services/TeamMemberService.ts +11 -0
- package/Server/Services/TelemetryExceptionService.ts +19 -90
- package/Server/Services/UserService.ts +59 -0
- package/Server/Types/AnalyticsDatabase/AggregateBy.ts +37 -7
- package/Server/Types/Markdown.ts +9 -9
- package/Server/Types/MarkdownSlugify.ts +47 -0
- package/Server/Utils/AI/AIRunTranscript.ts +240 -0
- package/Server/Utils/AI/Chat/ChatAgentRunner.ts +9 -0
- package/Server/Utils/AI/Chat/ObservabilityChatPrompt.ts +119 -5
- package/Server/Utils/AI/CodeFix/CodeFixAgentCompletion.ts +75 -0
- package/Server/Utils/AI/CodeFix/CodeFixReadiness.ts +235 -0
- package/Server/Utils/AI/SRE/Insights/FixRouting.ts +2 -3
- package/Server/Utils/AI/Toolbox/CodeTools.ts +883 -0
- package/Server/Utils/AI/Toolbox/CodeWriteTools.ts +519 -0
- package/Server/Utils/AI/Toolbox/Index.ts +27 -0
- package/Server/Utils/AI/Toolbox/ScheduledMaintenanceTools.ts +279 -0
- package/Server/Utils/AnalyticsDatabase/ClickhouseCapacity.ts +19 -1
- package/Server/Utils/Attribution.ts +99 -0
- package/Server/Utils/CodeRepository/GitHub/GitHub.ts +600 -0
- package/Server/Utils/CodeRepository/StackTraceRepoResolver.ts +7 -2
- package/Server/Utils/LLM/LLMService.ts +397 -18
- package/Server/Utils/Marketing/ConversionUploadProvider.ts +103 -0
- package/Server/Utils/Marketing/ConversionUploadProviders.ts +22 -0
- package/Server/Utils/Marketing/Providers/GoogleAds.ts +270 -0
- package/Server/Utils/Marketing/Providers/LinkedIn.ts +147 -0
- package/Server/Utils/Marketing/Providers/Meta.ts +148 -0
- package/Server/Utils/Marketing/Providers/MicrosoftAds.ts +196 -0
- package/Server/Utils/Marketing/Providers/Reddit.ts +178 -0
- package/Server/Utils/Monitor/MonitorAlert.ts +71 -7
- package/Server/Utils/Monitor/MonitorCriteriaEvaluator.ts +31 -19
- package/Server/Utils/Monitor/MonitorIncident.ts +71 -7
- package/Server/Utils/Monitor/MonitorMetricUtil.ts +57 -0
- package/Server/Utils/Monitor/MonitorTemplateUtil.ts +94 -0
- package/Server/Utils/Monitor/NetworkDeviceHydrationUtil.ts +19 -11
- package/Server/Utils/Monitor/NetworkInventoryUtil.ts +125 -14
- package/Server/Utils/ProductAnalytics.ts +133 -0
- package/Server/Utils/Telemetry/Telemetry.ts +39 -0
- package/Server/Utils/Telemetry/TelemetryEntity.ts +21 -0
- package/Tests/Models/StatusPageEnableMcpServer.test.ts +125 -0
- package/Tests/Server/API/BaseAnalyticsAPI.test.ts +72 -0
- package/Tests/Server/Infrastructure/SemaphorePermit.test.ts +9 -1
- package/Tests/Server/Services/AnalyticsDatabaseService.test.ts +21 -2
- package/Tests/Server/Services/MetricEntityMVKeyParity.test.ts +173 -0
- package/Tests/Server/Services/MetricServiceAggregate.test.ts +1391 -0
- package/Tests/Server/Services/NetworkDeviceOwnerServices.test.ts +260 -0
- package/Tests/Server/Services/StatusPageServiceMcp.test.ts +223 -0
- package/Tests/Server/Services/TelemetryExceptionAIFixReadiness.test.ts +26 -3
- package/Tests/Server/Services/TelemetryExceptionCodeFixRun.test.ts +12 -0
- package/Tests/Server/Types/Markdown.test.ts +106 -0
- package/Tests/Server/Utils/AI/AIRunTranscript.test.ts +182 -0
- package/Tests/Server/Utils/AI/CodeFixReadiness.test.ts +411 -0
- package/Tests/Server/Utils/AI/CodeTools.test.ts +596 -0
- package/Tests/Server/Utils/AI/CodeWriteTools.test.ts +475 -0
- package/Tests/Server/Utils/AI/LLMServiceModelCompatibility.test.ts +548 -0
- package/Tests/Server/Utils/AI/ObservabilityChatPrompt.test.ts +142 -0
- package/Tests/Server/Utils/AI/ScheduledMaintenanceTools.test.ts +176 -0
- package/Tests/Server/Utils/AnalyticsDatabase/ClickhouseCapacity.test.ts +63 -0
- package/Tests/Server/Utils/GitHubGetFileContent.test.ts +197 -0
- package/Tests/Server/Utils/Monitor/MonitorTemplateUtilNetworkDevice.test.ts +389 -0
- package/Tests/Server/Utils/Monitor/NetworkDeviceHydrationUtil.test.ts +502 -0
- package/Tests/Server/Utils/Monitor/NetworkInventoryUtil.test.ts +764 -0
- package/Tests/Types/AI/AIAgentTaskStatus.test.ts +7 -6
- package/Tests/Types/AI/AIChatPageContext.test.ts +0 -0
- package/Tests/Types/AI/AIRunStatus.test.ts +42 -0
- package/Tests/Types/BaseDatabase/AggregationIntervalUtil.test.ts +111 -2
- package/Tests/Types/Database/EndsWith.test.ts +64 -0
- package/Tests/Types/Database/GreaterThan.test.ts +62 -0
- package/Tests/Types/Database/GreaterThanOrEqual.test.ts +65 -0
- package/Tests/Types/Database/GreaterThanOrNull.test.ts +63 -0
- package/Tests/Types/Database/Includes.test.ts +65 -0
- package/Tests/Types/Database/IncludesAll.test.ts +65 -0
- package/Tests/Types/Database/IncludesNone.test.ts +65 -0
- package/Tests/Types/Database/IsNull.test.ts +44 -0
- package/Tests/Types/Database/LessThan.test.ts +62 -0
- package/Tests/Types/Database/LessThanOrEqual.test.ts +62 -0
- package/Tests/Types/Database/LessThanOrNull.test.ts +62 -0
- package/Tests/Types/Database/MultiSearch.test.ts +81 -0
- package/Tests/Types/Database/NotContains.test.ts +64 -0
- package/Tests/Types/Database/NotNull.test.ts +44 -0
- package/Tests/Types/Database/StartsWith.test.ts +64 -0
- package/Tests/Types/Log/LogSeverity.test.ts +78 -0
- package/Tests/Types/Monitor/MonitorStepSqlMonitor.test.ts +83 -1
- package/Tests/Types/Monitor/SnmpV3EnumParsing.test.ts +247 -0
- package/Tests/Types/Monitor/SnmpVendorTemplate.test.ts +263 -0
- package/Tests/UI/Components/BasicFormDropdownNormalization.test.tsx +167 -0
- package/Tests/UI/Components/Charts/AxisTickColor.test.tsx +66 -0
- package/Tests/UI/Components/XAxis.test.ts +5 -3
- package/Tests/UI/Utils/AIChatExport/ChatWidgetData.test.ts +319 -0
- package/Tests/UI/Utils/AIChatExport/ChatWidgetMarkdown.test.ts +188 -0
- package/Tests/Utils/EnterpriseLicenseUsage.test.ts +76 -0
- package/Tests/Utils/Metrics/MetricExplorerUrl.test.ts +622 -0
- package/Tests/Utils/Metrics/MetricFormulaEvaluator.test.ts +474 -0
- package/Tests/Utils/Telemetry/HeartbeatAvailability.test.ts +52 -4
- package/Types/AI/AIAgentTaskStatus.ts +13 -0
- package/Types/AI/AIChatPageContext.ts +137 -0
- package/Types/AI/AIChatTypes.ts +44 -0
- package/Types/AI/AIFixReadiness.ts +46 -0
- package/Types/AI/AIRunStatus.ts +11 -0
- package/Types/AnalyticsDatabase/AnalyticsTableName.ts +11 -0
- package/Types/BaseDatabase/AggregateBy.ts +31 -2
- package/Types/BaseDatabase/AggregatedResult.ts +22 -0
- package/Types/BaseDatabase/AggregationInterval.ts +11 -0
- package/Types/BaseDatabase/AggregationIntervalUtil.ts +30 -5
- package/Types/Dashboard/DashboardComponents/DashboardTraceChartComponent.ts +16 -0
- package/Types/Email/EmailTemplateType.ts +3 -0
- package/Types/Log/LogSeverity.ts +61 -0
- package/Types/Marketing/MarketingConversion.ts +11 -0
- package/Types/Metrics/MetricQueryConfigData.ts +21 -0
- package/Types/Metrics/MetricQueryData.ts +8 -0
- package/Types/Metrics/MetricViewData.ts +8 -0
- package/Types/Monitor/MonitorMetricType.ts +8 -0
- package/Types/Monitor/MonitorStep.ts +9 -0
- package/Types/Monitor/MonitorStepSqlMonitor.ts +12 -0
- package/Types/Monitor/MonitorType.ts +2 -1
- package/Types/Monitor/SSLMonitor/SslMonitorResponse.ts +17 -12
- package/Types/Monitor/SnmpMonitor/CdpNeighbor.ts +13 -0
- package/Types/Monitor/SnmpMonitor/NetworkTopology.ts +37 -3
- package/Types/Monitor/SnmpMonitor/SnmpAuthProtocol.ts +46 -0
- package/Types/Monitor/SnmpMonitor/SnmpEntityInfo.ts +15 -0
- package/Types/Monitor/SnmpMonitor/SnmpInterface.ts +8 -0
- package/Types/Monitor/SnmpMonitor/SnmpMonitorResponse.ts +17 -8
- package/Types/Monitor/SnmpMonitor/SnmpPrivProtocol.ts +53 -0
- package/Types/Monitor/SnmpMonitor/SnmpSecurityLevel.ts +43 -0
- package/Types/Monitor/SnmpMonitor/SnmpSystemInfo.ts +16 -0
- package/Types/Monitor/SnmpMonitor/SnmpVendorTemplate.ts +119 -3
- package/Types/Monitor/SnmpMonitor/SnmpVersion.ts +40 -0
- package/Types/NetFlow/NetworkFlowRecord.ts +25 -0
- package/Types/Syslog/SyslogMessage.ts +18 -0
- package/Types/Telemetry/TelemetrySavedViewState.ts +9 -0
- package/Types/Telemetry/TelemetrySavedViewType.ts +12 -0
- package/UI/Components/Charts/Area/AreaChart.tsx +51 -0
- package/UI/Components/Charts/Bar/BarChart.tsx +51 -1
- package/UI/Components/Charts/ChartGroup/ChartGroup.tsx +97 -26
- package/UI/Components/Charts/ChartLibrary/AreaChart/AreaChart.tsx +336 -3
- package/UI/Components/Charts/ChartLibrary/BarChart/BarChart.tsx +118 -1
- package/UI/Components/Charts/ChartLibrary/LineChart/LineChart.tsx +336 -3
- package/UI/Components/Charts/ChartLibrary/Types/ChartDataPoint.ts +7 -0
- package/UI/Components/Charts/ChartLibrary/Types/FormattedReferenceRegion.ts +15 -0
- package/UI/Components/Charts/ChartLibrary/Types/FormattedTimeReferenceLine.ts +13 -0
- package/UI/Components/Charts/Line/LineChart.tsx +51 -0
- package/UI/Components/Charts/Types/ReferenceRegionProps.ts +12 -0
- package/UI/Components/Charts/Types/TimeReferenceLineProps.ts +12 -0
- package/UI/Components/Charts/Types/XAxis/XAxisPrecision.ts +1 -0
- package/UI/Components/Charts/Utils/DataPoint.ts +0 -0
- package/UI/Components/Charts/Utils/TimeAnnotation.ts +169 -0
- package/UI/Components/Charts/Utils/XAxis.ts +28 -4
- package/UI/Components/Forms/BasicForm.tsx +26 -8
- package/UI/Components/Icon/Icon.tsx +33 -13
- package/UI/Components/Markdown.tsx/MarkdownViewer.tsx +9 -0
- package/UI/Components/MonitorTemplateVariables/TemplateVariablesCatalog.ts +67 -0
- package/UI/Components/Page/ModelPage.tsx +6 -1
- package/UI/Components/TelemetryViewer/components/SavedViewsDropdown.tsx +33 -4
- package/UI/Styles/Theme.css +1324 -0
- package/UI/Utils/AIChatExport/ChatWidgetData.ts +316 -0
- package/UI/Utils/AIChatExport/ChatWidgetMarkdown.ts +349 -0
- package/UI/Utils/AIChatExport/ConversationMarkdown.ts +177 -0
- package/UI/Utils/AIChatExport/MarkdownBlocks.ts +327 -0
- package/UI/Utils/AIChatExport/MarkdownSafety.ts +215 -0
- package/UI/Utils/DownloadFile.ts +54 -0
- package/UI/Utils/User.ts +41 -2
- package/Utils/Analytics.ts +8 -6
- package/Utils/EnterpriseLicense/EnterpriseLicenseUsage.ts +74 -0
- package/Utils/Metrics/MetricExplorerUrl.ts +771 -0
- package/Utils/Metrics/MetricFormulaEvaluator.ts +410 -46
- package/Utils/Monitor/NetworkTopologyUtil.ts +261 -49
- package/Utils/ValueFormatter.ts +22 -1
- package/build/dist/Models/AnalyticsModels/Index.js +13 -0
- package/build/dist/Models/AnalyticsModels/Index.js.map +1 -1
- package/build/dist/Models/AnalyticsModels/MetricItemAggMV1mByContainer.js +159 -0
- package/build/dist/Models/AnalyticsModels/MetricItemAggMV1mByContainer.js.map +1 -0
- package/build/dist/Models/AnalyticsModels/MetricItemAggMV1mByK8sCluster.js +158 -0
- package/build/dist/Models/AnalyticsModels/MetricItemAggMV1mByK8sCluster.js.map +1 -0
- package/build/dist/Models/AnalyticsModels/MetricItemAggMV1mByService.js +160 -0
- package/build/dist/Models/AnalyticsModels/MetricItemAggMV1mByService.js.map +1 -0
- package/build/dist/Models/AnalyticsModels/NetworkFlow.js +351 -0
- package/build/dist/Models/AnalyticsModels/NetworkFlow.js.map +1 -0
- package/build/dist/Models/DatabaseModels/AIAgentTaskPullRequest.js +15 -7
- package/build/dist/Models/DatabaseModels/AIAgentTaskPullRequest.js.map +1 -1
- package/build/dist/Models/DatabaseModels/AIRun.js +38 -0
- package/build/dist/Models/DatabaseModels/AIRun.js.map +1 -1
- package/build/dist/Models/DatabaseModels/AIRunEvent.js +31 -0
- package/build/dist/Models/DatabaseModels/AIRunEvent.js.map +1 -1
- package/build/dist/Models/DatabaseModels/EnterpriseLicenseInstance.js +19 -0
- package/build/dist/Models/DatabaseModels/EnterpriseLicenseInstance.js.map +1 -1
- package/build/dist/Models/DatabaseModels/GlobalConfig.js +38 -0
- package/build/dist/Models/DatabaseModels/GlobalConfig.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/MarketingConversion.js +219 -0
- package/build/dist/Models/DatabaseModels/MarketingConversion.js.map +1 -0
- package/build/dist/Models/DatabaseModels/MetricSavedView.js +35 -0
- package/build/dist/Models/DatabaseModels/MetricSavedView.js.map +1 -1
- package/build/dist/Models/DatabaseModels/MetricType.js +76 -0
- package/build/dist/Models/DatabaseModels/MetricType.js.map +1 -1
- package/build/dist/Models/DatabaseModels/NetworkDevice.js +341 -0
- package/build/dist/Models/DatabaseModels/NetworkDevice.js.map +1 -1
- package/build/dist/Models/DatabaseModels/NetworkDeviceDiscoveryScan.js +341 -0
- package/build/dist/Models/DatabaseModels/NetworkDeviceDiscoveryScan.js.map +1 -1
- package/build/dist/Models/DatabaseModels/NetworkInterface.js +60 -0
- package/build/dist/Models/DatabaseModels/NetworkInterface.js.map +1 -1
- package/build/dist/Models/DatabaseModels/Project.js +65 -0
- package/build/dist/Models/DatabaseModels/Project.js.map +1 -1
- package/build/dist/Models/DatabaseModels/StatusPage.js +43 -0
- package/build/dist/Models/DatabaseModels/StatusPage.js.map +1 -1
- package/build/dist/Models/DatabaseModels/User.js +38 -0
- package/build/dist/Models/DatabaseModels/User.js.map +1 -1
- package/build/dist/Server/API/AIAgentTaskAPI.js +37 -11
- package/build/dist/Server/API/AIAgentTaskAPI.js.map +1 -1
- package/build/dist/Server/API/AIAgentTaskLogAPI.js +32 -7
- package/build/dist/Server/API/AIAgentTaskLogAPI.js.map +1 -1
- package/build/dist/Server/API/AIChatAPI.js +9 -0
- package/build/dist/Server/API/AIChatAPI.js.map +1 -1
- package/build/dist/Server/API/AIReadinessAPI.js +57 -0
- package/build/dist/Server/API/AIReadinessAPI.js.map +1 -0
- package/build/dist/Server/API/BaseAnalyticsAPI.js +19 -0
- package/build/dist/Server/API/BaseAnalyticsAPI.js.map +1 -1
- package/build/dist/Server/API/CodeFixRunAPI.js +142 -0
- package/build/dist/Server/API/CodeFixRunAPI.js.map +1 -1
- package/build/dist/Server/API/EnterpriseLicenseAPI.js +8 -0
- package/build/dist/Server/API/EnterpriseLicenseAPI.js.map +1 -1
- package/build/dist/Server/API/TelemetryExceptionAPI.js +4 -0
- package/build/dist/Server/API/TelemetryExceptionAPI.js.map +1 -1
- package/build/dist/Server/EnvironmentConfig.js +51 -0
- package/build/dist/Server/EnvironmentConfig.js.map +1 -1
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1784124919694-AddAITaskNumberAndRunTranscript.js +80 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1784124919694-AddAITaskNumberAndRunTranscript.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1784135099754-AllowNullAiAgentOnPullRequest.js +37 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1784135099754-AllowNullAiAgentOnPullRequest.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1784137457184-AddEnableMcpServerToStatusPage.js +23 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1784137457184-AddEnableMcpServerToStatusPage.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1784191414522-AddCounterSemanticsToMetricType.js +27 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1784191414522-AddCounterSemanticsToMetricType.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1784191414600-AddViewTypeToMetricSavedView.js +21 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1784191414600-AddViewTypeToMetricSavedView.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1784200000000-AddSnmpV3ColumnsToNetworkDeviceDiscoveryScan.js +22 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1784200000000-AddSnmpV3ColumnsToNetworkDeviceDiscoveryScan.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1784211212164-AddNetworkDeviceInventoryAndDiscoverySchedule.js +47 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1784211212164-AddNetworkDeviceInventoryAndDiscoverySchedule.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1784218257664-AddEnterpriseLicenseNotificationColumns.js +16 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1784218257664-AddEnterpriseLicenseNotificationColumns.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1784293516000-AddAttributionColumnsToUserAndProject.js +18 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1784293516000-AddAttributionColumnsToUserAndProject.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1784298000000-AddMarketingConversionTable.js +20 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1784298000000-AddMarketingConversionTable.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js +20 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js.map +1 -1
- package/build/dist/Server/Services/AIRunEventService.js +8 -0
- package/build/dist/Server/Services/AIRunEventService.js.map +1 -1
- package/build/dist/Server/Services/AIRunService.js +29 -0
- package/build/dist/Server/Services/AIRunService.js.map +1 -1
- package/build/dist/Server/Services/AnalyticsDatabaseService.js +58 -4
- package/build/dist/Server/Services/AnalyticsDatabaseService.js.map +1 -1
- package/build/dist/Server/Services/IncidentService.js +12 -0
- package/build/dist/Server/Services/IncidentService.js.map +1 -1
- package/build/dist/Server/Services/Index.js +10 -0
- package/build/dist/Server/Services/Index.js.map +1 -1
- package/build/dist/Server/Services/LlmProviderService.js +2 -0
- package/build/dist/Server/Services/LlmProviderService.js.map +1 -1
- package/build/dist/Server/Services/MarketingConversionService.js +9 -0
- package/build/dist/Server/Services/MarketingConversionService.js.map +1 -0
- package/build/dist/Server/Services/MetricItemAggMV1mByContainerService.js +29 -0
- package/build/dist/Server/Services/MetricItemAggMV1mByContainerService.js.map +1 -0
- package/build/dist/Server/Services/MetricItemAggMV1mByK8sClusterService.js +29 -0
- package/build/dist/Server/Services/MetricItemAggMV1mByK8sClusterService.js.map +1 -0
- package/build/dist/Server/Services/MetricItemAggMV1mByServiceService.js +29 -0
- package/build/dist/Server/Services/MetricItemAggMV1mByServiceService.js.map +1 -0
- package/build/dist/Server/Services/MetricService.js +761 -125
- package/build/dist/Server/Services/MetricService.js.map +1 -1
- package/build/dist/Server/Services/MonitorService.js +18 -5
- package/build/dist/Server/Services/MonitorService.js.map +1 -1
- package/build/dist/Server/Services/NetworkDeviceOwnerTeamService.js +44 -0
- package/build/dist/Server/Services/NetworkDeviceOwnerTeamService.js.map +1 -1
- package/build/dist/Server/Services/NetworkDeviceOwnerUserService.js +88 -0
- package/build/dist/Server/Services/NetworkDeviceOwnerUserService.js.map +1 -1
- package/build/dist/Server/Services/NetworkFlowService.js +9 -0
- package/build/dist/Server/Services/NetworkFlowService.js.map +1 -0
- package/build/dist/Server/Services/OnCallDutyPolicyService.js +15 -6
- package/build/dist/Server/Services/OnCallDutyPolicyService.js.map +1 -1
- package/build/dist/Server/Services/ProjectService.js +146 -6
- package/build/dist/Server/Services/ProjectService.js.map +1 -1
- package/build/dist/Server/Services/SpanService.js +8 -6
- package/build/dist/Server/Services/SpanService.js.map +1 -1
- package/build/dist/Server/Services/StatusPageService.js +91 -0
- package/build/dist/Server/Services/StatusPageService.js.map +1 -1
- package/build/dist/Server/Services/TeamMemberService.js +11 -0
- package/build/dist/Server/Services/TeamMemberService.js.map +1 -1
- package/build/dist/Server/Services/TelemetryExceptionService.js +14 -61
- package/build/dist/Server/Services/TelemetryExceptionService.js.map +1 -1
- package/build/dist/Server/Services/UserService.js +52 -0
- package/build/dist/Server/Services/UserService.js.map +1 -1
- package/build/dist/Server/Types/AnalyticsDatabase/AggregateBy.js +33 -7
- package/build/dist/Server/Types/AnalyticsDatabase/AggregateBy.js.map +1 -1
- package/build/dist/Server/Types/Markdown.js +8 -8
- package/build/dist/Server/Types/Markdown.js.map +1 -1
- package/build/dist/Server/Types/MarkdownSlugify.js +47 -0
- package/build/dist/Server/Types/MarkdownSlugify.js.map +1 -0
- package/build/dist/Server/Utils/AI/AIRunTranscript.js +180 -0
- package/build/dist/Server/Utils/AI/AIRunTranscript.js.map +1 -0
- package/build/dist/Server/Utils/AI/Chat/ChatAgentRunner.js +1 -0
- package/build/dist/Server/Utils/AI/Chat/ChatAgentRunner.js.map +1 -1
- package/build/dist/Server/Utils/AI/Chat/ObservabilityChatPrompt.js +103 -5
- package/build/dist/Server/Utils/AI/Chat/ObservabilityChatPrompt.js.map +1 -1
- package/build/dist/Server/Utils/AI/CodeFix/CodeFixAgentCompletion.js +55 -0
- package/build/dist/Server/Utils/AI/CodeFix/CodeFixAgentCompletion.js.map +1 -1
- package/build/dist/Server/Utils/AI/CodeFix/CodeFixReadiness.js +211 -0
- package/build/dist/Server/Utils/AI/CodeFix/CodeFixReadiness.js.map +1 -0
- package/build/dist/Server/Utils/AI/SRE/Insights/FixRouting.js.map +1 -1
- package/build/dist/Server/Utils/AI/Toolbox/CodeTools.js +654 -0
- package/build/dist/Server/Utils/AI/Toolbox/CodeTools.js.map +1 -0
- package/build/dist/Server/Utils/AI/Toolbox/CodeWriteTools.js +389 -0
- package/build/dist/Server/Utils/AI/Toolbox/CodeWriteTools.js.map +1 -0
- package/build/dist/Server/Utils/AI/Toolbox/Index.js +19 -0
- package/build/dist/Server/Utils/AI/Toolbox/Index.js.map +1 -1
- package/build/dist/Server/Utils/AI/Toolbox/ScheduledMaintenanceTools.js +239 -0
- package/build/dist/Server/Utils/AI/Toolbox/ScheduledMaintenanceTools.js.map +1 -0
- package/build/dist/Server/Utils/AnalyticsDatabase/ClickhouseCapacity.js +19 -1
- package/build/dist/Server/Utils/AnalyticsDatabase/ClickhouseCapacity.js.map +1 -1
- package/build/dist/Server/Utils/Attribution.js +74 -0
- package/build/dist/Server/Utils/Attribution.js.map +1 -0
- package/build/dist/Server/Utils/CodeRepository/GitHub/GitHub.js +439 -0
- package/build/dist/Server/Utils/CodeRepository/GitHub/GitHub.js.map +1 -1
- package/build/dist/Server/Utils/CodeRepository/StackTraceRepoResolver.js +1 -1
- package/build/dist/Server/Utils/CodeRepository/StackTraceRepoResolver.js.map +1 -1
- package/build/dist/Server/Utils/LLM/LLMService.js +275 -19
- package/build/dist/Server/Utils/LLM/LLMService.js.map +1 -1
- package/build/dist/Server/Utils/Marketing/ConversionUploadProvider.js +40 -0
- package/build/dist/Server/Utils/Marketing/ConversionUploadProvider.js.map +1 -0
- package/build/dist/Server/Utils/Marketing/ConversionUploadProviders.js +20 -0
- package/build/dist/Server/Utils/Marketing/ConversionUploadProviders.js.map +1 -0
- package/build/dist/Server/Utils/Marketing/Providers/GoogleAds.js +177 -0
- package/build/dist/Server/Utils/Marketing/Providers/GoogleAds.js.map +1 -0
- package/build/dist/Server/Utils/Marketing/Providers/LinkedIn.js +113 -0
- package/build/dist/Server/Utils/Marketing/Providers/LinkedIn.js.map +1 -0
- package/build/dist/Server/Utils/Marketing/Providers/Meta.js +109 -0
- package/build/dist/Server/Utils/Marketing/Providers/Meta.js.map +1 -0
- package/build/dist/Server/Utils/Marketing/Providers/MicrosoftAds.js +130 -0
- package/build/dist/Server/Utils/Marketing/Providers/MicrosoftAds.js.map +1 -0
- package/build/dist/Server/Utils/Marketing/Providers/Reddit.js +126 -0
- package/build/dist/Server/Utils/Marketing/Providers/Reddit.js.map +1 -0
- package/build/dist/Server/Utils/Monitor/MonitorAlert.js +53 -9
- package/build/dist/Server/Utils/Monitor/MonitorAlert.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/MonitorCriteriaEvaluator.js +21 -10
- package/build/dist/Server/Utils/Monitor/MonitorCriteriaEvaluator.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/MonitorIncident.js +54 -11
- package/build/dist/Server/Utils/Monitor/MonitorIncident.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/MonitorMetricUtil.js +43 -3
- package/build/dist/Server/Utils/Monitor/MonitorMetricUtil.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/MonitorTemplateUtil.js +68 -0
- package/build/dist/Server/Utils/Monitor/MonitorTemplateUtil.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/NetworkDeviceHydrationUtil.js +17 -11
- package/build/dist/Server/Utils/Monitor/NetworkDeviceHydrationUtil.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/NetworkInventoryUtil.js +100 -15
- package/build/dist/Server/Utils/Monitor/NetworkInventoryUtil.js.map +1 -1
- package/build/dist/Server/Utils/ProductAnalytics.js +111 -0
- package/build/dist/Server/Utils/ProductAnalytics.js.map +1 -0
- package/build/dist/Server/Utils/Telemetry/Telemetry.js +32 -5
- package/build/dist/Server/Utils/Telemetry/Telemetry.js.map +1 -1
- package/build/dist/Server/Utils/Telemetry/TelemetryEntity.js +17 -0
- package/build/dist/Server/Utils/Telemetry/TelemetryEntity.js.map +1 -1
- package/build/dist/Types/AI/AIAgentTaskStatus.js +12 -0
- package/build/dist/Types/AI/AIAgentTaskStatus.js.map +1 -1
- package/build/dist/Types/AI/AIChatPageContext.js +101 -0
- package/build/dist/Types/AI/AIChatPageContext.js.map +1 -0
- package/build/dist/Types/AI/AIChatTypes.js +2 -0
- package/build/dist/Types/AI/AIChatTypes.js.map +1 -1
- package/build/dist/Types/AI/AIFixReadiness.js +9 -0
- package/build/dist/Types/AI/AIFixReadiness.js.map +1 -0
- package/build/dist/Types/AI/AIRunStatus.js +11 -0
- package/build/dist/Types/AI/AIRunStatus.js.map +1 -1
- package/build/dist/Types/AnalyticsDatabase/AnalyticsTableName.js +11 -0
- package/build/dist/Types/AnalyticsDatabase/AnalyticsTableName.js.map +1 -1
- package/build/dist/Types/BaseDatabase/AggregationInterval.js +11 -0
- package/build/dist/Types/BaseDatabase/AggregationInterval.js.map +1 -1
- package/build/dist/Types/BaseDatabase/AggregationIntervalUtil.js +33 -5
- package/build/dist/Types/BaseDatabase/AggregationIntervalUtil.js.map +1 -1
- package/build/dist/Types/Email/EmailTemplateType.js +2 -0
- package/build/dist/Types/Email/EmailTemplateType.js.map +1 -1
- package/build/dist/Types/Log/LogSeverity.js +56 -0
- package/build/dist/Types/Log/LogSeverity.js.map +1 -1
- package/build/dist/Types/Marketing/MarketingConversion.js +13 -0
- package/build/dist/Types/Marketing/MarketingConversion.js.map +1 -0
- package/build/dist/Types/Monitor/MonitorMetricType.js +7 -0
- package/build/dist/Types/Monitor/MonitorMetricType.js.map +1 -1
- package/build/dist/Types/Monitor/MonitorStep.js +6 -0
- package/build/dist/Types/Monitor/MonitorStep.js.map +1 -1
- package/build/dist/Types/Monitor/MonitorStepSqlMonitor.js +3 -0
- package/build/dist/Types/Monitor/MonitorStepSqlMonitor.js.map +1 -1
- package/build/dist/Types/Monitor/MonitorType.js +2 -1
- package/build/dist/Types/Monitor/MonitorType.js.map +1 -1
- package/build/dist/Types/Monitor/SnmpMonitor/CdpNeighbor.js +2 -0
- package/build/dist/Types/Monitor/SnmpMonitor/CdpNeighbor.js.map +1 -0
- package/build/dist/Types/Monitor/SnmpMonitor/SnmpAuthProtocol.js +41 -0
- package/build/dist/Types/Monitor/SnmpMonitor/SnmpAuthProtocol.js.map +1 -1
- package/build/dist/Types/Monitor/SnmpMonitor/SnmpEntityInfo.js +2 -0
- package/build/dist/Types/Monitor/SnmpMonitor/SnmpEntityInfo.js.map +1 -0
- package/build/dist/Types/Monitor/SnmpMonitor/SnmpPrivProtocol.js +48 -0
- package/build/dist/Types/Monitor/SnmpMonitor/SnmpPrivProtocol.js.map +1 -1
- package/build/dist/Types/Monitor/SnmpMonitor/SnmpSecurityLevel.js +38 -0
- package/build/dist/Types/Monitor/SnmpMonitor/SnmpSecurityLevel.js.map +1 -1
- package/build/dist/Types/Monitor/SnmpMonitor/SnmpSystemInfo.js +2 -0
- package/build/dist/Types/Monitor/SnmpMonitor/SnmpSystemInfo.js.map +1 -0
- package/build/dist/Types/Monitor/SnmpMonitor/SnmpVendorTemplate.js +96 -3
- package/build/dist/Types/Monitor/SnmpMonitor/SnmpVendorTemplate.js.map +1 -1
- package/build/dist/Types/Monitor/SnmpMonitor/SnmpVersion.js +38 -0
- package/build/dist/Types/Monitor/SnmpMonitor/SnmpVersion.js.map +1 -1
- package/build/dist/Types/NetFlow/NetworkFlowRecord.js +2 -0
- package/build/dist/Types/NetFlow/NetworkFlowRecord.js.map +1 -0
- package/build/dist/Types/Syslog/SyslogMessage.js +2 -0
- package/build/dist/Types/Syslog/SyslogMessage.js.map +1 -0
- package/build/dist/Types/Telemetry/TelemetrySavedViewState.js +0 -7
- package/build/dist/Types/Telemetry/TelemetrySavedViewState.js.map +1 -1
- package/build/dist/Types/Telemetry/TelemetrySavedViewType.js +13 -0
- package/build/dist/Types/Telemetry/TelemetrySavedViewType.js.map +1 -0
- package/build/dist/UI/Components/Charts/Area/AreaChart.js +25 -1
- package/build/dist/UI/Components/Charts/Area/AreaChart.js.map +1 -1
- package/build/dist/UI/Components/Charts/Bar/BarChart.js +26 -2
- package/build/dist/UI/Components/Charts/Bar/BarChart.js.map +1 -1
- package/build/dist/UI/Components/Charts/ChartGroup/ChartGroup.js +36 -12
- package/build/dist/UI/Components/Charts/ChartGroup/ChartGroup.js.map +1 -1
- package/build/dist/UI/Components/Charts/ChartLibrary/AreaChart/AreaChart.js +217 -8
- package/build/dist/UI/Components/Charts/ChartLibrary/AreaChart/AreaChart.js.map +1 -1
- package/build/dist/UI/Components/Charts/ChartLibrary/BarChart/BarChart.js +55 -4
- package/build/dist/UI/Components/Charts/ChartLibrary/BarChart/BarChart.js.map +1 -1
- package/build/dist/UI/Components/Charts/ChartLibrary/LineChart/LineChart.js +217 -8
- package/build/dist/UI/Components/Charts/ChartLibrary/LineChart/LineChart.js.map +1 -1
- package/build/dist/UI/Components/Charts/ChartLibrary/Types/ChartDataPoint.js +6 -1
- package/build/dist/UI/Components/Charts/ChartLibrary/Types/ChartDataPoint.js.map +1 -1
- package/build/dist/UI/Components/Charts/ChartLibrary/Types/FormattedReferenceRegion.js +2 -0
- package/build/dist/UI/Components/Charts/ChartLibrary/Types/FormattedReferenceRegion.js.map +1 -0
- package/build/dist/UI/Components/Charts/ChartLibrary/Types/FormattedTimeReferenceLine.js +2 -0
- package/build/dist/UI/Components/Charts/ChartLibrary/Types/FormattedTimeReferenceLine.js.map +1 -0
- package/build/dist/UI/Components/Charts/Line/LineChart.js +25 -1
- package/build/dist/UI/Components/Charts/Line/LineChart.js.map +1 -1
- package/build/dist/UI/Components/Charts/Types/ReferenceRegionProps.js +2 -0
- package/build/dist/UI/Components/Charts/Types/ReferenceRegionProps.js.map +1 -0
- package/build/dist/UI/Components/Charts/Types/TimeReferenceLineProps.js +2 -0
- package/build/dist/UI/Components/Charts/Types/TimeReferenceLineProps.js.map +1 -0
- package/build/dist/UI/Components/Charts/Types/XAxis/XAxisPrecision.js +1 -0
- package/build/dist/UI/Components/Charts/Types/XAxis/XAxisPrecision.js.map +1 -1
- package/build/dist/UI/Components/Charts/Utils/DataPoint.js +0 -0
- package/build/dist/UI/Components/Charts/Utils/DataPoint.js.map +1 -1
- package/build/dist/UI/Components/Charts/Utils/TimeAnnotation.js +121 -0
- package/build/dist/UI/Components/Charts/Utils/TimeAnnotation.js.map +1 -0
- package/build/dist/UI/Components/Charts/Utils/XAxis.js +27 -4
- package/build/dist/UI/Components/Charts/Utils/XAxis.js.map +1 -1
- package/build/dist/UI/Components/Forms/BasicForm.js +24 -6
- package/build/dist/UI/Components/Forms/BasicForm.js.map +1 -1
- package/build/dist/UI/Components/Icon/Icon.js +15 -8
- package/build/dist/UI/Components/Icon/Icon.js.map +1 -1
- package/build/dist/UI/Components/Markdown.tsx/MarkdownViewer.js.map +1 -1
- package/build/dist/UI/Components/MonitorTemplateVariables/TemplateVariablesCatalog.js +58 -0
- package/build/dist/UI/Components/MonitorTemplateVariables/TemplateVariablesCatalog.js.map +1 -1
- package/build/dist/UI/Components/Page/ModelPage.js +7 -1
- package/build/dist/UI/Components/Page/ModelPage.js.map +1 -1
- package/build/dist/UI/Components/TelemetryViewer/components/SavedViewsDropdown.js +10 -4
- package/build/dist/UI/Components/TelemetryViewer/components/SavedViewsDropdown.js.map +1 -1
- package/build/dist/UI/Utils/AIChatExport/ChatWidgetData.js +217 -0
- package/build/dist/UI/Utils/AIChatExport/ChatWidgetData.js.map +1 -0
- package/build/dist/UI/Utils/AIChatExport/ChatWidgetMarkdown.js +234 -0
- package/build/dist/UI/Utils/AIChatExport/ChatWidgetMarkdown.js.map +1 -0
- package/build/dist/UI/Utils/AIChatExport/ConversationMarkdown.js +111 -0
- package/build/dist/UI/Utils/AIChatExport/ConversationMarkdown.js.map +1 -0
- package/build/dist/UI/Utils/AIChatExport/MarkdownBlocks.js +233 -0
- package/build/dist/UI/Utils/AIChatExport/MarkdownBlocks.js.map +1 -0
- package/build/dist/UI/Utils/AIChatExport/MarkdownSafety.js +134 -0
- package/build/dist/UI/Utils/AIChatExport/MarkdownSafety.js.map +1 -0
- package/build/dist/UI/Utils/DownloadFile.js +41 -0
- package/build/dist/UI/Utils/DownloadFile.js.map +1 -0
- package/build/dist/UI/Utils/User.js +35 -2
- package/build/dist/UI/Utils/User.js.map +1 -1
- package/build/dist/Utils/Analytics.js +8 -5
- package/build/dist/Utils/Analytics.js.map +1 -1
- package/build/dist/Utils/EnterpriseLicense/EnterpriseLicenseUsage.js +57 -0
- package/build/dist/Utils/EnterpriseLicense/EnterpriseLicenseUsage.js.map +1 -1
- package/build/dist/Utils/Metrics/MetricExplorerUrl.js +418 -0
- package/build/dist/Utils/Metrics/MetricExplorerUrl.js.map +1 -0
- package/build/dist/Utils/Metrics/MetricFormulaEvaluator.js +296 -37
- package/build/dist/Utils/Metrics/MetricFormulaEvaluator.js.map +1 -1
- package/build/dist/Utils/Monitor/NetworkTopologyUtil.js +176 -40
- package/build/dist/Utils/Monitor/NetworkTopologyUtil.js.map +1 -1
- package/build/dist/Utils/ValueFormatter.js +20 -1
- package/build/dist/Utils/ValueFormatter.js.map +1 -1
- package/package.json +6 -2
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
import AIRunTranscript, {
|
|
2
|
+
MAX_MESSAGE_CONTENT_CHARS,
|
|
3
|
+
MAX_PAYLOAD_CHARS,
|
|
4
|
+
MAX_RESPONSE_CONTENT_CHARS,
|
|
5
|
+
MAX_TOOL_ARGUMENT_CHARS,
|
|
6
|
+
MAX_TOOL_RESULT_CHARS,
|
|
7
|
+
} from "../../../../Server/Utils/AI/AIRunTranscript";
|
|
8
|
+
import { AIRunEventContentPayload } from "../../../../Types/AI/AIChatTypes";
|
|
9
|
+
import { describe, expect, test } from "@jest/globals";
|
|
10
|
+
|
|
11
|
+
/*
|
|
12
|
+
* The run transcript is the ONE place a code-fix run's LLM content is stored
|
|
13
|
+
* (LlmLog redacts it — it is project-wide readable and these prompts embed
|
|
14
|
+
* customer source code). It stores content verbatim to be worth reading when
|
|
15
|
+
* a run goes wrong, which makes bounding it a storage requirement rather than
|
|
16
|
+
* a nicety: an agent may read large files and run test suites emitting
|
|
17
|
+
* megabytes, up to 40 times per run.
|
|
18
|
+
*
|
|
19
|
+
* These tests pin the two properties that make that safe: every field is
|
|
20
|
+
* capped, and the payload as a whole cannot exceed MAX_PAYLOAD_CHARS no
|
|
21
|
+
* matter WHICH field carries the bulk.
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
type SerializedLengthFunction = (payload: AIRunEventContentPayload) => number;
|
|
25
|
+
|
|
26
|
+
const serializedLength: SerializedLengthFunction = (
|
|
27
|
+
payload: AIRunEventContentPayload,
|
|
28
|
+
): number => {
|
|
29
|
+
return JSON.stringify(payload).length;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
describe("AIRunTranscript.clip", () => {
|
|
33
|
+
test("leaves a value under the cap untouched and unflagged", () => {
|
|
34
|
+
expect(AIRunTranscript.clip("short", 100)).toEqual({
|
|
35
|
+
value: "short",
|
|
36
|
+
isTruncated: false,
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
test("clips an oversized value and reports the truncation", () => {
|
|
41
|
+
const result: { value: string | undefined; isTruncated: boolean } =
|
|
42
|
+
AIRunTranscript.clip("x".repeat(50), 10);
|
|
43
|
+
|
|
44
|
+
expect(result.isTruncated).toBe(true);
|
|
45
|
+
expect(result.value).toContain("truncated");
|
|
46
|
+
expect(result.value!.startsWith("x".repeat(10))).toBe(true);
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
test("passes undefined through without inventing a value", () => {
|
|
50
|
+
expect(AIRunTranscript.clip(undefined, 10)).toEqual({
|
|
51
|
+
value: undefined,
|
|
52
|
+
isTruncated: false,
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
describe("AIRunTranscript.clipArguments", () => {
|
|
58
|
+
test("keeps arguments under the cap verbatim", () => {
|
|
59
|
+
const args: { path: string } = { path: "src/Index.ts" };
|
|
60
|
+
expect(AIRunTranscript.clipArguments(args)).toEqual({
|
|
61
|
+
value: args,
|
|
62
|
+
isTruncated: false,
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
/*
|
|
67
|
+
* A write_file call carries a whole file in its arguments — the single
|
|
68
|
+
* likeliest way one tool call bloats a row.
|
|
69
|
+
*/
|
|
70
|
+
test("replaces oversized arguments with a marker that keeps a preview", () => {
|
|
71
|
+
const result: {
|
|
72
|
+
value: Record<string, unknown> | undefined;
|
|
73
|
+
isTruncated: boolean;
|
|
74
|
+
} = AIRunTranscript.clipArguments({
|
|
75
|
+
content: "y".repeat(MAX_TOOL_ARGUMENT_CHARS + 1000),
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
expect(result.isTruncated).toBe(true);
|
|
79
|
+
expect(result.value!["_note"]).toContain("exceeds");
|
|
80
|
+
expect(typeof result.value!["_preview"]).toBe("string");
|
|
81
|
+
});
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
describe("AIRunTranscript.clampPayload", () => {
|
|
85
|
+
test("caps each field independently and stamps isTruncated", () => {
|
|
86
|
+
const clamped: AIRunEventContentPayload = AIRunTranscript.clampPayload({
|
|
87
|
+
requestMessages: [
|
|
88
|
+
{ role: "user", content: "a".repeat(MAX_MESSAGE_CONTENT_CHARS + 500) },
|
|
89
|
+
],
|
|
90
|
+
responseContent: "b".repeat(MAX_RESPONSE_CONTENT_CHARS + 500),
|
|
91
|
+
toolResult: "c".repeat(MAX_TOOL_RESULT_CHARS + 500),
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
expect(clamped.isTruncated).toBe(true);
|
|
95
|
+
expect(clamped.requestMessages![0]!.content.length).toBeLessThanOrEqual(
|
|
96
|
+
MAX_MESSAGE_CONTENT_CHARS + 100,
|
|
97
|
+
);
|
|
98
|
+
expect(clamped.responseContent!.length).toBeLessThanOrEqual(
|
|
99
|
+
MAX_RESPONSE_CONTENT_CHARS + 100,
|
|
100
|
+
);
|
|
101
|
+
expect(clamped.toolResult!.length).toBeLessThanOrEqual(
|
|
102
|
+
MAX_TOOL_RESULT_CHARS + 100,
|
|
103
|
+
);
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
test("leaves a small payload entirely alone", () => {
|
|
107
|
+
const payload: AIRunEventContentPayload = {
|
|
108
|
+
requestMessages: [{ role: "user", content: "fix the null deref" }],
|
|
109
|
+
responseContent: "Reading the file.",
|
|
110
|
+
responseToolCalls: [{ name: "read_file", arguments: { path: "a.ts" } }],
|
|
111
|
+
totalTokens: 120,
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
const clamped: AIRunEventContentPayload =
|
|
115
|
+
AIRunTranscript.clampPayload(payload);
|
|
116
|
+
|
|
117
|
+
expect(clamped.isTruncated).toBeUndefined();
|
|
118
|
+
expect(clamped).toEqual(payload);
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
/*
|
|
122
|
+
* The regression this file exists for. A single-pass backstop that only
|
|
123
|
+
* dropped requestMessages "succeeded" by deleting a two-character user
|
|
124
|
+
* message while the row stayed ~1.5x over the ceiling, because the bulk was
|
|
125
|
+
* in responseToolCalls. The cap must hold regardless of which field is fat.
|
|
126
|
+
*/
|
|
127
|
+
test("holds the ceiling when the bulk is in responseToolCalls, not messages", () => {
|
|
128
|
+
const clamped: AIRunEventContentPayload = AIRunTranscript.clampPayload({
|
|
129
|
+
requestMessages: [{ role: "user", content: "hi" }],
|
|
130
|
+
responseToolCalls: Array.from(
|
|
131
|
+
{ length: 30 },
|
|
132
|
+
(_value: unknown, index: number) => {
|
|
133
|
+
return {
|
|
134
|
+
id: `call_${index}`,
|
|
135
|
+
name: "write_file",
|
|
136
|
+
arguments: { content: "z".repeat(MAX_TOOL_ARGUMENT_CHARS - 200) },
|
|
137
|
+
};
|
|
138
|
+
},
|
|
139
|
+
),
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
expect(serializedLength(clamped)).toBeLessThanOrEqual(MAX_PAYLOAD_CHARS);
|
|
143
|
+
expect(clamped.isTruncated).toBe(true);
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
test("holds the ceiling when the bulk is a huge tool result", () => {
|
|
147
|
+
const clamped: AIRunEventContentPayload = AIRunTranscript.clampPayload({
|
|
148
|
+
toolResult: "q".repeat(MAX_PAYLOAD_CHARS * 3),
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
expect(serializedLength(clamped)).toBeLessThanOrEqual(MAX_PAYLOAD_CHARS);
|
|
152
|
+
expect(clamped.isTruncated).toBe(true);
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
/*
|
|
156
|
+
* Bounded ENTRIES are not a bounded ARRAY: with every argument already
|
|
157
|
+
* dropped, enough calls still blow the ceiling. The last resort collapses
|
|
158
|
+
* the array to a count.
|
|
159
|
+
*/
|
|
160
|
+
test("holds the ceiling against a pathological number of tool calls", () => {
|
|
161
|
+
const clamped: AIRunEventContentPayload = AIRunTranscript.clampPayload({
|
|
162
|
+
responseToolCalls: Array.from(
|
|
163
|
+
{ length: 20000 },
|
|
164
|
+
(_value: unknown, index: number) => {
|
|
165
|
+
return { id: `call_${index}`, name: "read_file" };
|
|
166
|
+
},
|
|
167
|
+
),
|
|
168
|
+
});
|
|
169
|
+
|
|
170
|
+
expect(serializedLength(clamped)).toBeLessThanOrEqual(MAX_PAYLOAD_CHARS);
|
|
171
|
+
expect(clamped.isTruncated).toBe(true);
|
|
172
|
+
});
|
|
173
|
+
|
|
174
|
+
// A clipped prompt must never be presented as though it were whole.
|
|
175
|
+
test("never reports a clipped payload as complete", () => {
|
|
176
|
+
const clamped: AIRunEventContentPayload = AIRunTranscript.clampPayload({
|
|
177
|
+
responseContent: "r".repeat(MAX_RESPONSE_CONTENT_CHARS + 1),
|
|
178
|
+
});
|
|
179
|
+
|
|
180
|
+
expect(clamped.isTruncated).toBe(true);
|
|
181
|
+
});
|
|
182
|
+
});
|
|
@@ -0,0 +1,411 @@
|
|
|
1
|
+
import CodeFixReadiness from "../../../../Server/Utils/AI/CodeFix/CodeFixReadiness";
|
|
2
|
+
import SubjectCodeFixRun from "../../../../Server/Utils/AI/SRE/SubjectCodeFixRun";
|
|
3
|
+
import AIAgentService from "../../../../Server/Services/AIAgentService";
|
|
4
|
+
import AIService from "../../../../Server/Services/AIService";
|
|
5
|
+
import LlmProviderService from "../../../../Server/Services/LlmProviderService";
|
|
6
|
+
import ProjectService from "../../../../Server/Services/ProjectService";
|
|
7
|
+
import AIAgent from "../../../../Models/DatabaseModels/AIAgent";
|
|
8
|
+
import LlmProvider from "../../../../Models/DatabaseModels/LlmProvider";
|
|
9
|
+
import Project from "../../../../Models/DatabaseModels/Project";
|
|
10
|
+
import ObjectID from "../../../../Types/ObjectID";
|
|
11
|
+
import {
|
|
12
|
+
AIFixReadiness,
|
|
13
|
+
AIFixReadinessCheck,
|
|
14
|
+
} from "../../../../Types/AI/AIFixReadiness";
|
|
15
|
+
import { describe, expect, test, afterEach, beforeEach } from "@jest/globals";
|
|
16
|
+
|
|
17
|
+
/*
|
|
18
|
+
* The gates the AI Tasks page renders. The invariant worth protecting: a
|
|
19
|
+
* project LLM provider is NOT a prerequisite — the shared global provider is
|
|
20
|
+
* a legitimate resolution for the agent path, so a project running on it must
|
|
21
|
+
* read as ready. The banner these checks replaced claimed otherwise.
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
const projectId: ObjectID = ObjectID.generate();
|
|
25
|
+
|
|
26
|
+
function fakeProvider(params: {
|
|
27
|
+
name: string;
|
|
28
|
+
isGlobalLlm?: boolean;
|
|
29
|
+
costPerMillionTokensInUSDCents?: number;
|
|
30
|
+
}): LlmProvider {
|
|
31
|
+
return {
|
|
32
|
+
id: ObjectID.generate(),
|
|
33
|
+
name: params.name,
|
|
34
|
+
isGlobalLlm: params.isGlobalLlm ?? false,
|
|
35
|
+
costPerMillionTokensInUSDCents: params.costPerMillionTokensInUSDCents ?? 0,
|
|
36
|
+
} as unknown as LlmProvider;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// No daily-budget limit configured: the common case, and never a blocker.
|
|
40
|
+
function mockBudgetNotExhausted(): void {
|
|
41
|
+
jest.spyOn(AIService, "getAutonomousDailyBudgetStatus").mockResolvedValue({
|
|
42
|
+
exhausted: false,
|
|
43
|
+
limitInTokens: null,
|
|
44
|
+
usedTokensToday: 0,
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
describe("CodeFixReadiness.getLlmProviderCheck", () => {
|
|
49
|
+
beforeEach(() => {
|
|
50
|
+
mockBudgetNotExhausted();
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
afterEach(() => {
|
|
54
|
+
jest.restoreAllMocks();
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
test("no provider resolves at all: not ready, and says where to add one", async () => {
|
|
58
|
+
jest
|
|
59
|
+
.spyOn(LlmProviderService, "getLlmProviderForMeteredAgentPath")
|
|
60
|
+
.mockResolvedValue(null);
|
|
61
|
+
|
|
62
|
+
const check: AIFixReadinessCheck =
|
|
63
|
+
await CodeFixReadiness.getLlmProviderCheck({ projectId });
|
|
64
|
+
|
|
65
|
+
expect(check.id).toBe("llmProvider");
|
|
66
|
+
expect(check.ok).toBe(false);
|
|
67
|
+
expect(check.detail).toContain("LLM Providers");
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
test("a project-owned provider is ready and is named as the project's own", async () => {
|
|
71
|
+
jest
|
|
72
|
+
.spyOn(LlmProviderService, "getLlmProviderForMeteredAgentPath")
|
|
73
|
+
.mockResolvedValue(fakeProvider({ name: "My OpenAI" }));
|
|
74
|
+
|
|
75
|
+
const check: AIFixReadinessCheck =
|
|
76
|
+
await CodeFixReadiness.getLlmProviderCheck({
|
|
77
|
+
projectId,
|
|
78
|
+
billingEnabled: true,
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
expect(check.ok).toBe(true);
|
|
82
|
+
expect(check.title).toContain("My OpenAI");
|
|
83
|
+
expect(check.detail).toContain("this project's own provider");
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
/*
|
|
87
|
+
* The headline case the old banner got wrong: no project provider, a free
|
|
88
|
+
* global one, and the project is nonetheless ready.
|
|
89
|
+
*/
|
|
90
|
+
test("a FREE global provider is ready with no project provider and no balance", async () => {
|
|
91
|
+
jest
|
|
92
|
+
.spyOn(LlmProviderService, "getLlmProviderForMeteredAgentPath")
|
|
93
|
+
.mockResolvedValue(
|
|
94
|
+
fakeProvider({
|
|
95
|
+
name: "Global LLM Provider",
|
|
96
|
+
isGlobalLlm: true,
|
|
97
|
+
costPerMillionTokensInUSDCents: 0,
|
|
98
|
+
}),
|
|
99
|
+
);
|
|
100
|
+
const projectSpy: jest.SpiedFunction<typeof ProjectService.findOneById> =
|
|
101
|
+
jest.spyOn(ProjectService, "findOneById");
|
|
102
|
+
|
|
103
|
+
const check: AIFixReadinessCheck =
|
|
104
|
+
await CodeFixReadiness.getLlmProviderCheck({
|
|
105
|
+
projectId,
|
|
106
|
+
billingEnabled: true,
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
expect(check.ok).toBe(true);
|
|
110
|
+
expect(check.detail).toContain("shared provider");
|
|
111
|
+
// A free provider bills nothing, so the balance must never be consulted.
|
|
112
|
+
expect(projectSpy).not.toHaveBeenCalled();
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
test("a costed global provider with billing OFF is ready and skips the balance check", async () => {
|
|
116
|
+
jest
|
|
117
|
+
.spyOn(LlmProviderService, "getLlmProviderForMeteredAgentPath")
|
|
118
|
+
.mockResolvedValue(
|
|
119
|
+
fakeProvider({
|
|
120
|
+
name: "OneUptime AI",
|
|
121
|
+
isGlobalLlm: true,
|
|
122
|
+
costPerMillionTokensInUSDCents: 500,
|
|
123
|
+
}),
|
|
124
|
+
);
|
|
125
|
+
const projectSpy: jest.SpiedFunction<typeof ProjectService.findOneById> =
|
|
126
|
+
jest.spyOn(ProjectService, "findOneById");
|
|
127
|
+
|
|
128
|
+
const check: AIFixReadinessCheck =
|
|
129
|
+
await CodeFixReadiness.getLlmProviderCheck({
|
|
130
|
+
projectId,
|
|
131
|
+
billingEnabled: false,
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
expect(check.ok).toBe(true);
|
|
135
|
+
expect(projectSpy).not.toHaveBeenCalled();
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
test("a costed global provider with billing ON and a funded balance is ready and says it is metered", async () => {
|
|
139
|
+
jest
|
|
140
|
+
.spyOn(LlmProviderService, "getLlmProviderForMeteredAgentPath")
|
|
141
|
+
.mockResolvedValue(
|
|
142
|
+
fakeProvider({
|
|
143
|
+
name: "OneUptime AI",
|
|
144
|
+
isGlobalLlm: true,
|
|
145
|
+
costPerMillionTokensInUSDCents: 500,
|
|
146
|
+
}),
|
|
147
|
+
);
|
|
148
|
+
jest.spyOn(ProjectService, "findOneById").mockResolvedValue({
|
|
149
|
+
aiCurrentBalanceInUSDCents: 2000,
|
|
150
|
+
} as unknown as Project);
|
|
151
|
+
|
|
152
|
+
const check: AIFixReadinessCheck =
|
|
153
|
+
await CodeFixReadiness.getLlmProviderCheck({
|
|
154
|
+
projectId,
|
|
155
|
+
billingEnabled: true,
|
|
156
|
+
});
|
|
157
|
+
|
|
158
|
+
expect(check.ok).toBe(true);
|
|
159
|
+
expect(check.detail).toContain("AI balance");
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
test("a costed global provider with billing ON and an empty balance is NOT ready", async () => {
|
|
163
|
+
jest
|
|
164
|
+
.spyOn(LlmProviderService, "getLlmProviderForMeteredAgentPath")
|
|
165
|
+
.mockResolvedValue(
|
|
166
|
+
fakeProvider({
|
|
167
|
+
name: "OneUptime AI",
|
|
168
|
+
isGlobalLlm: true,
|
|
169
|
+
costPerMillionTokensInUSDCents: 500,
|
|
170
|
+
}),
|
|
171
|
+
);
|
|
172
|
+
jest.spyOn(ProjectService, "findOneById").mockResolvedValue({
|
|
173
|
+
aiCurrentBalanceInUSDCents: 0,
|
|
174
|
+
} as unknown as Project);
|
|
175
|
+
|
|
176
|
+
const check: AIFixReadinessCheck =
|
|
177
|
+
await CodeFixReadiness.getLlmProviderCheck({
|
|
178
|
+
projectId,
|
|
179
|
+
billingEnabled: true,
|
|
180
|
+
});
|
|
181
|
+
|
|
182
|
+
expect(check.ok).toBe(false);
|
|
183
|
+
expect(check.detail).toContain("AI Credits");
|
|
184
|
+
});
|
|
185
|
+
});
|
|
186
|
+
|
|
187
|
+
/*
|
|
188
|
+
* AI_CODE_FIX_FEATURE is one of AUTONOMOUS_AI_FEATURES, so executeWithLogging
|
|
189
|
+
* runs every fix completion through the daily token budget. Readiness that
|
|
190
|
+
* ignored it would report ready and then die at the run's first completion
|
|
191
|
+
* call — the exact fail-late hole the balance gate exists to close.
|
|
192
|
+
*/
|
|
193
|
+
describe("CodeFixReadiness.getLlmProviderCheck — daily autonomous token budget", () => {
|
|
194
|
+
afterEach(() => {
|
|
195
|
+
jest.restoreAllMocks();
|
|
196
|
+
});
|
|
197
|
+
|
|
198
|
+
test("a zeroed daily limit (the kill switch) is NOT ready, even with a healthy project-owned provider", async () => {
|
|
199
|
+
jest
|
|
200
|
+
.spyOn(LlmProviderService, "getLlmProviderForMeteredAgentPath")
|
|
201
|
+
.mockResolvedValue(fakeProvider({ name: "My OpenAI" }));
|
|
202
|
+
jest.spyOn(AIService, "getAutonomousDailyBudgetStatus").mockResolvedValue({
|
|
203
|
+
exhausted: true,
|
|
204
|
+
limitInTokens: 0,
|
|
205
|
+
usedTokensToday: 0,
|
|
206
|
+
});
|
|
207
|
+
|
|
208
|
+
const check: AIFixReadinessCheck =
|
|
209
|
+
await CodeFixReadiness.getLlmProviderCheck({
|
|
210
|
+
projectId,
|
|
211
|
+
billingEnabled: false,
|
|
212
|
+
});
|
|
213
|
+
|
|
214
|
+
expect(check.ok).toBe(false);
|
|
215
|
+
expect(check.detail).toContain("paused");
|
|
216
|
+
});
|
|
217
|
+
|
|
218
|
+
test("an exhausted daily budget is NOT ready and reports the usage", async () => {
|
|
219
|
+
jest
|
|
220
|
+
.spyOn(LlmProviderService, "getLlmProviderForMeteredAgentPath")
|
|
221
|
+
.mockResolvedValue(fakeProvider({ name: "My OpenAI" }));
|
|
222
|
+
jest.spyOn(AIService, "getAutonomousDailyBudgetStatus").mockResolvedValue({
|
|
223
|
+
exhausted: true,
|
|
224
|
+
limitInTokens: 1000,
|
|
225
|
+
usedTokensToday: 1000,
|
|
226
|
+
});
|
|
227
|
+
|
|
228
|
+
const check: AIFixReadinessCheck =
|
|
229
|
+
await CodeFixReadiness.getLlmProviderCheck({
|
|
230
|
+
projectId,
|
|
231
|
+
billingEnabled: false,
|
|
232
|
+
});
|
|
233
|
+
|
|
234
|
+
expect(check.ok).toBe(false);
|
|
235
|
+
expect(check.detail).toContain("exhausted");
|
|
236
|
+
expect(check.detail).toContain("1,000");
|
|
237
|
+
});
|
|
238
|
+
|
|
239
|
+
test("an unset daily limit never blocks", async () => {
|
|
240
|
+
jest
|
|
241
|
+
.spyOn(LlmProviderService, "getLlmProviderForMeteredAgentPath")
|
|
242
|
+
.mockResolvedValue(fakeProvider({ name: "My OpenAI" }));
|
|
243
|
+
mockBudgetNotExhausted();
|
|
244
|
+
|
|
245
|
+
const check: AIFixReadinessCheck =
|
|
246
|
+
await CodeFixReadiness.getLlmProviderCheck({
|
|
247
|
+
projectId,
|
|
248
|
+
billingEnabled: false,
|
|
249
|
+
});
|
|
250
|
+
|
|
251
|
+
expect(check.ok).toBe(true);
|
|
252
|
+
});
|
|
253
|
+
});
|
|
254
|
+
|
|
255
|
+
describe("CodeFixReadiness.getAgentCheck", () => {
|
|
256
|
+
afterEach(() => {
|
|
257
|
+
jest.restoreAllMocks();
|
|
258
|
+
});
|
|
259
|
+
|
|
260
|
+
test("no agent for the project: not ready", async () => {
|
|
261
|
+
jest.spyOn(AIAgentService, "getAIAgentForProject").mockResolvedValue(null);
|
|
262
|
+
|
|
263
|
+
const check: AIFixReadinessCheck = await CodeFixReadiness.getAgentCheck({
|
|
264
|
+
projectId,
|
|
265
|
+
});
|
|
266
|
+
|
|
267
|
+
expect(check.id).toBe("agentAvailable");
|
|
268
|
+
expect(check.ok).toBe(false);
|
|
269
|
+
expect(check.detail).toContain("No AI agent is available");
|
|
270
|
+
});
|
|
271
|
+
|
|
272
|
+
test("an agent that exists but is not alive: not ready, and names it", async () => {
|
|
273
|
+
jest
|
|
274
|
+
.spyOn(AIAgentService, "getAIAgentForProject")
|
|
275
|
+
.mockResolvedValue({ name: "fix-worker" } as unknown as AIAgent);
|
|
276
|
+
jest.spyOn(AIAgentService, "isAgentAlive").mockReturnValue(false);
|
|
277
|
+
|
|
278
|
+
const check: AIFixReadinessCheck = await CodeFixReadiness.getAgentCheck({
|
|
279
|
+
projectId,
|
|
280
|
+
});
|
|
281
|
+
|
|
282
|
+
expect(check.ok).toBe(false);
|
|
283
|
+
expect(check.detail).toContain("fix-worker");
|
|
284
|
+
});
|
|
285
|
+
|
|
286
|
+
test("a live agent is ready and is named", async () => {
|
|
287
|
+
jest
|
|
288
|
+
.spyOn(AIAgentService, "getAIAgentForProject")
|
|
289
|
+
.mockResolvedValue({ name: "fix-worker" } as unknown as AIAgent);
|
|
290
|
+
jest.spyOn(AIAgentService, "isAgentAlive").mockReturnValue(true);
|
|
291
|
+
|
|
292
|
+
const check: AIFixReadinessCheck = await CodeFixReadiness.getAgentCheck({
|
|
293
|
+
projectId,
|
|
294
|
+
});
|
|
295
|
+
|
|
296
|
+
expect(check.ok).toBe(true);
|
|
297
|
+
expect(check.title).toContain("fix-worker");
|
|
298
|
+
});
|
|
299
|
+
});
|
|
300
|
+
|
|
301
|
+
describe("CodeFixReadiness.getRepositoryConnectedCheck", () => {
|
|
302
|
+
afterEach(() => {
|
|
303
|
+
jest.restoreAllMocks();
|
|
304
|
+
});
|
|
305
|
+
|
|
306
|
+
/*
|
|
307
|
+
* The page-level gate asserts the WEAKER any-repo claim, so its id must
|
|
308
|
+
* stay distinct from the per-exception repositoryResolved — a UI that saw
|
|
309
|
+
* the same id would imply a specific exception will resolve.
|
|
310
|
+
*/
|
|
311
|
+
test("a connected repository is ready under the repositoryConnected id", async () => {
|
|
312
|
+
jest
|
|
313
|
+
.spyOn(SubjectCodeFixRun, "hasGitHubAppConnectedRepository")
|
|
314
|
+
.mockResolvedValue(true);
|
|
315
|
+
|
|
316
|
+
const check: AIFixReadinessCheck =
|
|
317
|
+
await CodeFixReadiness.getRepositoryConnectedCheck({ projectId });
|
|
318
|
+
|
|
319
|
+
expect(check.id).toBe("repositoryConnected");
|
|
320
|
+
expect(check.ok).toBe(true);
|
|
321
|
+
});
|
|
322
|
+
|
|
323
|
+
test("no connected repository: not ready, and points at the GitHub App", async () => {
|
|
324
|
+
jest
|
|
325
|
+
.spyOn(SubjectCodeFixRun, "hasGitHubAppConnectedRepository")
|
|
326
|
+
.mockResolvedValue(false);
|
|
327
|
+
|
|
328
|
+
const check: AIFixReadinessCheck =
|
|
329
|
+
await CodeFixReadiness.getRepositoryConnectedCheck({ projectId });
|
|
330
|
+
|
|
331
|
+
expect(check.ok).toBe(false);
|
|
332
|
+
expect(check.detail).toContain("GitHub App");
|
|
333
|
+
});
|
|
334
|
+
});
|
|
335
|
+
|
|
336
|
+
describe("CodeFixReadiness.getProjectReadiness", () => {
|
|
337
|
+
afterEach(() => {
|
|
338
|
+
jest.restoreAllMocks();
|
|
339
|
+
});
|
|
340
|
+
|
|
341
|
+
type MockAllParams = {
|
|
342
|
+
hasRepo: boolean;
|
|
343
|
+
hasProvider: boolean;
|
|
344
|
+
agentAlive: boolean;
|
|
345
|
+
};
|
|
346
|
+
|
|
347
|
+
function mockAll(params: MockAllParams): void {
|
|
348
|
+
mockBudgetNotExhausted();
|
|
349
|
+
jest
|
|
350
|
+
.spyOn(SubjectCodeFixRun, "hasGitHubAppConnectedRepository")
|
|
351
|
+
.mockResolvedValue(params.hasRepo);
|
|
352
|
+
jest
|
|
353
|
+
.spyOn(LlmProviderService, "getLlmProviderForMeteredAgentPath")
|
|
354
|
+
.mockResolvedValue(
|
|
355
|
+
params.hasProvider ? fakeProvider({ name: "provider" }) : null,
|
|
356
|
+
);
|
|
357
|
+
jest
|
|
358
|
+
.spyOn(AIAgentService, "getAIAgentForProject")
|
|
359
|
+
.mockResolvedValue({ name: "agent" } as unknown as AIAgent);
|
|
360
|
+
jest
|
|
361
|
+
.spyOn(AIAgentService, "isAgentAlive")
|
|
362
|
+
.mockReturnValue(params.agentAlive);
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
test("all three gates satisfied: ready", async () => {
|
|
366
|
+
mockAll({ hasRepo: true, hasProvider: true, agentAlive: true });
|
|
367
|
+
|
|
368
|
+
const readiness: AIFixReadiness =
|
|
369
|
+
await CodeFixReadiness.getProjectReadiness({ projectId });
|
|
370
|
+
|
|
371
|
+
expect(readiness.ready).toBe(true);
|
|
372
|
+
expect(readiness.checks).toHaveLength(3);
|
|
373
|
+
});
|
|
374
|
+
|
|
375
|
+
test("the checks are ordered the way the user sets them up", async () => {
|
|
376
|
+
mockAll({ hasRepo: true, hasProvider: true, agentAlive: true });
|
|
377
|
+
|
|
378
|
+
const readiness: AIFixReadiness =
|
|
379
|
+
await CodeFixReadiness.getProjectReadiness({ projectId });
|
|
380
|
+
|
|
381
|
+
expect(
|
|
382
|
+
readiness.checks.map((check: AIFixReadinessCheck) => {
|
|
383
|
+
return check.id;
|
|
384
|
+
}),
|
|
385
|
+
).toEqual(["repositoryConnected", "llmProvider", "agentAvailable"]);
|
|
386
|
+
});
|
|
387
|
+
|
|
388
|
+
test("any single failing gate makes the whole project not ready", async () => {
|
|
389
|
+
const cases: Array<MockAllParams> = [
|
|
390
|
+
{ hasRepo: false, hasProvider: true, agentAlive: true },
|
|
391
|
+
{ hasRepo: true, hasProvider: false, agentAlive: true },
|
|
392
|
+
{ hasRepo: true, hasProvider: true, agentAlive: false },
|
|
393
|
+
];
|
|
394
|
+
|
|
395
|
+
for (const params of cases) {
|
|
396
|
+
jest.restoreAllMocks();
|
|
397
|
+
mockAll(params);
|
|
398
|
+
|
|
399
|
+
const readiness: AIFixReadiness =
|
|
400
|
+
await CodeFixReadiness.getProjectReadiness({ projectId });
|
|
401
|
+
|
|
402
|
+
expect(readiness.ready).toBe(false);
|
|
403
|
+
// The failing gate must still be reported, not swallowed.
|
|
404
|
+
expect(
|
|
405
|
+
readiness.checks.some((check: AIFixReadinessCheck) => {
|
|
406
|
+
return !check.ok;
|
|
407
|
+
}),
|
|
408
|
+
).toBe(true);
|
|
409
|
+
}
|
|
410
|
+
});
|
|
411
|
+
});
|