@oneuptime/common 9.2.16 → 9.2.18
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/CodeRepository.ts +664 -0
- package/Models/DatabaseModels/Index.ts +8 -0
- package/Models/DatabaseModels/LlmLog.ts +818 -0
- package/Models/DatabaseModels/LlmProvider.ts +21 -0
- package/Models/DatabaseModels/Project.ts +206 -0
- package/Models/DatabaseModels/ServiceCatalogCodeRepository.ts +549 -0
- package/Server/API/AIBillingAPI.ts +126 -0
- package/Server/API/AlertAPI.ts +139 -0
- package/Server/API/GitHubAPI.ts +360 -0
- package/Server/API/IncidentAPI.ts +258 -0
- package/Server/API/ScheduledMaintenanceAPI.ts +164 -0
- package/Server/EnvironmentConfig.ts +44 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1765580181582-MigrationName.ts +79 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1765633554715-MigrationName.ts +75 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1765801357168-MigrationName.ts +32 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1765810218488-MigrationName.ts +69 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1765830758857-MigrationName.ts +111 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1765834537501-MigrationName.ts +39 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/Index.ts +12 -0
- package/Server/Services/AIBillingService.ts +247 -0
- package/Server/Services/AIService.ts +238 -0
- package/Server/Services/CodeRepositoryService.ts +10 -0
- package/Server/Services/IncidentService.ts +88 -0
- package/Server/Services/Index.ts +2 -0
- package/Server/Services/LlmLogService.ts +14 -0
- package/Server/Services/LlmProviderService.ts +58 -0
- package/Server/Services/ServiceCatalogCodeRepositoryService.ts +55 -0
- package/Server/Utils/AI/AlertAIContextBuilder.ts +264 -0
- package/Server/Utils/AI/IncidentAIContextBuilder.ts +710 -0
- package/Server/Utils/AI/ScheduledMaintenanceAIContextBuilder.ts +345 -0
- package/Server/Utils/CodeRepository/GitHub/GitHub.ts +226 -0
- package/Server/Utils/LLM/LLMService.ts +276 -0
- package/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeams.ts +166 -0
- package/Server/Utils/Workspace/Slack/Slack.ts +134 -0
- package/Server/Utils/Workspace/Workspace.ts +126 -0
- package/Tests/Types/Domain.test.ts +24 -3
- package/Types/CodeRepository/CodeRepositoryType.ts +1 -1
- package/Types/Domain.ts +21 -24
- package/Types/LlmLogStatus.ts +7 -0
- package/Types/Permission.ts +87 -0
- package/Types/ServiceCatalog/CodeRepositoryImprovementAction.ts +9 -0
- package/UI/Components/AI/AILoader.tsx +95 -0
- package/UI/Components/AI/GenerateFromAIModal.tsx +432 -0
- package/UI/Components/Modal/Modal.tsx +6 -1
- package/build/dist/Models/DatabaseModels/CodeRepository.js +689 -0
- package/build/dist/Models/DatabaseModels/CodeRepository.js.map +1 -0
- package/build/dist/Models/DatabaseModels/Index.js +7 -0
- package/build/dist/Models/DatabaseModels/Index.js.map +1 -1
- package/build/dist/Models/DatabaseModels/LlmLog.js +856 -0
- package/build/dist/Models/DatabaseModels/LlmLog.js.map +1 -0
- package/build/dist/Models/DatabaseModels/LlmProvider.js +22 -0
- package/build/dist/Models/DatabaseModels/LlmProvider.js.map +1 -1
- package/build/dist/Models/DatabaseModels/Project.js +220 -0
- package/build/dist/Models/DatabaseModels/Project.js.map +1 -1
- package/build/dist/Models/DatabaseModels/ServiceCatalogCodeRepository.js +565 -0
- package/build/dist/Models/DatabaseModels/ServiceCatalogCodeRepository.js.map +1 -0
- package/build/dist/Server/API/AIBillingAPI.js +58 -0
- package/build/dist/Server/API/AIBillingAPI.js.map +1 -0
- package/build/dist/Server/API/AlertAPI.js +94 -0
- package/build/dist/Server/API/AlertAPI.js.map +1 -0
- package/build/dist/Server/API/GitHubAPI.js +207 -0
- package/build/dist/Server/API/GitHubAPI.js.map +1 -0
- package/build/dist/Server/API/IncidentAPI.js +171 -1
- package/build/dist/Server/API/IncidentAPI.js.map +1 -1
- package/build/dist/Server/API/ScheduledMaintenanceAPI.js +103 -0
- package/build/dist/Server/API/ScheduledMaintenanceAPI.js.map +1 -0
- package/build/dist/Server/EnvironmentConfig.js +31 -0
- package/build/dist/Server/EnvironmentConfig.js.map +1 -1
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1765580181582-MigrationName.js +34 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1765580181582-MigrationName.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1765633554715-MigrationName.js +32 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1765633554715-MigrationName.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1765801357168-MigrationName.js +38 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1765801357168-MigrationName.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1765810218488-MigrationName.js +30 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1765810218488-MigrationName.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1765830758857-MigrationName.js +44 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1765830758857-MigrationName.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1765834537501-MigrationName.js +22 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1765834537501-MigrationName.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js +12 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js.map +1 -1
- package/build/dist/Server/Services/AIBillingService.js +187 -0
- package/build/dist/Server/Services/AIBillingService.js.map +1 -0
- package/build/dist/Server/Services/AIService.js +184 -0
- package/build/dist/Server/Services/AIService.js.map +1 -0
- package/build/dist/Server/Services/CodeRepositoryService.js +9 -0
- package/build/dist/Server/Services/CodeRepositoryService.js.map +1 -0
- package/build/dist/Server/Services/IncidentService.js +60 -0
- package/build/dist/Server/Services/IncidentService.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/LlmLogService.js +13 -0
- package/build/dist/Server/Services/LlmLogService.js.map +1 -0
- package/build/dist/Server/Services/LlmProviderService.js +65 -0
- package/build/dist/Server/Services/LlmProviderService.js.map +1 -1
- package/build/dist/Server/Services/ServiceCatalogCodeRepositoryService.js +54 -0
- package/build/dist/Server/Services/ServiceCatalogCodeRepositoryService.js.map +1 -0
- package/build/dist/Server/Utils/AI/AlertAIContextBuilder.js +238 -0
- package/build/dist/Server/Utils/AI/AlertAIContextBuilder.js.map +1 -0
- package/build/dist/Server/Utils/AI/IncidentAIContextBuilder.js +597 -0
- package/build/dist/Server/Utils/AI/IncidentAIContextBuilder.js.map +1 -0
- package/build/dist/Server/Utils/AI/ScheduledMaintenanceAIContextBuilder.js +311 -0
- package/build/dist/Server/Utils/AI/ScheduledMaintenanceAIContextBuilder.js.map +1 -0
- package/build/dist/Server/Utils/CodeRepository/GitHub/GitHub.js +163 -0
- package/build/dist/Server/Utils/CodeRepository/GitHub/GitHub.js.map +1 -1
- package/build/dist/Server/Utils/LLM/LLMService.js +225 -0
- package/build/dist/Server/Utils/LLM/LLMService.js.map +1 -0
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeams.js +110 -0
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeams.js.map +1 -1
- package/build/dist/Server/Utils/Workspace/Slack/Slack.js +89 -0
- package/build/dist/Server/Utils/Workspace/Slack/Slack.js.map +1 -1
- package/build/dist/Server/Utils/Workspace/Workspace.js +80 -0
- package/build/dist/Server/Utils/Workspace/Workspace.js.map +1 -1
- package/build/dist/Tests/Types/Domain.test.js +19 -3
- package/build/dist/Tests/Types/Domain.test.js.map +1 -1
- package/build/dist/Types/CodeRepository/CodeRepositoryType.js +1 -1
- package/build/dist/Types/CodeRepository/CodeRepositoryType.js.map +1 -1
- package/build/dist/Types/Domain.js +18 -16
- package/build/dist/Types/Domain.js.map +1 -1
- package/build/dist/Types/LlmLogStatus.js +8 -0
- package/build/dist/Types/LlmLogStatus.js.map +1 -0
- package/build/dist/Types/Permission.js +74 -0
- package/build/dist/Types/Permission.js.map +1 -1
- package/build/dist/Types/ServiceCatalog/CodeRepositoryImprovementAction.js +10 -0
- package/build/dist/Types/ServiceCatalog/CodeRepositoryImprovementAction.js.map +1 -0
- package/build/dist/UI/Components/AI/AILoader.js +64 -0
- package/build/dist/UI/Components/AI/AILoader.js.map +1 -0
- package/build/dist/UI/Components/AI/GenerateFromAIModal.js +320 -0
- package/build/dist/UI/Components/AI/GenerateFromAIModal.js.map +1 -0
- package/build/dist/UI/Components/Modal/Modal.js +6 -1
- package/build/dist/UI/Components/Modal/Modal.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,311 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
import ScheduledMaintenanceService from "../../Services/ScheduledMaintenanceService";
|
|
11
|
+
import ScheduledMaintenanceStateTimelineService from "../../Services/ScheduledMaintenanceStateTimelineService";
|
|
12
|
+
import ScheduledMaintenanceInternalNoteService from "../../Services/ScheduledMaintenanceInternalNoteService";
|
|
13
|
+
import ScheduledMaintenancePublicNoteService from "../../Services/ScheduledMaintenancePublicNoteService";
|
|
14
|
+
import CaptureSpan from "../Telemetry/CaptureSpan";
|
|
15
|
+
import OneUptimeDate from "../../../Types/Date";
|
|
16
|
+
import SortOrder from "../../../Types/BaseDatabase/SortOrder";
|
|
17
|
+
export default class ScheduledMaintenanceAIContextBuilder {
|
|
18
|
+
static async buildScheduledMaintenanceContext(data) {
|
|
19
|
+
const scheduledMaintenance = await ScheduledMaintenanceService.findOneById({
|
|
20
|
+
id: data.scheduledMaintenanceId,
|
|
21
|
+
select: {
|
|
22
|
+
_id: true,
|
|
23
|
+
title: true,
|
|
24
|
+
description: true,
|
|
25
|
+
createdAt: true,
|
|
26
|
+
startsAt: true,
|
|
27
|
+
endsAt: true,
|
|
28
|
+
customFields: true,
|
|
29
|
+
projectId: true,
|
|
30
|
+
currentScheduledMaintenanceState: {
|
|
31
|
+
name: true,
|
|
32
|
+
color: true,
|
|
33
|
+
},
|
|
34
|
+
monitors: {
|
|
35
|
+
name: true,
|
|
36
|
+
},
|
|
37
|
+
labels: {
|
|
38
|
+
name: true,
|
|
39
|
+
color: true,
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
props: {
|
|
43
|
+
isRoot: true,
|
|
44
|
+
},
|
|
45
|
+
});
|
|
46
|
+
if (!scheduledMaintenance) {
|
|
47
|
+
throw new Error("Scheduled Maintenance not found");
|
|
48
|
+
}
|
|
49
|
+
// Fetch state timeline
|
|
50
|
+
const stateTimeline = await ScheduledMaintenanceStateTimelineService.findBy({
|
|
51
|
+
query: {
|
|
52
|
+
scheduledMaintenanceId: data.scheduledMaintenanceId,
|
|
53
|
+
},
|
|
54
|
+
select: {
|
|
55
|
+
_id: true,
|
|
56
|
+
createdAt: true,
|
|
57
|
+
startsAt: true,
|
|
58
|
+
endsAt: true,
|
|
59
|
+
scheduledMaintenanceState: {
|
|
60
|
+
name: true,
|
|
61
|
+
color: true,
|
|
62
|
+
},
|
|
63
|
+
createdByUser: {
|
|
64
|
+
name: true,
|
|
65
|
+
email: true,
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
sort: {
|
|
69
|
+
startsAt: SortOrder.Ascending,
|
|
70
|
+
},
|
|
71
|
+
limit: 100,
|
|
72
|
+
skip: 0,
|
|
73
|
+
props: {
|
|
74
|
+
isRoot: true,
|
|
75
|
+
},
|
|
76
|
+
});
|
|
77
|
+
// Fetch internal notes
|
|
78
|
+
const internalNotes = await ScheduledMaintenanceInternalNoteService.findBy({
|
|
79
|
+
query: {
|
|
80
|
+
scheduledMaintenanceId: data.scheduledMaintenanceId,
|
|
81
|
+
},
|
|
82
|
+
select: {
|
|
83
|
+
_id: true,
|
|
84
|
+
note: true,
|
|
85
|
+
createdAt: true,
|
|
86
|
+
createdByUser: {
|
|
87
|
+
name: true,
|
|
88
|
+
email: true,
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
sort: {
|
|
92
|
+
createdAt: SortOrder.Ascending,
|
|
93
|
+
},
|
|
94
|
+
limit: 100,
|
|
95
|
+
skip: 0,
|
|
96
|
+
props: {
|
|
97
|
+
isRoot: true,
|
|
98
|
+
},
|
|
99
|
+
});
|
|
100
|
+
// Fetch public notes
|
|
101
|
+
const publicNotes = await ScheduledMaintenancePublicNoteService.findBy({
|
|
102
|
+
query: {
|
|
103
|
+
scheduledMaintenanceId: data.scheduledMaintenanceId,
|
|
104
|
+
},
|
|
105
|
+
select: {
|
|
106
|
+
_id: true,
|
|
107
|
+
note: true,
|
|
108
|
+
createdAt: true,
|
|
109
|
+
postedAt: true,
|
|
110
|
+
createdByUser: {
|
|
111
|
+
name: true,
|
|
112
|
+
email: true,
|
|
113
|
+
},
|
|
114
|
+
},
|
|
115
|
+
sort: {
|
|
116
|
+
createdAt: SortOrder.Ascending,
|
|
117
|
+
},
|
|
118
|
+
limit: 100,
|
|
119
|
+
skip: 0,
|
|
120
|
+
props: {
|
|
121
|
+
isRoot: true,
|
|
122
|
+
},
|
|
123
|
+
});
|
|
124
|
+
return {
|
|
125
|
+
scheduledMaintenance,
|
|
126
|
+
stateTimeline,
|
|
127
|
+
internalNotes,
|
|
128
|
+
publicNotes,
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
static formatScheduledMaintenanceContextForNote(contextData, noteType, template) {
|
|
132
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
133
|
+
const { scheduledMaintenance, stateTimeline, internalNotes, publicNotes } = contextData;
|
|
134
|
+
let contextText = "";
|
|
135
|
+
// Basic scheduled maintenance information
|
|
136
|
+
contextText += "# Scheduled Maintenance Information\n\n";
|
|
137
|
+
contextText += `**Title:** ${scheduledMaintenance.title || "N/A"}\n\n`;
|
|
138
|
+
contextText += `**Description:** ${scheduledMaintenance.description || "N/A"}\n\n`;
|
|
139
|
+
contextText += `**Current State:** ${((_a = scheduledMaintenance.currentScheduledMaintenanceState) === null || _a === void 0 ? void 0 : _a.name) || "N/A"}\n\n`;
|
|
140
|
+
contextText += `**Scheduled Start:** ${scheduledMaintenance.startsAt ? OneUptimeDate.getDateAsFormattedString(scheduledMaintenance.startsAt) : "N/A"}\n\n`;
|
|
141
|
+
contextText += `**Scheduled End:** ${scheduledMaintenance.endsAt ? OneUptimeDate.getDateAsFormattedString(scheduledMaintenance.endsAt) : "N/A"}\n\n`;
|
|
142
|
+
contextText += `**Created At:** ${scheduledMaintenance.createdAt ? OneUptimeDate.getDateAsFormattedString(scheduledMaintenance.createdAt) : "N/A"}\n\n`;
|
|
143
|
+
// Affected monitors
|
|
144
|
+
if (scheduledMaintenance.monitors &&
|
|
145
|
+
scheduledMaintenance.monitors.length > 0) {
|
|
146
|
+
contextText += "**Affected Monitors:** ";
|
|
147
|
+
contextText += scheduledMaintenance.monitors
|
|
148
|
+
.map((m) => {
|
|
149
|
+
return m.name;
|
|
150
|
+
})
|
|
151
|
+
.join(", ");
|
|
152
|
+
contextText += "\n\n";
|
|
153
|
+
}
|
|
154
|
+
// Labels
|
|
155
|
+
if (scheduledMaintenance.labels && scheduledMaintenance.labels.length > 0) {
|
|
156
|
+
contextText += "**Labels:** ";
|
|
157
|
+
contextText += scheduledMaintenance.labels
|
|
158
|
+
.map((l) => {
|
|
159
|
+
return l.name;
|
|
160
|
+
})
|
|
161
|
+
.join(", ");
|
|
162
|
+
contextText += "\n\n";
|
|
163
|
+
}
|
|
164
|
+
// State timeline
|
|
165
|
+
if (stateTimeline.length > 0) {
|
|
166
|
+
contextText += "# State Timeline\n\n";
|
|
167
|
+
for (const timeline of stateTimeline) {
|
|
168
|
+
const startTime = timeline.startsAt
|
|
169
|
+
? OneUptimeDate.getDateAsFormattedString(timeline.startsAt)
|
|
170
|
+
: "N/A";
|
|
171
|
+
const stateName = ((_c = (_b = timeline.scheduledMaintenanceState) === null || _b === void 0 ? void 0 : _b.name) === null || _c === void 0 ? void 0 : _c.toString()) || "Unknown";
|
|
172
|
+
const createdBy = ((_e = (_d = timeline.createdByUser) === null || _d === void 0 ? void 0 : _d.name) === null || _e === void 0 ? void 0 : _e.toString()) ||
|
|
173
|
+
((_g = (_f = timeline.createdByUser) === null || _f === void 0 ? void 0 : _f.email) === null || _g === void 0 ? void 0 : _g.toString()) ||
|
|
174
|
+
"System";
|
|
175
|
+
contextText += `- **${startTime}**: State changed to **${stateName}** by ${createdBy}\n`;
|
|
176
|
+
}
|
|
177
|
+
contextText += "\n";
|
|
178
|
+
}
|
|
179
|
+
// Include internal notes for context (for both note types)
|
|
180
|
+
if (internalNotes.length > 0) {
|
|
181
|
+
contextText += "# Internal Notes (Private)\n\n";
|
|
182
|
+
for (const note of internalNotes) {
|
|
183
|
+
const noteTime = note.createdAt
|
|
184
|
+
? OneUptimeDate.getDateAsFormattedString(note.createdAt)
|
|
185
|
+
: "N/A";
|
|
186
|
+
const createdBy = ((_j = (_h = note.createdByUser) === null || _h === void 0 ? void 0 : _h.name) === null || _j === void 0 ? void 0 : _j.toString()) ||
|
|
187
|
+
((_l = (_k = note.createdByUser) === null || _k === void 0 ? void 0 : _k.email) === null || _l === void 0 ? void 0 : _l.toString()) ||
|
|
188
|
+
"Unknown";
|
|
189
|
+
contextText += `**[${noteTime}] ${createdBy}:**\n`;
|
|
190
|
+
contextText += `${note.note || "N/A"}\n\n`;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
// Public notes
|
|
194
|
+
if (publicNotes.length > 0) {
|
|
195
|
+
contextText += "# Public Notes\n\n";
|
|
196
|
+
for (const note of publicNotes) {
|
|
197
|
+
const noteTime = note.postedAt
|
|
198
|
+
? OneUptimeDate.getDateAsFormattedString(note.postedAt)
|
|
199
|
+
: note.createdAt
|
|
200
|
+
? OneUptimeDate.getDateAsFormattedString(note.createdAt)
|
|
201
|
+
: "N/A";
|
|
202
|
+
const createdBy = ((_o = (_m = note.createdByUser) === null || _m === void 0 ? void 0 : _m.name) === null || _o === void 0 ? void 0 : _o.toString()) ||
|
|
203
|
+
((_q = (_p = note.createdByUser) === null || _p === void 0 ? void 0 : _p.email) === null || _q === void 0 ? void 0 : _q.toString()) ||
|
|
204
|
+
"Unknown";
|
|
205
|
+
contextText += `**[${noteTime}] ${createdBy}:**\n`;
|
|
206
|
+
contextText += `${note.note || "N/A"}\n\n`;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
// System prompt for note generation
|
|
210
|
+
let systemPrompt;
|
|
211
|
+
if (noteType === "public") {
|
|
212
|
+
if (template) {
|
|
213
|
+
systemPrompt = `You are an expert technical communicator. Your task is to fill in a public scheduled maintenance note template based on the provided maintenance event data.
|
|
214
|
+
|
|
215
|
+
CRITICAL INSTRUCTIONS:
|
|
216
|
+
- You MUST use ONLY the exact template structure provided below
|
|
217
|
+
- Fill in each section of the template with relevant information from the maintenance data
|
|
218
|
+
- Do NOT add any new sections, headers, or content that is not part of the template
|
|
219
|
+
- Do NOT add introductions, conclusions, or any text outside the template structure
|
|
220
|
+
- Write in a professional, clear, and customer-friendly manner
|
|
221
|
+
- Focus on what customers need to know: timing, impact, and what to expect
|
|
222
|
+
- Avoid technical jargon - keep it understandable for non-technical readers
|
|
223
|
+
- Be concise but informative
|
|
224
|
+
|
|
225
|
+
TEMPLATE TO FILL (use this exact structure):
|
|
226
|
+
|
|
227
|
+
${template}`;
|
|
228
|
+
}
|
|
229
|
+
else {
|
|
230
|
+
systemPrompt = `You are an expert technical communicator. Your task is to generate a public scheduled maintenance note that will be visible to customers on the status page.
|
|
231
|
+
|
|
232
|
+
The note should:
|
|
233
|
+
1. Be written in a professional, customer-friendly tone
|
|
234
|
+
2. Clearly communicate the current status of the maintenance
|
|
235
|
+
3. Explain what work is being done and any impact on users
|
|
236
|
+
4. Provide timing information (when it started, expected completion, etc.)
|
|
237
|
+
5. Set appropriate expectations
|
|
238
|
+
6. Be concise but informative
|
|
239
|
+
|
|
240
|
+
DO NOT include:
|
|
241
|
+
- Internal technical details that customers don't need
|
|
242
|
+
- Confidential information
|
|
243
|
+
- Excessive jargon
|
|
244
|
+
|
|
245
|
+
Write in markdown format for better readability.`;
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
else if (template) {
|
|
249
|
+
// Internal note with template
|
|
250
|
+
systemPrompt = `You are an expert Site Reliability Engineer (SRE). Your task is to fill in an internal scheduled maintenance note template based on the provided maintenance event data.
|
|
251
|
+
|
|
252
|
+
CRITICAL INSTRUCTIONS:
|
|
253
|
+
- You MUST use ONLY the exact template structure provided below
|
|
254
|
+
- Fill in each section of the template with relevant information from the maintenance data
|
|
255
|
+
- Do NOT add any new sections, headers, or content that is not part of the template
|
|
256
|
+
- Do NOT add introductions, conclusions, or any text outside the template structure
|
|
257
|
+
- Be technical and detailed - this is for the internal team
|
|
258
|
+
- Include relevant technical details, progress updates, and observations
|
|
259
|
+
|
|
260
|
+
TEMPLATE TO FILL (use this exact structure):
|
|
261
|
+
|
|
262
|
+
${template}`;
|
|
263
|
+
}
|
|
264
|
+
else {
|
|
265
|
+
// Internal note without template
|
|
266
|
+
systemPrompt = `You are an expert Site Reliability Engineer (SRE). Your task is to generate an internal scheduled maintenance note for the team.
|
|
267
|
+
|
|
268
|
+
The note should:
|
|
269
|
+
1. Provide technical details about the maintenance progress
|
|
270
|
+
2. Document observations, findings, or actions taken
|
|
271
|
+
3. Include any issues encountered or changes to the plan
|
|
272
|
+
4. Be detailed enough to help team members understand the current status
|
|
273
|
+
5. Use technical language appropriate for the engineering team
|
|
274
|
+
|
|
275
|
+
Write in markdown format for better readability. Be thorough and technical.`;
|
|
276
|
+
}
|
|
277
|
+
// Build user message
|
|
278
|
+
const userMessage = template
|
|
279
|
+
? `Fill in the template above using ONLY the following scheduled maintenance data. Output only the filled template, nothing else:\n\n${contextText}`
|
|
280
|
+
: `Based on the following scheduled maintenance data, please generate ${noteType === "public" ? "a customer-facing public" : "an internal technical"} maintenance note:\n\n${contextText}`;
|
|
281
|
+
// Build messages array
|
|
282
|
+
const messages = [
|
|
283
|
+
{
|
|
284
|
+
role: "system",
|
|
285
|
+
content: systemPrompt,
|
|
286
|
+
},
|
|
287
|
+
{
|
|
288
|
+
role: "user",
|
|
289
|
+
content: userMessage,
|
|
290
|
+
},
|
|
291
|
+
];
|
|
292
|
+
return {
|
|
293
|
+
contextText,
|
|
294
|
+
systemPrompt,
|
|
295
|
+
messages,
|
|
296
|
+
};
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
__decorate([
|
|
300
|
+
CaptureSpan(),
|
|
301
|
+
__metadata("design:type", Function),
|
|
302
|
+
__metadata("design:paramtypes", [Object]),
|
|
303
|
+
__metadata("design:returntype", Promise)
|
|
304
|
+
], ScheduledMaintenanceAIContextBuilder, "buildScheduledMaintenanceContext", null);
|
|
305
|
+
__decorate([
|
|
306
|
+
CaptureSpan(),
|
|
307
|
+
__metadata("design:type", Function),
|
|
308
|
+
__metadata("design:paramtypes", [Object, String, String]),
|
|
309
|
+
__metadata("design:returntype", Object)
|
|
310
|
+
], ScheduledMaintenanceAIContextBuilder, "formatScheduledMaintenanceContextForNote", null);
|
|
311
|
+
//# sourceMappingURL=ScheduledMaintenanceAIContextBuilder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ScheduledMaintenanceAIContextBuilder.js","sourceRoot":"","sources":["../../../../../Server/Utils/AI/ScheduledMaintenanceAIContextBuilder.ts"],"names":[],"mappings":";;;;;;;;;AAKA,OAAO,2BAA2B,MAAM,4CAA4C,CAAC;AACrF,OAAO,wCAAwC,MAAM,yDAAyD,CAAC;AAC/G,OAAO,uCAAuC,MAAM,wDAAwD,CAAC;AAC7G,OAAO,qCAAqC,MAAM,sDAAsD,CAAC;AACzG,OAAO,WAAW,MAAM,0BAA0B,CAAC;AACnD,OAAO,aAAa,MAAM,qBAAqB,CAAC;AAChD,OAAO,SAAS,MAAM,uCAAuC,CAAC;AAgB9D,MAAM,CAAC,OAAO,OAAO,oCAAoC;IAEnC,AAAb,MAAM,CAAC,KAAK,CAAC,gCAAgC,CAAC,IAEpD;QACC,MAAM,oBAAoB,GACxB,MAAM,2BAA2B,CAAC,WAAW,CAAC;YAC5C,EAAE,EAAE,IAAI,CAAC,sBAAsB;YAC/B,MAAM,EAAE;gBACN,GAAG,EAAE,IAAI;gBACT,KAAK,EAAE,IAAI;gBACX,WAAW,EAAE,IAAI;gBACjB,SAAS,EAAE,IAAI;gBACf,QAAQ,EAAE,IAAI;gBACd,MAAM,EAAE,IAAI;gBACZ,YAAY,EAAE,IAAI;gBAClB,SAAS,EAAE,IAAI;gBACf,gCAAgC,EAAE;oBAChC,IAAI,EAAE,IAAI;oBACV,KAAK,EAAE,IAAI;iBACZ;gBACD,QAAQ,EAAE;oBACR,IAAI,EAAE,IAAI;iBACX;gBACD,MAAM,EAAE;oBACN,IAAI,EAAE,IAAI;oBACV,KAAK,EAAE,IAAI;iBACZ;aACF;YACD,KAAK,EAAE;gBACL,MAAM,EAAE,IAAI;aACb;SAC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CAAC,uBAAuB,yBAAyB,WAAW,EAAE,CAAC;QAE7L,uBAAuB;QACvB,MAAM,QAAQ,GAAsB;YAClC;gBACE,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,YAAY;aACtB;YACD;gBACE,IAAI,EAAE,MAAM;gBACZ,OAAO,EAAE,WAAW;aACrB;SACF,CAAC;QAEF,OAAO;YACL,WAAW;YACX,YAAY;YACZ,QAAQ;SACT,CAAC;IACJ,CAAC;CACF;AA3TqB;IADnB,WAAW,EAAE;;;;kFA4Hb;AAGa;IADb,WAAW,EAAE;;;;0FA6Lb"}
|
|
@@ -16,6 +16,9 @@ import PullRequestState from "../../../../Types/CodeRepository/PullRequestState"
|
|
|
16
16
|
import OneUptimeDate from "../../../../Types/Date";
|
|
17
17
|
import API from "../../../../Utils/API";
|
|
18
18
|
import CaptureSpan from "../../Telemetry/CaptureSpan";
|
|
19
|
+
import { GitHubAppId, GitHubAppPrivateKey, GitHubAppWebhookSecret, } from "../../../EnvironmentConfig";
|
|
20
|
+
import BadDataException from "../../../../Types/Exception/BadDataException";
|
|
21
|
+
import * as crypto from "crypto";
|
|
19
22
|
export default class GitHubUtil extends HostedCodeRepository {
|
|
20
23
|
getPullRequestFromJSONObject(data) {
|
|
21
24
|
let pullRequestState = data.pullRequest["state"] === "open"
|
|
@@ -165,6 +168,148 @@ export default class GitHubUtil extends HostedCodeRepository {
|
|
|
165
168
|
repositoryName: data.repositoryName,
|
|
166
169
|
});
|
|
167
170
|
}
|
|
171
|
+
// GitHub App Authentication Methods
|
|
172
|
+
/**
|
|
173
|
+
* Generates a JWT for GitHub App authentication
|
|
174
|
+
* @returns JWT string valid for 10 minutes
|
|
175
|
+
*/
|
|
176
|
+
static generateAppJWT() {
|
|
177
|
+
if (!GitHubAppId) {
|
|
178
|
+
throw new BadDataException("GITHUB_APP_ID environment variable is not set");
|
|
179
|
+
}
|
|
180
|
+
if (!GitHubAppPrivateKey) {
|
|
181
|
+
throw new BadDataException("GITHUB_APP_PRIVATE_KEY environment variable is not set");
|
|
182
|
+
}
|
|
183
|
+
const now = Math.floor(Date.now() / 1000);
|
|
184
|
+
const payload = {
|
|
185
|
+
iat: now - 60, // Issued at time (60 seconds in the past to allow for clock drift)
|
|
186
|
+
exp: now + 600, // Expiration time (10 minutes from now)
|
|
187
|
+
iss: GitHubAppId,
|
|
188
|
+
};
|
|
189
|
+
// Create JWT header
|
|
190
|
+
const header = {
|
|
191
|
+
alg: "RS256",
|
|
192
|
+
typ: "JWT",
|
|
193
|
+
};
|
|
194
|
+
const encodedHeader = Buffer.from(JSON.stringify(header)).toString("base64url");
|
|
195
|
+
const encodedPayload = Buffer.from(JSON.stringify(payload)).toString("base64url");
|
|
196
|
+
const signatureInput = `${encodedHeader}.${encodedPayload}`;
|
|
197
|
+
// Sign with private key
|
|
198
|
+
const sign = crypto.createSign("RSA-SHA256");
|
|
199
|
+
sign.update(signatureInput);
|
|
200
|
+
const signature = sign.sign(GitHubAppPrivateKey, "base64url");
|
|
201
|
+
return `${signatureInput}.${signature}`;
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* Gets an installation access token for a GitHub App installation
|
|
205
|
+
* @param installationId - The GitHub App installation ID
|
|
206
|
+
* @returns Installation token and expiration date
|
|
207
|
+
*/
|
|
208
|
+
static async getInstallationAccessToken(installationId) {
|
|
209
|
+
const jwt = GitHubUtil.generateAppJWT();
|
|
210
|
+
const url = URL.fromString(`https://api.github.com/app/installations/${installationId}/access_tokens`);
|
|
211
|
+
const result = await API.post({
|
|
212
|
+
url: url,
|
|
213
|
+
data: {},
|
|
214
|
+
headers: {
|
|
215
|
+
Authorization: `Bearer ${jwt}`,
|
|
216
|
+
Accept: "application/vnd.github+json",
|
|
217
|
+
"X-GitHub-Api-Version": "2022-11-28",
|
|
218
|
+
},
|
|
219
|
+
});
|
|
220
|
+
if (result instanceof HTTPErrorResponse) {
|
|
221
|
+
throw result;
|
|
222
|
+
}
|
|
223
|
+
return {
|
|
224
|
+
token: result.data["token"],
|
|
225
|
+
expiresAt: OneUptimeDate.fromString(result.data["expires_at"]),
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* Lists repositories accessible to a GitHub App installation
|
|
230
|
+
* @param installationId - The GitHub App installation ID
|
|
231
|
+
* @returns Array of repositories
|
|
232
|
+
*/
|
|
233
|
+
static async listRepositoriesForInstallation(installationId) {
|
|
234
|
+
const tokenData = await GitHubUtil.getInstallationAccessToken(installationId);
|
|
235
|
+
const allRepositories = [];
|
|
236
|
+
let page = 1;
|
|
237
|
+
let hasMore = true;
|
|
238
|
+
while (hasMore) {
|
|
239
|
+
const url = URL.fromString(`https://api.github.com/installation/repositories?per_page=100&page=${page}`);
|
|
240
|
+
const result = await API.get({
|
|
241
|
+
url: url,
|
|
242
|
+
data: {},
|
|
243
|
+
headers: {
|
|
244
|
+
Authorization: `Bearer ${tokenData.token}`,
|
|
245
|
+
Accept: "application/vnd.github+json",
|
|
246
|
+
"X-GitHub-Api-Version": "2022-11-28",
|
|
247
|
+
},
|
|
248
|
+
});
|
|
249
|
+
if (result instanceof HTTPErrorResponse) {
|
|
250
|
+
throw result;
|
|
251
|
+
}
|
|
252
|
+
const repositories = result.data["repositories"] || [];
|
|
253
|
+
for (const repo of repositories) {
|
|
254
|
+
const repoData = repo;
|
|
255
|
+
const owner = repoData["owner"];
|
|
256
|
+
allRepositories.push({
|
|
257
|
+
id: repoData["id"],
|
|
258
|
+
name: repoData["name"],
|
|
259
|
+
fullName: repoData["full_name"],
|
|
260
|
+
private: repoData["private"],
|
|
261
|
+
htmlUrl: repoData["html_url"],
|
|
262
|
+
description: repoData["description"] || null,
|
|
263
|
+
defaultBranch: repoData["default_branch"],
|
|
264
|
+
ownerLogin: owner["login"],
|
|
265
|
+
});
|
|
266
|
+
}
|
|
267
|
+
// Check if there are more pages
|
|
268
|
+
if (repositories.length < 100) {
|
|
269
|
+
hasMore = false;
|
|
270
|
+
}
|
|
271
|
+
else {
|
|
272
|
+
page++;
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
return allRepositories;
|
|
276
|
+
}
|
|
277
|
+
/**
|
|
278
|
+
* Verifies a GitHub webhook signature
|
|
279
|
+
* @param payload - The raw request body
|
|
280
|
+
* @param signature - The X-Hub-Signature-256 header value
|
|
281
|
+
* @returns true if signature is valid
|
|
282
|
+
*/
|
|
283
|
+
static verifyWebhookSignature(payload, signature) {
|
|
284
|
+
if (!GitHubAppWebhookSecret) {
|
|
285
|
+
logger.warn("GITHUB_APP_WEBHOOK_SECRET is not set, skipping verification");
|
|
286
|
+
return true;
|
|
287
|
+
}
|
|
288
|
+
const expectedSignature = `sha256=${crypto
|
|
289
|
+
.createHmac("sha256", GitHubAppWebhookSecret)
|
|
290
|
+
.update(payload)
|
|
291
|
+
.digest("hex")}`;
|
|
292
|
+
try {
|
|
293
|
+
return crypto.timingSafeEqual(Buffer.from(signature), Buffer.from(expectedSignature));
|
|
294
|
+
}
|
|
295
|
+
catch (_a) {
|
|
296
|
+
return false;
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
/**
|
|
300
|
+
* Gets the GitHub App installation URL for a project to install the app
|
|
301
|
+
* @returns The installation URL
|
|
302
|
+
*/
|
|
303
|
+
static getAppInstallationUrl() {
|
|
304
|
+
if (!GitHubAppId) {
|
|
305
|
+
throw new BadDataException("GITHUB_APP_ID environment variable is not set");
|
|
306
|
+
}
|
|
307
|
+
/*
|
|
308
|
+
* This is the standard GitHub App installation URL format
|
|
309
|
+
* The app slug would typically come from another env var, but we can use the client ID approach
|
|
310
|
+
*/
|
|
311
|
+
return `https://github.com/apps`;
|
|
312
|
+
}
|
|
168
313
|
}
|
|
169
314
|
__decorate([
|
|
170
315
|
CaptureSpan(),
|
|
@@ -196,4 +341,22 @@ __decorate([
|
|
|
196
341
|
__metadata("design:paramtypes", [Object]),
|
|
197
342
|
__metadata("design:returntype", Promise)
|
|
198
343
|
], GitHubUtil.prototype, "createPullRequest", null);
|
|
344
|
+
__decorate([
|
|
345
|
+
CaptureSpan(),
|
|
346
|
+
__metadata("design:type", Function),
|
|
347
|
+
__metadata("design:paramtypes", []),
|
|
348
|
+
__metadata("design:returntype", String)
|
|
349
|
+
], GitHubUtil, "generateAppJWT", null);
|
|
350
|
+
__decorate([
|
|
351
|
+
CaptureSpan(),
|
|
352
|
+
__metadata("design:type", Function),
|
|
353
|
+
__metadata("design:paramtypes", [String]),
|
|
354
|
+
__metadata("design:returntype", Promise)
|
|
355
|
+
], GitHubUtil, "getInstallationAccessToken", null);
|
|
356
|
+
__decorate([
|
|
357
|
+
CaptureSpan(),
|
|
358
|
+
__metadata("design:type", Function),
|
|
359
|
+
__metadata("design:paramtypes", [String]),
|
|
360
|
+
__metadata("design:returntype", Promise)
|
|
361
|
+
], GitHubUtil, "listRepositoriesForInstallation", null);
|
|
199
362
|
//# sourceMappingURL=GitHub.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GitHub.js","sourceRoot":"","sources":["../../../../../../Server/Utils/CodeRepository/GitHub/GitHub.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,OAAO,MAAM,eAAe,CAAC;AACpC,OAAO,MAAM,MAAM,cAAc,CAAC;AAClC,OAAO,oBAAoB,MAAM,8CAA8C,CAAC;AAChF,OAAO,iBAAiB,MAAM,yCAAyC,CAAC;AAExE,OAAO,GAAG,MAAM,2BAA2B,CAAC;AAE5C,OAAO,gBAAgB,MAAM,mDAAmD,CAAC;AACjF,OAAO,aAAa,MAAM,wBAAwB,CAAC;AAEnD,OAAO,GAAG,MAAM,uBAAuB,CAAC;AACxC,OAAO,WAAW,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"GitHub.js","sourceRoot":"","sources":["../../../../../../Server/Utils/CodeRepository/GitHub/GitHub.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,OAAO,MAAM,eAAe,CAAC;AACpC,OAAO,MAAM,MAAM,cAAc,CAAC;AAClC,OAAO,o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