terse-types 0.0.1 → 0.0.2
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/dist/Configs.d.ts +187 -56
- package/dist/Configs.js +256 -34
- package/dist/Integrations.js +1 -1
- package/dist/ModelEvents.d.ts +302 -155
- package/dist/ModelEvents.js +184 -0
- package/dist/Notifications.d.ts +23 -10
- package/dist/Notifications.js +12 -0
- package/dist/RunHistoryTypes.d.ts +7 -3
- package/dist/RunHistoryTypes.js +5 -6
- package/dist/Tools.d.ts +299 -168
- package/dist/Tools.js +171 -164
- package/dist/ToolsTypes.d.ts +4 -0
- package/dist/ToolsTypes.js +5 -1
- package/dist/types.d.ts +4797 -685
- package/dist/types.js +722 -103
- package/package.json +46 -42
package/dist/types.js
CHANGED
|
@@ -1,7 +1,128 @@
|
|
|
1
|
+
import * as z from "zod";
|
|
2
|
+
import { configDataSchema, configTypeEnum } from "./Configs.js";
|
|
3
|
+
import { integrationTypeEnum } from "./Integrations.js";
|
|
4
|
+
import { RUN_HISTORY_ACTION_TYPES, RunHistoryStatus, runHistoryActionBaseSchema } from "./RunHistoryTypes.js";
|
|
5
|
+
import { slackUserResponseSchema } from "./Tools.js";
|
|
6
|
+
const pointSchema = z.object({
|
|
7
|
+
x: z.number(),
|
|
8
|
+
y: z.number()
|
|
9
|
+
});
|
|
10
|
+
const unknownRecordSchema = z.record(z.string(), z.unknown());
|
|
11
|
+
export const roleSchema = z.enum(["admin", "user"]);
|
|
12
|
+
export const userSchema = z.object({
|
|
13
|
+
id: z.string(),
|
|
14
|
+
workosId: z.string(),
|
|
15
|
+
organizationId: z.string(),
|
|
16
|
+
organizationName: z.string(),
|
|
17
|
+
email: z.string(),
|
|
18
|
+
displayName: z.string(),
|
|
19
|
+
firstName: z.string().nullable(),
|
|
20
|
+
lastName: z.string().nullable(),
|
|
21
|
+
displayPhotoUrl: z.string(),
|
|
22
|
+
roles: z.array(roleSchema)
|
|
23
|
+
});
|
|
24
|
+
export const userNoOrganizationSchema = userSchema.omit({
|
|
25
|
+
organizationId: true,
|
|
26
|
+
organizationName: true,
|
|
27
|
+
roles: true
|
|
28
|
+
});
|
|
29
|
+
export const commitAssociationSchema = z.object({
|
|
30
|
+
sha: z.string(),
|
|
31
|
+
message: z.string(),
|
|
32
|
+
url: z.string()
|
|
33
|
+
});
|
|
34
|
+
export const subActivitySchema = z.object({
|
|
35
|
+
summary: z.string(),
|
|
36
|
+
commits: z.array(commitAssociationSchema)
|
|
37
|
+
});
|
|
38
|
+
export const activityEventSchema = z.object({
|
|
39
|
+
event_type: z.string(),
|
|
40
|
+
title: z.string(),
|
|
41
|
+
github_repository_owner_id: z.string(),
|
|
42
|
+
github_repository_name: z.string(),
|
|
43
|
+
created_at: z.date(),
|
|
44
|
+
sub_activities: z.array(subActivitySchema)
|
|
45
|
+
});
|
|
46
|
+
export const linearWorkspaceSchema = z.object({
|
|
47
|
+
id: z.string(),
|
|
48
|
+
name: z.string()
|
|
49
|
+
});
|
|
50
|
+
export const jiraProjectSchema = z.object({
|
|
51
|
+
id: z.string(),
|
|
52
|
+
key: z.string(),
|
|
53
|
+
name: z.string()
|
|
54
|
+
});
|
|
55
|
+
export const jiraCredentialsValidationResponseSchema = z.object({
|
|
56
|
+
valid: z.boolean(),
|
|
57
|
+
projects: z.array(jiraProjectSchema).optional(),
|
|
58
|
+
error: z.string().optional()
|
|
59
|
+
});
|
|
60
|
+
export const notionResourceTypeSchema = z.enum(["database", "page"]);
|
|
61
|
+
export const notionResourceSchema = z.object({
|
|
62
|
+
id: z.string(),
|
|
63
|
+
title: z.string(),
|
|
64
|
+
url: z.string(),
|
|
65
|
+
type: notionResourceTypeSchema
|
|
66
|
+
});
|
|
67
|
+
export const notionResourcesResponseSchema = z.object({
|
|
68
|
+
resources: z.array(notionResourceSchema)
|
|
69
|
+
});
|
|
70
|
+
export const posthogProjectSchema = z.object({
|
|
71
|
+
id: z.string(),
|
|
72
|
+
name: z.string(),
|
|
73
|
+
organization_id: z.string().optional()
|
|
74
|
+
});
|
|
75
|
+
export const posthogProjectsResponseSchema = z.object({
|
|
76
|
+
projects: z.array(posthogProjectSchema)
|
|
77
|
+
});
|
|
78
|
+
export const launchDarklyProjectSchema = z.object({
|
|
79
|
+
key: z.string(),
|
|
80
|
+
name: z.string()
|
|
81
|
+
});
|
|
82
|
+
export const launchDarklyProjectsResponseSchema = z.object({
|
|
83
|
+
projects: z.array(launchDarklyProjectSchema)
|
|
84
|
+
});
|
|
85
|
+
export const launchDarklyEnvironmentSchema = z.object({
|
|
86
|
+
key: z.string(),
|
|
87
|
+
name: z.string()
|
|
88
|
+
});
|
|
89
|
+
export const launchDarklyEnvironmentsResponseSchema = z.object({
|
|
90
|
+
environments: z.array(launchDarklyEnvironmentSchema)
|
|
91
|
+
});
|
|
92
|
+
export const datadogIndexSchema = z.object({
|
|
93
|
+
id: z.string(),
|
|
94
|
+
name: z.string(),
|
|
95
|
+
isEnabled: z.boolean(),
|
|
96
|
+
dailyLimit: z.number().int().optional(),
|
|
97
|
+
retentionDays: z.number().int().optional()
|
|
98
|
+
});
|
|
99
|
+
export const datadogIndexesResponseSchema = z.object({
|
|
100
|
+
indexes: z.array(datadogIndexSchema)
|
|
101
|
+
});
|
|
102
|
+
export const slackChannelSchema = z.object({
|
|
103
|
+
id: z.string(),
|
|
104
|
+
name: z.string(),
|
|
105
|
+
isPrivate: z.boolean(),
|
|
106
|
+
isArchived: z.boolean(),
|
|
107
|
+
isMPIM: z.boolean()
|
|
108
|
+
});
|
|
109
|
+
export const slackChannelsResponseSchema = z.object({
|
|
110
|
+
channels: z.array(slackChannelSchema),
|
|
111
|
+
selectedChannelId: z.string().nullable()
|
|
112
|
+
});
|
|
113
|
+
export const slackUsersResponseSchema = z.object({
|
|
114
|
+
users: z.array(slackUserResponseSchema)
|
|
115
|
+
});
|
|
1
116
|
export const TERSE_AGENT_MESSAGE_EVENT_TYPE = "terse_agent_message";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
117
|
+
export const terseAgentMessageEventPayloadSchema = z.object({
|
|
118
|
+
run_id: z.string(),
|
|
119
|
+
automation_id: z.string(),
|
|
120
|
+
organization_id: z.string()
|
|
121
|
+
});
|
|
122
|
+
export const terseAgentMessageMetadataSchema = z.object({
|
|
123
|
+
event_type: z.literal(TERSE_AGENT_MESSAGE_EVENT_TYPE),
|
|
124
|
+
event_payload: terseAgentMessageEventPayloadSchema
|
|
125
|
+
});
|
|
5
126
|
export var SlackChannelType;
|
|
6
127
|
(function (SlackChannelType) {
|
|
7
128
|
SlackChannelType["CHANNEL"] = "channel";
|
|
@@ -9,107 +130,605 @@ export var SlackChannelType;
|
|
|
9
130
|
SlackChannelType["MPIM"] = "mpim";
|
|
10
131
|
SlackChannelType["IM"] = "im";
|
|
11
132
|
})(SlackChannelType || (SlackChannelType = {}));
|
|
12
|
-
|
|
133
|
+
export const slackChannelTypeSchema = z.enum(SlackChannelType);
|
|
134
|
+
export const confluencePageSchema = z.object({
|
|
135
|
+
id: z.string(),
|
|
136
|
+
title: z.string(),
|
|
137
|
+
spaceId: z.string(),
|
|
138
|
+
spaceName: z.string(),
|
|
139
|
+
url: z.string(),
|
|
140
|
+
status: z.string(),
|
|
141
|
+
version: z.number().int()
|
|
142
|
+
});
|
|
143
|
+
export const confluencePagesQuerySchema = z
|
|
144
|
+
.object({
|
|
145
|
+
integrationId: z.string(),
|
|
146
|
+
spaceId: z.string().optional(),
|
|
147
|
+
spaceKey: z.string().optional()
|
|
148
|
+
})
|
|
149
|
+
.refine(({ spaceId, spaceKey }) => spaceId != null || spaceKey != null, {
|
|
150
|
+
message: "Either spaceId or spaceKey is required"
|
|
151
|
+
});
|
|
152
|
+
export const confluencePagesResponseSchema = z.object({
|
|
153
|
+
pages: z.array(confluencePageSchema),
|
|
154
|
+
spaceId: z.string(),
|
|
155
|
+
total: z.number().int()
|
|
156
|
+
});
|
|
157
|
+
export const confluenceResourcesResponseSchema = z.object({
|
|
158
|
+
resources: z.array(confluencePageSchema),
|
|
159
|
+
spaceId: z.string(),
|
|
160
|
+
total: z.number().int()
|
|
161
|
+
});
|
|
162
|
+
export const jiraResourceProjectSchema = z.object({
|
|
163
|
+
id: z.string(),
|
|
164
|
+
key: z.string(),
|
|
165
|
+
name: z.string(),
|
|
166
|
+
projectTypeKey: z.string()
|
|
167
|
+
});
|
|
168
|
+
export const jiraResourcesPayloadSchema = z.object({
|
|
169
|
+
projects: z.array(jiraResourceProjectSchema),
|
|
170
|
+
baseUrl: z.string(),
|
|
171
|
+
cloudId: z.string()
|
|
172
|
+
});
|
|
173
|
+
export const jiraResourcesResponseSchema = z.object({
|
|
174
|
+
success: z.boolean(),
|
|
175
|
+
resources: jiraResourcesPayloadSchema
|
|
176
|
+
});
|
|
177
|
+
export const useConfluenceResourcesReturnBaseSchema = z.object({
|
|
178
|
+
resources: z.array(confluencePageSchema),
|
|
179
|
+
response: confluenceResourcesResponseSchema.optional(),
|
|
180
|
+
isLoading: z.boolean(),
|
|
181
|
+
isError: z.boolean(),
|
|
182
|
+
error: z.unknown(),
|
|
183
|
+
isValidating: z.boolean()
|
|
184
|
+
});
|
|
185
|
+
export const createUseConfluenceResourcesReturnSchema = (mutateSchema) => useConfluenceResourcesReturnBaseSchema.extend({
|
|
186
|
+
mutate: mutateSchema
|
|
187
|
+
});
|
|
13
188
|
export var FigmaEventTypes;
|
|
14
189
|
(function (FigmaEventTypes) {
|
|
15
190
|
FigmaEventTypes["FILE_COMMENT"] = "FILE_COMMENT";
|
|
16
191
|
})(FigmaEventTypes || (FigmaEventTypes = {}));
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
192
|
+
export const figmaEventTypesSchema = z.enum(FigmaEventTypes);
|
|
193
|
+
export const figmaWebhookUserSchema = z.object({
|
|
194
|
+
id: z.string(),
|
|
195
|
+
handle: z.string(),
|
|
196
|
+
email: z.string(),
|
|
197
|
+
img_url: z.string()
|
|
198
|
+
});
|
|
199
|
+
export const figmaCommentImageUrlsSchema = z.object({
|
|
200
|
+
nodeImage: z.string().optional(),
|
|
201
|
+
fullFrame: z.string().optional()
|
|
202
|
+
});
|
|
203
|
+
export const figmaVectorDataSchema = pointSchema;
|
|
204
|
+
export const figmaFrameOffsetDataSchema = z.object({
|
|
205
|
+
node_id: z.string(),
|
|
206
|
+
node_offset: pointSchema
|
|
207
|
+
});
|
|
208
|
+
export const figmaRegionDataSchema = z.object({
|
|
209
|
+
x: z.number(),
|
|
210
|
+
y: z.number(),
|
|
211
|
+
width: z.number(),
|
|
212
|
+
height: z.number()
|
|
213
|
+
});
|
|
214
|
+
export const figmaFrameOffsetRegionDataSchema = z.object({
|
|
215
|
+
node_id: z.string(),
|
|
216
|
+
node_offset: pointSchema,
|
|
217
|
+
x: z.number(),
|
|
218
|
+
y: z.number(),
|
|
219
|
+
width: z.number(),
|
|
220
|
+
height: z.number()
|
|
221
|
+
});
|
|
222
|
+
export const figmaVectorPositioningSchema = z.object({ type: z.literal("Vector"), data: figmaVectorDataSchema });
|
|
223
|
+
export const figmaFrameOffsetPositioningSchema = z.object({ type: z.literal("FrameOffset"), data: figmaFrameOffsetDataSchema });
|
|
224
|
+
export const figmaRegionPositioningSchema = z.object({ type: z.literal("Region"), data: figmaRegionDataSchema });
|
|
225
|
+
export const figmaFrameOffsetRegionPositioningSchema = z.object({ type: z.literal("FrameOffsetRegion"), data: figmaFrameOffsetRegionDataSchema });
|
|
226
|
+
export const figmaPositioningDataSchema = z.discriminatedUnion("type", [
|
|
227
|
+
figmaVectorPositioningSchema,
|
|
228
|
+
figmaFrameOffsetPositioningSchema,
|
|
229
|
+
figmaRegionPositioningSchema,
|
|
230
|
+
figmaFrameOffsetRegionPositioningSchema
|
|
231
|
+
]);
|
|
232
|
+
export const figmaClientMetaSchema = z.object({
|
|
233
|
+
x: z.number(),
|
|
234
|
+
y: z.number(),
|
|
235
|
+
width: z.number(),
|
|
236
|
+
height: z.number(),
|
|
237
|
+
node_id: z.string(),
|
|
238
|
+
node_offset: pointSchema
|
|
239
|
+
});
|
|
240
|
+
export const figmaWebhookCommentSchema = z.object({
|
|
241
|
+
id: z.string(),
|
|
242
|
+
message: z.string(),
|
|
243
|
+
client_meta: figmaClientMetaSchema,
|
|
244
|
+
user: figmaWebhookUserSchema,
|
|
245
|
+
created_at: z.string(),
|
|
246
|
+
resolved_at: z.string().nullable()
|
|
247
|
+
});
|
|
248
|
+
export const figmaApiCommentSchema = z.object({
|
|
249
|
+
id: z.string(),
|
|
250
|
+
message: z.string(),
|
|
251
|
+
client_meta: figmaClientMetaSchema.nullable(),
|
|
252
|
+
user: figmaWebhookUserSchema,
|
|
253
|
+
created_at: z.string(),
|
|
254
|
+
resolved_at: z.string().nullable(),
|
|
255
|
+
parent_id: z.string().nullable().optional(),
|
|
256
|
+
order_id: z.string().optional(),
|
|
257
|
+
mentions: z.array(z.unknown()).optional(),
|
|
258
|
+
reactions: z.array(z.unknown()).optional()
|
|
259
|
+
});
|
|
260
|
+
export const figmaCommentThreadEntrySchema = z.object({
|
|
261
|
+
id: z.string(),
|
|
262
|
+
message: z.string(),
|
|
263
|
+
author: figmaWebhookUserSchema,
|
|
264
|
+
createdAt: z.string(),
|
|
265
|
+
resolvedAt: z.string().nullable(),
|
|
266
|
+
parentId: z.string().nullable(),
|
|
267
|
+
orderId: z.string().optional(),
|
|
268
|
+
isRoot: z.boolean().optional()
|
|
269
|
+
});
|
|
270
|
+
export const figmaFileMetadataSchema = z
|
|
271
|
+
.object({
|
|
272
|
+
name: z.string().optional(),
|
|
273
|
+
folder_name: z.string().optional(),
|
|
274
|
+
url: z.string().optional()
|
|
275
|
+
})
|
|
276
|
+
.passthrough();
|
|
277
|
+
export const figmaCommentEventDataSchema = z.object({
|
|
278
|
+
integrationId: z.string(),
|
|
279
|
+
commentId: z.string(),
|
|
280
|
+
fileKey: z.string(),
|
|
281
|
+
fileUrl: z.string(),
|
|
282
|
+
nodeId: z.string().optional(),
|
|
283
|
+
message: z.string(),
|
|
284
|
+
author: figmaWebhookUserSchema,
|
|
285
|
+
createdAt: z.string(),
|
|
286
|
+
resolved: z.boolean().optional(),
|
|
287
|
+
thread: z.array(figmaCommentThreadEntrySchema).optional(),
|
|
288
|
+
fileMetadata: figmaFileMetadataSchema.optional(),
|
|
289
|
+
positioningData: figmaPositioningDataSchema.optional(),
|
|
290
|
+
matchedNodeIds: z.array(z.string()).optional(),
|
|
291
|
+
imageUrls: figmaCommentImageUrlsSchema.optional()
|
|
292
|
+
});
|
|
293
|
+
export const apiTokenSchema = z.object({
|
|
294
|
+
id: z.string(),
|
|
295
|
+
name: z.string(),
|
|
296
|
+
tokenPrefix: z.string(),
|
|
297
|
+
createdAt: z.string(),
|
|
298
|
+
lastUsedAt: z.string().nullable()
|
|
299
|
+
});
|
|
300
|
+
export const apiTokenCreateResponseSchema = z.object({
|
|
301
|
+
token: apiTokenSchema,
|
|
302
|
+
rawToken: z.string()
|
|
303
|
+
});
|
|
304
|
+
export const deviceTokenExchangeUserSchema = z.object({
|
|
305
|
+
email: z.string(),
|
|
306
|
+
firstName: z.string().nullable(),
|
|
307
|
+
displayName: z.string().nullable()
|
|
308
|
+
});
|
|
309
|
+
export const deviceTokenExchangeResponseSchema = z.object({
|
|
310
|
+
apiKey: z.string(),
|
|
311
|
+
user: deviceTokenExchangeUserSchema
|
|
312
|
+
});
|
|
313
|
+
const configInstanceDataSchema = configDataSchema;
|
|
314
|
+
export const agentTriggerSchema = z.object({
|
|
315
|
+
id: z.string(),
|
|
316
|
+
config: configInstanceDataSchema
|
|
317
|
+
});
|
|
318
|
+
export const agentOutputSchema = z.object({
|
|
319
|
+
id: z.string(),
|
|
320
|
+
config: configInstanceDataSchema
|
|
321
|
+
});
|
|
322
|
+
export const agentPromptSchema = z.object({
|
|
323
|
+
text: z.string()
|
|
324
|
+
});
|
|
325
|
+
export const transientAgentTriggerSchema = z.object({
|
|
326
|
+
id: z.string(),
|
|
327
|
+
config: configInstanceDataSchema.optional(),
|
|
328
|
+
configType: configTypeEnum
|
|
329
|
+
});
|
|
330
|
+
export const transientAgentOutputSchema = z.object({
|
|
331
|
+
id: z.string(),
|
|
332
|
+
config: configInstanceDataSchema.optional(),
|
|
333
|
+
configType: configTypeEnum
|
|
334
|
+
});
|
|
335
|
+
export const templateConfigRefSchema = z.object({
|
|
336
|
+
configType: configTypeEnum,
|
|
337
|
+
integrationType: integrationTypeEnum
|
|
338
|
+
});
|
|
339
|
+
export const templateTriggerSchema = z.object({
|
|
340
|
+
config: templateConfigRefSchema
|
|
341
|
+
});
|
|
342
|
+
export const templateOutputSchema = z.object({
|
|
343
|
+
config: templateConfigRefSchema
|
|
344
|
+
});
|
|
345
|
+
export const templateCategorySchema = z.enum(["ship", "users", "sync", "track"]);
|
|
346
|
+
export const agentTemplateSchema = z.object({
|
|
347
|
+
id: z.string(),
|
|
348
|
+
category: templateCategorySchema,
|
|
349
|
+
name: z.string(),
|
|
350
|
+
description: z.string(),
|
|
351
|
+
chatPrompt: z.string(),
|
|
352
|
+
prompt: agentPromptSchema,
|
|
353
|
+
triggers: z.array(templateTriggerSchema),
|
|
354
|
+
outputs: z.array(templateOutputSchema),
|
|
355
|
+
requireApproval: z.boolean(),
|
|
356
|
+
isActive: z.boolean()
|
|
357
|
+
});
|
|
358
|
+
const runHistoryActionTypeSchema = z.enum(RUN_HISTORY_ACTION_TYPES);
|
|
359
|
+
const runHistoryStatusSchema = z.enum(RunHistoryStatus);
|
|
360
|
+
const runHistoryTriggerSchema = z.object({
|
|
361
|
+
event: z.string(),
|
|
362
|
+
integration: integrationTypeEnum,
|
|
363
|
+
source: z.string(),
|
|
364
|
+
title: z.string().optional(),
|
|
365
|
+
subheader: z.string().optional(),
|
|
366
|
+
url: z.string().optional()
|
|
367
|
+
});
|
|
368
|
+
const runHistoryDecisionSchema = z.object({
|
|
369
|
+
action: z.enum(["processed", "skipped"]),
|
|
370
|
+
reasoning: z.string()
|
|
371
|
+
});
|
|
372
|
+
const runHistoryRecordSchema = z.object({
|
|
373
|
+
id: z.string(),
|
|
374
|
+
agentId: z.string(),
|
|
375
|
+
timestamp: z.string(),
|
|
376
|
+
trigger: runHistoryTriggerSchema,
|
|
377
|
+
filtered: z.boolean(),
|
|
378
|
+
decision: runHistoryDecisionSchema,
|
|
379
|
+
actions: z.array(runHistoryActionBaseSchema).optional(),
|
|
380
|
+
status: runHistoryStatusSchema,
|
|
381
|
+
isManuallyTriggered: z.boolean()
|
|
382
|
+
});
|
|
383
|
+
const runHistoryRecordWithAgentSchema = runHistoryRecordSchema.extend({
|
|
384
|
+
agentName: z.string()
|
|
385
|
+
});
|
|
386
|
+
export const agentNotificationSettingsSchema = z.object({
|
|
387
|
+
enabled: z.boolean(),
|
|
388
|
+
actionTypes: z.array(runHistoryActionTypeSchema)
|
|
389
|
+
});
|
|
390
|
+
export const agentSchema = z.object({
|
|
391
|
+
id: z.string(),
|
|
392
|
+
name: z.string(),
|
|
393
|
+
isActive: z.boolean(),
|
|
394
|
+
requireApproval: z.boolean(),
|
|
395
|
+
prompt: agentPromptSchema,
|
|
396
|
+
triggers: z.array(agentTriggerSchema),
|
|
397
|
+
outputs: z.array(agentOutputSchema),
|
|
398
|
+
createdByUserId: z.string(),
|
|
399
|
+
notificationSettings: agentNotificationSettingsSchema.nullable(),
|
|
400
|
+
toolApprovals: z.array(z.string()).nullable(),
|
|
401
|
+
updatedAt: z.string().nullable(),
|
|
402
|
+
source: z.enum(["WEB_UI", "SDK"]).nullable()
|
|
403
|
+
});
|
|
404
|
+
export const agentUpdateSchema = z.object({
|
|
405
|
+
name: z.string().optional(),
|
|
406
|
+
triggers: z.array(agentTriggerSchema).optional(),
|
|
407
|
+
outputs: z.array(agentOutputSchema).optional(),
|
|
408
|
+
prompt: agentPromptSchema.optional(),
|
|
409
|
+
isActive: z.boolean().optional(),
|
|
410
|
+
requireApproval: z.boolean().optional(),
|
|
411
|
+
notificationSettings: agentNotificationSettingsSchema.nullable().optional(),
|
|
412
|
+
toolApprovals: z.array(z.string()).nullable().optional()
|
|
413
|
+
});
|
|
414
|
+
export const agentCreateSchema = agentSchema.omit({
|
|
415
|
+
id: true,
|
|
416
|
+
createdByUserId: true,
|
|
417
|
+
source: true,
|
|
418
|
+
updatedAt: true
|
|
419
|
+
});
|
|
420
|
+
export const agentDraftSchema = agentCreateSchema.extend({
|
|
421
|
+
id: z.string().nullable(),
|
|
422
|
+
createdByUserId: z.string()
|
|
423
|
+
});
|
|
424
|
+
export const paginationSchema = z.object({
|
|
425
|
+
page: z.number(),
|
|
426
|
+
limit: z.number(),
|
|
427
|
+
total: z.number(),
|
|
428
|
+
totalPages: z.number()
|
|
429
|
+
});
|
|
430
|
+
export const agentsResponseSchema = z.object({
|
|
431
|
+
agents: z.array(agentSchema),
|
|
432
|
+
pagination: paginationSchema
|
|
433
|
+
});
|
|
434
|
+
export const recentAgentSchema = agentSchema.extend({
|
|
435
|
+
updatedAt: z.string(),
|
|
436
|
+
lastEventProcessedAt: z.string().nullable()
|
|
437
|
+
});
|
|
438
|
+
export const agentImprovementStatusSchema = z.enum(["PENDING", "APPLIED", "DISMISSED"]);
|
|
439
|
+
export const agentImprovementTargetAreaSchema = z.enum(["prompt", "trigger_config", "output_config", "general", "code"]);
|
|
440
|
+
export const agentReviewSchema = z.object({
|
|
441
|
+
id: z.string(),
|
|
442
|
+
automationId: z.string(),
|
|
443
|
+
title: z.string(),
|
|
444
|
+
summary: z.string(),
|
|
445
|
+
runsAnalyzed: z.number().int(),
|
|
446
|
+
reviewPeriodStart: z.string(),
|
|
447
|
+
reviewPeriodEnd: z.string(),
|
|
448
|
+
createdAt: z.string()
|
|
449
|
+
});
|
|
450
|
+
export const agentImprovementSchema = z.object({
|
|
451
|
+
id: z.string(),
|
|
452
|
+
reviewId: z.string(),
|
|
453
|
+
automationId: z.string(),
|
|
454
|
+
title: z.string(),
|
|
455
|
+
description: z.string(),
|
|
456
|
+
targetArea: agentImprovementTargetAreaSchema,
|
|
457
|
+
confidence: z.number(),
|
|
458
|
+
status: agentImprovementStatusSchema,
|
|
459
|
+
suggestedPatch: z.string().optional(),
|
|
460
|
+
appliedPrompt: z.string().optional(),
|
|
461
|
+
appliedAt: z.string().optional(),
|
|
462
|
+
dismissedAt: z.string().optional(),
|
|
463
|
+
createdAt: z.string(),
|
|
464
|
+
updatedAt: z.string()
|
|
465
|
+
});
|
|
466
|
+
export const getAgentImprovementsResponseSchema = z.object({
|
|
467
|
+
review: agentReviewSchema.nullable(),
|
|
468
|
+
improvements: z.array(agentImprovementSchema),
|
|
469
|
+
improvementsEnabled: z.boolean()
|
|
470
|
+
});
|
|
471
|
+
export const applyImprovementResponseSchema = z.object({
|
|
472
|
+
success: z.boolean(),
|
|
473
|
+
appliedPrompt: z.string()
|
|
474
|
+
});
|
|
475
|
+
export const dismissImprovementResponseSchema = z.object({
|
|
476
|
+
success: z.boolean()
|
|
477
|
+
});
|
|
478
|
+
export const toggleImprovementsEnabledResponseSchema = z.object({
|
|
479
|
+
success: z.boolean(),
|
|
480
|
+
improvementsEnabled: z.boolean()
|
|
481
|
+
});
|
|
482
|
+
export const repositorySchema = z.object({
|
|
483
|
+
name: z.string(),
|
|
484
|
+
owner: z.string(),
|
|
485
|
+
id: z.number().int()
|
|
486
|
+
});
|
|
487
|
+
export const githubAppInstallationCallbackRequestSchema = z.object({
|
|
488
|
+
name: z.string(),
|
|
489
|
+
email: z.string(),
|
|
490
|
+
username: z.string(),
|
|
491
|
+
installationId: z.number().int(),
|
|
492
|
+
accountName: z.string().nullable(),
|
|
493
|
+
repositories: z.array(repositorySchema)
|
|
494
|
+
});
|
|
495
|
+
export const getGithubRepositoriesForIntegrationRequestSchema = z.object({});
|
|
496
|
+
export const getGithubRepositoriesForIntegrationResponseSchema = z.object({
|
|
497
|
+
repositories: z.array(repositorySchema)
|
|
498
|
+
});
|
|
499
|
+
export const oauthInstallationDetailsSchema = z.object({
|
|
500
|
+
oauthUrl: z.string()
|
|
501
|
+
});
|
|
502
|
+
export const formFieldTypeSchema = z.enum(["text", "password", "textarea"]);
|
|
503
|
+
export const formFieldDefinitionSchema = z.object({
|
|
504
|
+
name: z.string(),
|
|
505
|
+
type: formFieldTypeSchema,
|
|
506
|
+
label: z.string(),
|
|
507
|
+
placeholder: z.string().optional(),
|
|
508
|
+
required: z.boolean().optional(),
|
|
509
|
+
hint: z.string().optional()
|
|
510
|
+
});
|
|
511
|
+
export const configurationFieldTypeSchema = z.enum(["radio", "select"]);
|
|
512
|
+
export const configurationOptionSchema = z.object({
|
|
513
|
+
label: z.string(),
|
|
514
|
+
value: z.string()
|
|
515
|
+
});
|
|
516
|
+
export const configurationFieldDefinitionSchema = z.object({
|
|
517
|
+
name: z.string(),
|
|
518
|
+
type: configurationFieldTypeSchema,
|
|
519
|
+
label: z.string(),
|
|
520
|
+
options: z.array(configurationOptionSchema),
|
|
521
|
+
required: z.boolean().optional(),
|
|
522
|
+
hint: z.string().optional()
|
|
523
|
+
});
|
|
524
|
+
export const integrationFieldsResponseSchema = z.object({
|
|
525
|
+
installationType: z.enum(["form", "oauth"]),
|
|
526
|
+
fields: z.union([z.array(formFieldDefinitionSchema), z.array(configurationFieldDefinitionSchema)])
|
|
527
|
+
});
|
|
528
|
+
export const statsIntervalSchema = z.enum(["1h", "24h", "7d", "1mo", "3mo", "1y"]);
|
|
529
|
+
export const dailyEventCountSchema = z.object({
|
|
530
|
+
date: z.string(),
|
|
531
|
+
events: z.number().int()
|
|
532
|
+
});
|
|
533
|
+
export const recentActionSchema = z.object({
|
|
534
|
+
action: z.string(),
|
|
535
|
+
integration: integrationTypeEnum,
|
|
536
|
+
target: z.string(),
|
|
537
|
+
details: z.string(),
|
|
538
|
+
url: z.string().optional(),
|
|
539
|
+
timestamp: z.string(),
|
|
540
|
+
agentName: z.string(),
|
|
541
|
+
type: runHistoryActionTypeSchema
|
|
542
|
+
});
|
|
543
|
+
export const agentActivityItemSchema = z.object({
|
|
544
|
+
agentId: z.string(),
|
|
545
|
+
agentName: z.string(),
|
|
546
|
+
runCount: z.number().int()
|
|
547
|
+
});
|
|
548
|
+
export const countByStringSchema = z.object({
|
|
549
|
+
label: z.string(),
|
|
550
|
+
count: z.number().int()
|
|
551
|
+
});
|
|
552
|
+
export const statsResponseSchema = z.object({
|
|
553
|
+
totalEventsProcessed: z.number(),
|
|
554
|
+
totalEventsProcessedChange: z.string(),
|
|
555
|
+
actionsTaken: z.number(),
|
|
556
|
+
actionsTakenChange: z.string(),
|
|
557
|
+
numberOfAgents: z.number(),
|
|
558
|
+
numberOfAgentsChange: z.string(),
|
|
559
|
+
dailyEvents: z.array(dailyEventCountSchema),
|
|
560
|
+
recentActions: z.array(recentActionSchema),
|
|
561
|
+
recentRuns: z.array(runHistoryRecordWithAgentSchema),
|
|
562
|
+
timezone: z.string(),
|
|
563
|
+
agentActivity: z.array(agentActivityItemSchema),
|
|
564
|
+
statusBreakdown: z.array(countByStringSchema),
|
|
565
|
+
triggerIntegrations: z.array(countByStringSchema),
|
|
566
|
+
actionIntegrations: z.array(countByStringSchema),
|
|
567
|
+
actionTypes: z.array(countByStringSchema)
|
|
568
|
+
});
|
|
569
|
+
export const triggerPayloadSchema = z.object({
|
|
570
|
+
integrationId: z.string(),
|
|
571
|
+
integrationType: integrationTypeEnum,
|
|
572
|
+
config: configDataSchema
|
|
573
|
+
});
|
|
574
|
+
export const serializedEventSchema = z.object({
|
|
575
|
+
integrationType: integrationTypeEnum,
|
|
576
|
+
eventType: z.string().optional(),
|
|
577
|
+
formattedContent: z.string(),
|
|
578
|
+
debugLog: z.string(),
|
|
579
|
+
metadata: unknownRecordSchema.optional()
|
|
580
|
+
});
|
|
581
|
+
export const sdkAgentRunEventPayloadSchema = z.object({
|
|
582
|
+
integrationType: integrationTypeEnum,
|
|
583
|
+
formattedContent: z.string(),
|
|
584
|
+
debugLog: z.string()
|
|
585
|
+
});
|
|
586
|
+
export const partialSdkAgentRunEventPayloadSchema = sdkAgentRunEventPayloadSchema.partial();
|
|
587
|
+
export const sdkAgentRunOptionsPayloadSchema = z.object({
|
|
588
|
+
maxTurns: z.number().int().optional(),
|
|
589
|
+
requireApproval: z.boolean().optional()
|
|
590
|
+
});
|
|
591
|
+
export const sdkAgentRunRequestBodySchema = z.object({
|
|
592
|
+
prompt: z.string().optional(),
|
|
593
|
+
event: partialSdkAgentRunEventPayloadSchema.optional(),
|
|
594
|
+
skills: z.array(configDataSchema).optional(),
|
|
595
|
+
options: sdkAgentRunOptionsPayloadSchema.optional(),
|
|
596
|
+
toolApprovals: z.array(z.string()).optional()
|
|
597
|
+
});
|
|
598
|
+
export const sdkAgentRunResponseContractSchema = z.object({
|
|
599
|
+
responseMode: z.literal("streaming"),
|
|
600
|
+
supportsInterruptions: z.boolean()
|
|
601
|
+
});
|
|
602
|
+
export const sdkAgentRunNormalizedRequestOptionsSchema = z.object({
|
|
603
|
+
maxTurns: z.number().int(),
|
|
604
|
+
requireApproval: z.boolean()
|
|
605
|
+
});
|
|
606
|
+
export const sdkAgentRunNormalizedRequestSchema = z.object({
|
|
607
|
+
prompt: z.string(),
|
|
608
|
+
event: sdkAgentRunEventPayloadSchema,
|
|
609
|
+
skills: z.array(configDataSchema),
|
|
610
|
+
toolApprovals: z.array(z.string()),
|
|
611
|
+
options: sdkAgentRunNormalizedRequestOptionsSchema
|
|
612
|
+
});
|
|
613
|
+
export const sdkAgentRunResponseBodySchema = z.object({
|
|
614
|
+
success: z.boolean(),
|
|
615
|
+
error: z.string().optional(),
|
|
616
|
+
details: z.array(z.string()).optional(),
|
|
617
|
+
contract: sdkAgentRunResponseContractSchema.optional(),
|
|
618
|
+
normalizedRequest: sdkAgentRunNormalizedRequestSchema.optional()
|
|
619
|
+
});
|
|
620
|
+
export const toolApprovalRequestedPayloadSchema = z.object({
|
|
621
|
+
stepId: z.string(),
|
|
622
|
+
toolName: z.string(),
|
|
623
|
+
arguments: z.string()
|
|
624
|
+
});
|
|
625
|
+
export const sdkAgentStreamEventSchema = z.discriminatedUnion("type", [
|
|
626
|
+
z.object({ type: z.literal("run_started"), runId: z.string() }),
|
|
627
|
+
z.object({ type: z.literal("text"), text: z.string() }),
|
|
628
|
+
z.object({ type: z.literal("final_output"), finalOutput: z.string() }),
|
|
629
|
+
z.object({ type: z.literal("tool_call_params"), toolCallParams: z.string() }),
|
|
630
|
+
z.object({ type: z.literal("tool_call_started"), toolCallStarted: z.string() }),
|
|
631
|
+
z.object({ type: z.literal("tool_call_completed"), toolCallCompleted: z.string() }),
|
|
632
|
+
z.object({
|
|
633
|
+
type: z.literal("tool_approval_requested"),
|
|
634
|
+
toolApprovalRequested: toolApprovalRequestedPayloadSchema
|
|
635
|
+
}),
|
|
636
|
+
z.object({ type: z.literal("action"), action: runHistoryActionBaseSchema }),
|
|
637
|
+
z.object({ type: z.literal("error"), message: z.string() }),
|
|
638
|
+
z.object({ type: z.literal("done") })
|
|
639
|
+
]);
|
|
640
|
+
export const sdkApprovalDecisionRequestBodySchema = z.object({
|
|
641
|
+
runId: z.string(),
|
|
642
|
+
stepId: z.string(),
|
|
643
|
+
approved: z.boolean()
|
|
644
|
+
});
|
|
645
|
+
export const sdkDeployJobSchema = z.object({
|
|
646
|
+
jobName: z.string(),
|
|
647
|
+
triggers: z.array(configDataSchema),
|
|
648
|
+
outputs: z.array(configDataSchema),
|
|
649
|
+
toolApprovals: z.array(z.string()),
|
|
650
|
+
webhookURL: z.string().optional()
|
|
651
|
+
});
|
|
652
|
+
export const sdkDeployRequestBodySchema = z.object({
|
|
653
|
+
jobs: z.array(sdkDeployJobSchema),
|
|
654
|
+
sourceZipBase64: z.string()
|
|
655
|
+
});
|
|
656
|
+
export const sdkDeployResultSchema = z.object({
|
|
657
|
+
jobName: z.string(),
|
|
658
|
+
automationId: z.string(),
|
|
659
|
+
isUpdate: z.boolean()
|
|
660
|
+
});
|
|
661
|
+
export const sdkDeployRemovedSchema = z.object({
|
|
662
|
+
id: z.string(),
|
|
663
|
+
name: z.string()
|
|
664
|
+
});
|
|
665
|
+
export const sdkDeployResponseBodySchema = z.object({
|
|
666
|
+
success: z.boolean(),
|
|
667
|
+
results: z.array(sdkDeployResultSchema),
|
|
668
|
+
removed: z.array(sdkDeployRemovedSchema),
|
|
669
|
+
error: z.string().optional(),
|
|
670
|
+
details: z.string().optional()
|
|
671
|
+
});
|
|
672
|
+
// ─── Request / param schemas ─────────────────────────────────────────
|
|
673
|
+
export const agentIdParamsSchema = z.object({
|
|
674
|
+
agentId: z.string()
|
|
675
|
+
});
|
|
676
|
+
export const agentAndImprovementParamsSchema = z.object({
|
|
677
|
+
agentId: z.string(),
|
|
678
|
+
id: z.string()
|
|
679
|
+
});
|
|
680
|
+
export const manualTriggerParamsSchema = z.object({
|
|
681
|
+
inputId: z.string()
|
|
682
|
+
});
|
|
683
|
+
export const triggerWithEventParamsSchema = z.object({
|
|
684
|
+
automationId: z.string()
|
|
685
|
+
});
|
|
686
|
+
export const logoUploadUrlQuerySchema = z.object({
|
|
687
|
+
contentType: z.string()
|
|
688
|
+
});
|
|
689
|
+
export const logoParamsSchema = z.object({
|
|
690
|
+
organizationId: z.string()
|
|
691
|
+
});
|
|
692
|
+
export const webhookWorkOSTriggerParamsSchema = z.object({
|
|
693
|
+
integrationId: z.string()
|
|
694
|
+
});
|
|
695
|
+
export const organizationCreateRequestSchema = z.object({
|
|
696
|
+
name: z.string(),
|
|
697
|
+
firstName: z.string().optional(),
|
|
698
|
+
lastName: z.string().optional()
|
|
699
|
+
});
|
|
700
|
+
export const organizationSwitchRequestSchema = z.object({
|
|
701
|
+
organizationId: z.string()
|
|
702
|
+
});
|
|
703
|
+
export const organizationUpdateRequestSchema = z.object({
|
|
704
|
+
name: z.string()
|
|
705
|
+
});
|
|
706
|
+
export const apiTokenCreateRequestSchema = z.object({
|
|
707
|
+
name: z.string().max(100)
|
|
708
|
+
});
|
|
709
|
+
export const apiTokenUpdateRequestSchema = z.object({
|
|
710
|
+
name: z.string().max(100)
|
|
711
|
+
});
|
|
712
|
+
export const deviceTokenExchangeRequestSchema = z.object({
|
|
713
|
+
accessToken: z.string()
|
|
714
|
+
});
|
|
715
|
+
export const sdkToolExecuteRequestSchema = z.object({
|
|
716
|
+
toolName: z.string(),
|
|
717
|
+
params: z.record(z.string(), z.unknown()).optional()
|
|
718
|
+
});
|
|
719
|
+
export const manualTriggerRequestSchema = z.object({
|
|
720
|
+
context: z.string().optional()
|
|
721
|
+
});
|
|
722
|
+
export const toggleImprovementsEnabledRequestSchema = z.object({
|
|
723
|
+
enabled: z.boolean()
|
|
724
|
+
});
|
|
725
|
+
export const workosWebhookSecretUpdateRequestSchema = z.object({
|
|
726
|
+
webhookSecret: z.string(),
|
|
727
|
+
state: z.string().optional()
|
|
728
|
+
});
|
|
729
|
+
export const sdkSampleEventsRequestSchema = z.object({
|
|
730
|
+
triggers: z.array(triggerPayloadSchema).min(1)
|
|
731
|
+
});
|
|
732
|
+
export const triggerWithEventRequestSchema = z.object({
|
|
733
|
+
event: serializedEventSchema
|
|
734
|
+
});
|