@prave/shared 1.2.2 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/compile-skill.d.ts +54 -0
- package/dist/lib/compile-skill.d.ts.map +1 -0
- package/dist/lib/compile-skill.js +52 -0
- package/dist/lib/index.d.ts +2 -0
- package/dist/lib/index.d.ts.map +1 -1
- package/dist/lib/index.js +2 -0
- package/dist/lib/secret-scanner.d.ts +63 -0
- package/dist/lib/secret-scanner.d.ts.map +1 -0
- package/dist/lib/secret-scanner.js +214 -0
- package/dist/schemas/index.d.ts +1 -0
- package/dist/schemas/index.d.ts.map +1 -1
- package/dist/schemas/index.js +1 -0
- package/dist/schemas/run.schema.d.ts +501 -0
- package/dist/schemas/run.schema.d.ts.map +1 -0
- package/dist/schemas/run.schema.js +179 -0
- package/dist/schemas/skill.schema.d.ts +51 -0
- package/dist/schemas/skill.schema.d.ts.map +1 -1
- package/dist/schemas/skill.schema.js +42 -0
- package/dist/types/plan-limits.d.ts +27 -0
- package/dist/types/plan-limits.d.ts.map +1 -1
- package/dist/types/plan-limits.js +26 -4
- package/package.json +1 -1
|
@@ -0,0 +1,501 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* Run schemas — server-side scheduled Skill executions.
|
|
4
|
+
*
|
|
5
|
+
* The on-disk shape is split across three tables:
|
|
6
|
+
*
|
|
7
|
+
* - `skill_bundles` uploaded project folder (SKILL.md + scripts + .env)
|
|
8
|
+
* - `runs` schedule + agent + status for one deployment
|
|
9
|
+
* - `run_executions` append-only fire-history with logs and tokens
|
|
10
|
+
*
|
|
11
|
+
* (See supabase/migrations/049_runs_and_bundles.sql for the full
|
|
12
|
+
* column-level docstrings.)
|
|
13
|
+
*/
|
|
14
|
+
export declare const runAgentSchema: z.ZodEnum<["claude", "codex", "cursor", "gemini", "cline", "amp"]>;
|
|
15
|
+
export type RunAgent = z.infer<typeof runAgentSchema>;
|
|
16
|
+
export declare const runScheduleKindSchema: z.ZodEnum<["hourly", "daily", "weekly", "monthly", "custom"]>;
|
|
17
|
+
export type RunScheduleKind = z.infer<typeof runScheduleKindSchema>;
|
|
18
|
+
export declare const runStatusSchema: z.ZodEnum<["active", "paused", "failed", "disabled"]>;
|
|
19
|
+
export type RunStatus = z.infer<typeof runStatusSchema>;
|
|
20
|
+
export declare const runExecutionStatusSchema: z.ZodEnum<["running", "success", "failed", "timeout", "cancelled"]>;
|
|
21
|
+
export type RunExecutionStatus = z.infer<typeof runExecutionStatusSchema>;
|
|
22
|
+
export declare const runScheduleInputSchema: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
|
|
23
|
+
kind: z.ZodLiteral<"hourly">;
|
|
24
|
+
}, "strip", z.ZodTypeAny, {
|
|
25
|
+
kind: "hourly";
|
|
26
|
+
}, {
|
|
27
|
+
kind: "hourly";
|
|
28
|
+
}>, z.ZodObject<{
|
|
29
|
+
kind: z.ZodLiteral<"daily">;
|
|
30
|
+
time: z.ZodString;
|
|
31
|
+
}, "strip", z.ZodTypeAny, {
|
|
32
|
+
kind: "daily";
|
|
33
|
+
time: string;
|
|
34
|
+
}, {
|
|
35
|
+
kind: "daily";
|
|
36
|
+
time: string;
|
|
37
|
+
}>, z.ZodObject<{
|
|
38
|
+
kind: z.ZodLiteral<"weekly">;
|
|
39
|
+
time: z.ZodString;
|
|
40
|
+
weekday: z.ZodNumber;
|
|
41
|
+
}, "strip", z.ZodTypeAny, {
|
|
42
|
+
kind: "weekly";
|
|
43
|
+
time: string;
|
|
44
|
+
weekday: number;
|
|
45
|
+
}, {
|
|
46
|
+
kind: "weekly";
|
|
47
|
+
time: string;
|
|
48
|
+
weekday: number;
|
|
49
|
+
}>, z.ZodObject<{
|
|
50
|
+
kind: z.ZodLiteral<"monthly">;
|
|
51
|
+
time: z.ZodString;
|
|
52
|
+
day_of_month: z.ZodNumber;
|
|
53
|
+
}, "strip", z.ZodTypeAny, {
|
|
54
|
+
kind: "monthly";
|
|
55
|
+
time: string;
|
|
56
|
+
day_of_month: number;
|
|
57
|
+
}, {
|
|
58
|
+
kind: "monthly";
|
|
59
|
+
time: string;
|
|
60
|
+
day_of_month: number;
|
|
61
|
+
}>, z.ZodObject<{
|
|
62
|
+
kind: z.ZodLiteral<"custom">;
|
|
63
|
+
cron_expr: z.ZodString;
|
|
64
|
+
}, "strip", z.ZodTypeAny, {
|
|
65
|
+
kind: "custom";
|
|
66
|
+
cron_expr: string;
|
|
67
|
+
}, {
|
|
68
|
+
kind: "custom";
|
|
69
|
+
cron_expr: string;
|
|
70
|
+
}>]>;
|
|
71
|
+
export type RunScheduleInput = z.infer<typeof runScheduleInputSchema>;
|
|
72
|
+
export declare const skillBundleSchema: z.ZodObject<{
|
|
73
|
+
id: z.ZodString;
|
|
74
|
+
owner_id: z.ZodString;
|
|
75
|
+
skill_id: z.ZodNullable<z.ZodString>;
|
|
76
|
+
source: z.ZodEnum<["upload", "github"]>;
|
|
77
|
+
tarball_path: z.ZodString;
|
|
78
|
+
manifest: z.ZodArray<z.ZodObject<{
|
|
79
|
+
path: z.ZodString;
|
|
80
|
+
size: z.ZodNumber;
|
|
81
|
+
sha256: z.ZodString;
|
|
82
|
+
kind: z.ZodEnum<["text", "binary", "script"]>;
|
|
83
|
+
}, "strip", z.ZodTypeAny, {
|
|
84
|
+
path: string;
|
|
85
|
+
kind: "text" | "binary" | "script";
|
|
86
|
+
size: number;
|
|
87
|
+
sha256: string;
|
|
88
|
+
}, {
|
|
89
|
+
path: string;
|
|
90
|
+
kind: "text" | "binary" | "script";
|
|
91
|
+
size: number;
|
|
92
|
+
sha256: string;
|
|
93
|
+
}>, "many">;
|
|
94
|
+
total_size_bytes: z.ZodNumber;
|
|
95
|
+
has_scripts: z.ZodBoolean;
|
|
96
|
+
has_env_template: z.ZodBoolean;
|
|
97
|
+
secret_scan_status: z.ZodEnum<["pending", "clean", "rejected"]>;
|
|
98
|
+
secret_scan_findings: z.ZodNullable<z.ZodArray<z.ZodObject<{
|
|
99
|
+
path: z.ZodString;
|
|
100
|
+
rule: z.ZodString;
|
|
101
|
+
line: z.ZodOptional<z.ZodNumber>;
|
|
102
|
+
}, "strip", z.ZodTypeAny, {
|
|
103
|
+
path: string;
|
|
104
|
+
rule: string;
|
|
105
|
+
line?: number | undefined;
|
|
106
|
+
}, {
|
|
107
|
+
path: string;
|
|
108
|
+
rule: string;
|
|
109
|
+
line?: number | undefined;
|
|
110
|
+
}>, "many">>;
|
|
111
|
+
created_at: z.ZodString;
|
|
112
|
+
updated_at: z.ZodString;
|
|
113
|
+
}, "strip", z.ZodTypeAny, {
|
|
114
|
+
id: string;
|
|
115
|
+
skill_id: string | null;
|
|
116
|
+
created_at: string;
|
|
117
|
+
updated_at: string;
|
|
118
|
+
owner_id: string;
|
|
119
|
+
source: "upload" | "github";
|
|
120
|
+
tarball_path: string;
|
|
121
|
+
manifest: {
|
|
122
|
+
path: string;
|
|
123
|
+
kind: "text" | "binary" | "script";
|
|
124
|
+
size: number;
|
|
125
|
+
sha256: string;
|
|
126
|
+
}[];
|
|
127
|
+
total_size_bytes: number;
|
|
128
|
+
has_scripts: boolean;
|
|
129
|
+
has_env_template: boolean;
|
|
130
|
+
secret_scan_status: "pending" | "clean" | "rejected";
|
|
131
|
+
secret_scan_findings: {
|
|
132
|
+
path: string;
|
|
133
|
+
rule: string;
|
|
134
|
+
line?: number | undefined;
|
|
135
|
+
}[] | null;
|
|
136
|
+
}, {
|
|
137
|
+
id: string;
|
|
138
|
+
skill_id: string | null;
|
|
139
|
+
created_at: string;
|
|
140
|
+
updated_at: string;
|
|
141
|
+
owner_id: string;
|
|
142
|
+
source: "upload" | "github";
|
|
143
|
+
tarball_path: string;
|
|
144
|
+
manifest: {
|
|
145
|
+
path: string;
|
|
146
|
+
kind: "text" | "binary" | "script";
|
|
147
|
+
size: number;
|
|
148
|
+
sha256: string;
|
|
149
|
+
}[];
|
|
150
|
+
total_size_bytes: number;
|
|
151
|
+
has_scripts: boolean;
|
|
152
|
+
has_env_template: boolean;
|
|
153
|
+
secret_scan_status: "pending" | "clean" | "rejected";
|
|
154
|
+
secret_scan_findings: {
|
|
155
|
+
path: string;
|
|
156
|
+
rule: string;
|
|
157
|
+
line?: number | undefined;
|
|
158
|
+
}[] | null;
|
|
159
|
+
}>;
|
|
160
|
+
export type SkillBundle = z.infer<typeof skillBundleSchema>;
|
|
161
|
+
export declare const runSchema: z.ZodObject<{
|
|
162
|
+
id: z.ZodString;
|
|
163
|
+
owner_id: z.ZodString;
|
|
164
|
+
bundle_id: z.ZodString;
|
|
165
|
+
slug: z.ZodString;
|
|
166
|
+
name: z.ZodString;
|
|
167
|
+
agent: z.ZodEnum<["claude", "codex", "cursor", "gemini", "cline", "amp"]>;
|
|
168
|
+
schedule_kind: z.ZodEnum<["hourly", "daily", "weekly", "monthly", "custom"]>;
|
|
169
|
+
cron_expr: z.ZodString;
|
|
170
|
+
timezone: z.ZodString;
|
|
171
|
+
status: z.ZodEnum<["active", "paused", "failed", "disabled"]>;
|
|
172
|
+
timeout_seconds: z.ZodNumber;
|
|
173
|
+
max_log_bytes: z.ZodNumber;
|
|
174
|
+
next_run_at: z.ZodNullable<z.ZodString>;
|
|
175
|
+
last_run_at: z.ZodNullable<z.ZodString>;
|
|
176
|
+
last_exec_status: z.ZodNullable<z.ZodEnum<["success", "failed", "timeout", "cancelled"]>>;
|
|
177
|
+
total_runs: z.ZodNumber;
|
|
178
|
+
total_failures: z.ZodNumber;
|
|
179
|
+
created_at: z.ZodString;
|
|
180
|
+
updated_at: z.ZodString;
|
|
181
|
+
}, "strip", z.ZodTypeAny, {
|
|
182
|
+
status: "failed" | "active" | "paused" | "disabled";
|
|
183
|
+
id: string;
|
|
184
|
+
created_at: string;
|
|
185
|
+
updated_at: string;
|
|
186
|
+
slug: string;
|
|
187
|
+
name: string;
|
|
188
|
+
owner_id: string;
|
|
189
|
+
cron_expr: string;
|
|
190
|
+
bundle_id: string;
|
|
191
|
+
agent: "claude" | "codex" | "cursor" | "gemini" | "cline" | "amp";
|
|
192
|
+
schedule_kind: "custom" | "monthly" | "hourly" | "daily" | "weekly";
|
|
193
|
+
timezone: string;
|
|
194
|
+
timeout_seconds: number;
|
|
195
|
+
max_log_bytes: number;
|
|
196
|
+
next_run_at: string | null;
|
|
197
|
+
last_run_at: string | null;
|
|
198
|
+
last_exec_status: "success" | "failed" | "timeout" | "cancelled" | null;
|
|
199
|
+
total_runs: number;
|
|
200
|
+
total_failures: number;
|
|
201
|
+
}, {
|
|
202
|
+
status: "failed" | "active" | "paused" | "disabled";
|
|
203
|
+
id: string;
|
|
204
|
+
created_at: string;
|
|
205
|
+
updated_at: string;
|
|
206
|
+
slug: string;
|
|
207
|
+
name: string;
|
|
208
|
+
owner_id: string;
|
|
209
|
+
cron_expr: string;
|
|
210
|
+
bundle_id: string;
|
|
211
|
+
agent: "claude" | "codex" | "cursor" | "gemini" | "cline" | "amp";
|
|
212
|
+
schedule_kind: "custom" | "monthly" | "hourly" | "daily" | "weekly";
|
|
213
|
+
timezone: string;
|
|
214
|
+
timeout_seconds: number;
|
|
215
|
+
max_log_bytes: number;
|
|
216
|
+
next_run_at: string | null;
|
|
217
|
+
last_run_at: string | null;
|
|
218
|
+
last_exec_status: "success" | "failed" | "timeout" | "cancelled" | null;
|
|
219
|
+
total_runs: number;
|
|
220
|
+
total_failures: number;
|
|
221
|
+
}>;
|
|
222
|
+
export type Run = z.infer<typeof runSchema>;
|
|
223
|
+
export declare const createRunInputSchema: z.ZodObject<{
|
|
224
|
+
bundle_id: z.ZodString;
|
|
225
|
+
name: z.ZodString;
|
|
226
|
+
agent: z.ZodEnum<["claude", "codex", "cursor", "gemini", "cline", "amp"]>;
|
|
227
|
+
schedule: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
|
|
228
|
+
kind: z.ZodLiteral<"hourly">;
|
|
229
|
+
}, "strip", z.ZodTypeAny, {
|
|
230
|
+
kind: "hourly";
|
|
231
|
+
}, {
|
|
232
|
+
kind: "hourly";
|
|
233
|
+
}>, z.ZodObject<{
|
|
234
|
+
kind: z.ZodLiteral<"daily">;
|
|
235
|
+
time: z.ZodString;
|
|
236
|
+
}, "strip", z.ZodTypeAny, {
|
|
237
|
+
kind: "daily";
|
|
238
|
+
time: string;
|
|
239
|
+
}, {
|
|
240
|
+
kind: "daily";
|
|
241
|
+
time: string;
|
|
242
|
+
}>, z.ZodObject<{
|
|
243
|
+
kind: z.ZodLiteral<"weekly">;
|
|
244
|
+
time: z.ZodString;
|
|
245
|
+
weekday: z.ZodNumber;
|
|
246
|
+
}, "strip", z.ZodTypeAny, {
|
|
247
|
+
kind: "weekly";
|
|
248
|
+
time: string;
|
|
249
|
+
weekday: number;
|
|
250
|
+
}, {
|
|
251
|
+
kind: "weekly";
|
|
252
|
+
time: string;
|
|
253
|
+
weekday: number;
|
|
254
|
+
}>, z.ZodObject<{
|
|
255
|
+
kind: z.ZodLiteral<"monthly">;
|
|
256
|
+
time: z.ZodString;
|
|
257
|
+
day_of_month: z.ZodNumber;
|
|
258
|
+
}, "strip", z.ZodTypeAny, {
|
|
259
|
+
kind: "monthly";
|
|
260
|
+
time: string;
|
|
261
|
+
day_of_month: number;
|
|
262
|
+
}, {
|
|
263
|
+
kind: "monthly";
|
|
264
|
+
time: string;
|
|
265
|
+
day_of_month: number;
|
|
266
|
+
}>, z.ZodObject<{
|
|
267
|
+
kind: z.ZodLiteral<"custom">;
|
|
268
|
+
cron_expr: z.ZodString;
|
|
269
|
+
}, "strip", z.ZodTypeAny, {
|
|
270
|
+
kind: "custom";
|
|
271
|
+
cron_expr: string;
|
|
272
|
+
}, {
|
|
273
|
+
kind: "custom";
|
|
274
|
+
cron_expr: string;
|
|
275
|
+
}>]>;
|
|
276
|
+
timezone: z.ZodDefault<z.ZodString>;
|
|
277
|
+
timeout_seconds: z.ZodOptional<z.ZodNumber>;
|
|
278
|
+
}, "strip", z.ZodTypeAny, {
|
|
279
|
+
name: string;
|
|
280
|
+
bundle_id: string;
|
|
281
|
+
agent: "claude" | "codex" | "cursor" | "gemini" | "cline" | "amp";
|
|
282
|
+
timezone: string;
|
|
283
|
+
schedule: {
|
|
284
|
+
kind: "hourly";
|
|
285
|
+
} | {
|
|
286
|
+
kind: "daily";
|
|
287
|
+
time: string;
|
|
288
|
+
} | {
|
|
289
|
+
kind: "weekly";
|
|
290
|
+
time: string;
|
|
291
|
+
weekday: number;
|
|
292
|
+
} | {
|
|
293
|
+
kind: "monthly";
|
|
294
|
+
time: string;
|
|
295
|
+
day_of_month: number;
|
|
296
|
+
} | {
|
|
297
|
+
kind: "custom";
|
|
298
|
+
cron_expr: string;
|
|
299
|
+
};
|
|
300
|
+
timeout_seconds?: number | undefined;
|
|
301
|
+
}, {
|
|
302
|
+
name: string;
|
|
303
|
+
bundle_id: string;
|
|
304
|
+
agent: "claude" | "codex" | "cursor" | "gemini" | "cline" | "amp";
|
|
305
|
+
schedule: {
|
|
306
|
+
kind: "hourly";
|
|
307
|
+
} | {
|
|
308
|
+
kind: "daily";
|
|
309
|
+
time: string;
|
|
310
|
+
} | {
|
|
311
|
+
kind: "weekly";
|
|
312
|
+
time: string;
|
|
313
|
+
weekday: number;
|
|
314
|
+
} | {
|
|
315
|
+
kind: "monthly";
|
|
316
|
+
time: string;
|
|
317
|
+
day_of_month: number;
|
|
318
|
+
} | {
|
|
319
|
+
kind: "custom";
|
|
320
|
+
cron_expr: string;
|
|
321
|
+
};
|
|
322
|
+
timezone?: string | undefined;
|
|
323
|
+
timeout_seconds?: number | undefined;
|
|
324
|
+
}>;
|
|
325
|
+
export type CreateRunInput = z.infer<typeof createRunInputSchema>;
|
|
326
|
+
export declare const updateRunInputSchema: z.ZodObject<{
|
|
327
|
+
name: z.ZodOptional<z.ZodString>;
|
|
328
|
+
agent: z.ZodOptional<z.ZodEnum<["claude", "codex", "cursor", "gemini", "cline", "amp"]>>;
|
|
329
|
+
schedule: z.ZodOptional<z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
|
|
330
|
+
kind: z.ZodLiteral<"hourly">;
|
|
331
|
+
}, "strip", z.ZodTypeAny, {
|
|
332
|
+
kind: "hourly";
|
|
333
|
+
}, {
|
|
334
|
+
kind: "hourly";
|
|
335
|
+
}>, z.ZodObject<{
|
|
336
|
+
kind: z.ZodLiteral<"daily">;
|
|
337
|
+
time: z.ZodString;
|
|
338
|
+
}, "strip", z.ZodTypeAny, {
|
|
339
|
+
kind: "daily";
|
|
340
|
+
time: string;
|
|
341
|
+
}, {
|
|
342
|
+
kind: "daily";
|
|
343
|
+
time: string;
|
|
344
|
+
}>, z.ZodObject<{
|
|
345
|
+
kind: z.ZodLiteral<"weekly">;
|
|
346
|
+
time: z.ZodString;
|
|
347
|
+
weekday: z.ZodNumber;
|
|
348
|
+
}, "strip", z.ZodTypeAny, {
|
|
349
|
+
kind: "weekly";
|
|
350
|
+
time: string;
|
|
351
|
+
weekday: number;
|
|
352
|
+
}, {
|
|
353
|
+
kind: "weekly";
|
|
354
|
+
time: string;
|
|
355
|
+
weekday: number;
|
|
356
|
+
}>, z.ZodObject<{
|
|
357
|
+
kind: z.ZodLiteral<"monthly">;
|
|
358
|
+
time: z.ZodString;
|
|
359
|
+
day_of_month: z.ZodNumber;
|
|
360
|
+
}, "strip", z.ZodTypeAny, {
|
|
361
|
+
kind: "monthly";
|
|
362
|
+
time: string;
|
|
363
|
+
day_of_month: number;
|
|
364
|
+
}, {
|
|
365
|
+
kind: "monthly";
|
|
366
|
+
time: string;
|
|
367
|
+
day_of_month: number;
|
|
368
|
+
}>, z.ZodObject<{
|
|
369
|
+
kind: z.ZodLiteral<"custom">;
|
|
370
|
+
cron_expr: z.ZodString;
|
|
371
|
+
}, "strip", z.ZodTypeAny, {
|
|
372
|
+
kind: "custom";
|
|
373
|
+
cron_expr: string;
|
|
374
|
+
}, {
|
|
375
|
+
kind: "custom";
|
|
376
|
+
cron_expr: string;
|
|
377
|
+
}>]>>;
|
|
378
|
+
timezone: z.ZodOptional<z.ZodString>;
|
|
379
|
+
timeout_seconds: z.ZodOptional<z.ZodNumber>;
|
|
380
|
+
status: z.ZodOptional<z.ZodEnum<["active", "paused"]>>;
|
|
381
|
+
}, "strip", z.ZodTypeAny, {
|
|
382
|
+
status?: "active" | "paused" | undefined;
|
|
383
|
+
name?: string | undefined;
|
|
384
|
+
agent?: "claude" | "codex" | "cursor" | "gemini" | "cline" | "amp" | undefined;
|
|
385
|
+
timezone?: string | undefined;
|
|
386
|
+
timeout_seconds?: number | undefined;
|
|
387
|
+
schedule?: {
|
|
388
|
+
kind: "hourly";
|
|
389
|
+
} | {
|
|
390
|
+
kind: "daily";
|
|
391
|
+
time: string;
|
|
392
|
+
} | {
|
|
393
|
+
kind: "weekly";
|
|
394
|
+
time: string;
|
|
395
|
+
weekday: number;
|
|
396
|
+
} | {
|
|
397
|
+
kind: "monthly";
|
|
398
|
+
time: string;
|
|
399
|
+
day_of_month: number;
|
|
400
|
+
} | {
|
|
401
|
+
kind: "custom";
|
|
402
|
+
cron_expr: string;
|
|
403
|
+
} | undefined;
|
|
404
|
+
}, {
|
|
405
|
+
status?: "active" | "paused" | undefined;
|
|
406
|
+
name?: string | undefined;
|
|
407
|
+
agent?: "claude" | "codex" | "cursor" | "gemini" | "cline" | "amp" | undefined;
|
|
408
|
+
timezone?: string | undefined;
|
|
409
|
+
timeout_seconds?: number | undefined;
|
|
410
|
+
schedule?: {
|
|
411
|
+
kind: "hourly";
|
|
412
|
+
} | {
|
|
413
|
+
kind: "daily";
|
|
414
|
+
time: string;
|
|
415
|
+
} | {
|
|
416
|
+
kind: "weekly";
|
|
417
|
+
time: string;
|
|
418
|
+
weekday: number;
|
|
419
|
+
} | {
|
|
420
|
+
kind: "monthly";
|
|
421
|
+
time: string;
|
|
422
|
+
day_of_month: number;
|
|
423
|
+
} | {
|
|
424
|
+
kind: "custom";
|
|
425
|
+
cron_expr: string;
|
|
426
|
+
} | undefined;
|
|
427
|
+
}>;
|
|
428
|
+
export type UpdateRunInput = z.infer<typeof updateRunInputSchema>;
|
|
429
|
+
export declare const runExecutionSchema: z.ZodObject<{
|
|
430
|
+
id: z.ZodString;
|
|
431
|
+
run_id: z.ZodString;
|
|
432
|
+
worker_id: z.ZodNullable<z.ZodString>;
|
|
433
|
+
status: z.ZodEnum<["running", "success", "failed", "timeout", "cancelled"]>;
|
|
434
|
+
started_at: z.ZodString;
|
|
435
|
+
finished_at: z.ZodNullable<z.ZodString>;
|
|
436
|
+
duration_ms: z.ZodNullable<z.ZodNumber>;
|
|
437
|
+
exit_code: z.ZodNullable<z.ZodNumber>;
|
|
438
|
+
log_text: z.ZodNullable<z.ZodString>;
|
|
439
|
+
log_truncated: z.ZodBoolean;
|
|
440
|
+
input_tokens: z.ZodNullable<z.ZodNumber>;
|
|
441
|
+
output_tokens: z.ZodNullable<z.ZodNumber>;
|
|
442
|
+
cost_estimate_cents: z.ZodNullable<z.ZodNumber>;
|
|
443
|
+
error_message: z.ZodNullable<z.ZodString>;
|
|
444
|
+
created_at: z.ZodString;
|
|
445
|
+
}, "strip", z.ZodTypeAny, {
|
|
446
|
+
status: "success" | "failed" | "running" | "timeout" | "cancelled";
|
|
447
|
+
id: string;
|
|
448
|
+
created_at: string;
|
|
449
|
+
input_tokens: number | null;
|
|
450
|
+
output_tokens: number | null;
|
|
451
|
+
error_message: string | null;
|
|
452
|
+
run_id: string;
|
|
453
|
+
worker_id: string | null;
|
|
454
|
+
started_at: string;
|
|
455
|
+
finished_at: string | null;
|
|
456
|
+
duration_ms: number | null;
|
|
457
|
+
exit_code: number | null;
|
|
458
|
+
log_text: string | null;
|
|
459
|
+
log_truncated: boolean;
|
|
460
|
+
cost_estimate_cents: number | null;
|
|
461
|
+
}, {
|
|
462
|
+
status: "success" | "failed" | "running" | "timeout" | "cancelled";
|
|
463
|
+
id: string;
|
|
464
|
+
created_at: string;
|
|
465
|
+
input_tokens: number | null;
|
|
466
|
+
output_tokens: number | null;
|
|
467
|
+
error_message: string | null;
|
|
468
|
+
run_id: string;
|
|
469
|
+
worker_id: string | null;
|
|
470
|
+
started_at: string;
|
|
471
|
+
finished_at: string | null;
|
|
472
|
+
duration_ms: number | null;
|
|
473
|
+
exit_code: number | null;
|
|
474
|
+
log_text: string | null;
|
|
475
|
+
log_truncated: boolean;
|
|
476
|
+
cost_estimate_cents: number | null;
|
|
477
|
+
}>;
|
|
478
|
+
export type RunExecution = z.infer<typeof runExecutionSchema>;
|
|
479
|
+
export declare const deploySessionSchema: z.ZodObject<{
|
|
480
|
+
session_id: z.ZodString;
|
|
481
|
+
upload_url: z.ZodString;
|
|
482
|
+
wizard_url: z.ZodString;
|
|
483
|
+
expires_at: z.ZodString;
|
|
484
|
+
}, "strip", z.ZodTypeAny, {
|
|
485
|
+
expires_at: string;
|
|
486
|
+
session_id: string;
|
|
487
|
+
upload_url: string;
|
|
488
|
+
wizard_url: string;
|
|
489
|
+
}, {
|
|
490
|
+
expires_at: string;
|
|
491
|
+
session_id: string;
|
|
492
|
+
upload_url: string;
|
|
493
|
+
wizard_url: string;
|
|
494
|
+
}>;
|
|
495
|
+
export type DeploySession = z.infer<typeof deploySessionSchema>;
|
|
496
|
+
export interface RunExecuteJob {
|
|
497
|
+
run_id: string;
|
|
498
|
+
execution_id: string;
|
|
499
|
+
scheduled_at: string;
|
|
500
|
+
}
|
|
501
|
+
//# sourceMappingURL=run.schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run.schema.d.ts","sourceRoot":"","sources":["../../src/schemas/run.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB;;;;;;;;;;;GAWG;AAKH,eAAO,MAAM,cAAc,oEAOzB,CAAA;AACF,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAA;AAKrD,eAAO,MAAM,qBAAqB,+DAMhC,CAAA;AACF,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAA;AAEnE,eAAO,MAAM,eAAe,uDAK1B,CAAA;AACF,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAA;AAEvD,eAAO,MAAM,wBAAwB,qEAMnC,CAAA;AACF,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAA;AAezE,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAsBjC,CAAA;AACF,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAA;AAGrE,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA6B5B,CAAA;AACF,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAA;AAG3D,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAsBpB,CAAA;AACF,MAAM,MAAM,GAAG,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,SAAS,CAAC,CAAA;AAE3C,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAO/B,CAAA;AACF,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAA;AAEjE,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAO/B,CAAA;AACF,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAA;AAGjE,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgB7B,CAAA;AACF,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAA;AAO7D,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;EAK9B,CAAA;AACF,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAA;AAG/D,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,MAAM,CAAA;IACd,YAAY,EAAE,MAAM,CAAA;IACpB,YAAY,EAAE,MAAM,CAAA;CACrB"}
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* Run schemas — server-side scheduled Skill executions.
|
|
4
|
+
*
|
|
5
|
+
* The on-disk shape is split across three tables:
|
|
6
|
+
*
|
|
7
|
+
* - `skill_bundles` uploaded project folder (SKILL.md + scripts + .env)
|
|
8
|
+
* - `runs` schedule + agent + status for one deployment
|
|
9
|
+
* - `run_executions` append-only fire-history with logs and tokens
|
|
10
|
+
*
|
|
11
|
+
* (See supabase/migrations/049_runs_and_bundles.sql for the full
|
|
12
|
+
* column-level docstrings.)
|
|
13
|
+
*/
|
|
14
|
+
// ── Agent identifier ─────────────────────────────────────────────────
|
|
15
|
+
// Same string set as the existing multi-agent feature. The runner
|
|
16
|
+
// picks the matching CLI invocation per name.
|
|
17
|
+
export const runAgentSchema = z.enum([
|
|
18
|
+
'claude',
|
|
19
|
+
'codex',
|
|
20
|
+
'cursor',
|
|
21
|
+
'gemini',
|
|
22
|
+
'cline',
|
|
23
|
+
'amp',
|
|
24
|
+
]);
|
|
25
|
+
// ── Schedule presets ─────────────────────────────────────────────────
|
|
26
|
+
// The wizard picker only shows the presets; `custom` is a power-user
|
|
27
|
+
// affordance exposed via the same form's "Advanced" twirl-down.
|
|
28
|
+
export const runScheduleKindSchema = z.enum([
|
|
29
|
+
'hourly',
|
|
30
|
+
'daily',
|
|
31
|
+
'weekly',
|
|
32
|
+
'monthly',
|
|
33
|
+
'custom',
|
|
34
|
+
]);
|
|
35
|
+
export const runStatusSchema = z.enum([
|
|
36
|
+
'active',
|
|
37
|
+
'paused',
|
|
38
|
+
'failed',
|
|
39
|
+
'disabled',
|
|
40
|
+
]);
|
|
41
|
+
export const runExecutionStatusSchema = z.enum([
|
|
42
|
+
'running',
|
|
43
|
+
'success',
|
|
44
|
+
'failed',
|
|
45
|
+
'timeout',
|
|
46
|
+
'cancelled',
|
|
47
|
+
]);
|
|
48
|
+
// ── Schedule input ───────────────────────────────────────────────────
|
|
49
|
+
//
|
|
50
|
+
// The wizard sends one of:
|
|
51
|
+
//
|
|
52
|
+
// { kind: 'hourly' } → "0 * * * *"
|
|
53
|
+
// { kind: 'daily', time: '08:00' } → "0 8 * * *"
|
|
54
|
+
// { kind: 'weekly', time: '08:00', weekday: 1 } → "0 8 * * 1"
|
|
55
|
+
// { kind: 'monthly', time: '08:00', day_of_month: 1 } → "0 8 1 * *"
|
|
56
|
+
// { kind: 'custom', cron_expr: '*/15 * * * *' }
|
|
57
|
+
//
|
|
58
|
+
// The API service expands these into the canonical 5-field cron used
|
|
59
|
+
// downstream. Timezone is captured separately so "daily at 08:00" lands
|
|
60
|
+
// at the user's local 08:00 regardless of server location.
|
|
61
|
+
export const runScheduleInputSchema = z.discriminatedUnion('kind', [
|
|
62
|
+
z.object({
|
|
63
|
+
kind: z.literal('hourly'),
|
|
64
|
+
}),
|
|
65
|
+
z.object({
|
|
66
|
+
kind: z.literal('daily'),
|
|
67
|
+
time: z.string().regex(/^([01]\d|2[0-3]):[0-5]\d$/, 'HH:MM'),
|
|
68
|
+
}),
|
|
69
|
+
z.object({
|
|
70
|
+
kind: z.literal('weekly'),
|
|
71
|
+
time: z.string().regex(/^([01]\d|2[0-3]):[0-5]\d$/, 'HH:MM'),
|
|
72
|
+
weekday: z.number().int().min(0).max(6),
|
|
73
|
+
}),
|
|
74
|
+
z.object({
|
|
75
|
+
kind: z.literal('monthly'),
|
|
76
|
+
time: z.string().regex(/^([01]\d|2[0-3]):[0-5]\d$/, 'HH:MM'),
|
|
77
|
+
day_of_month: z.number().int().min(1).max(28),
|
|
78
|
+
}),
|
|
79
|
+
z.object({
|
|
80
|
+
kind: z.literal('custom'),
|
|
81
|
+
cron_expr: z.string().min(9).max(120),
|
|
82
|
+
}),
|
|
83
|
+
]);
|
|
84
|
+
// ── Bundle ───────────────────────────────────────────────────────────
|
|
85
|
+
export const skillBundleSchema = z.object({
|
|
86
|
+
id: z.string().uuid(),
|
|
87
|
+
owner_id: z.string().uuid(),
|
|
88
|
+
skill_id: z.string().uuid().nullable(),
|
|
89
|
+
source: z.enum(['upload', 'github']),
|
|
90
|
+
tarball_path: z.string(),
|
|
91
|
+
manifest: z.array(z.object({
|
|
92
|
+
path: z.string(),
|
|
93
|
+
size: z.number().int().nonnegative(),
|
|
94
|
+
sha256: z.string(),
|
|
95
|
+
kind: z.enum(['text', 'binary', 'script']),
|
|
96
|
+
})),
|
|
97
|
+
total_size_bytes: z.number().int().nonnegative(),
|
|
98
|
+
has_scripts: z.boolean(),
|
|
99
|
+
has_env_template: z.boolean(),
|
|
100
|
+
secret_scan_status: z.enum(['pending', 'clean', 'rejected']),
|
|
101
|
+
secret_scan_findings: z
|
|
102
|
+
.array(z.object({
|
|
103
|
+
path: z.string(),
|
|
104
|
+
rule: z.string(),
|
|
105
|
+
line: z.number().int().nonnegative().optional(),
|
|
106
|
+
}))
|
|
107
|
+
.nullable(),
|
|
108
|
+
created_at: z.string().datetime(),
|
|
109
|
+
updated_at: z.string().datetime(),
|
|
110
|
+
});
|
|
111
|
+
// ── Run ──────────────────────────────────────────────────────────────
|
|
112
|
+
export const runSchema = z.object({
|
|
113
|
+
id: z.string().uuid(),
|
|
114
|
+
owner_id: z.string().uuid(),
|
|
115
|
+
bundle_id: z.string().uuid(),
|
|
116
|
+
slug: z.string(),
|
|
117
|
+
name: z.string(),
|
|
118
|
+
agent: runAgentSchema,
|
|
119
|
+
schedule_kind: runScheduleKindSchema,
|
|
120
|
+
cron_expr: z.string(),
|
|
121
|
+
timezone: z.string(),
|
|
122
|
+
status: runStatusSchema,
|
|
123
|
+
timeout_seconds: z.number().int().positive(),
|
|
124
|
+
max_log_bytes: z.number().int().positive(),
|
|
125
|
+
next_run_at: z.string().datetime().nullable(),
|
|
126
|
+
last_run_at: z.string().datetime().nullable(),
|
|
127
|
+
last_exec_status: z
|
|
128
|
+
.enum(['success', 'failed', 'timeout', 'cancelled'])
|
|
129
|
+
.nullable(),
|
|
130
|
+
total_runs: z.number().int().nonnegative(),
|
|
131
|
+
total_failures: z.number().int().nonnegative(),
|
|
132
|
+
created_at: z.string().datetime(),
|
|
133
|
+
updated_at: z.string().datetime(),
|
|
134
|
+
});
|
|
135
|
+
export const createRunInputSchema = z.object({
|
|
136
|
+
bundle_id: z.string().uuid(),
|
|
137
|
+
name: z.string().min(1).max(120),
|
|
138
|
+
agent: runAgentSchema,
|
|
139
|
+
schedule: runScheduleInputSchema,
|
|
140
|
+
timezone: z.string().min(2).max(60).default('UTC'),
|
|
141
|
+
timeout_seconds: z.number().int().min(5).max(300).optional(),
|
|
142
|
+
});
|
|
143
|
+
export const updateRunInputSchema = z.object({
|
|
144
|
+
name: z.string().min(1).max(120).optional(),
|
|
145
|
+
agent: runAgentSchema.optional(),
|
|
146
|
+
schedule: runScheduleInputSchema.optional(),
|
|
147
|
+
timezone: z.string().optional(),
|
|
148
|
+
timeout_seconds: z.number().int().min(5).max(300).optional(),
|
|
149
|
+
status: z.enum(['active', 'paused']).optional(),
|
|
150
|
+
});
|
|
151
|
+
// ── Execution ────────────────────────────────────────────────────────
|
|
152
|
+
export const runExecutionSchema = z.object({
|
|
153
|
+
id: z.string().uuid(),
|
|
154
|
+
run_id: z.string().uuid(),
|
|
155
|
+
worker_id: z.string().nullable(),
|
|
156
|
+
status: runExecutionStatusSchema,
|
|
157
|
+
started_at: z.string().datetime(),
|
|
158
|
+
finished_at: z.string().datetime().nullable(),
|
|
159
|
+
duration_ms: z.number().int().nullable(),
|
|
160
|
+
exit_code: z.number().int().nullable(),
|
|
161
|
+
log_text: z.string().nullable(),
|
|
162
|
+
log_truncated: z.boolean(),
|
|
163
|
+
input_tokens: z.number().int().nullable(),
|
|
164
|
+
output_tokens: z.number().int().nullable(),
|
|
165
|
+
cost_estimate_cents: z.number().int().nullable(),
|
|
166
|
+
error_message: z.string().nullable(),
|
|
167
|
+
created_at: z.string().datetime(),
|
|
168
|
+
});
|
|
169
|
+
// ── Deploy-CLI session ──────────────────────────────────────────────
|
|
170
|
+
// The CLI's `prave deploy` flow uses a short-lived session token to
|
|
171
|
+
// hand off the upload from the terminal to the browser wizard. The
|
|
172
|
+
// API mints the session, the CLI uploads the tarball, the browser
|
|
173
|
+
// claims the session and finalizes the Run.
|
|
174
|
+
export const deploySessionSchema = z.object({
|
|
175
|
+
session_id: z.string(),
|
|
176
|
+
upload_url: z.string().url(),
|
|
177
|
+
wizard_url: z.string().url(),
|
|
178
|
+
expires_at: z.string().datetime(),
|
|
179
|
+
});
|