@oneuptime/common 9.2.27 → 9.3.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/AIAgent.ts +589 -0
- package/Models/DatabaseModels/AIAgentOwnerTeam.ts +434 -0
- package/Models/DatabaseModels/AIAgentOwnerUser.ts +433 -0
- package/Models/DatabaseModels/AIAgentTask.ts +549 -0
- package/Models/DatabaseModels/AIAgentTaskLog.ts +417 -0
- package/Models/DatabaseModels/AIAgentTaskPullRequest.ts +731 -0
- package/Models/DatabaseModels/AIAgentTaskTelemetryException.ts +388 -0
- package/Models/DatabaseModels/Index.ts +15 -0
- package/Models/DatabaseModels/Monitor.ts +33 -0
- package/Models/DatabaseModels/Project.ts +25 -0
- package/Models/DatabaseModels/TelemetryException.ts +1 -1
- package/Server/API/AIAgentAPI.ts +200 -0
- package/Server/API/AIAgentDataAPI.ts +692 -0
- package/Server/API/AIAgentTaskAPI.ts +286 -0
- package/Server/API/AIAgentTaskLogAPI.ts +165 -0
- package/Server/API/AIAgentTaskPullRequestAPI.ts +14 -0
- package/Server/API/GitHubAPI.ts +25 -7
- package/Server/API/TelemetryExceptionAPI.ts +169 -0
- package/Server/EnvironmentConfig.ts +3 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1766590916627-MigrationName.ts +195 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1766600860972-MigrationName.ts +31 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1766606720183-MigrationName.ts +17 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1766688107858-MigrationName.ts +63 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1766754182870-MigrationName.ts +75 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1766774689743-MigrationName.ts +157 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1766777986427-MigrationName.ts +33 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1766918848434-AddAIAgentIsDefault.ts +27 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1766923324521-MigrationName.ts +37 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1766958924188-AddGitHubAppInstallationIdToProject.ts +31 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1767009661768-MigrationName.ts +35 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/Index.ts +22 -0
- package/Server/Services/AIAgentOwnerTeamService.ts +10 -0
- package/Server/Services/AIAgentOwnerUserService.ts +10 -0
- package/Server/Services/AIAgentService.ts +564 -0
- package/Server/Services/AIAgentTaskLogService.ts +10 -0
- package/Server/Services/AIAgentTaskPullRequestService.ts +10 -0
- package/Server/Services/AIAgentTaskService.ts +178 -0
- package/Server/Services/AIAgentTaskTelemetryExceptionService.ts +39 -0
- package/Server/Services/Index.ts +10 -0
- package/Server/Services/TelemetryExceptionService.ts +162 -0
- package/Server/Utils/Monitor/MonitorResource.ts +228 -0
- package/Server/Utils/PushNotificationUtil.ts +29 -0
- package/Server/Utils/WhatsAppTemplateUtil.ts +6 -0
- package/Tests/UI/Components/Badge.test.tsx +5 -5
- package/Tests/UI/Components/Card.test.tsx +4 -8
- package/Tests/UI/Components/HiddenText.test.tsx +2 -5
- package/Tests/UI/Components/SideMenuItem.test.tsx +4 -2
- package/Types/AI/AIAgentTaskMetadata.ts +25 -0
- package/Types/AI/AIAgentTaskStatus.ts +65 -0
- package/Types/AI/AIAgentTaskType.ts +40 -0
- package/Types/Email/EmailTemplateType.ts +2 -0
- package/Types/Monitor/MonitorEvaluationSummary.ts +2 -1
- package/Types/NotificationSetting/NotificationSettingEventType.ts +4 -0
- package/Types/Permission.ts +176 -0
- package/Types/WhatsApp/WhatsAppTemplates.ts +9 -0
- package/UI/Components/AIAgent/AIAgent.tsx +69 -0
- package/UI/Components/Badge/Badge.tsx +9 -5
- package/UI/Components/Banner/Banner.tsx +1 -1
- package/UI/Components/Card/Card.tsx +14 -12
- package/UI/Components/CodeBlock/CodeBlock.tsx +47 -4
- package/UI/Components/Detail/Detail.tsx +239 -49
- package/UI/Components/Detail/FieldLabel.tsx +35 -11
- package/UI/Components/Detail/PlaceholderText.tsx +18 -1
- package/UI/Components/Footer/Footer.tsx +9 -7
- package/UI/Components/Header/Header.tsx +4 -3
- package/UI/Components/Header/HeaderIconDropdownButton.tsx +13 -11
- package/UI/Components/Header/IconDropdown/IconDropdownItem.tsx +3 -3
- package/UI/Components/Header/IconDropdown/IconDropdownMenu.tsx +1 -1
- package/UI/Components/Header/ProjectPicker/CreateNewProjectButton.tsx +4 -4
- package/UI/Components/Header/ProjectPicker/ProjectPicker.tsx +6 -6
- package/UI/Components/Header/ProjectPicker/ProjectPickerFilterBox.tsx +3 -3
- package/UI/Components/Header/ProjectPicker/ProjectPickerMenu.tsx +1 -1
- package/UI/Components/Header/ProjectPicker/ProjectPickerMenuItem.tsx +4 -4
- package/UI/Components/HeaderAlert/HeaderAlert.tsx +32 -32
- package/UI/Components/HeaderAlert/HeaderAlertGroup.tsx +1 -7
- package/UI/Components/HiddenText/HiddenText.tsx +98 -27
- package/UI/Components/Icon/Icon.tsx +12 -9
- package/UI/Components/InfoCard/InfoCard.tsx +7 -3
- package/UI/Components/ModelTable/BaseModelTable.tsx +1 -1
- package/UI/Components/ObjectID/ObjectIDView.tsx +73 -0
- package/UI/Components/Page/Page.tsx +3 -5
- package/UI/Components/SideMenu/SideMenu.tsx +175 -40
- package/UI/Components/SideMenu/SideMenuDivider.tsx +17 -0
- package/UI/Components/SideMenu/SideMenuItem.tsx +111 -158
- package/UI/Components/SideMenu/SideMenuSection.tsx +53 -3
- package/UI/Components/Table/Table.tsx +1 -1
- package/UI/Components/Types/FieldType.ts +2 -0
- package/UI/Config.ts +5 -0
- package/build/dist/Models/DatabaseModels/AIAgent.js +614 -0
- package/build/dist/Models/DatabaseModels/AIAgent.js.map +1 -0
- package/build/dist/Models/DatabaseModels/AIAgentOwnerTeam.js +452 -0
- package/build/dist/Models/DatabaseModels/AIAgentOwnerTeam.js.map +1 -0
- package/build/dist/Models/DatabaseModels/AIAgentOwnerUser.js +451 -0
- package/build/dist/Models/DatabaseModels/AIAgentOwnerUser.js.map +1 -0
- package/build/dist/Models/DatabaseModels/AIAgentTask.js +580 -0
- package/build/dist/Models/DatabaseModels/AIAgentTask.js.map +1 -0
- package/build/dist/Models/DatabaseModels/AIAgentTaskLog.js +438 -0
- package/build/dist/Models/DatabaseModels/AIAgentTaskLog.js.map +1 -0
- package/build/dist/Models/DatabaseModels/AIAgentTaskPullRequest.js +771 -0
- package/build/dist/Models/DatabaseModels/AIAgentTaskPullRequest.js.map +1 -0
- package/build/dist/Models/DatabaseModels/AIAgentTaskTelemetryException.js +404 -0
- package/build/dist/Models/DatabaseModels/AIAgentTaskTelemetryException.js.map +1 -0
- package/build/dist/Models/DatabaseModels/Index.js +14 -0
- package/build/dist/Models/DatabaseModels/Index.js.map +1 -1
- package/build/dist/Models/DatabaseModels/Monitor.js +34 -0
- package/build/dist/Models/DatabaseModels/Monitor.js.map +1 -1
- package/build/dist/Models/DatabaseModels/Project.js +26 -0
- package/build/dist/Models/DatabaseModels/Project.js.map +1 -1
- package/build/dist/Models/DatabaseModels/TelemetryException.js +1 -1
- package/build/dist/Models/DatabaseModels/TelemetryException.js.map +1 -1
- package/build/dist/Server/API/AIAgentAPI.js +141 -0
- package/build/dist/Server/API/AIAgentAPI.js.map +1 -0
- package/build/dist/Server/API/AIAgentDataAPI.js +415 -0
- package/build/dist/Server/API/AIAgentDataAPI.js.map +1 -0
- package/build/dist/Server/API/AIAgentTaskAPI.js +199 -0
- package/build/dist/Server/API/AIAgentTaskAPI.js.map +1 -0
- package/build/dist/Server/API/AIAgentTaskLogAPI.js +106 -0
- package/build/dist/Server/API/AIAgentTaskLogAPI.js.map +1 -0
- package/build/dist/Server/API/AIAgentTaskPullRequestAPI.js +9 -0
- package/build/dist/Server/API/AIAgentTaskPullRequestAPI.js.map +1 -0
- package/build/dist/Server/API/GitHubAPI.js +23 -8
- package/build/dist/Server/API/GitHubAPI.js.map +1 -1
- package/build/dist/Server/API/TelemetryExceptionAPI.js +120 -0
- package/build/dist/Server/API/TelemetryExceptionAPI.js.map +1 -0
- package/build/dist/Server/EnvironmentConfig.js +2 -0
- package/build/dist/Server/EnvironmentConfig.js.map +1 -1
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1766590916627-MigrationName.js +74 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1766590916627-MigrationName.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1766600860972-MigrationName.js +18 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1766600860972-MigrationName.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1766606720183-MigrationName.js +12 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1766606720183-MigrationName.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1766688107858-MigrationName.js +28 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1766688107858-MigrationName.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1766754182870-MigrationName.js +32 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1766754182870-MigrationName.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1766774689743-MigrationName.js +60 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1766774689743-MigrationName.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1766777986427-MigrationName.js +18 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1766777986427-MigrationName.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1766918848434-AddAIAgentIsDefault.js +16 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1766918848434-AddAIAgentIsDefault.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1766923324521-MigrationName.js +20 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1766923324521-MigrationName.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1766958924188-AddGitHubAppInstallationIdToProject.js +16 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1766958924188-AddGitHubAppInstallationIdToProject.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1767009661768-MigrationName.js +18 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1767009661768-MigrationName.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js +22 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js.map +1 -1
- package/build/dist/Server/Services/AIAgentOwnerTeamService.js +9 -0
- package/build/dist/Server/Services/AIAgentOwnerTeamService.js.map +1 -0
- package/build/dist/Server/Services/AIAgentOwnerUserService.js +9 -0
- package/build/dist/Server/Services/AIAgentOwnerUserService.js.map +1 -0
- package/build/dist/Server/Services/AIAgentService.js +471 -0
- package/build/dist/Server/Services/AIAgentService.js.map +1 -0
- package/build/dist/Server/Services/AIAgentTaskLogService.js +9 -0
- package/build/dist/Server/Services/AIAgentTaskLogService.js.map +1 -0
- package/build/dist/Server/Services/AIAgentTaskPullRequestService.js +9 -0
- package/build/dist/Server/Services/AIAgentTaskPullRequestService.js.map +1 -0
- package/build/dist/Server/Services/AIAgentTaskService.js +158 -0
- package/build/dist/Server/Services/AIAgentTaskService.js.map +1 -0
- package/build/dist/Server/Services/AIAgentTaskTelemetryExceptionService.js +36 -0
- package/build/dist/Server/Services/AIAgentTaskTelemetryExceptionService.js.map +1 -0
- package/build/dist/Server/Services/Index.js +10 -0
- package/build/dist/Server/Services/Index.js.map +1 -1
- package/build/dist/Server/Services/TelemetryExceptionService.js +137 -0
- package/build/dist/Server/Services/TelemetryExceptionService.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/MonitorResource.js +168 -0
- package/build/dist/Server/Utils/Monitor/MonitorResource.js.map +1 -1
- package/build/dist/Server/Utils/PushNotificationUtil.js +21 -0
- package/build/dist/Server/Utils/PushNotificationUtil.js.map +1 -1
- package/build/dist/Server/Utils/WhatsAppTemplateUtil.js +4 -0
- package/build/dist/Server/Utils/WhatsAppTemplateUtil.js.map +1 -1
- package/build/dist/Tests/UI/Components/Badge.test.js +5 -5
- package/build/dist/Tests/UI/Components/Badge.test.js.map +1 -1
- package/build/dist/Tests/UI/Components/Card.test.js +4 -8
- package/build/dist/Tests/UI/Components/Card.test.js.map +1 -1
- package/build/dist/Tests/UI/Components/HiddenText.test.js +2 -3
- package/build/dist/Tests/UI/Components/HiddenText.test.js.map +1 -1
- package/build/dist/Tests/UI/Components/SideMenuItem.test.js +3 -2
- package/build/dist/Tests/UI/Components/SideMenuItem.test.js.map +1 -1
- package/build/dist/Types/AI/AIAgentTaskMetadata.js +6 -0
- package/build/dist/Types/AI/AIAgentTaskMetadata.js.map +1 -0
- package/build/dist/Types/AI/AIAgentTaskStatus.js +51 -0
- package/build/dist/Types/AI/AIAgentTaskStatus.js.map +1 -0
- package/build/dist/Types/AI/AIAgentTaskType.js +29 -0
- package/build/dist/Types/AI/AIAgentTaskType.js.map +1 -0
- package/build/dist/Types/Email/EmailTemplateType.js +2 -0
- package/build/dist/Types/Email/EmailTemplateType.js.map +1 -1
- package/build/dist/Types/NotificationSetting/NotificationSettingEventType.js +3 -0
- package/build/dist/Types/NotificationSetting/NotificationSettingEventType.js.map +1 -1
- package/build/dist/Types/Permission.js +160 -0
- package/build/dist/Types/Permission.js.map +1 -1
- package/build/dist/Types/WhatsApp/WhatsAppTemplates.js +6 -0
- package/build/dist/Types/WhatsApp/WhatsAppTemplates.js.map +1 -1
- package/build/dist/UI/Components/AIAgent/AIAgent.js +32 -0
- package/build/dist/UI/Components/AIAgent/AIAgent.js.map +1 -0
- package/build/dist/UI/Components/Badge/Badge.js +9 -5
- package/build/dist/UI/Components/Badge/Badge.js.map +1 -1
- package/build/dist/UI/Components/Banner/Banner.js +1 -1
- package/build/dist/UI/Components/Banner/Banner.js.map +1 -1
- package/build/dist/UI/Components/Card/Card.js +12 -12
- package/build/dist/UI/Components/Card/Card.js.map +1 -1
- package/build/dist/UI/Components/CodeBlock/CodeBlock.js +22 -2
- package/build/dist/UI/Components/CodeBlock/CodeBlock.js.map +1 -1
- package/build/dist/UI/Components/Detail/Detail.js +117 -37
- package/build/dist/UI/Components/Detail/Detail.js.map +1 -1
- package/build/dist/UI/Components/Detail/FieldLabel.js +12 -7
- package/build/dist/UI/Components/Detail/FieldLabel.js.map +1 -1
- package/build/dist/UI/Components/Detail/PlaceholderText.js +4 -1
- package/build/dist/UI/Components/Detail/PlaceholderText.js.map +1 -1
- package/build/dist/UI/Components/Footer/Footer.js +6 -6
- package/build/dist/UI/Components/Footer/Footer.js.map +1 -1
- package/build/dist/UI/Components/Header/Header.js +4 -3
- package/build/dist/UI/Components/Header/Header.js.map +1 -1
- package/build/dist/UI/Components/Header/HeaderIconDropdownButton.js +7 -7
- package/build/dist/UI/Components/Header/HeaderIconDropdownButton.js.map +1 -1
- package/build/dist/UI/Components/Header/IconDropdown/IconDropdownItem.js +3 -3
- package/build/dist/UI/Components/Header/IconDropdown/IconDropdownItem.js.map +1 -1
- package/build/dist/UI/Components/Header/IconDropdown/IconDropdownMenu.js +1 -1
- package/build/dist/UI/Components/Header/IconDropdown/IconDropdownMenu.js.map +1 -1
- package/build/dist/UI/Components/Header/ProjectPicker/CreateNewProjectButton.js +4 -4
- package/build/dist/UI/Components/Header/ProjectPicker/CreateNewProjectButton.js.map +1 -1
- package/build/dist/UI/Components/Header/ProjectPicker/ProjectPicker.js +6 -6
- package/build/dist/UI/Components/Header/ProjectPicker/ProjectPicker.js.map +1 -1
- package/build/dist/UI/Components/Header/ProjectPicker/ProjectPickerFilterBox.js +2 -2
- package/build/dist/UI/Components/Header/ProjectPicker/ProjectPickerFilterBox.js.map +1 -1
- package/build/dist/UI/Components/Header/ProjectPicker/ProjectPickerMenu.js +1 -1
- package/build/dist/UI/Components/Header/ProjectPicker/ProjectPickerMenu.js.map +1 -1
- package/build/dist/UI/Components/Header/ProjectPicker/ProjectPickerMenuItem.js +4 -4
- package/build/dist/UI/Components/Header/ProjectPicker/ProjectPickerMenuItem.js.map +1 -1
- package/build/dist/UI/Components/HeaderAlert/HeaderAlert.js +31 -29
- package/build/dist/UI/Components/HeaderAlert/HeaderAlert.js.map +1 -1
- package/build/dist/UI/Components/HeaderAlert/HeaderAlertGroup.js +1 -3
- package/build/dist/UI/Components/HeaderAlert/HeaderAlertGroup.js.map +1 -1
- package/build/dist/UI/Components/HiddenText/HiddenText.js +33 -14
- package/build/dist/UI/Components/HiddenText/HiddenText.js.map +1 -1
- package/build/dist/UI/Components/Icon/Icon.js +3 -4
- package/build/dist/UI/Components/Icon/Icon.js.map +1 -1
- package/build/dist/UI/Components/InfoCard/InfoCard.js +3 -3
- package/build/dist/UI/Components/InfoCard/InfoCard.js.map +1 -1
- package/build/dist/UI/Components/ModelTable/BaseModelTable.js +1 -1
- package/build/dist/UI/Components/ModelTable/BaseModelTable.js.map +1 -1
- package/build/dist/UI/Components/ObjectID/ObjectIDView.js +30 -0
- package/build/dist/UI/Components/ObjectID/ObjectIDView.js.map +1 -0
- package/build/dist/UI/Components/Page/Page.js +3 -3
- package/build/dist/UI/Components/Page/Page.js.map +1 -1
- package/build/dist/UI/Components/SideMenu/SideMenu.js +82 -17
- package/build/dist/UI/Components/SideMenu/SideMenu.js.map +1 -1
- package/build/dist/UI/Components/SideMenu/SideMenuDivider.js +7 -0
- package/build/dist/UI/Components/SideMenu/SideMenuDivider.js.map +1 -0
- package/build/dist/UI/Components/SideMenu/SideMenuItem.js +68 -97
- package/build/dist/UI/Components/SideMenu/SideMenuItem.js.map +1 -1
- package/build/dist/UI/Components/SideMenu/SideMenuSection.js +18 -3
- package/build/dist/UI/Components/SideMenu/SideMenuSection.js.map +1 -1
- package/build/dist/UI/Components/Table/Table.js +1 -1
- package/build/dist/UI/Components/Table/Table.js.map +1 -1
- package/build/dist/UI/Components/Types/FieldType.js +2 -0
- package/build/dist/UI/Components/Types/FieldType.js.map +1 -1
- package/build/dist/UI/Config.js +2 -0
- package/build/dist/UI/Config.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,388 @@
|
|
|
1
|
+
import Project from "./Project";
|
|
2
|
+
import User from "./User";
|
|
3
|
+
import BaseModel from "./DatabaseBaseModel/DatabaseBaseModel";
|
|
4
|
+
import Route from "../../Types/API/Route";
|
|
5
|
+
import { PlanType } from "../../Types/Billing/SubscriptionPlan";
|
|
6
|
+
import ColumnAccessControl from "../../Types/Database/AccessControl/ColumnAccessControl";
|
|
7
|
+
import TableAccessControl from "../../Types/Database/AccessControl/TableAccessControl";
|
|
8
|
+
import TableBillingAccessControl from "../../Types/Database/AccessControl/TableBillingAccessControl";
|
|
9
|
+
import ColumnType from "../../Types/Database/ColumnType";
|
|
10
|
+
import CrudApiEndpoint from "../../Types/Database/CrudApiEndpoint";
|
|
11
|
+
import EnableDocumentation from "../../Types/Database/EnableDocumentation";
|
|
12
|
+
import TableColumn from "../../Types/Database/TableColumn";
|
|
13
|
+
import TableColumnType from "../../Types/Database/TableColumnType";
|
|
14
|
+
import TableMetadata from "../../Types/Database/TableMetadata";
|
|
15
|
+
import TenantColumn from "../../Types/Database/TenantColumn";
|
|
16
|
+
import IconProp from "../../Types/Icon/IconProp";
|
|
17
|
+
import ObjectID from "../../Types/ObjectID";
|
|
18
|
+
import Permission from "../../Types/Permission";
|
|
19
|
+
import { Column, Entity, Index, JoinColumn, ManyToOne } from "typeorm";
|
|
20
|
+
import AIAgentTask from "./AIAgentTask";
|
|
21
|
+
import TelemetryException from "./TelemetryException";
|
|
22
|
+
|
|
23
|
+
@EnableDocumentation()
|
|
24
|
+
@TenantColumn("projectId")
|
|
25
|
+
@TableBillingAccessControl({
|
|
26
|
+
create: PlanType.Growth,
|
|
27
|
+
read: PlanType.Growth,
|
|
28
|
+
update: PlanType.Growth,
|
|
29
|
+
delete: PlanType.Growth,
|
|
30
|
+
})
|
|
31
|
+
@TableAccessControl({
|
|
32
|
+
create: [
|
|
33
|
+
Permission.ProjectOwner,
|
|
34
|
+
Permission.ProjectAdmin,
|
|
35
|
+
Permission.ProjectMember,
|
|
36
|
+
Permission.CreateProjectAIAgentTaskTelemetryException,
|
|
37
|
+
],
|
|
38
|
+
read: [
|
|
39
|
+
Permission.ProjectOwner,
|
|
40
|
+
Permission.ProjectAdmin,
|
|
41
|
+
Permission.ProjectMember,
|
|
42
|
+
Permission.ReadProjectAIAgentTaskTelemetryException,
|
|
43
|
+
],
|
|
44
|
+
delete: [
|
|
45
|
+
Permission.ProjectOwner,
|
|
46
|
+
Permission.ProjectAdmin,
|
|
47
|
+
Permission.ProjectMember,
|
|
48
|
+
Permission.DeleteProjectAIAgentTaskTelemetryException,
|
|
49
|
+
],
|
|
50
|
+
update: [
|
|
51
|
+
Permission.ProjectOwner,
|
|
52
|
+
Permission.ProjectAdmin,
|
|
53
|
+
Permission.ProjectMember,
|
|
54
|
+
Permission.EditProjectAIAgentTaskTelemetryException,
|
|
55
|
+
],
|
|
56
|
+
})
|
|
57
|
+
@CrudApiEndpoint(new Route("/ai-agent-task-telemetry-exception"))
|
|
58
|
+
@TableMetadata({
|
|
59
|
+
tableName: "AIAgentTaskTelemetryException",
|
|
60
|
+
singularName: "AI Agent Task Exception",
|
|
61
|
+
pluralName: "AI Agent Task Exceptions",
|
|
62
|
+
icon: IconProp.Bolt,
|
|
63
|
+
tableDescription:
|
|
64
|
+
"Link between AI Agent Tasks and Telemetry Exceptions. This table tracks which exceptions are being addressed by which AI agent tasks.",
|
|
65
|
+
})
|
|
66
|
+
@Entity({
|
|
67
|
+
name: "AIAgentTaskTelemetryException",
|
|
68
|
+
})
|
|
69
|
+
export default class AIAgentTaskTelemetryException extends BaseModel {
|
|
70
|
+
@ColumnAccessControl({
|
|
71
|
+
create: [
|
|
72
|
+
Permission.ProjectOwner,
|
|
73
|
+
Permission.ProjectAdmin,
|
|
74
|
+
Permission.ProjectMember,
|
|
75
|
+
Permission.CreateProjectAIAgentTaskTelemetryException,
|
|
76
|
+
],
|
|
77
|
+
read: [
|
|
78
|
+
Permission.ProjectOwner,
|
|
79
|
+
Permission.ProjectAdmin,
|
|
80
|
+
Permission.ProjectMember,
|
|
81
|
+
Permission.ReadProjectAIAgentTaskTelemetryException,
|
|
82
|
+
],
|
|
83
|
+
update: [],
|
|
84
|
+
})
|
|
85
|
+
@TableColumn({
|
|
86
|
+
manyToOneRelationColumn: "projectId",
|
|
87
|
+
type: TableColumnType.Entity,
|
|
88
|
+
modelType: Project,
|
|
89
|
+
title: "Project",
|
|
90
|
+
description: "Relation to Project Resource in which this object belongs",
|
|
91
|
+
})
|
|
92
|
+
@ManyToOne(
|
|
93
|
+
() => {
|
|
94
|
+
return Project;
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
eager: false,
|
|
98
|
+
nullable: true,
|
|
99
|
+
onDelete: "CASCADE",
|
|
100
|
+
orphanedRowAction: "nullify",
|
|
101
|
+
},
|
|
102
|
+
)
|
|
103
|
+
@JoinColumn({ name: "projectId" })
|
|
104
|
+
public project?: Project = undefined;
|
|
105
|
+
|
|
106
|
+
@ColumnAccessControl({
|
|
107
|
+
create: [
|
|
108
|
+
Permission.ProjectOwner,
|
|
109
|
+
Permission.ProjectAdmin,
|
|
110
|
+
Permission.ProjectMember,
|
|
111
|
+
Permission.CreateProjectAIAgentTaskTelemetryException,
|
|
112
|
+
],
|
|
113
|
+
read: [
|
|
114
|
+
Permission.ProjectOwner,
|
|
115
|
+
Permission.ProjectAdmin,
|
|
116
|
+
Permission.ProjectMember,
|
|
117
|
+
Permission.ReadProjectAIAgentTaskTelemetryException,
|
|
118
|
+
],
|
|
119
|
+
update: [],
|
|
120
|
+
})
|
|
121
|
+
@Index()
|
|
122
|
+
@TableColumn({
|
|
123
|
+
type: TableColumnType.ObjectID,
|
|
124
|
+
required: true,
|
|
125
|
+
canReadOnRelationQuery: true,
|
|
126
|
+
title: "Project ID",
|
|
127
|
+
description: "ID of your OneUptime Project in which this object belongs",
|
|
128
|
+
})
|
|
129
|
+
@Column({
|
|
130
|
+
type: ColumnType.ObjectID,
|
|
131
|
+
nullable: false,
|
|
132
|
+
transformer: ObjectID.getDatabaseTransformer(),
|
|
133
|
+
})
|
|
134
|
+
public projectId?: ObjectID = undefined;
|
|
135
|
+
|
|
136
|
+
@ColumnAccessControl({
|
|
137
|
+
create: [
|
|
138
|
+
Permission.ProjectOwner,
|
|
139
|
+
Permission.ProjectAdmin,
|
|
140
|
+
Permission.ProjectMember,
|
|
141
|
+
Permission.CreateProjectAIAgentTaskTelemetryException,
|
|
142
|
+
],
|
|
143
|
+
read: [
|
|
144
|
+
Permission.ProjectOwner,
|
|
145
|
+
Permission.ProjectAdmin,
|
|
146
|
+
Permission.ProjectMember,
|
|
147
|
+
Permission.ReadProjectAIAgentTaskTelemetryException,
|
|
148
|
+
],
|
|
149
|
+
update: [],
|
|
150
|
+
})
|
|
151
|
+
@TableColumn({
|
|
152
|
+
manyToOneRelationColumn: "aiAgentTaskId",
|
|
153
|
+
type: TableColumnType.Entity,
|
|
154
|
+
modelType: AIAgentTask,
|
|
155
|
+
title: "AI Agent Task",
|
|
156
|
+
description: "Relation to AI Agent Task that is addressing this exception",
|
|
157
|
+
})
|
|
158
|
+
@ManyToOne(
|
|
159
|
+
() => {
|
|
160
|
+
return AIAgentTask;
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
eager: false,
|
|
164
|
+
nullable: false,
|
|
165
|
+
onDelete: "CASCADE",
|
|
166
|
+
orphanedRowAction: "nullify",
|
|
167
|
+
},
|
|
168
|
+
)
|
|
169
|
+
@JoinColumn({ name: "aiAgentTaskId" })
|
|
170
|
+
public aiAgentTask?: AIAgentTask = undefined;
|
|
171
|
+
|
|
172
|
+
@ColumnAccessControl({
|
|
173
|
+
create: [
|
|
174
|
+
Permission.ProjectOwner,
|
|
175
|
+
Permission.ProjectAdmin,
|
|
176
|
+
Permission.ProjectMember,
|
|
177
|
+
Permission.CreateProjectAIAgentTaskTelemetryException,
|
|
178
|
+
],
|
|
179
|
+
read: [
|
|
180
|
+
Permission.ProjectOwner,
|
|
181
|
+
Permission.ProjectAdmin,
|
|
182
|
+
Permission.ProjectMember,
|
|
183
|
+
Permission.ReadProjectAIAgentTaskTelemetryException,
|
|
184
|
+
],
|
|
185
|
+
update: [],
|
|
186
|
+
})
|
|
187
|
+
@Index()
|
|
188
|
+
@TableColumn({
|
|
189
|
+
type: TableColumnType.ObjectID,
|
|
190
|
+
required: true,
|
|
191
|
+
canReadOnRelationQuery: true,
|
|
192
|
+
title: "AI Agent Task ID",
|
|
193
|
+
description: "ID of the AI Agent Task that is addressing this exception",
|
|
194
|
+
})
|
|
195
|
+
@Column({
|
|
196
|
+
type: ColumnType.ObjectID,
|
|
197
|
+
nullable: false,
|
|
198
|
+
transformer: ObjectID.getDatabaseTransformer(),
|
|
199
|
+
})
|
|
200
|
+
public aiAgentTaskId?: ObjectID = undefined;
|
|
201
|
+
|
|
202
|
+
@ColumnAccessControl({
|
|
203
|
+
create: [
|
|
204
|
+
Permission.ProjectOwner,
|
|
205
|
+
Permission.ProjectAdmin,
|
|
206
|
+
Permission.ProjectMember,
|
|
207
|
+
Permission.CreateProjectAIAgentTaskTelemetryException,
|
|
208
|
+
],
|
|
209
|
+
read: [
|
|
210
|
+
Permission.ProjectOwner,
|
|
211
|
+
Permission.ProjectAdmin,
|
|
212
|
+
Permission.ProjectMember,
|
|
213
|
+
Permission.ReadProjectAIAgentTaskTelemetryException,
|
|
214
|
+
],
|
|
215
|
+
update: [],
|
|
216
|
+
})
|
|
217
|
+
@TableColumn({
|
|
218
|
+
manyToOneRelationColumn: "telemetryExceptionId",
|
|
219
|
+
type: TableColumnType.Entity,
|
|
220
|
+
modelType: TelemetryException,
|
|
221
|
+
title: "Telemetry Exception",
|
|
222
|
+
description: "Relation to Telemetry Exception being addressed by this task",
|
|
223
|
+
})
|
|
224
|
+
@ManyToOne(
|
|
225
|
+
() => {
|
|
226
|
+
return TelemetryException;
|
|
227
|
+
},
|
|
228
|
+
{
|
|
229
|
+
eager: false,
|
|
230
|
+
nullable: false,
|
|
231
|
+
onDelete: "CASCADE",
|
|
232
|
+
orphanedRowAction: "nullify",
|
|
233
|
+
},
|
|
234
|
+
)
|
|
235
|
+
@JoinColumn({ name: "telemetryExceptionId" })
|
|
236
|
+
public telemetryException?: TelemetryException = undefined;
|
|
237
|
+
|
|
238
|
+
@ColumnAccessControl({
|
|
239
|
+
create: [
|
|
240
|
+
Permission.ProjectOwner,
|
|
241
|
+
Permission.ProjectAdmin,
|
|
242
|
+
Permission.ProjectMember,
|
|
243
|
+
Permission.CreateProjectAIAgentTaskTelemetryException,
|
|
244
|
+
],
|
|
245
|
+
read: [
|
|
246
|
+
Permission.ProjectOwner,
|
|
247
|
+
Permission.ProjectAdmin,
|
|
248
|
+
Permission.ProjectMember,
|
|
249
|
+
Permission.ReadProjectAIAgentTaskTelemetryException,
|
|
250
|
+
],
|
|
251
|
+
update: [],
|
|
252
|
+
})
|
|
253
|
+
@Index()
|
|
254
|
+
@TableColumn({
|
|
255
|
+
type: TableColumnType.ObjectID,
|
|
256
|
+
required: true,
|
|
257
|
+
canReadOnRelationQuery: true,
|
|
258
|
+
title: "Telemetry Exception ID",
|
|
259
|
+
description: "ID of the Telemetry Exception being addressed by this task",
|
|
260
|
+
})
|
|
261
|
+
@Column({
|
|
262
|
+
type: ColumnType.ObjectID,
|
|
263
|
+
nullable: false,
|
|
264
|
+
transformer: ObjectID.getDatabaseTransformer(),
|
|
265
|
+
})
|
|
266
|
+
public telemetryExceptionId?: ObjectID = undefined;
|
|
267
|
+
|
|
268
|
+
@ColumnAccessControl({
|
|
269
|
+
create: [
|
|
270
|
+
Permission.ProjectOwner,
|
|
271
|
+
Permission.ProjectAdmin,
|
|
272
|
+
Permission.ProjectMember,
|
|
273
|
+
Permission.CreateProjectAIAgentTaskTelemetryException,
|
|
274
|
+
],
|
|
275
|
+
read: [
|
|
276
|
+
Permission.ProjectOwner,
|
|
277
|
+
Permission.ProjectAdmin,
|
|
278
|
+
Permission.ProjectMember,
|
|
279
|
+
Permission.ReadProjectAIAgentTaskTelemetryException,
|
|
280
|
+
],
|
|
281
|
+
update: [],
|
|
282
|
+
})
|
|
283
|
+
@TableColumn({
|
|
284
|
+
manyToOneRelationColumn: "createdByUserId",
|
|
285
|
+
type: TableColumnType.Entity,
|
|
286
|
+
modelType: User,
|
|
287
|
+
title: "Created by User",
|
|
288
|
+
description:
|
|
289
|
+
"Relation to User who created this object (if this object was created by a User)",
|
|
290
|
+
})
|
|
291
|
+
@ManyToOne(
|
|
292
|
+
() => {
|
|
293
|
+
return User;
|
|
294
|
+
},
|
|
295
|
+
{
|
|
296
|
+
eager: false,
|
|
297
|
+
nullable: true,
|
|
298
|
+
onDelete: "SET NULL",
|
|
299
|
+
orphanedRowAction: "nullify",
|
|
300
|
+
},
|
|
301
|
+
)
|
|
302
|
+
@JoinColumn({ name: "createdByUserId" })
|
|
303
|
+
public createdByUser?: User = undefined;
|
|
304
|
+
|
|
305
|
+
@ColumnAccessControl({
|
|
306
|
+
create: [
|
|
307
|
+
Permission.ProjectOwner,
|
|
308
|
+
Permission.ProjectAdmin,
|
|
309
|
+
Permission.ProjectMember,
|
|
310
|
+
Permission.CreateProjectAIAgentTaskTelemetryException,
|
|
311
|
+
],
|
|
312
|
+
read: [
|
|
313
|
+
Permission.ProjectOwner,
|
|
314
|
+
Permission.ProjectAdmin,
|
|
315
|
+
Permission.ProjectMember,
|
|
316
|
+
Permission.ReadProjectAIAgentTaskTelemetryException,
|
|
317
|
+
],
|
|
318
|
+
update: [],
|
|
319
|
+
})
|
|
320
|
+
@TableColumn({
|
|
321
|
+
type: TableColumnType.ObjectID,
|
|
322
|
+
title: "Created by User ID",
|
|
323
|
+
description:
|
|
324
|
+
"User ID who created this object (if this object was created by a User)",
|
|
325
|
+
})
|
|
326
|
+
@Column({
|
|
327
|
+
type: ColumnType.ObjectID,
|
|
328
|
+
nullable: true,
|
|
329
|
+
transformer: ObjectID.getDatabaseTransformer(),
|
|
330
|
+
})
|
|
331
|
+
public createdByUserId?: ObjectID = undefined;
|
|
332
|
+
|
|
333
|
+
@ColumnAccessControl({
|
|
334
|
+
create: [],
|
|
335
|
+
read: [
|
|
336
|
+
Permission.ProjectOwner,
|
|
337
|
+
Permission.ProjectAdmin,
|
|
338
|
+
Permission.ProjectMember,
|
|
339
|
+
Permission.ReadProjectAIAgentTaskTelemetryException,
|
|
340
|
+
],
|
|
341
|
+
update: [],
|
|
342
|
+
})
|
|
343
|
+
@TableColumn({
|
|
344
|
+
manyToOneRelationColumn: "deletedByUserId",
|
|
345
|
+
type: TableColumnType.Entity,
|
|
346
|
+
title: "Deleted by User",
|
|
347
|
+
modelType: User,
|
|
348
|
+
description:
|
|
349
|
+
"Relation to User who deleted this object (if this object was deleted by a User)",
|
|
350
|
+
})
|
|
351
|
+
@ManyToOne(
|
|
352
|
+
() => {
|
|
353
|
+
return User;
|
|
354
|
+
},
|
|
355
|
+
{
|
|
356
|
+
cascade: false,
|
|
357
|
+
eager: false,
|
|
358
|
+
nullable: true,
|
|
359
|
+
onDelete: "SET NULL",
|
|
360
|
+
orphanedRowAction: "nullify",
|
|
361
|
+
},
|
|
362
|
+
)
|
|
363
|
+
@JoinColumn({ name: "deletedByUserId" })
|
|
364
|
+
public deletedByUser?: User = undefined;
|
|
365
|
+
|
|
366
|
+
@ColumnAccessControl({
|
|
367
|
+
create: [],
|
|
368
|
+
read: [
|
|
369
|
+
Permission.ProjectOwner,
|
|
370
|
+
Permission.ProjectAdmin,
|
|
371
|
+
Permission.ProjectMember,
|
|
372
|
+
Permission.ReadProjectAIAgentTaskTelemetryException,
|
|
373
|
+
],
|
|
374
|
+
update: [],
|
|
375
|
+
})
|
|
376
|
+
@TableColumn({
|
|
377
|
+
type: TableColumnType.ObjectID,
|
|
378
|
+
title: "Deleted by User ID",
|
|
379
|
+
description:
|
|
380
|
+
"User ID who deleted this object (if this object was deleted by a User)",
|
|
381
|
+
})
|
|
382
|
+
@Column({
|
|
383
|
+
type: ColumnType.ObjectID,
|
|
384
|
+
nullable: true,
|
|
385
|
+
transformer: ObjectID.getDatabaseTransformer(),
|
|
386
|
+
})
|
|
387
|
+
public deletedByUserId?: ObjectID = undefined;
|
|
388
|
+
}
|
|
@@ -72,6 +72,13 @@ import OnCallDutyPolicyTimeLog from "./OnCallDutyPolicyTimeLog";
|
|
|
72
72
|
import Probe from "./Probe";
|
|
73
73
|
import ProbeOwnerTeam from "./ProbeOwnerTeam";
|
|
74
74
|
import ProbeOwnerUser from "./ProbeOwnerUser";
|
|
75
|
+
import AIAgent from "./AIAgent";
|
|
76
|
+
import AIAgentOwnerTeam from "./AIAgentOwnerTeam";
|
|
77
|
+
import AIAgentOwnerUser from "./AIAgentOwnerUser";
|
|
78
|
+
import AIAgentTask from "./AIAgentTask";
|
|
79
|
+
import AIAgentTaskLog from "./AIAgentTaskLog";
|
|
80
|
+
import AIAgentTaskPullRequest from "./AIAgentTaskPullRequest";
|
|
81
|
+
import AIAgentTaskTelemetryException from "./AIAgentTaskTelemetryException";
|
|
75
82
|
import LlmProvider from "./LlmProvider";
|
|
76
83
|
import LlmLog from "./LlmLog";
|
|
77
84
|
import Project from "./Project";
|
|
@@ -379,6 +386,14 @@ const AllModelTypes: Array<{
|
|
|
379
386
|
ProbeOwnerTeam,
|
|
380
387
|
ProbeOwnerUser,
|
|
381
388
|
|
|
389
|
+
AIAgent,
|
|
390
|
+
AIAgentOwnerTeam,
|
|
391
|
+
AIAgentOwnerUser,
|
|
392
|
+
AIAgentTask,
|
|
393
|
+
AIAgentTaskLog,
|
|
394
|
+
AIAgentTaskPullRequest,
|
|
395
|
+
AIAgentTaskTelemetryException,
|
|
396
|
+
|
|
382
397
|
LlmProvider,
|
|
383
398
|
LlmLog,
|
|
384
399
|
|
|
@@ -1029,6 +1029,39 @@ export default class Monitor extends BaseModel {
|
|
|
1029
1029
|
})
|
|
1030
1030
|
public isNoProbeEnabledOnThisMonitor?: boolean = undefined;
|
|
1031
1031
|
|
|
1032
|
+
@ColumnAccessControl({
|
|
1033
|
+
create: [
|
|
1034
|
+
Permission.ProjectOwner,
|
|
1035
|
+
Permission.ProjectAdmin,
|
|
1036
|
+
Permission.ProjectMember,
|
|
1037
|
+
Permission.CreateProjectMonitor,
|
|
1038
|
+
],
|
|
1039
|
+
read: [
|
|
1040
|
+
Permission.ProjectOwner,
|
|
1041
|
+
Permission.ProjectAdmin,
|
|
1042
|
+
Permission.ProjectMember,
|
|
1043
|
+
Permission.ReadProjectMonitor,
|
|
1044
|
+
],
|
|
1045
|
+
update: [
|
|
1046
|
+
Permission.ProjectOwner,
|
|
1047
|
+
Permission.ProjectAdmin,
|
|
1048
|
+
Permission.ProjectMember,
|
|
1049
|
+
Permission.EditProjectMonitor,
|
|
1050
|
+
],
|
|
1051
|
+
})
|
|
1052
|
+
@TableColumn({
|
|
1053
|
+
type: TableColumnType.Number,
|
|
1054
|
+
required: false,
|
|
1055
|
+
title: "Minimum Probe Agreement",
|
|
1056
|
+
description:
|
|
1057
|
+
"Minimum number of probes that must agree on a status before the monitor status changes. If null, all enabled and connected probes must agree.",
|
|
1058
|
+
})
|
|
1059
|
+
@Column({
|
|
1060
|
+
type: ColumnType.Number,
|
|
1061
|
+
nullable: true,
|
|
1062
|
+
})
|
|
1063
|
+
public minimumProbeAgreement?: number = undefined;
|
|
1064
|
+
|
|
1032
1065
|
@ColumnAccessControl({
|
|
1033
1066
|
create: [],
|
|
1034
1067
|
read: [],
|
|
@@ -1603,4 +1603,29 @@ export default class Project extends TenantModel {
|
|
|
1603
1603
|
default: false,
|
|
1604
1604
|
})
|
|
1605
1605
|
public doNotAddGlobalProbesByDefaultOnNewMonitors?: boolean = undefined;
|
|
1606
|
+
|
|
1607
|
+
// GitHub App Installation ID for this project
|
|
1608
|
+
@ColumnAccessControl({
|
|
1609
|
+
create: [],
|
|
1610
|
+
read: [
|
|
1611
|
+
Permission.ProjectOwner,
|
|
1612
|
+
Permission.ProjectAdmin,
|
|
1613
|
+
Permission.ProjectMember,
|
|
1614
|
+
Permission.ReadProject,
|
|
1615
|
+
],
|
|
1616
|
+
update: [Permission.ProjectOwner, Permission.ProjectAdmin],
|
|
1617
|
+
})
|
|
1618
|
+
@TableColumn({
|
|
1619
|
+
required: false,
|
|
1620
|
+
type: TableColumnType.LongText,
|
|
1621
|
+
title: "GitHub App Installation ID",
|
|
1622
|
+
description:
|
|
1623
|
+
"The GitHub App installation ID for this project. This is set when the GitHub App is installed on the organization.",
|
|
1624
|
+
})
|
|
1625
|
+
@Column({
|
|
1626
|
+
type: ColumnType.LongText,
|
|
1627
|
+
nullable: true,
|
|
1628
|
+
unique: false,
|
|
1629
|
+
})
|
|
1630
|
+
public gitHubAppInstallationId?: string = undefined;
|
|
1606
1631
|
}
|
|
@@ -44,7 +44,7 @@ import TelemetryService from "./TelemetryService";
|
|
|
44
44
|
Permission.EditTelemetryException,
|
|
45
45
|
],
|
|
46
46
|
})
|
|
47
|
-
@CrudApiEndpoint(new Route("/telemetry-exception
|
|
47
|
+
@CrudApiEndpoint(new Route("/telemetry-exception"))
|
|
48
48
|
@TableMetadata({
|
|
49
49
|
tableName: "TelemetryException",
|
|
50
50
|
singularName: "Exception",
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
import UserMiddleware from "../Middleware/UserAuthorization";
|
|
2
|
+
import ClusterKeyAuthorization from "../Middleware/ClusterKeyAuthorization";
|
|
3
|
+
import AIAgentService, {
|
|
4
|
+
Service as AIAgentServiceType,
|
|
5
|
+
} from "../Services/AIAgentService";
|
|
6
|
+
import {
|
|
7
|
+
ExpressRequest,
|
|
8
|
+
ExpressResponse,
|
|
9
|
+
NextFunction,
|
|
10
|
+
} from "../Utils/Express";
|
|
11
|
+
import Response from "../Utils/Response";
|
|
12
|
+
import BaseAPI from "./BaseAPI";
|
|
13
|
+
import LIMIT_MAX from "../../Types/Database/LimitMax";
|
|
14
|
+
import PositiveNumber from "../../Types/PositiveNumber";
|
|
15
|
+
import AIAgent, {
|
|
16
|
+
AIAgentConnectionStatus,
|
|
17
|
+
} from "../../Models/DatabaseModels/AIAgent";
|
|
18
|
+
import BadDataException from "../../Types/Exception/BadDataException";
|
|
19
|
+
import { JSONObject } from "../../Types/JSON";
|
|
20
|
+
import ObjectID from "../../Types/ObjectID";
|
|
21
|
+
import OneUptimeDate from "../../Types/Date";
|
|
22
|
+
import Version from "../../Types/Version";
|
|
23
|
+
|
|
24
|
+
export default class AIAgentAPI extends BaseAPI<AIAgent, AIAgentServiceType> {
|
|
25
|
+
public constructor() {
|
|
26
|
+
super(AIAgent, AIAgentService);
|
|
27
|
+
|
|
28
|
+
// Register Global AI Agent. Custom AI Agent can be registered via dashboard.
|
|
29
|
+
this.router.post(
|
|
30
|
+
`${new this.entityType().getCrudApiPath()?.toString()}/register`,
|
|
31
|
+
ClusterKeyAuthorization.isAuthorizedServiceMiddleware,
|
|
32
|
+
async (
|
|
33
|
+
req: ExpressRequest,
|
|
34
|
+
res: ExpressResponse,
|
|
35
|
+
next: NextFunction,
|
|
36
|
+
): Promise<void> => {
|
|
37
|
+
try {
|
|
38
|
+
const data: JSONObject = req.body;
|
|
39
|
+
|
|
40
|
+
if (!data["aiAgentKey"]) {
|
|
41
|
+
return Response.sendErrorResponse(
|
|
42
|
+
req,
|
|
43
|
+
res,
|
|
44
|
+
new BadDataException("aiAgentKey is missing"),
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const aiAgentKey: string = data["aiAgentKey"] as string;
|
|
49
|
+
|
|
50
|
+
const aiAgent: AIAgent | null = await AIAgentService.findOneBy({
|
|
51
|
+
query: {
|
|
52
|
+
key: aiAgentKey,
|
|
53
|
+
isGlobalAIAgent: true,
|
|
54
|
+
},
|
|
55
|
+
select: {
|
|
56
|
+
_id: true,
|
|
57
|
+
},
|
|
58
|
+
props: {
|
|
59
|
+
isRoot: true,
|
|
60
|
+
},
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
const defaultDescription: string =
|
|
64
|
+
"AI-powered agent that analyzes and resolves code issues, triages incidents and alerts, and helps automate operational workflows.";
|
|
65
|
+
|
|
66
|
+
if (aiAgent) {
|
|
67
|
+
await AIAgentService.updateOneById({
|
|
68
|
+
id: aiAgent.id!,
|
|
69
|
+
data: {
|
|
70
|
+
name: (data["aiAgentName"] as string) || "Global AI Agent",
|
|
71
|
+
description:
|
|
72
|
+
(data["aiAgentDescription"] as string) || defaultDescription,
|
|
73
|
+
lastAlive: OneUptimeDate.getCurrentDate(),
|
|
74
|
+
connectionStatus: AIAgentConnectionStatus.Connected,
|
|
75
|
+
},
|
|
76
|
+
props: {
|
|
77
|
+
isRoot: true,
|
|
78
|
+
},
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
return Response.sendJsonObjectResponse(req, res, {
|
|
82
|
+
_id: aiAgent._id?.toString(),
|
|
83
|
+
message: "AI Agent already registered",
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
let newAIAgent: AIAgent = new AIAgent();
|
|
88
|
+
newAIAgent.isGlobalAIAgent = true;
|
|
89
|
+
newAIAgent.key = aiAgentKey;
|
|
90
|
+
newAIAgent.name =
|
|
91
|
+
(data["aiAgentName"] as string) || "Global AI Agent";
|
|
92
|
+
newAIAgent.description =
|
|
93
|
+
(data["aiAgentDescription"] as string) || defaultDescription;
|
|
94
|
+
newAIAgent.lastAlive = OneUptimeDate.getCurrentDate();
|
|
95
|
+
newAIAgent.connectionStatus = AIAgentConnectionStatus.Connected;
|
|
96
|
+
newAIAgent.aiAgentVersion = new Version("1.0.0");
|
|
97
|
+
|
|
98
|
+
newAIAgent = await AIAgentService.create({
|
|
99
|
+
data: newAIAgent,
|
|
100
|
+
props: {
|
|
101
|
+
isRoot: true,
|
|
102
|
+
},
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
return Response.sendJsonObjectResponse(req, res, {
|
|
106
|
+
_id: newAIAgent._id?.toString(),
|
|
107
|
+
message: "AI Agent registered successfully",
|
|
108
|
+
});
|
|
109
|
+
} catch (err) {
|
|
110
|
+
return next(err);
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
);
|
|
114
|
+
|
|
115
|
+
// Alive endpoint for AI Agent heartbeat
|
|
116
|
+
this.router.post(
|
|
117
|
+
`${new this.entityType().getCrudApiPath()?.toString()}/alive`,
|
|
118
|
+
async (req: ExpressRequest, res: ExpressResponse, next: NextFunction) => {
|
|
119
|
+
try {
|
|
120
|
+
const data: JSONObject = req.body;
|
|
121
|
+
|
|
122
|
+
if (!data["aiAgentId"] || !data["aiAgentKey"]) {
|
|
123
|
+
return Response.sendErrorResponse(
|
|
124
|
+
req,
|
|
125
|
+
res,
|
|
126
|
+
new BadDataException("aiAgentId or aiAgentKey is missing"),
|
|
127
|
+
);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
const aiAgentId: ObjectID = new ObjectID(data["aiAgentId"] as string);
|
|
131
|
+
const aiAgentKey: string = data["aiAgentKey"] as string;
|
|
132
|
+
|
|
133
|
+
const aiAgent: AIAgent | null = await AIAgentService.findOneBy({
|
|
134
|
+
query: {
|
|
135
|
+
_id: aiAgentId.toString(),
|
|
136
|
+
key: aiAgentKey,
|
|
137
|
+
},
|
|
138
|
+
select: {
|
|
139
|
+
_id: true,
|
|
140
|
+
},
|
|
141
|
+
props: {
|
|
142
|
+
isRoot: true,
|
|
143
|
+
},
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
if (!aiAgent) {
|
|
147
|
+
return Response.sendErrorResponse(
|
|
148
|
+
req,
|
|
149
|
+
res,
|
|
150
|
+
new BadDataException("Invalid AI Agent ID or AI Agent Key"),
|
|
151
|
+
);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
// Update last alive
|
|
155
|
+
await AIAgentService.updateLastAlive(aiAgentId);
|
|
156
|
+
|
|
157
|
+
return Response.sendEmptySuccessResponse(req, res);
|
|
158
|
+
} catch (err) {
|
|
159
|
+
next(err);
|
|
160
|
+
}
|
|
161
|
+
},
|
|
162
|
+
);
|
|
163
|
+
|
|
164
|
+
this.router.post(
|
|
165
|
+
`${new this.entityType().getCrudApiPath()?.toString()}/global-ai-agents`,
|
|
166
|
+
UserMiddleware.getUserMiddleware,
|
|
167
|
+
async (req: ExpressRequest, res: ExpressResponse, next: NextFunction) => {
|
|
168
|
+
try {
|
|
169
|
+
const aiAgents: Array<AIAgent> = await AIAgentService.findBy({
|
|
170
|
+
query: {
|
|
171
|
+
isGlobalAIAgent: true,
|
|
172
|
+
},
|
|
173
|
+
select: {
|
|
174
|
+
name: true,
|
|
175
|
+
description: true,
|
|
176
|
+
lastAlive: true,
|
|
177
|
+
iconFileId: true,
|
|
178
|
+
connectionStatus: true,
|
|
179
|
+
},
|
|
180
|
+
props: {
|
|
181
|
+
isRoot: true,
|
|
182
|
+
},
|
|
183
|
+
skip: 0,
|
|
184
|
+
limit: LIMIT_MAX,
|
|
185
|
+
});
|
|
186
|
+
|
|
187
|
+
return Response.sendEntityArrayResponse(
|
|
188
|
+
req,
|
|
189
|
+
res,
|
|
190
|
+
aiAgents,
|
|
191
|
+
new PositiveNumber(aiAgents.length),
|
|
192
|
+
AIAgent,
|
|
193
|
+
);
|
|
194
|
+
} catch (err) {
|
|
195
|
+
next(err);
|
|
196
|
+
}
|
|
197
|
+
},
|
|
198
|
+
);
|
|
199
|
+
}
|
|
200
|
+
}
|