@oneuptime/common 11.3.25 → 11.3.26

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.
Files changed (189) hide show
  1. package/Models/DatabaseModels/AIConversation.ts +322 -0
  2. package/Models/DatabaseModels/AIConversationMessage.ts +495 -0
  3. package/Models/DatabaseModels/AIRun.ts +584 -0
  4. package/Models/DatabaseModels/AIRunEvent.ts +443 -0
  5. package/Models/DatabaseModels/Index.ts +8 -0
  6. package/Models/DatabaseModels/LlmLog.ts +26 -0
  7. package/Models/DatabaseModels/LlmProvider.ts +2 -2
  8. package/Server/API/AIChatAPI.ts +693 -0
  9. package/Server/API/LlmProviderAPI.ts +169 -0
  10. package/Server/API/MicrosoftTeamsAPI.ts +5 -0
  11. package/Server/API/SlackAPI.ts +663 -0
  12. package/Server/Infrastructure/Postgres/SchemaMigrations/1783363279075-AddAIChatModels.ts +245 -0
  13. package/Server/Infrastructure/Postgres/SchemaMigrations/1783443471795-AddLlmProviderToAIConversation.ts +36 -0
  14. package/Server/Infrastructure/Postgres/SchemaMigrations/1783453297388-AddAIChatWriteActionsAndWidgets.ts +46 -0
  15. package/Server/Infrastructure/Postgres/SchemaMigrations/1783461767405-MigrationName.ts +119 -0
  16. package/Server/Infrastructure/Postgres/SchemaMigrations/Index.ts +8 -0
  17. package/Server/Services/AIConversationMessageService.ts +39 -0
  18. package/Server/Services/AIConversationService.ts +63 -0
  19. package/Server/Services/AIRunEventService.ts +39 -0
  20. package/Server/Services/AIRunService.ts +39 -0
  21. package/Server/Services/AIService.ts +53 -31
  22. package/Server/Services/DatabaseService.ts +19 -0
  23. package/Server/Services/LlmProviderService.ts +110 -0
  24. package/Server/Services/ProjectService.ts +24 -0
  25. package/Server/Types/AnalyticsDatabase/ModelPermission.ts +74 -9
  26. package/Server/Utils/AI/AIChatPrivacyFilter.ts +28 -0
  27. package/Server/Utils/AI/Chat/ChatAgentRunner.ts +1054 -0
  28. package/Server/Utils/AI/Chat/ObservabilityAssistant.ts +239 -0
  29. package/Server/Utils/AI/Chat/ObservabilityChatPrompt.ts +51 -0
  30. package/Server/Utils/AI/Toolbox/AlertTools.ts +201 -0
  31. package/Server/Utils/AI/Toolbox/AlertWriteTools.ts +174 -0
  32. package/Server/Utils/AI/Toolbox/ContextTools.ts +189 -0
  33. package/Server/Utils/AI/Toolbox/ExceptionTools.ts +149 -0
  34. package/Server/Utils/AI/Toolbox/IncidentTools.ts +204 -0
  35. package/Server/Utils/AI/Toolbox/IncidentWriteTools.ts +350 -0
  36. package/Server/Utils/AI/Toolbox/Index.ts +228 -0
  37. package/Server/Utils/AI/Toolbox/LogTools.ts +339 -0
  38. package/Server/Utils/AI/Toolbox/MetricTools.ts +179 -0
  39. package/Server/Utils/AI/Toolbox/MonitorTools.ts +193 -0
  40. package/Server/Utils/AI/Toolbox/Serializer.ts +257 -0
  41. package/Server/Utils/AI/Toolbox/ToolTypes.ts +249 -0
  42. package/Server/Utils/AI/Toolbox/TraceTools.ts +402 -0
  43. package/Server/Utils/AI/Toolbox/WidgetBuilder.ts +189 -0
  44. package/Server/Utils/LLM/LLMService.ts +502 -92
  45. package/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeams.ts +512 -19
  46. package/Server/Utils/Workspace/Slack/Slack.ts +80 -0
  47. package/Server/Utils/Workspace/Slack/app-manifest.json +16 -1
  48. package/Tests/Server/Utils/AI/AIChatModelACL.test.ts +42 -0
  49. package/Tests/Server/Utils/AI/ChatAgentHelpers.test.ts +89 -0
  50. package/Tests/Server/Utils/AI/LLMServiceBaseUrl.test.ts +139 -0
  51. package/Tests/Server/Utils/AI/LLMServiceToolCalling.test.ts +308 -0
  52. package/Tests/Server/Utils/AI/ToolArgsGetTimeRange.test.ts +62 -0
  53. package/Tests/Server/Utils/AI/ToolArgsScopeServiceIds.test.ts +79 -0
  54. package/Tests/Server/Utils/AI/ToolResultSerializer.test.ts +155 -0
  55. package/Tests/Types/Billing/SubscriptionStatus.test.ts +127 -0
  56. package/Tests/Types/Metrics/RecordingRuleDefinition.test.ts +213 -0
  57. package/Types/AI/AIChatMessageRole.ts +6 -0
  58. package/Types/AI/AIChatMessageStatus.ts +32 -0
  59. package/Types/AI/AIChatPermissionMode.ts +69 -0
  60. package/Types/AI/AIChatTypes.ts +231 -0
  61. package/Types/AI/AIRunEventType.ts +17 -0
  62. package/Types/AI/AIRunStatus.ts +28 -0
  63. package/Types/AI/AIRunType.ts +6 -0
  64. package/Types/LLM/LlmType.ts +6 -0
  65. package/UI/Components/Header/HeaderIconDropdownButton.tsx +22 -12
  66. package/UI/Components/Markdown.tsx/MarkdownViewer.tsx +35 -3
  67. package/UI/Components/Page/Page.tsx +14 -0
  68. package/UI/Utils/LlmTypeDropdownOptions.ts +40 -0
  69. package/UI/Utils/TestLLMProvider.ts +59 -0
  70. package/build/dist/Models/DatabaseModels/AIConversation.js +345 -0
  71. package/build/dist/Models/DatabaseModels/AIConversation.js.map +1 -0
  72. package/build/dist/Models/DatabaseModels/AIConversationMessage.js +521 -0
  73. package/build/dist/Models/DatabaseModels/AIConversationMessage.js.map +1 -0
  74. package/build/dist/Models/DatabaseModels/AIRun.js +619 -0
  75. package/build/dist/Models/DatabaseModels/AIRun.js.map +1 -0
  76. package/build/dist/Models/DatabaseModels/AIRunEvent.js +469 -0
  77. package/build/dist/Models/DatabaseModels/AIRunEvent.js.map +1 -0
  78. package/build/dist/Models/DatabaseModels/Index.js +8 -0
  79. package/build/dist/Models/DatabaseModels/Index.js.map +1 -1
  80. package/build/dist/Models/DatabaseModels/LlmLog.js +28 -0
  81. package/build/dist/Models/DatabaseModels/LlmLog.js.map +1 -1
  82. package/build/dist/Models/DatabaseModels/LlmProvider.js +2 -2
  83. package/build/dist/Models/DatabaseModels/LlmProvider.js.map +1 -1
  84. package/build/dist/Server/API/AIChatAPI.js +498 -0
  85. package/build/dist/Server/API/AIChatAPI.js.map +1 -0
  86. package/build/dist/Server/API/LlmProviderAPI.js +107 -1
  87. package/build/dist/Server/API/LlmProviderAPI.js.map +1 -1
  88. package/build/dist/Server/API/MicrosoftTeamsAPI.js +4 -0
  89. package/build/dist/Server/API/MicrosoftTeamsAPI.js.map +1 -1
  90. package/build/dist/Server/API/SlackAPI.js +442 -0
  91. package/build/dist/Server/API/SlackAPI.js.map +1 -1
  92. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783363279075-AddAIChatModels.js +96 -0
  93. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783363279075-AddAIChatModels.js.map +1 -0
  94. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783443471795-AddLlmProviderToAIConversation.js +25 -0
  95. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783443471795-AddLlmProviderToAIConversation.js.map +1 -0
  96. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783453297388-AddAIChatWriteActionsAndWidgets.js +31 -0
  97. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783453297388-AddAIChatWriteActionsAndWidgets.js.map +1 -0
  98. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783461767405-MigrationName.js +46 -0
  99. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783461767405-MigrationName.js.map +1 -0
  100. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js +8 -0
  101. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js.map +1 -1
  102. package/build/dist/Server/Services/AIConversationMessageService.js +34 -0
  103. package/build/dist/Server/Services/AIConversationMessageService.js.map +1 -0
  104. package/build/dist/Server/Services/AIConversationService.js +42 -0
  105. package/build/dist/Server/Services/AIConversationService.js.map +1 -0
  106. package/build/dist/Server/Services/AIRunEventService.js +34 -0
  107. package/build/dist/Server/Services/AIRunEventService.js.map +1 -0
  108. package/build/dist/Server/Services/AIRunService.js +34 -0
  109. package/build/dist/Server/Services/AIRunService.js.map +1 -0
  110. package/build/dist/Server/Services/AIService.js +31 -23
  111. package/build/dist/Server/Services/AIService.js.map +1 -1
  112. package/build/dist/Server/Services/DatabaseService.js +10 -0
  113. package/build/dist/Server/Services/DatabaseService.js.map +1 -1
  114. package/build/dist/Server/Services/LlmProviderService.js +108 -0
  115. package/build/dist/Server/Services/LlmProviderService.js.map +1 -1
  116. package/build/dist/Server/Services/ProjectService.js +25 -0
  117. package/build/dist/Server/Services/ProjectService.js.map +1 -1
  118. package/build/dist/Server/Types/AnalyticsDatabase/ModelPermission.js +50 -7
  119. package/build/dist/Server/Types/AnalyticsDatabase/ModelPermission.js.map +1 -1
  120. package/build/dist/Server/Utils/AI/AIChatPrivacyFilter.js +18 -0
  121. package/build/dist/Server/Utils/AI/AIChatPrivacyFilter.js.map +1 -0
  122. package/build/dist/Server/Utils/AI/Chat/ChatAgentRunner.js +745 -0
  123. package/build/dist/Server/Utils/AI/Chat/ChatAgentRunner.js.map +1 -0
  124. package/build/dist/Server/Utils/AI/Chat/ObservabilityAssistant.js +165 -0
  125. package/build/dist/Server/Utils/AI/Chat/ObservabilityAssistant.js.map +1 -0
  126. package/build/dist/Server/Utils/AI/Chat/ObservabilityChatPrompt.js +44 -0
  127. package/build/dist/Server/Utils/AI/Chat/ObservabilityChatPrompt.js.map +1 -0
  128. package/build/dist/Server/Utils/AI/Toolbox/AlertTools.js +167 -0
  129. package/build/dist/Server/Utils/AI/Toolbox/AlertTools.js.map +1 -0
  130. package/build/dist/Server/Utils/AI/Toolbox/AlertWriteTools.js +136 -0
  131. package/build/dist/Server/Utils/AI/Toolbox/AlertWriteTools.js.map +1 -0
  132. package/build/dist/Server/Utils/AI/Toolbox/ContextTools.js +141 -0
  133. package/build/dist/Server/Utils/AI/Toolbox/ContextTools.js.map +1 -0
  134. package/build/dist/Server/Utils/AI/Toolbox/ExceptionTools.js +117 -0
  135. package/build/dist/Server/Utils/AI/Toolbox/ExceptionTools.js.map +1 -0
  136. package/build/dist/Server/Utils/AI/Toolbox/IncidentTools.js +167 -0
  137. package/build/dist/Server/Utils/AI/Toolbox/IncidentTools.js.map +1 -0
  138. package/build/dist/Server/Utils/AI/Toolbox/IncidentWriteTools.js +280 -0
  139. package/build/dist/Server/Utils/AI/Toolbox/IncidentWriteTools.js.map +1 -0
  140. package/build/dist/Server/Utils/AI/Toolbox/Index.js +150 -0
  141. package/build/dist/Server/Utils/AI/Toolbox/Index.js.map +1 -0
  142. package/build/dist/Server/Utils/AI/Toolbox/LogTools.js +246 -0
  143. package/build/dist/Server/Utils/AI/Toolbox/LogTools.js.map +1 -0
  144. package/build/dist/Server/Utils/AI/Toolbox/MetricTools.js +120 -0
  145. package/build/dist/Server/Utils/AI/Toolbox/MetricTools.js.map +1 -0
  146. package/build/dist/Server/Utils/AI/Toolbox/MonitorTools.js +158 -0
  147. package/build/dist/Server/Utils/AI/Toolbox/MonitorTools.js.map +1 -0
  148. package/build/dist/Server/Utils/AI/Toolbox/Serializer.js +188 -0
  149. package/build/dist/Server/Utils/AI/Toolbox/Serializer.js.map +1 -0
  150. package/build/dist/Server/Utils/AI/Toolbox/ToolTypes.js +142 -0
  151. package/build/dist/Server/Utils/AI/Toolbox/ToolTypes.js.map +1 -0
  152. package/build/dist/Server/Utils/AI/Toolbox/TraceTools.js +309 -0
  153. package/build/dist/Server/Utils/AI/Toolbox/TraceTools.js.map +1 -0
  154. package/build/dist/Server/Utils/AI/Toolbox/WidgetBuilder.js +120 -0
  155. package/build/dist/Server/Utils/AI/Toolbox/WidgetBuilder.js.map +1 -0
  156. package/build/dist/Server/Utils/LLM/LLMService.js +372 -88
  157. package/build/dist/Server/Utils/LLM/LLMService.js.map +1 -1
  158. package/build/dist/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeams.js +378 -15
  159. package/build/dist/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeams.js.map +1 -1
  160. package/build/dist/Server/Utils/Workspace/Slack/Slack.js +59 -0
  161. package/build/dist/Server/Utils/Workspace/Slack/Slack.js.map +1 -1
  162. package/build/dist/Server/Utils/Workspace/Slack/app-manifest.json +16 -1
  163. package/build/dist/Types/AI/AIChatMessageRole.js +7 -0
  164. package/build/dist/Types/AI/AIChatMessageRole.js.map +1 -0
  165. package/build/dist/Types/AI/AIChatMessageStatus.js +27 -0
  166. package/build/dist/Types/AI/AIChatMessageStatus.js.map +1 -0
  167. package/build/dist/Types/AI/AIChatPermissionMode.js +53 -0
  168. package/build/dist/Types/AI/AIChatPermissionMode.js.map +1 -0
  169. package/build/dist/Types/AI/AIChatTypes.js +74 -0
  170. package/build/dist/Types/AI/AIChatTypes.js.map +1 -0
  171. package/build/dist/Types/AI/AIRunEventType.js +18 -0
  172. package/build/dist/Types/AI/AIRunEventType.js.map +1 -0
  173. package/build/dist/Types/AI/AIRunStatus.js +26 -0
  174. package/build/dist/Types/AI/AIRunStatus.js.map +1 -0
  175. package/build/dist/Types/AI/AIRunType.js +7 -0
  176. package/build/dist/Types/AI/AIRunType.js.map +1 -0
  177. package/build/dist/Types/LLM/LlmType.js +6 -0
  178. package/build/dist/Types/LLM/LlmType.js.map +1 -1
  179. package/build/dist/UI/Components/Header/HeaderIconDropdownButton.js +10 -5
  180. package/build/dist/UI/Components/Header/HeaderIconDropdownButton.js.map +1 -1
  181. package/build/dist/UI/Components/Markdown.tsx/MarkdownViewer.js +18 -4
  182. package/build/dist/UI/Components/Markdown.tsx/MarkdownViewer.js.map +1 -1
  183. package/build/dist/UI/Components/Page/Page.js +3 -1
  184. package/build/dist/UI/Components/Page/Page.js.map +1 -1
  185. package/build/dist/UI/Utils/LlmTypeDropdownOptions.js +38 -0
  186. package/build/dist/UI/Utils/LlmTypeDropdownOptions.js.map +1 -0
  187. package/build/dist/UI/Utils/TestLLMProvider.js +37 -0
  188. package/build/dist/UI/Utils/TestLLMProvider.js.map +1 -0
  189. package/package.json +1 -1
@@ -0,0 +1,443 @@
1
+ import AIRun from "./AIRun";
2
+ import Project from "./Project";
3
+ import User from "./User";
4
+ import BaseModel from "./DatabaseBaseModel/DatabaseBaseModel";
5
+ import Route from "../../Types/API/Route";
6
+ import { PlanType } from "../../Types/Billing/SubscriptionPlan";
7
+ import ColumnAccessControl from "../../Types/Database/AccessControl/ColumnAccessControl";
8
+ import TableAccessControl from "../../Types/Database/AccessControl/TableAccessControl";
9
+ import TableBillingAccessControl from "../../Types/Database/AccessControl/TableBillingAccessControl";
10
+ import ColumnLength from "../../Types/Database/ColumnLength";
11
+ import ColumnType from "../../Types/Database/ColumnType";
12
+ import CrudApiEndpoint from "../../Types/Database/CrudApiEndpoint";
13
+ import TableColumn from "../../Types/Database/TableColumn";
14
+ import TableColumnType from "../../Types/Database/TableColumnType";
15
+ import TableMetadata from "../../Types/Database/TableMetadata";
16
+ import TenantColumn from "../../Types/Database/TenantColumn";
17
+ import IconProp from "../../Types/Icon/IconProp";
18
+ import ObjectID from "../../Types/ObjectID";
19
+ import Permission from "../../Types/Permission";
20
+ import { JSONObject } from "../../Types/JSON";
21
+ import { Column, Entity, Index, JoinColumn, ManyToOne } from "typeorm";
22
+ import EnableDocumentation from "../../Types/Database/EnableDocumentation";
23
+ import AIRunEventType from "../../Types/AI/AIRunEventType";
24
+ import { AIRunEventResultSummary } from "../../Types/AI/AIChatTypes";
25
+
26
+ /*
27
+ * One event in an AI run: an LLM call, a tool call with its validated
28
+ * arguments, or a lifecycle transition. This is both the live progress feed
29
+ * and the tool-invocation audit trail. Server-only writes.
30
+ */
31
+ @EnableDocumentation()
32
+ @TableBillingAccessControl({
33
+ create: PlanType.Growth,
34
+ read: PlanType.Free,
35
+ update: PlanType.Growth,
36
+ delete: PlanType.Free,
37
+ })
38
+ @TenantColumn("projectId")
39
+ @CrudApiEndpoint(new Route("/ai-run-event"))
40
+ @Entity({
41
+ name: "AIRunEvent",
42
+ })
43
+ @TableMetadata({
44
+ tableName: "AIRunEvent",
45
+ singularName: "AI Run Event",
46
+ pluralName: "AI Run Events",
47
+ icon: IconProp.List,
48
+ tableDescription:
49
+ "An event in an AI run: LLM calls, tool calls with validated arguments, and lifecycle transitions.",
50
+ enableRealtimeEventsOn: {
51
+ create: true,
52
+ },
53
+ })
54
+ @TableAccessControl({
55
+ create: [],
56
+ read: [
57
+ Permission.ProjectOwner,
58
+ Permission.ProjectAdmin,
59
+ Permission.ProjectMember,
60
+ ],
61
+ delete: [],
62
+ update: [],
63
+ })
64
+ export default class AIRunEvent extends BaseModel {
65
+ @ColumnAccessControl({
66
+ create: [],
67
+ read: [
68
+ Permission.ProjectOwner,
69
+ Permission.ProjectAdmin,
70
+ Permission.ProjectMember,
71
+ ],
72
+ update: [],
73
+ })
74
+ @TableColumn({
75
+ type: TableColumnType.Entity,
76
+ required: true,
77
+ modelType: Project,
78
+ manyToOneRelationColumn: "projectId",
79
+ title: "Project",
80
+ description: "Project this event belongs to.",
81
+ })
82
+ @ManyToOne(
83
+ () => {
84
+ return Project;
85
+ },
86
+ {
87
+ cascade: false,
88
+ eager: false,
89
+ nullable: false,
90
+ onDelete: "CASCADE",
91
+ orphanedRowAction: "nullify",
92
+ },
93
+ )
94
+ @JoinColumn({ name: "projectId" })
95
+ public project?: Project = undefined;
96
+
97
+ @ColumnAccessControl({
98
+ create: [],
99
+ read: [
100
+ Permission.ProjectOwner,
101
+ Permission.ProjectAdmin,
102
+ Permission.ProjectMember,
103
+ ],
104
+ update: [],
105
+ })
106
+ @Index()
107
+ @TableColumn({
108
+ type: TableColumnType.ObjectID,
109
+ required: true,
110
+ canReadOnRelationQuery: true,
111
+ title: "Project ID",
112
+ description: "ID of the project this event belongs to.",
113
+ })
114
+ @Column({
115
+ type: ColumnType.ObjectID,
116
+ nullable: false,
117
+ transformer: ObjectID.getDatabaseTransformer(),
118
+ })
119
+ public projectId?: ObjectID = undefined;
120
+
121
+ @ColumnAccessControl({
122
+ create: [],
123
+ read: [
124
+ Permission.ProjectOwner,
125
+ Permission.ProjectAdmin,
126
+ Permission.ProjectMember,
127
+ ],
128
+ update: [],
129
+ })
130
+ @TableColumn({
131
+ type: TableColumnType.Entity,
132
+ required: true,
133
+ modelType: AIRun,
134
+ manyToOneRelationColumn: "aiRunId",
135
+ title: "AI Run",
136
+ description: "Run this event belongs to.",
137
+ })
138
+ @ManyToOne(
139
+ () => {
140
+ return AIRun;
141
+ },
142
+ {
143
+ cascade: false,
144
+ eager: false,
145
+ nullable: false,
146
+ onDelete: "CASCADE",
147
+ orphanedRowAction: "nullify",
148
+ },
149
+ )
150
+ @JoinColumn({ name: "aiRunId" })
151
+ public aiRun?: AIRun = undefined;
152
+
153
+ @ColumnAccessControl({
154
+ create: [],
155
+ read: [
156
+ Permission.ProjectOwner,
157
+ Permission.ProjectAdmin,
158
+ Permission.ProjectMember,
159
+ ],
160
+ update: [],
161
+ })
162
+ @Index()
163
+ @TableColumn({
164
+ type: TableColumnType.ObjectID,
165
+ required: true,
166
+ canReadOnRelationQuery: true,
167
+ title: "AI Run ID",
168
+ description: "ID of the run this event belongs to.",
169
+ })
170
+ @Column({
171
+ type: ColumnType.ObjectID,
172
+ nullable: false,
173
+ transformer: ObjectID.getDatabaseTransformer(),
174
+ })
175
+ public aiRunId?: ObjectID = undefined;
176
+
177
+ @ColumnAccessControl({
178
+ create: [],
179
+ read: [
180
+ Permission.ProjectOwner,
181
+ Permission.ProjectAdmin,
182
+ Permission.ProjectMember,
183
+ ],
184
+ update: [],
185
+ })
186
+ @TableColumn({
187
+ type: TableColumnType.Entity,
188
+ required: false,
189
+ modelType: User,
190
+ manyToOneRelationColumn: "userId",
191
+ title: "User",
192
+ description: "User whose run this event belongs to.",
193
+ })
194
+ @ManyToOne(
195
+ () => {
196
+ return User;
197
+ },
198
+ {
199
+ cascade: false,
200
+ eager: false,
201
+ nullable: true,
202
+ onDelete: "SET NULL",
203
+ orphanedRowAction: "nullify",
204
+ },
205
+ )
206
+ @JoinColumn({ name: "userId" })
207
+ public user?: User = undefined;
208
+
209
+ @ColumnAccessControl({
210
+ create: [],
211
+ read: [
212
+ Permission.ProjectOwner,
213
+ Permission.ProjectAdmin,
214
+ Permission.ProjectMember,
215
+ ],
216
+ update: [],
217
+ })
218
+ @Index()
219
+ @TableColumn({
220
+ type: TableColumnType.ObjectID,
221
+ required: false,
222
+ canReadOnRelationQuery: true,
223
+ title: "User ID",
224
+ description: "ID of the user whose run this event belongs to.",
225
+ })
226
+ @Column({
227
+ type: ColumnType.ObjectID,
228
+ nullable: true,
229
+ transformer: ObjectID.getDatabaseTransformer(),
230
+ })
231
+ public userId?: ObjectID = undefined;
232
+
233
+ @ColumnAccessControl({
234
+ create: [],
235
+ read: [
236
+ Permission.ProjectOwner,
237
+ Permission.ProjectAdmin,
238
+ Permission.ProjectMember,
239
+ ],
240
+ update: [],
241
+ })
242
+ @TableColumn({
243
+ required: true,
244
+ type: TableColumnType.Number,
245
+ title: "Sequence",
246
+ description: "Order of this event within the run.",
247
+ })
248
+ @Column({
249
+ type: ColumnType.Number,
250
+ nullable: false,
251
+ default: 0,
252
+ })
253
+ public sequence?: number = undefined;
254
+
255
+ @ColumnAccessControl({
256
+ create: [],
257
+ read: [
258
+ Permission.ProjectOwner,
259
+ Permission.ProjectAdmin,
260
+ Permission.ProjectMember,
261
+ ],
262
+ update: [],
263
+ })
264
+ @Index()
265
+ @TableColumn({
266
+ required: true,
267
+ type: TableColumnType.ShortText,
268
+ title: "Event Type",
269
+ description: "Type of event.",
270
+ canReadOnRelationQuery: true,
271
+ })
272
+ @Column({
273
+ nullable: false,
274
+ type: ColumnType.ShortText,
275
+ length: ColumnLength.ShortText,
276
+ })
277
+ public eventType?: AIRunEventType = undefined;
278
+
279
+ @ColumnAccessControl({
280
+ create: [],
281
+ read: [
282
+ Permission.ProjectOwner,
283
+ Permission.ProjectAdmin,
284
+ Permission.ProjectMember,
285
+ ],
286
+ update: [],
287
+ })
288
+ @TableColumn({
289
+ required: false,
290
+ type: TableColumnType.ShortText,
291
+ title: "Tool Name",
292
+ description: "Name of the tool for tool-call events.",
293
+ })
294
+ @Column({
295
+ nullable: true,
296
+ type: ColumnType.ShortText,
297
+ length: ColumnLength.ShortText,
298
+ })
299
+ public toolName?: string = undefined;
300
+
301
+ @ColumnAccessControl({
302
+ create: [],
303
+ read: [
304
+ Permission.ProjectOwner,
305
+ Permission.ProjectAdmin,
306
+ Permission.ProjectMember,
307
+ ],
308
+ update: [],
309
+ })
310
+ @TableColumn({
311
+ required: false,
312
+ type: TableColumnType.JSON,
313
+ title: "Tool Arguments",
314
+ description: "Validated tool arguments as executed.",
315
+ })
316
+ @Column({
317
+ nullable: true,
318
+ type: ColumnType.JSON,
319
+ })
320
+ public toolArguments?: JSONObject = undefined;
321
+
322
+ @ColumnAccessControl({
323
+ create: [],
324
+ read: [
325
+ Permission.ProjectOwner,
326
+ Permission.ProjectAdmin,
327
+ Permission.ProjectMember,
328
+ ],
329
+ update: [],
330
+ })
331
+ @TableColumn({
332
+ required: false,
333
+ type: TableColumnType.JSON,
334
+ title: "Result Summary",
335
+ description:
336
+ "Summary of the result: row count, duration, truncation and bytes sent to the LLM.",
337
+ })
338
+ @Column({
339
+ nullable: true,
340
+ type: ColumnType.JSON,
341
+ })
342
+ public resultSummary?: AIRunEventResultSummary = undefined;
343
+
344
+ @ColumnAccessControl({
345
+ create: [],
346
+ read: [
347
+ Permission.ProjectOwner,
348
+ Permission.ProjectAdmin,
349
+ Permission.ProjectMember,
350
+ ],
351
+ update: [],
352
+ })
353
+ @TableColumn({
354
+ required: false,
355
+ type: TableColumnType.ShortText,
356
+ title: "Citation ID",
357
+ description:
358
+ "ID of the citation this event minted (e.g. C1), if it produced one.",
359
+ })
360
+ @Column({
361
+ nullable: true,
362
+ type: ColumnType.ShortText,
363
+ length: ColumnLength.ShortText,
364
+ })
365
+ public citationId?: string = undefined;
366
+
367
+ @ColumnAccessControl({
368
+ create: [],
369
+ read: [],
370
+ update: [],
371
+ })
372
+ @TableColumn({ type: TableColumnType.Entity, modelType: User })
373
+ @ManyToOne(
374
+ () => {
375
+ return User;
376
+ },
377
+ {
378
+ cascade: false,
379
+ eager: false,
380
+ nullable: true,
381
+ onDelete: "SET NULL",
382
+ orphanedRowAction: "nullify",
383
+ },
384
+ )
385
+ @JoinColumn({ name: "deletedByUserId" })
386
+ public deletedByUser?: User = undefined;
387
+
388
+ @ColumnAccessControl({
389
+ create: [],
390
+ read: [],
391
+ update: [],
392
+ })
393
+ @TableColumn({
394
+ type: TableColumnType.ObjectID,
395
+ title: "Deleted by User ID",
396
+ description:
397
+ "User ID who deleted this object (if this object was deleted by a User)",
398
+ })
399
+ @Column({
400
+ type: ColumnType.ObjectID,
401
+ nullable: true,
402
+ transformer: ObjectID.getDatabaseTransformer(),
403
+ })
404
+ public deletedByUserId?: ObjectID = undefined;
405
+
406
+ @ColumnAccessControl({
407
+ create: [],
408
+ read: [],
409
+ update: [],
410
+ })
411
+ @TableColumn({ type: TableColumnType.Entity, modelType: User })
412
+ @ManyToOne(
413
+ () => {
414
+ return User;
415
+ },
416
+ {
417
+ eager: false,
418
+ nullable: true,
419
+ onDelete: "SET NULL",
420
+ orphanedRowAction: "nullify",
421
+ },
422
+ )
423
+ @JoinColumn({ name: "createdByUserId" })
424
+ public createdByUser?: User = undefined;
425
+
426
+ @ColumnAccessControl({
427
+ create: [],
428
+ read: [],
429
+ update: [],
430
+ })
431
+ @TableColumn({
432
+ type: TableColumnType.ObjectID,
433
+ title: "Created by User ID",
434
+ description:
435
+ "User ID who created this object (if this object was created by a User)",
436
+ })
437
+ @Column({
438
+ type: ColumnType.ObjectID,
439
+ nullable: true,
440
+ transformer: ObjectID.getDatabaseTransformer(),
441
+ })
442
+ public createdByUserId?: ObjectID = undefined;
443
+ }
@@ -166,6 +166,10 @@ import AIAgentTask from "./AIAgentTask";
166
166
  import AIAgentTaskLog from "./AIAgentTaskLog";
167
167
  import AIAgentTaskPullRequest from "./AIAgentTaskPullRequest";
168
168
  import AIAgentTaskTelemetryException from "./AIAgentTaskTelemetryException";
169
+ import AIConversation from "./AIConversation";
170
+ import AIConversationMessage from "./AIConversationMessage";
171
+ import AIRun from "./AIRun";
172
+ import AIRunEvent from "./AIRunEvent";
169
173
  import LlmProvider from "./LlmProvider";
170
174
  import LlmLog from "./LlmLog";
171
175
  import Project from "./Project";
@@ -713,6 +717,10 @@ const AllModelTypes: Array<{
713
717
  AIAgentTaskLog,
714
718
  AIAgentTaskPullRequest,
715
719
  AIAgentTaskTelemetryException,
720
+ AIConversation,
721
+ AIConversationMessage,
722
+ AIRun,
723
+ AIRunEvent,
716
724
 
717
725
  LlmProvider,
718
726
  LlmLog,
@@ -604,6 +604,32 @@ export default class LlmLog extends BaseModel {
604
604
  })
605
605
  public alertId?: ObjectID = undefined;
606
606
 
607
+ @ColumnAccessControl({
608
+ create: [],
609
+ read: [
610
+ Permission.ProjectOwner,
611
+ Permission.ProjectAdmin,
612
+ Permission.ProjectMember,
613
+ Permission.Viewer,
614
+ Permission.ReadLlmLog,
615
+ ],
616
+ update: [],
617
+ })
618
+ @Index()
619
+ @TableColumn({
620
+ type: TableColumnType.ObjectID,
621
+ required: false,
622
+ canReadOnRelationQuery: true,
623
+ title: "AI Run ID",
624
+ description: "ID of the AI run this LLM call was part of (if any)",
625
+ })
626
+ @Column({
627
+ type: ColumnType.ObjectID,
628
+ nullable: true,
629
+ transformer: ObjectID.getDatabaseTransformer(),
630
+ })
631
+ public aiRunId?: ObjectID = undefined;
632
+
607
633
  @ColumnAccessControl({
608
634
  create: [],
609
635
  read: [
@@ -42,7 +42,7 @@ import LlmType from "../../Types/LLM/LlmType";
42
42
  pluralName: "LLM Providers",
43
43
  icon: IconProp.Bolt,
44
44
  tableDescription:
45
- "Manage LLM Provider configurations. Connect to OpenAI, Azure OpenAI, Anthropic, Groq, Mistral, Ollama, or other LLM providers to enable AI features.",
45
+ "Manage LLM Provider configurations. Connect to OpenAI, Azure OpenAI, Anthropic, Groq, Mistral, Ollama, OpenAI-compatible servers (e.g. vLLM, LocalAI), or other LLM providers to enable AI features.",
46
46
  })
47
47
  @TableAccessControl({
48
48
  create: [
@@ -190,7 +190,7 @@ export default class LlmProvider extends BaseModel {
190
190
  type: TableColumnType.ShortText,
191
191
  title: "LLM Type",
192
192
  description:
193
- "The type of LLM provider (OpenAI, Azure OpenAI, Anthropic, Groq, Mistral, Ollama, etc.)",
193
+ "The type of LLM provider (OpenAI, Azure OpenAI, Anthropic, Groq, Mistral, Ollama, OpenAICompatible, etc.)",
194
194
  })
195
195
  @Column({
196
196
  nullable: false,