-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathschemas.ts
More file actions
65 lines (51 loc) · 1.4 KB
/
schemas.ts
File metadata and controls
65 lines (51 loc) · 1.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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
import {
type CloudTaskUpdatePayload,
isTerminalStatus,
type TaskRunStatus,
TERMINAL_STATUSES,
} from "@shared/types";
import { z } from "zod";
export type { CloudTaskUpdatePayload, TaskRunStatus };
export { TERMINAL_STATUSES, isTerminalStatus };
// --- Events ---
export const CloudTaskEvent = {
Update: "cloud-task-update",
} as const;
export interface CloudTaskEvents {
[CloudTaskEvent.Update]: CloudTaskUpdatePayload;
}
// --- tRPC Schemas ---
export const watchInput = z.object({
taskId: z.string(),
runId: z.string(),
apiHost: z.string(),
teamId: z.number(),
});
export type WatchInput = z.infer<typeof watchInput>;
export const unwatchInput = z.object({
taskId: z.string(),
runId: z.string(),
});
export const retryInput = z.object({
taskId: z.string(),
runId: z.string(),
});
export const onUpdateInput = z.object({
taskId: z.string(),
runId: z.string(),
});
export const sendCommandInput = z.object({
taskId: z.string(),
runId: z.string(),
apiHost: z.string(),
teamId: z.number(),
method: z.enum(["user_message", "cancel", "close"]),
params: z.record(z.string(), z.unknown()).optional(),
});
export type SendCommandInput = z.infer<typeof sendCommandInput>;
export const sendCommandOutput = z.object({
success: z.boolean(),
result: z.unknown().optional(),
error: z.string().optional(),
});
export type SendCommandOutput = z.infer<typeof sendCommandOutput>;