@oneuptime/common 11.3.26 → 11.4.0
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/AIRun.ts +50 -0
- package/Models/DatabaseModels/IncidentEpisodeRoleMember.ts +1 -1
- package/Models/DatabaseModels/IncidentMember.ts +1 -1
- package/Models/DatabaseModels/IncomingCallPolicy.ts +13 -0
- package/Models/DatabaseModels/Index.ts +3 -0
- package/Models/DatabaseModels/MigrationFailure.ts +170 -0
- package/Models/DatabaseModels/OnCallDutyPolicyExecutionLog.ts +51 -2
- package/Models/DatabaseModels/OnCallDutyPolicySchedule.ts +44 -0
- package/Models/DatabaseModels/OnCallDutyPolicyScheduleLayer.ts +6 -0
- package/Models/DatabaseModels/OnCallDutyPolicyScheduleLayerUser.ts +6 -0
- package/Models/DatabaseModels/OnCallDutyPolicyTimeLog.ts +1 -1
- package/Models/DatabaseModels/OnCallDutyPolicyUserOverride.ts +2 -2
- package/Models/DatabaseModels/Project.ts +60 -0
- package/Server/API/AIInvestigationAPI.ts +148 -0
- package/Server/API/AlertAPI.ts +1 -1
- package/Server/API/IncidentAPI.ts +2 -2
- package/Server/API/IncidentEpisodeAPI.ts +1 -1
- package/Server/API/LlmProviderAPI.ts +1 -0
- package/Server/API/ScheduledMaintenanceAPI.ts +1 -1
- package/Server/Infrastructure/Postgres/SchemaMigrations/1783470000000-AddIncomingCallPolicyRoutingPhoneNumberUnique.ts +25 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1783510935686-FixNotNullForeignKeysOnDelete.ts +81 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1783515836148-MigrationName.ts +25 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1783523076215-AddMigrationFailureTable.ts +35 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1783598145111-AddEnableAutomaticIncidentInvestigationToProject.ts +19 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1783615884106-AddInvestigationSubjectToAIRun.ts +33 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1783632447975-AddEnableAutomaticAlertInvestigationToProject.ts +19 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/Index.ts +14 -0
- package/Server/Infrastructure/PostgresDatabase.ts +11 -0
- package/Server/Services/AIService.ts +74 -2
- package/Server/Services/AlertService.ts +25 -0
- package/Server/Services/AnalyticsDatabaseService.ts +10 -1
- package/Server/Services/DatabaseService.ts +10 -1
- package/Server/Services/IncidentService.ts +26 -1
- package/Server/Services/IncidentStateTimelineService.ts +19 -0
- package/Server/Services/IncomingCallPolicyEscalationRuleService.ts +75 -2
- package/Server/Services/IncomingCallPolicyService.ts +42 -1
- package/Server/Services/Index.ts +2 -0
- package/Server/Services/MigrationFailureService.ts +9 -0
- package/Server/Services/MonitorProbeService.ts +33 -7
- package/Server/Services/MonitorService.ts +19 -7
- package/Server/Services/OnCallDutyPolicyEscalationRuleScheduleService.ts +65 -0
- package/Server/Services/OnCallDutyPolicyEscalationRuleService.ts +185 -41
- package/Server/Services/OnCallDutyPolicyEscalationRuleUserService.ts +23 -15
- package/Server/Services/OnCallDutyPolicyExecutionLogService.ts +39 -0
- package/Server/Services/OnCallDutyPolicyScheduleLayerService.ts +148 -0
- package/Server/Services/OnCallDutyPolicyScheduleLayerUserService.ts +11 -2
- package/Server/Services/OnCallDutyPolicyScheduleService.ts +502 -26
- package/Server/Services/OnCallDutyPolicyTimeLogService.ts +49 -7
- package/Server/Services/OnCallDutyPolicyUserOverrideService.ts +218 -4
- package/Server/Services/ProjectCallSMSConfigService.ts +82 -1
- package/Server/Services/TeamMemberService.ts +6 -0
- package/Server/Services/UserNotificationRuleService.ts +13 -42
- package/Server/Services/UserOnCallLogService.ts +90 -0
- package/Server/Services/UserOnCallLogTimelineService.ts +43 -1
- package/Server/Types/Database/QueryUtil.ts +57 -0
- package/Server/Utils/AI/AlertAIContextBuilder.ts +6 -1
- package/Server/Utils/AI/Chat/ChatAgentRunner.ts +14 -2
- package/Server/Utils/AI/Chat/ObservabilityAssistant.ts +119 -11
- package/Server/Utils/AI/IncidentAIContextBuilder.ts +18 -3
- package/Server/Utils/AI/IncidentEpisodeAIContextBuilder.ts +6 -1
- package/Server/Utils/AI/ScheduledMaintenanceAIContextBuilder.ts +12 -2
- package/Server/Utils/AI/Sentinel/AlertInvestigationRunner.ts +141 -0
- package/Server/Utils/AI/Sentinel/IncidentInvestigationRunner.ts +178 -0
- package/Server/Utils/AI/Sentinel/IncidentPostmortemRunner.ts +105 -0
- package/Server/Utils/AI/Sentinel/SentinelInvestigationEngine.ts +405 -0
- package/Server/Utils/AI/Sentinel/SentinelMemory.ts +167 -0
- package/Server/Utils/AI/Toolbox/IncidentTools.ts +183 -1
- package/Server/Utils/AI/Toolbox/Index.ts +15 -1
- package/Server/Utils/AI/Toolbox/RecentChangesTools.ts +208 -0
- package/Server/Utils/AI/Toolbox/SentinelActionTools.ts +577 -0
- package/Server/Utils/AI/Toolbox/Serializer.ts +42 -0
- package/Server/Utils/Database/MigrationFailureLog.ts +240 -0
- package/Server/Utils/IncomingCallPhoneNumber.ts +41 -0
- package/Server/Utils/LLM/LLMService.ts +110 -11
- package/Server/Utils/Telemetry/IoTSnapshotScan.ts +12 -9
- package/Server/Utils/Telemetry/ProxmoxCephSnapshotScan.ts +12 -9
- package/Tests/Server/API/BaseAPI.test.ts +1 -0
- package/Tests/Server/Services/AnalyticsDatabaseService.test.ts +0 -8
- package/Tests/Server/Services/OnCallDutyPolicyScheduleLayerUserReorder.test.ts +233 -0
- package/Tests/Server/Services/OnCallDutyPolicyTimeLogServiceScoping.test.ts +242 -0
- package/Tests/Server/Services/OnCallDutyPolicyUserOverrideEdit.test.ts +198 -0
- package/Tests/Server/Services/UserOnCallLogClaimNotificationRule.test.ts +495 -0
- package/Tests/Server/Types/Database/QueryUtil.test.ts +74 -0
- package/Tests/Server/Utils/AI/LLMServiceToolCalling.test.ts +78 -0
- package/Tests/Server/Utils/AI/ToolResultSerializer.test.ts +68 -0
- package/Tests/Types/DateExhaustiveTimezone.test.ts +700 -0
- package/Tests/Types/DateTimezoneWallClock.test.ts +99 -0
- package/Tests/Types/Events/Recurring.test.ts +22 -9
- package/Tests/Types/OnCallDutyPolicy/LayerUtilAuditFixes.test.ts +291 -0
- package/Tests/Types/OnCallDutyPolicy/LayerUtilAuditFixesRound2.test.ts +398 -0
- package/Tests/Types/OnCallDutyPolicy/LayerUtilDSTWeekendGap.test.ts +114 -0
- package/Tests/Types/OnCallDutyPolicy/LayerUtilDSTWeeklyDayShift.test.ts +76 -0
- package/Tests/Types/OnCallDutyPolicy/LayerUtilDailyMutation.test.ts +128 -0
- package/Tests/Types/OnCallDutyPolicy/LayerUtilDailyProbe.test.ts +203 -0
- package/Tests/Types/OnCallDutyPolicy/LayerUtilDiffFuzz.test.ts +322 -0
- package/Tests/Types/OnCallDutyPolicy/LayerUtilEdgeCases.test.ts +280 -0
- package/Tests/Types/OnCallDutyPolicy/LayerUtilExhaustiveCurrentUser.test.ts +863 -0
- package/Tests/Types/OnCallDutyPolicy/LayerUtilExhaustiveDaily.test.ts +900 -0
- package/Tests/Types/OnCallDutyPolicy/LayerUtilExhaustiveMultiLayer.test.ts +1104 -0
- package/Tests/Types/OnCallDutyPolicy/LayerUtilExhaustiveRotation.test.ts +957 -0
- package/Tests/Types/OnCallDutyPolicy/LayerUtilExhaustiveWeekly.test.ts +1095 -0
- package/Tests/Types/OnCallDutyPolicy/LayerUtilInvariants.test.ts +232 -0
- package/Tests/Types/OnCallDutyPolicy/LayerUtilMergeAudit.test.ts +227 -0
- package/Tests/Types/OnCallDutyPolicy/LayerUtilMonthYearAudit.test.ts +255 -0
- package/Tests/Types/OnCallDutyPolicy/LayerUtilMultiLayerAudit.test.ts +388 -0
- package/Tests/Types/OnCallDutyPolicy/LayerUtilMultiLayerEdge.test.ts +300 -0
- package/Tests/Types/OnCallDutyPolicy/LayerUtilOvernightDSTAudit.test.ts +158 -0
- package/Tests/Types/OnCallDutyPolicy/LayerUtilRestrictedGapFix.test.ts +253 -0
- package/Tests/Types/OnCallDutyPolicy/LayerUtilRestrictedGapRepro.test.ts +157 -0
- package/Tests/Types/OnCallDutyPolicy/LayerUtilRotationFixes.test.ts +414 -0
- package/Tests/Types/OnCallDutyPolicy/LayerUtilTimezone.test.ts +243 -0
- package/Tests/Types/OnCallDutyPolicy/LayerUtilWeekendGapRepro.test.ts +112 -0
- package/Tests/Types/OnCallDutyPolicy/OverrideLensAudit.test.ts +117 -0
- package/Tests/Types/OnCallDutyPolicy/RestrictionTimes.test.ts +8 -6
- package/Tests/Types/OnCallDutyPolicy/RestrictionTimesDefaultDayAudit.test.ts +112 -0
- package/Tests/Types/OnCallDutyPolicy/RestrictionTimesExhaustive.test.ts +821 -0
- package/Tests/Types/OnCallDutyPolicy/RestrictionTimesMutationInvariant.test.ts +886 -0
- package/Tests/Types/OnCallDutyPolicy/ScheduleShiftUtil.test.ts +260 -0
- package/Tests/Types/OnCallDutyPolicy/UserOverrideUtil.test.ts +255 -0
- package/Tests/Types/OnCallDutyPolicy/UserOverrideUtilExhaustive.test.ts +1126 -0
- package/Types/Date.ts +246 -15
- package/Types/OnCallDutyPolicy/Layer.ts +790 -260
- package/Types/OnCallDutyPolicy/RestrictionTimes.ts +39 -13
- package/Types/OnCallDutyPolicy/ScheduleShiftUtil.ts +257 -0
- package/Types/OnCallDutyPolicy/UserOverrideUtil.ts +21 -5
- package/UI/Components/Calendar/Calendar.tsx +8 -2
- package/UI/Components/Charts/ChartGroup/ChartGroup.tsx +5 -5
- package/UI/Components/Events/RecurringFieldElement.tsx +16 -0
- package/UI/Components/ModelFormModal/ModelFormModal.tsx +8 -0
- package/UI/Components/RadioButtons/BasicRadioButtons.tsx +1 -1
- package/build/dist/Models/DatabaseModels/AIRun.js +52 -0
- package/build/dist/Models/DatabaseModels/AIRun.js.map +1 -1
- package/build/dist/Models/DatabaseModels/IncidentEpisodeRoleMember.js +1 -1
- package/build/dist/Models/DatabaseModels/IncidentEpisodeRoleMember.js.map +1 -1
- package/build/dist/Models/DatabaseModels/IncidentMember.js +1 -1
- package/build/dist/Models/DatabaseModels/IncidentMember.js.map +1 -1
- package/build/dist/Models/DatabaseModels/IncomingCallPolicy.js +10 -0
- package/build/dist/Models/DatabaseModels/IncomingCallPolicy.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/MigrationFailure.js +196 -0
- package/build/dist/Models/DatabaseModels/MigrationFailure.js.map +1 -0
- package/build/dist/Models/DatabaseModels/OnCallDutyPolicyExecutionLog.js +52 -2
- package/build/dist/Models/DatabaseModels/OnCallDutyPolicyExecutionLog.js.map +1 -1
- package/build/dist/Models/DatabaseModels/OnCallDutyPolicySchedule.js +45 -0
- package/build/dist/Models/DatabaseModels/OnCallDutyPolicySchedule.js.map +1 -1
- package/build/dist/Models/DatabaseModels/OnCallDutyPolicyScheduleLayer.js +6 -0
- package/build/dist/Models/DatabaseModels/OnCallDutyPolicyScheduleLayer.js.map +1 -1
- package/build/dist/Models/DatabaseModels/OnCallDutyPolicyScheduleLayerUser.js +6 -0
- package/build/dist/Models/DatabaseModels/OnCallDutyPolicyScheduleLayerUser.js.map +1 -1
- package/build/dist/Models/DatabaseModels/OnCallDutyPolicyTimeLog.js +1 -1
- package/build/dist/Models/DatabaseModels/OnCallDutyPolicyTimeLog.js.map +1 -1
- package/build/dist/Models/DatabaseModels/OnCallDutyPolicyUserOverride.js +2 -2
- package/build/dist/Models/DatabaseModels/OnCallDutyPolicyUserOverride.js.map +1 -1
- package/build/dist/Models/DatabaseModels/Project.js +62 -0
- package/build/dist/Models/DatabaseModels/Project.js.map +1 -1
- package/build/dist/Server/API/AIInvestigationAPI.js +107 -0
- package/build/dist/Server/API/AIInvestigationAPI.js.map +1 -0
- package/build/dist/Server/API/AlertAPI.js +1 -1
- package/build/dist/Server/API/IncidentAPI.js +2 -2
- package/build/dist/Server/API/IncidentEpisodeAPI.js +1 -1
- package/build/dist/Server/API/LlmProviderAPI.js +1 -0
- package/build/dist/Server/API/LlmProviderAPI.js.map +1 -1
- package/build/dist/Server/API/ScheduledMaintenanceAPI.js +1 -1
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783470000000-AddIncomingCallPolicyRoutingPhoneNumberUnique.js +18 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783470000000-AddIncomingCallPolicyRoutingPhoneNumberUnique.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783510935686-FixNotNullForeignKeysOnDelete.js +38 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783510935686-FixNotNullForeignKeysOnDelete.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783515836148-MigrationName.js +16 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783515836148-MigrationName.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783523076215-AddMigrationFailureTable.js +18 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783523076215-AddMigrationFailureTable.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783598145111-AddEnableAutomaticIncidentInvestigationToProject.js +12 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783598145111-AddEnableAutomaticIncidentInvestigationToProject.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783615884106-AddInvestigationSubjectToAIRun.js +18 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783615884106-AddInvestigationSubjectToAIRun.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783632447975-AddEnableAutomaticAlertInvestigationToProject.js +12 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783632447975-AddEnableAutomaticAlertInvestigationToProject.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js +14 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js.map +1 -1
- package/build/dist/Server/Infrastructure/PostgresDatabase.js +9 -0
- package/build/dist/Server/Infrastructure/PostgresDatabase.js.map +1 -1
- package/build/dist/Server/Services/AIService.js +53 -2
- package/build/dist/Server/Services/AIService.js.map +1 -1
- package/build/dist/Server/Services/AlertService.js +24 -0
- package/build/dist/Server/Services/AlertService.js.map +1 -1
- package/build/dist/Server/Services/AnalyticsDatabaseService.js +10 -1
- package/build/dist/Server/Services/AnalyticsDatabaseService.js.map +1 -1
- package/build/dist/Server/Services/DatabaseService.js +10 -1
- package/build/dist/Server/Services/DatabaseService.js.map +1 -1
- package/build/dist/Server/Services/IncidentService.js +25 -1
- package/build/dist/Server/Services/IncidentService.js.map +1 -1
- package/build/dist/Server/Services/IncidentStateTimelineService.js +19 -0
- package/build/dist/Server/Services/IncidentStateTimelineService.js.map +1 -1
- package/build/dist/Server/Services/IncomingCallPolicyEscalationRuleService.js +55 -2
- package/build/dist/Server/Services/IncomingCallPolicyEscalationRuleService.js.map +1 -1
- package/build/dist/Server/Services/IncomingCallPolicyService.js +40 -0
- package/build/dist/Server/Services/IncomingCallPolicyService.js.map +1 -1
- package/build/dist/Server/Services/Index.js +2 -0
- package/build/dist/Server/Services/Index.js.map +1 -1
- package/build/dist/Server/Services/MigrationFailureService.js +9 -0
- package/build/dist/Server/Services/MigrationFailureService.js.map +1 -0
- package/build/dist/Server/Services/MonitorProbeService.js +33 -7
- package/build/dist/Server/Services/MonitorProbeService.js.map +1 -1
- package/build/dist/Server/Services/MonitorService.js +12 -5
- package/build/dist/Server/Services/MonitorService.js.map +1 -1
- package/build/dist/Server/Services/OnCallDutyPolicyEscalationRuleScheduleService.js +81 -22
- package/build/dist/Server/Services/OnCallDutyPolicyEscalationRuleScheduleService.js.map +1 -1
- package/build/dist/Server/Services/OnCallDutyPolicyEscalationRuleService.js +134 -31
- package/build/dist/Server/Services/OnCallDutyPolicyEscalationRuleService.js.map +1 -1
- package/build/dist/Server/Services/OnCallDutyPolicyEscalationRuleUserService.js +21 -13
- package/build/dist/Server/Services/OnCallDutyPolicyEscalationRuleUserService.js.map +1 -1
- package/build/dist/Server/Services/OnCallDutyPolicyExecutionLogService.js +36 -0
- package/build/dist/Server/Services/OnCallDutyPolicyExecutionLogService.js.map +1 -1
- package/build/dist/Server/Services/OnCallDutyPolicyScheduleLayerService.js +121 -0
- package/build/dist/Server/Services/OnCallDutyPolicyScheduleLayerService.js.map +1 -1
- package/build/dist/Server/Services/OnCallDutyPolicyScheduleLayerUserService.js +11 -2
- package/build/dist/Server/Services/OnCallDutyPolicyScheduleLayerUserService.js.map +1 -1
- package/build/dist/Server/Services/OnCallDutyPolicyScheduleService.js +409 -36
- package/build/dist/Server/Services/OnCallDutyPolicyScheduleService.js.map +1 -1
- package/build/dist/Server/Services/OnCallDutyPolicyTimeLogService.js +52 -8
- package/build/dist/Server/Services/OnCallDutyPolicyTimeLogService.js.map +1 -1
- package/build/dist/Server/Services/OnCallDutyPolicyUserOverrideService.js +170 -3
- package/build/dist/Server/Services/OnCallDutyPolicyUserOverrideService.js.map +1 -1
- package/build/dist/Server/Services/ProjectCallSMSConfigService.js +72 -0
- package/build/dist/Server/Services/ProjectCallSMSConfigService.js.map +1 -1
- package/build/dist/Server/Services/TeamMemberService.js +6 -0
- package/build/dist/Server/Services/TeamMemberService.js.map +1 -1
- package/build/dist/Server/Services/UserNotificationRuleService.js +12 -30
- package/build/dist/Server/Services/UserNotificationRuleService.js.map +1 -1
- package/build/dist/Server/Services/UserOnCallLogService.js +75 -0
- package/build/dist/Server/Services/UserOnCallLogService.js.map +1 -1
- package/build/dist/Server/Services/UserOnCallLogTimelineService.js +31 -1
- package/build/dist/Server/Services/UserOnCallLogTimelineService.js.map +1 -1
- package/build/dist/Server/Types/Database/QueryUtil.js +45 -0
- package/build/dist/Server/Types/Database/QueryUtil.js.map +1 -1
- package/build/dist/Server/Utils/AI/AlertAIContextBuilder.js +6 -1
- package/build/dist/Server/Utils/AI/AlertAIContextBuilder.js.map +1 -1
- package/build/dist/Server/Utils/AI/Chat/ChatAgentRunner.js +13 -2
- package/build/dist/Server/Utils/AI/Chat/ChatAgentRunner.js.map +1 -1
- package/build/dist/Server/Utils/AI/Chat/ObservabilityAssistant.js +59 -11
- package/build/dist/Server/Utils/AI/Chat/ObservabilityAssistant.js.map +1 -1
- package/build/dist/Server/Utils/AI/IncidentAIContextBuilder.js +18 -3
- package/build/dist/Server/Utils/AI/IncidentAIContextBuilder.js.map +1 -1
- package/build/dist/Server/Utils/AI/IncidentEpisodeAIContextBuilder.js +6 -1
- package/build/dist/Server/Utils/AI/IncidentEpisodeAIContextBuilder.js.map +1 -1
- package/build/dist/Server/Utils/AI/ScheduledMaintenanceAIContextBuilder.js +12 -2
- package/build/dist/Server/Utils/AI/ScheduledMaintenanceAIContextBuilder.js.map +1 -1
- package/build/dist/Server/Utils/AI/Sentinel/AlertInvestigationRunner.js +119 -0
- package/build/dist/Server/Utils/AI/Sentinel/AlertInvestigationRunner.js.map +1 -0
- package/build/dist/Server/Utils/AI/Sentinel/IncidentInvestigationRunner.js +147 -0
- package/build/dist/Server/Utils/AI/Sentinel/IncidentInvestigationRunner.js.map +1 -0
- package/build/dist/Server/Utils/AI/Sentinel/IncidentPostmortemRunner.js +93 -0
- package/build/dist/Server/Utils/AI/Sentinel/IncidentPostmortemRunner.js.map +1 -0
- package/build/dist/Server/Utils/AI/Sentinel/SentinelInvestigationEngine.js +311 -0
- package/build/dist/Server/Utils/AI/Sentinel/SentinelInvestigationEngine.js.map +1 -0
- package/build/dist/Server/Utils/AI/Sentinel/SentinelMemory.js +143 -0
- package/build/dist/Server/Utils/AI/Sentinel/SentinelMemory.js.map +1 -0
- package/build/dist/Server/Utils/AI/Toolbox/IncidentTools.js +152 -1
- package/build/dist/Server/Utils/AI/Toolbox/IncidentTools.js.map +1 -1
- package/build/dist/Server/Utils/AI/Toolbox/Index.js +10 -1
- package/build/dist/Server/Utils/AI/Toolbox/Index.js.map +1 -1
- package/build/dist/Server/Utils/AI/Toolbox/RecentChangesTools.js +165 -0
- package/build/dist/Server/Utils/AI/Toolbox/RecentChangesTools.js.map +1 -0
- package/build/dist/Server/Utils/AI/Toolbox/SentinelActionTools.js +451 -0
- package/build/dist/Server/Utils/AI/Toolbox/SentinelActionTools.js.map +1 -0
- package/build/dist/Server/Utils/AI/Toolbox/Serializer.js +40 -0
- package/build/dist/Server/Utils/AI/Toolbox/Serializer.js.map +1 -1
- package/build/dist/Server/Utils/Database/MigrationFailureLog.js +174 -0
- package/build/dist/Server/Utils/Database/MigrationFailureLog.js.map +1 -0
- package/build/dist/Server/Utils/IncomingCallPhoneNumber.js +30 -0
- package/build/dist/Server/Utils/IncomingCallPhoneNumber.js.map +1 -0
- package/build/dist/Server/Utils/LLM/LLMService.js +81 -5
- package/build/dist/Server/Utils/LLM/LLMService.js.map +1 -1
- package/build/dist/Server/Utils/Telemetry/IoTSnapshotScan.js +11 -8
- package/build/dist/Server/Utils/Telemetry/IoTSnapshotScan.js.map +1 -1
- package/build/dist/Server/Utils/Telemetry/ProxmoxCephSnapshotScan.js +11 -8
- package/build/dist/Server/Utils/Telemetry/ProxmoxCephSnapshotScan.js.map +1 -1
- package/build/dist/Types/Date.js +185 -15
- package/build/dist/Types/Date.js.map +1 -1
- package/build/dist/Types/OnCallDutyPolicy/Layer.js +602 -171
- package/build/dist/Types/OnCallDutyPolicy/Layer.js.map +1 -1
- package/build/dist/Types/OnCallDutyPolicy/RestrictionTimes.js +27 -13
- package/build/dist/Types/OnCallDutyPolicy/RestrictionTimes.js.map +1 -1
- package/build/dist/Types/OnCallDutyPolicy/ScheduleShiftUtil.js +159 -0
- package/build/dist/Types/OnCallDutyPolicy/ScheduleShiftUtil.js.map +1 -0
- package/build/dist/Types/OnCallDutyPolicy/UserOverrideUtil.js +20 -5
- package/build/dist/Types/OnCallDutyPolicy/UserOverrideUtil.js.map +1 -1
- package/build/dist/UI/Components/Calendar/Calendar.js +2 -2
- package/build/dist/UI/Components/Calendar/Calendar.js.map +1 -1
- package/build/dist/UI/Components/Charts/ChartGroup/ChartGroup.js +2 -2
- package/build/dist/UI/Components/Charts/ChartGroup/ChartGroup.js.map +1 -1
- package/build/dist/UI/Components/Events/RecurringFieldElement.js +13 -0
- package/build/dist/UI/Components/Events/RecurringFieldElement.js.map +1 -1
- package/build/dist/UI/Components/ModelFormModal/ModelFormModal.js.map +1 -1
- package/build/dist/UI/Components/RadioButtons/BasicRadioButtons.js +1 -1
- package/build/dist/UI/Components/RadioButtons/BasicRadioButtons.js.map +1 -1
- package/package.json +1 -1
|
@@ -284,6 +284,56 @@ export default class AIRun extends BaseModel {
|
|
|
284
284
|
})
|
|
285
285
|
public conversationId?: ObjectID = undefined;
|
|
286
286
|
|
|
287
|
+
@ColumnAccessControl({
|
|
288
|
+
create: [],
|
|
289
|
+
read: [
|
|
290
|
+
Permission.ProjectOwner,
|
|
291
|
+
Permission.ProjectAdmin,
|
|
292
|
+
Permission.ProjectMember,
|
|
293
|
+
],
|
|
294
|
+
update: [],
|
|
295
|
+
})
|
|
296
|
+
@Index()
|
|
297
|
+
@TableColumn({
|
|
298
|
+
type: TableColumnType.ObjectID,
|
|
299
|
+
required: false,
|
|
300
|
+
canReadOnRelationQuery: true,
|
|
301
|
+
title: "Triggered By Incident ID",
|
|
302
|
+
description:
|
|
303
|
+
"The incident that triggered this run (for autonomous investigations).",
|
|
304
|
+
})
|
|
305
|
+
@Column({
|
|
306
|
+
type: ColumnType.ObjectID,
|
|
307
|
+
nullable: true,
|
|
308
|
+
transformer: ObjectID.getDatabaseTransformer(),
|
|
309
|
+
})
|
|
310
|
+
public triggeredByIncidentId?: ObjectID = undefined;
|
|
311
|
+
|
|
312
|
+
@ColumnAccessControl({
|
|
313
|
+
create: [],
|
|
314
|
+
read: [
|
|
315
|
+
Permission.ProjectOwner,
|
|
316
|
+
Permission.ProjectAdmin,
|
|
317
|
+
Permission.ProjectMember,
|
|
318
|
+
],
|
|
319
|
+
update: [],
|
|
320
|
+
})
|
|
321
|
+
@Index()
|
|
322
|
+
@TableColumn({
|
|
323
|
+
type: TableColumnType.ObjectID,
|
|
324
|
+
required: false,
|
|
325
|
+
canReadOnRelationQuery: true,
|
|
326
|
+
title: "Triggered By Alert ID",
|
|
327
|
+
description:
|
|
328
|
+
"The alert that triggered this run (for autonomous investigations).",
|
|
329
|
+
})
|
|
330
|
+
@Column({
|
|
331
|
+
type: ColumnType.ObjectID,
|
|
332
|
+
nullable: true,
|
|
333
|
+
transformer: ObjectID.getDatabaseTransformer(),
|
|
334
|
+
})
|
|
335
|
+
public triggeredByAlertId?: ObjectID = undefined;
|
|
336
|
+
|
|
287
337
|
@ColumnAccessControl({
|
|
288
338
|
create: [],
|
|
289
339
|
read: [
|
|
@@ -89,6 +89,19 @@ import EnableWorkflow from "../../Types/Database/EnableWorkflow";
|
|
|
89
89
|
tableDescription:
|
|
90
90
|
"Manage incoming call routing policies with escalation rules for on-call teams",
|
|
91
91
|
})
|
|
92
|
+
/*
|
|
93
|
+
* A routing phone number may belong to at most one active policy. The inbound
|
|
94
|
+
* /voice webhook looks up the policy by routingPhoneNumber and assumes a single
|
|
95
|
+
* match, so this uniqueness is enforced at the DB level (partial index in the
|
|
96
|
+
* migration; NULLs are allowed for policies without a number yet).
|
|
97
|
+
*/
|
|
98
|
+
@Index(
|
|
99
|
+
"IDX_INCOMING_CALL_POLICY_ROUTING_PHONE_UNIQUE",
|
|
100
|
+
["routingPhoneNumber"],
|
|
101
|
+
{
|
|
102
|
+
unique: true,
|
|
103
|
+
},
|
|
104
|
+
)
|
|
92
105
|
export default class IncomingCallPolicy extends BaseModel {
|
|
93
106
|
@ColumnAccessControl({
|
|
94
107
|
create: [
|
|
@@ -58,6 +58,7 @@ import BillingPaymentMethods from "./BillingPaymentMethod";
|
|
|
58
58
|
import CallLog from "./CallLog";
|
|
59
59
|
// Date migration
|
|
60
60
|
import DataMigration from "./DataMigration";
|
|
61
|
+
import MigrationFailure from "./MigrationFailure";
|
|
61
62
|
import Domain from "./Domain";
|
|
62
63
|
import EmailLog from "./EmailLog";
|
|
63
64
|
import EmailVerificationToken from "./EmailVerificationToken";
|
|
@@ -650,6 +651,8 @@ const AllModelTypes: Array<{
|
|
|
650
651
|
|
|
651
652
|
DataMigration,
|
|
652
653
|
|
|
654
|
+
MigrationFailure,
|
|
655
|
+
|
|
653
656
|
ShortLink,
|
|
654
657
|
|
|
655
658
|
ScheduledMaintenanceTemplate,
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import BaseModel from "./DatabaseBaseModel/DatabaseBaseModel";
|
|
2
|
+
import ColumnAccessControl from "../../Types/Database/AccessControl/ColumnAccessControl";
|
|
3
|
+
import TableAccessControl from "../../Types/Database/AccessControl/TableAccessControl";
|
|
4
|
+
import ColumnLength from "../../Types/Database/ColumnLength";
|
|
5
|
+
import ColumnType from "../../Types/Database/ColumnType";
|
|
6
|
+
import TableColumn from "../../Types/Database/TableColumn";
|
|
7
|
+
import TableColumnType from "../../Types/Database/TableColumnType";
|
|
8
|
+
import TableMetadata from "../../Types/Database/TableMetadata";
|
|
9
|
+
import IconProp from "../../Types/Icon/IconProp";
|
|
10
|
+
import { Column, Entity, Index } from "typeorm";
|
|
11
|
+
|
|
12
|
+
/*
|
|
13
|
+
* Persistent log of migrations that FAILED to apply. Neither the TypeORM
|
|
14
|
+
* `migrations` table nor the `DataMigrations` table records failures — they
|
|
15
|
+
* only ever gain a row on SUCCESS — so without this table the admin health
|
|
16
|
+
* page can show that a migration is pending but never why. Each failed attempt
|
|
17
|
+
* appends a row here (name + redacted error + when it ran), which the
|
|
18
|
+
* migration-status endpoint reads back to explain a stuck / behind schema.
|
|
19
|
+
*
|
|
20
|
+
* Access control is empty (root-only): rows are written by the migration
|
|
21
|
+
* runners and read by the master-admin health endpoint via raw/isRoot queries,
|
|
22
|
+
* never by tenant users, so no CRUD API is exposed.
|
|
23
|
+
*/
|
|
24
|
+
@TableAccessControl({
|
|
25
|
+
create: [],
|
|
26
|
+
read: [],
|
|
27
|
+
delete: [],
|
|
28
|
+
update: [],
|
|
29
|
+
})
|
|
30
|
+
@TableMetadata({
|
|
31
|
+
tableName: "MigrationFailure",
|
|
32
|
+
singularName: "Migration Failure",
|
|
33
|
+
pluralName: "Migration Failures",
|
|
34
|
+
icon: IconProp.Database,
|
|
35
|
+
tableDescription:
|
|
36
|
+
"Log of database migrations that failed to apply, with the error and when they were attempted.",
|
|
37
|
+
})
|
|
38
|
+
@Entity({
|
|
39
|
+
name: "MigrationFailure",
|
|
40
|
+
})
|
|
41
|
+
export default class MigrationFailure extends BaseModel {
|
|
42
|
+
@ColumnAccessControl({
|
|
43
|
+
create: [],
|
|
44
|
+
read: [],
|
|
45
|
+
update: [],
|
|
46
|
+
})
|
|
47
|
+
@Index()
|
|
48
|
+
@TableColumn({
|
|
49
|
+
required: true,
|
|
50
|
+
type: TableColumnType.ShortText,
|
|
51
|
+
title: "Migration Name",
|
|
52
|
+
description: "Name of the migration that failed to apply.",
|
|
53
|
+
})
|
|
54
|
+
@Column({
|
|
55
|
+
nullable: false,
|
|
56
|
+
type: ColumnType.ShortText,
|
|
57
|
+
length: ColumnLength.ShortText,
|
|
58
|
+
})
|
|
59
|
+
public migrationName?: string = undefined;
|
|
60
|
+
|
|
61
|
+
@ColumnAccessControl({
|
|
62
|
+
create: [],
|
|
63
|
+
read: [],
|
|
64
|
+
update: [],
|
|
65
|
+
})
|
|
66
|
+
@Index()
|
|
67
|
+
@TableColumn({
|
|
68
|
+
required: true,
|
|
69
|
+
type: TableColumnType.ShortText,
|
|
70
|
+
title: "Migration Type",
|
|
71
|
+
description:
|
|
72
|
+
"Which runner the migration belongs to: 'PostgresSchema' (TypeORM schema migration) or 'DataMigration' (ClickHouse / data backfill).",
|
|
73
|
+
})
|
|
74
|
+
@Column({
|
|
75
|
+
nullable: false,
|
|
76
|
+
type: ColumnType.ShortText,
|
|
77
|
+
length: ColumnLength.ShortText,
|
|
78
|
+
})
|
|
79
|
+
public migrationType?: string = undefined;
|
|
80
|
+
|
|
81
|
+
@ColumnAccessControl({
|
|
82
|
+
create: [],
|
|
83
|
+
read: [],
|
|
84
|
+
update: [],
|
|
85
|
+
})
|
|
86
|
+
@TableColumn({
|
|
87
|
+
required: true,
|
|
88
|
+
type: TableColumnType.VeryLongText,
|
|
89
|
+
title: "Error Message",
|
|
90
|
+
description:
|
|
91
|
+
"The error message from the failed attempt (credentials redacted).",
|
|
92
|
+
})
|
|
93
|
+
@Column({
|
|
94
|
+
nullable: false,
|
|
95
|
+
type: ColumnType.VeryLongText,
|
|
96
|
+
})
|
|
97
|
+
public errorMessage?: string = undefined;
|
|
98
|
+
|
|
99
|
+
@ColumnAccessControl({
|
|
100
|
+
create: [],
|
|
101
|
+
read: [],
|
|
102
|
+
update: [],
|
|
103
|
+
})
|
|
104
|
+
@TableColumn({
|
|
105
|
+
required: false,
|
|
106
|
+
type: TableColumnType.VeryLongText,
|
|
107
|
+
title: "Error Stack",
|
|
108
|
+
description:
|
|
109
|
+
"The stack trace from the failed attempt, if available (credentials redacted).",
|
|
110
|
+
})
|
|
111
|
+
@Column({
|
|
112
|
+
nullable: true,
|
|
113
|
+
type: ColumnType.VeryLongText,
|
|
114
|
+
})
|
|
115
|
+
public errorStack?: string = undefined;
|
|
116
|
+
|
|
117
|
+
@ColumnAccessControl({
|
|
118
|
+
create: [],
|
|
119
|
+
read: [],
|
|
120
|
+
update: [],
|
|
121
|
+
})
|
|
122
|
+
@Index()
|
|
123
|
+
@TableColumn({
|
|
124
|
+
required: true,
|
|
125
|
+
type: TableColumnType.Date,
|
|
126
|
+
title: "Attempted At",
|
|
127
|
+
description: "When this migration was attempted (and failed).",
|
|
128
|
+
})
|
|
129
|
+
@Column({
|
|
130
|
+
nullable: false,
|
|
131
|
+
type: ColumnType.Date,
|
|
132
|
+
})
|
|
133
|
+
public attemptedAt?: Date = undefined;
|
|
134
|
+
|
|
135
|
+
@ColumnAccessControl({
|
|
136
|
+
create: [],
|
|
137
|
+
read: [],
|
|
138
|
+
update: [],
|
|
139
|
+
})
|
|
140
|
+
@TableColumn({
|
|
141
|
+
required: false,
|
|
142
|
+
type: TableColumnType.ShortText,
|
|
143
|
+
title: "Host Name",
|
|
144
|
+
description: "Hostname / pod that ran the failed migration.",
|
|
145
|
+
})
|
|
146
|
+
@Column({
|
|
147
|
+
nullable: true,
|
|
148
|
+
type: ColumnType.ShortText,
|
|
149
|
+
length: ColumnLength.ShortText,
|
|
150
|
+
})
|
|
151
|
+
public hostName?: string = undefined;
|
|
152
|
+
|
|
153
|
+
@ColumnAccessControl({
|
|
154
|
+
create: [],
|
|
155
|
+
read: [],
|
|
156
|
+
update: [],
|
|
157
|
+
})
|
|
158
|
+
@TableColumn({
|
|
159
|
+
required: false,
|
|
160
|
+
type: TableColumnType.ShortText,
|
|
161
|
+
title: "App Version",
|
|
162
|
+
description: "Build / app version that attempted the migration.",
|
|
163
|
+
})
|
|
164
|
+
@Column({
|
|
165
|
+
nullable: true,
|
|
166
|
+
type: ColumnType.ShortText,
|
|
167
|
+
length: ColumnLength.ShortText,
|
|
168
|
+
})
|
|
169
|
+
public appVersion?: string = undefined;
|
|
170
|
+
}
|
|
@@ -1017,7 +1017,16 @@ export default class OnCallDutyPolicyExecutionLog extends BaseModel {
|
|
|
1017
1017
|
Permission.OnCallMember,
|
|
1018
1018
|
Permission.CreateProjectOnCallDutyPolicyExecutionLog,
|
|
1019
1019
|
],
|
|
1020
|
-
read: [
|
|
1020
|
+
read: [
|
|
1021
|
+
Permission.ProjectOwner,
|
|
1022
|
+
Permission.ProjectAdmin,
|
|
1023
|
+
Permission.ProjectMember,
|
|
1024
|
+
Permission.Viewer,
|
|
1025
|
+
Permission.OnCallAdmin,
|
|
1026
|
+
Permission.OnCallMember,
|
|
1027
|
+
Permission.OnCallViewer,
|
|
1028
|
+
Permission.ReadProjectOnCallDutyPolicyExecutionLog,
|
|
1029
|
+
],
|
|
1021
1030
|
update: [],
|
|
1022
1031
|
})
|
|
1023
1032
|
@Index()
|
|
@@ -1180,7 +1189,16 @@ export default class OnCallDutyPolicyExecutionLog extends BaseModel {
|
|
|
1180
1189
|
Permission.OnCallMember,
|
|
1181
1190
|
Permission.CreateProjectOnCallDutyPolicyExecutionLog,
|
|
1182
1191
|
],
|
|
1183
|
-
read: [
|
|
1192
|
+
read: [
|
|
1193
|
+
Permission.ProjectOwner,
|
|
1194
|
+
Permission.ProjectAdmin,
|
|
1195
|
+
Permission.ProjectMember,
|
|
1196
|
+
Permission.Viewer,
|
|
1197
|
+
Permission.OnCallAdmin,
|
|
1198
|
+
Permission.OnCallMember,
|
|
1199
|
+
Permission.OnCallViewer,
|
|
1200
|
+
Permission.ReadProjectOnCallDutyPolicyExecutionLog,
|
|
1201
|
+
],
|
|
1184
1202
|
update: [],
|
|
1185
1203
|
})
|
|
1186
1204
|
@Index()
|
|
@@ -1201,6 +1219,37 @@ export default class OnCallDutyPolicyExecutionLog extends BaseModel {
|
|
|
1201
1219
|
})
|
|
1202
1220
|
public onCallPolicyExecutionRepeatCount?: number = undefined;
|
|
1203
1221
|
|
|
1222
|
+
@ColumnAccessControl({
|
|
1223
|
+
create: [],
|
|
1224
|
+
read: [
|
|
1225
|
+
Permission.ProjectOwner,
|
|
1226
|
+
Permission.ProjectAdmin,
|
|
1227
|
+
Permission.ProjectMember,
|
|
1228
|
+
Permission.Viewer,
|
|
1229
|
+
Permission.OnCallAdmin,
|
|
1230
|
+
Permission.OnCallMember,
|
|
1231
|
+
Permission.OnCallViewer,
|
|
1232
|
+
Permission.ReadProjectOnCallDutyPolicyExecutionLog,
|
|
1233
|
+
],
|
|
1234
|
+
update: [],
|
|
1235
|
+
})
|
|
1236
|
+
@TableColumn({
|
|
1237
|
+
type: TableColumnType.Number,
|
|
1238
|
+
required: true,
|
|
1239
|
+
isDefaultValueColumn: true,
|
|
1240
|
+
title: "Schedule Gap Retry Count",
|
|
1241
|
+
description:
|
|
1242
|
+
"How many times the current escalation rule has been re-sampled because its target schedule(s) momentarily had no on-call user.",
|
|
1243
|
+
defaultValue: 0,
|
|
1244
|
+
example: 0,
|
|
1245
|
+
})
|
|
1246
|
+
@Column({
|
|
1247
|
+
type: ColumnType.Number,
|
|
1248
|
+
nullable: false,
|
|
1249
|
+
default: 0,
|
|
1250
|
+
})
|
|
1251
|
+
public scheduleGapRetryCount?: number = undefined;
|
|
1252
|
+
|
|
1204
1253
|
@ColumnAccessControl({
|
|
1205
1254
|
create: [
|
|
1206
1255
|
Permission.ProjectOwner,
|
|
@@ -20,6 +20,7 @@ import TenantColumn from "../../Types/Database/TenantColumn";
|
|
|
20
20
|
import IconProp from "../../Types/Icon/IconProp";
|
|
21
21
|
import ObjectID from "../../Types/ObjectID";
|
|
22
22
|
import Permission from "../../Types/Permission";
|
|
23
|
+
import Timezone from "../../Types/Timezone";
|
|
23
24
|
import {
|
|
24
25
|
Column,
|
|
25
26
|
Entity,
|
|
@@ -319,6 +320,49 @@ export default class OnCallDutyPolicySchedule extends BaseModel {
|
|
|
319
320
|
})
|
|
320
321
|
public description?: string = undefined;
|
|
321
322
|
|
|
323
|
+
@ColumnAccessControl({
|
|
324
|
+
create: [
|
|
325
|
+
Permission.ProjectOwner,
|
|
326
|
+
Permission.ProjectAdmin,
|
|
327
|
+
Permission.ProjectMember,
|
|
328
|
+
Permission.OnCallAdmin,
|
|
329
|
+
Permission.OnCallMember,
|
|
330
|
+
Permission.CreateProjectOnCallDutyPolicySchedule,
|
|
331
|
+
],
|
|
332
|
+
read: [
|
|
333
|
+
Permission.ProjectOwner,
|
|
334
|
+
Permission.ProjectAdmin,
|
|
335
|
+
Permission.ProjectMember,
|
|
336
|
+
Permission.Viewer,
|
|
337
|
+
Permission.OnCallAdmin,
|
|
338
|
+
Permission.OnCallMember,
|
|
339
|
+
Permission.OnCallViewer,
|
|
340
|
+
Permission.ReadProjectOnCallDutyPolicySchedule,
|
|
341
|
+
],
|
|
342
|
+
update: [
|
|
343
|
+
Permission.ProjectOwner,
|
|
344
|
+
Permission.ProjectAdmin,
|
|
345
|
+
Permission.ProjectMember,
|
|
346
|
+
Permission.OnCallAdmin,
|
|
347
|
+
Permission.OnCallMember,
|
|
348
|
+
Permission.EditProjectOnCallDutyPolicySchedule,
|
|
349
|
+
],
|
|
350
|
+
})
|
|
351
|
+
@TableColumn({
|
|
352
|
+
required: false,
|
|
353
|
+
type: TableColumnType.ShortText,
|
|
354
|
+
title: "Timezone",
|
|
355
|
+
description:
|
|
356
|
+
"IANA timezone this schedule's restriction and hand-off wall-clock times are interpreted in. When empty, times are interpreted in the server's local timezone (legacy behavior).",
|
|
357
|
+
example: "America/New_York",
|
|
358
|
+
})
|
|
359
|
+
@Column({
|
|
360
|
+
nullable: true,
|
|
361
|
+
type: ColumnType.ShortText,
|
|
362
|
+
length: ColumnLength.ShortText,
|
|
363
|
+
})
|
|
364
|
+
public timezone?: Timezone = undefined;
|
|
365
|
+
|
|
322
366
|
@Index()
|
|
323
367
|
@ColumnAccessControl({
|
|
324
368
|
create: [
|
|
@@ -52,11 +52,17 @@ import { Column, Entity, Index, JoinColumn, ManyToOne } from "typeorm";
|
|
|
52
52
|
delete: [
|
|
53
53
|
Permission.ProjectOwner,
|
|
54
54
|
Permission.ProjectAdmin,
|
|
55
|
+
Permission.ProjectMember,
|
|
56
|
+
Permission.OnCallAdmin,
|
|
57
|
+
Permission.OnCallMember,
|
|
55
58
|
Permission.DeleteOnCallDutyPolicyScheduleLayer,
|
|
56
59
|
],
|
|
57
60
|
update: [
|
|
58
61
|
Permission.ProjectOwner,
|
|
59
62
|
Permission.ProjectAdmin,
|
|
63
|
+
Permission.ProjectMember,
|
|
64
|
+
Permission.OnCallAdmin,
|
|
65
|
+
Permission.OnCallMember,
|
|
60
66
|
Permission.EditOnCallDutyPolicyScheduleLayer,
|
|
61
67
|
],
|
|
62
68
|
})
|
|
@@ -50,11 +50,17 @@ import { Column, Entity, Index, JoinColumn, ManyToOne } from "typeorm";
|
|
|
50
50
|
delete: [
|
|
51
51
|
Permission.ProjectOwner,
|
|
52
52
|
Permission.ProjectAdmin,
|
|
53
|
+
Permission.ProjectMember,
|
|
54
|
+
Permission.OnCallAdmin,
|
|
55
|
+
Permission.OnCallMember,
|
|
53
56
|
Permission.DeleteOnCallDutyPolicyScheduleLayer,
|
|
54
57
|
],
|
|
55
58
|
update: [
|
|
56
59
|
Permission.ProjectOwner,
|
|
57
60
|
Permission.ProjectAdmin,
|
|
61
|
+
Permission.ProjectMember,
|
|
62
|
+
Permission.OnCallAdmin,
|
|
63
|
+
Permission.OnCallMember,
|
|
58
64
|
Permission.EditOnCallDutyPolicyScheduleLayer,
|
|
59
65
|
],
|
|
60
66
|
})
|
|
@@ -357,7 +357,7 @@ export default class OnCallDutyPolicyUserOverride extends BaseModel {
|
|
|
357
357
|
{
|
|
358
358
|
eager: false,
|
|
359
359
|
nullable: true,
|
|
360
|
-
onDelete: "
|
|
360
|
+
onDelete: "CASCADE",
|
|
361
361
|
orphanedRowAction: "nullify",
|
|
362
362
|
},
|
|
363
363
|
)
|
|
@@ -435,7 +435,7 @@ export default class OnCallDutyPolicyUserOverride extends BaseModel {
|
|
|
435
435
|
{
|
|
436
436
|
eager: false,
|
|
437
437
|
nullable: true,
|
|
438
|
-
onDelete: "
|
|
438
|
+
onDelete: "CASCADE",
|
|
439
439
|
orphanedRowAction: "nullify",
|
|
440
440
|
},
|
|
441
441
|
)
|
|
@@ -1422,6 +1422,66 @@ export default class Project extends TenantModel {
|
|
|
1422
1422
|
})
|
|
1423
1423
|
public enableAi?: boolean = undefined;
|
|
1424
1424
|
|
|
1425
|
+
@ColumnAccessControl({
|
|
1426
|
+
create: [],
|
|
1427
|
+
read: [
|
|
1428
|
+
Permission.ProjectOwner,
|
|
1429
|
+
Permission.ProjectAdmin,
|
|
1430
|
+
Permission.ProjectMember,
|
|
1431
|
+
Permission.Viewer,
|
|
1432
|
+
Permission.ReadProject,
|
|
1433
|
+
Permission.UnAuthorizedSsoUser,
|
|
1434
|
+
Permission.ProjectUser,
|
|
1435
|
+
],
|
|
1436
|
+
update: [Permission.ProjectOwner, Permission.ProjectAdmin],
|
|
1437
|
+
})
|
|
1438
|
+
@TableColumn({
|
|
1439
|
+
required: true,
|
|
1440
|
+
isDefaultValueColumn: true,
|
|
1441
|
+
type: TableColumnType.Boolean,
|
|
1442
|
+
title: "Enable Automatic Incident Investigation",
|
|
1443
|
+
description:
|
|
1444
|
+
"When enabled, OneUptime's AI SRE (Sentinel) automatically investigates every new incident and posts a cited root cause analysis to the incident timeline. Requires AI to be enabled and an LLM provider to be configured.",
|
|
1445
|
+
defaultValue: false,
|
|
1446
|
+
example: true,
|
|
1447
|
+
})
|
|
1448
|
+
@Column({
|
|
1449
|
+
nullable: false,
|
|
1450
|
+
default: false,
|
|
1451
|
+
type: ColumnType.Boolean,
|
|
1452
|
+
})
|
|
1453
|
+
public enableAutomaticIncidentInvestigation?: boolean = undefined;
|
|
1454
|
+
|
|
1455
|
+
@ColumnAccessControl({
|
|
1456
|
+
create: [],
|
|
1457
|
+
read: [
|
|
1458
|
+
Permission.ProjectOwner,
|
|
1459
|
+
Permission.ProjectAdmin,
|
|
1460
|
+
Permission.ProjectMember,
|
|
1461
|
+
Permission.Viewer,
|
|
1462
|
+
Permission.ReadProject,
|
|
1463
|
+
Permission.UnAuthorizedSsoUser,
|
|
1464
|
+
Permission.ProjectUser,
|
|
1465
|
+
],
|
|
1466
|
+
update: [Permission.ProjectOwner, Permission.ProjectAdmin],
|
|
1467
|
+
})
|
|
1468
|
+
@TableColumn({
|
|
1469
|
+
required: true,
|
|
1470
|
+
isDefaultValueColumn: true,
|
|
1471
|
+
type: TableColumnType.Boolean,
|
|
1472
|
+
title: "Enable Automatic Alert Investigation",
|
|
1473
|
+
description:
|
|
1474
|
+
"When enabled, OneUptime's AI SRE (Sentinel) automatically investigates every new alert and posts a cited root cause analysis to the alert timeline. Requires AI to be enabled and an LLM provider to be configured.",
|
|
1475
|
+
defaultValue: false,
|
|
1476
|
+
example: true,
|
|
1477
|
+
})
|
|
1478
|
+
@Column({
|
|
1479
|
+
nullable: false,
|
|
1480
|
+
default: false,
|
|
1481
|
+
type: ColumnType.Boolean,
|
|
1482
|
+
})
|
|
1483
|
+
public enableAutomaticAlertInvestigation?: boolean = undefined;
|
|
1484
|
+
|
|
1425
1485
|
@ColumnAccessControl({
|
|
1426
1486
|
create: [],
|
|
1427
1487
|
read: [
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import UserMiddleware from "../Middleware/UserAuthorization";
|
|
2
|
+
import CommonAPI from "./CommonAPI";
|
|
3
|
+
import Express, {
|
|
4
|
+
ExpressRequest,
|
|
5
|
+
ExpressResponse,
|
|
6
|
+
ExpressRouter,
|
|
7
|
+
NextFunction,
|
|
8
|
+
} from "../Utils/Express";
|
|
9
|
+
import Response from "../Utils/Response";
|
|
10
|
+
import DatabaseCommonInteractionProps from "../../Types/BaseDatabase/DatabaseCommonInteractionProps";
|
|
11
|
+
import ObjectID from "../../Types/ObjectID";
|
|
12
|
+
import BadDataException from "../../Types/Exception/BadDataException";
|
|
13
|
+
import NotAuthorizedException from "../../Types/Exception/NotAuthorizedException";
|
|
14
|
+
import SortOrder from "../../Types/BaseDatabase/SortOrder";
|
|
15
|
+
import { JSONArray, JSONObject } from "../../Types/JSON";
|
|
16
|
+
import AIRunType from "../../Types/AI/AIRunType";
|
|
17
|
+
import AIRun from "../../Models/DatabaseModels/AIRun";
|
|
18
|
+
import AIRunEvent from "../../Models/DatabaseModels/AIRunEvent";
|
|
19
|
+
import Incident from "../../Models/DatabaseModels/Incident";
|
|
20
|
+
import BaseModel from "../../Models/DatabaseModels/DatabaseBaseModel/DatabaseBaseModel";
|
|
21
|
+
import IncidentService from "../Services/IncidentService";
|
|
22
|
+
import AIRunService from "../Services/AIRunService";
|
|
23
|
+
import AIRunEventService from "../Services/AIRunEventService";
|
|
24
|
+
|
|
25
|
+
const router: ExpressRouter = Express.getRouter();
|
|
26
|
+
|
|
27
|
+
const MAX_EVENTS: number = 500;
|
|
28
|
+
|
|
29
|
+
/*
|
|
30
|
+
* Returns the latest Sentinel investigation (the AIRun + its ordered
|
|
31
|
+
* AIRunEvents) for an incident, so the dashboard can render a live "watch it
|
|
32
|
+
* think" panel.
|
|
33
|
+
*
|
|
34
|
+
* Investigation runs are system-authored (userId = null) and are therefore
|
|
35
|
+
* hidden by the per-user privacy pin on the generic AIRun / AIRunEvent CRUD. So
|
|
36
|
+
* we gate access explicitly here: first confirm the caller can read the incident
|
|
37
|
+
* under THEIR permissions, then read the run + events as root.
|
|
38
|
+
*/
|
|
39
|
+
router.post(
|
|
40
|
+
"/ai-investigation/incident",
|
|
41
|
+
UserMiddleware.getUserMiddleware,
|
|
42
|
+
async (
|
|
43
|
+
req: ExpressRequest,
|
|
44
|
+
res: ExpressResponse,
|
|
45
|
+
next: NextFunction,
|
|
46
|
+
): Promise<void> => {
|
|
47
|
+
try {
|
|
48
|
+
const props: DatabaseCommonInteractionProps =
|
|
49
|
+
await CommonAPI.getDatabaseCommonInteractionProps(req);
|
|
50
|
+
|
|
51
|
+
if (!props.userId) {
|
|
52
|
+
throw new NotAuthorizedException(
|
|
53
|
+
"A logged-in user session is required.",
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const incidentIdString: string | undefined = req.body["incidentId"] as
|
|
58
|
+
| string
|
|
59
|
+
| undefined;
|
|
60
|
+
|
|
61
|
+
if (!incidentIdString) {
|
|
62
|
+
throw new BadDataException("incidentId is required.");
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const incidentId: ObjectID = new ObjectID(incidentIdString);
|
|
66
|
+
|
|
67
|
+
// Access check under the USER's permissions (null when not allowed).
|
|
68
|
+
const incident: Incident | null = await IncidentService.findOneById({
|
|
69
|
+
id: incidentId,
|
|
70
|
+
select: { _id: true },
|
|
71
|
+
props,
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
if (!incident) {
|
|
75
|
+
throw new BadDataException(
|
|
76
|
+
"Incident not found (or you do not have access to it).",
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// Read the latest investigation run as root (bypasses the per-user pin).
|
|
81
|
+
const runs: Array<AIRun> = await AIRunService.findBy({
|
|
82
|
+
query: {
|
|
83
|
+
triggeredByIncidentId: incidentId,
|
|
84
|
+
runType: AIRunType.Investigation,
|
|
85
|
+
},
|
|
86
|
+
select: {
|
|
87
|
+
_id: true,
|
|
88
|
+
status: true,
|
|
89
|
+
startedAt: true,
|
|
90
|
+
completedAt: true,
|
|
91
|
+
errorMessage: true,
|
|
92
|
+
llmCallCount: true,
|
|
93
|
+
toolCallCount: true,
|
|
94
|
+
totalTokens: true,
|
|
95
|
+
createdAt: true,
|
|
96
|
+
},
|
|
97
|
+
sort: { createdAt: SortOrder.Descending },
|
|
98
|
+
limit: 1,
|
|
99
|
+
skip: 0,
|
|
100
|
+
props: { isRoot: true },
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
const run: AIRun | undefined = runs[0];
|
|
104
|
+
|
|
105
|
+
if (!run) {
|
|
106
|
+
Response.sendJsonObjectResponse(req, res, {
|
|
107
|
+
run: null,
|
|
108
|
+
events: [],
|
|
109
|
+
});
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
const events: Array<AIRunEvent> = await AIRunEventService.findBy({
|
|
114
|
+
query: { aiRunId: run.id! },
|
|
115
|
+
select: {
|
|
116
|
+
_id: true,
|
|
117
|
+
sequence: true,
|
|
118
|
+
eventType: true,
|
|
119
|
+
toolName: true,
|
|
120
|
+
resultSummary: true,
|
|
121
|
+
createdAt: true,
|
|
122
|
+
},
|
|
123
|
+
sort: { sequence: SortOrder.Ascending },
|
|
124
|
+
limit: MAX_EVENTS,
|
|
125
|
+
skip: 0,
|
|
126
|
+
props: { isRoot: true },
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
const runJson: JSONObject | undefined = BaseModel.toJSONArray(
|
|
130
|
+
[run],
|
|
131
|
+
AIRun,
|
|
132
|
+
)[0];
|
|
133
|
+
|
|
134
|
+
const eventsJson: JSONArray = BaseModel.toJSONArray(events, AIRunEvent);
|
|
135
|
+
|
|
136
|
+
Response.sendJsonObjectResponse(req, res, {
|
|
137
|
+
run: runJson || null,
|
|
138
|
+
events: eventsJson,
|
|
139
|
+
});
|
|
140
|
+
return;
|
|
141
|
+
} catch (err) {
|
|
142
|
+
next(err);
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
},
|
|
146
|
+
);
|
|
147
|
+
|
|
148
|
+
export default router;
|