Skip to content

Commit 12decce

Browse files
committed
feat(code): cloud task SSE streaming
1 parent 52cfd23 commit 12decce

File tree

22 files changed

+1715
-339
lines changed

22 files changed

+1715
-339
lines changed

apps/code/src/main/services/cloud-task/schemas.ts

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1-
import type { CloudTaskUpdatePayload, TaskRun } from "@shared/types";
1+
import {
2+
type CloudTaskUpdatePayload,
3+
isTerminalStatus,
4+
type TaskRunStatus,
5+
TERMINAL_STATUSES,
6+
} from "@shared/types";
27
import { z } from "zod";
38

4-
export type { CloudTaskUpdatePayload };
5-
6-
// --- Terminal statuses ---
7-
8-
export const TERMINAL_STATUSES = ["completed", "failed", "cancelled"] as const;
9+
export type { CloudTaskUpdatePayload, TaskRunStatus };
10+
export { TERMINAL_STATUSES, isTerminalStatus };
911

1012
// --- Events ---
1113

@@ -17,16 +19,13 @@ export interface CloudTaskEvents {
1719
[CloudTaskEvent.Update]: CloudTaskUpdatePayload;
1820
}
1921

20-
export type TaskRunStatus = TaskRun["status"];
21-
2222
// --- tRPC Schemas ---
2323

2424
export const watchInput = z.object({
2525
taskId: z.string(),
2626
runId: z.string(),
2727
apiHost: z.string(),
2828
teamId: z.number(),
29-
viewing: z.boolean().optional(),
3029
});
3130

3231
export type WatchInput = z.infer<typeof watchInput>;
@@ -36,15 +35,14 @@ export const unwatchInput = z.object({
3635
runId: z.string(),
3736
});
3837

39-
export const onUpdateInput = z.object({
38+
export const retryInput = z.object({
4039
taskId: z.string(),
4140
runId: z.string(),
4241
});
4342

44-
export const setViewingInput = z.object({
43+
export const onUpdateInput = z.object({
4544
taskId: z.string(),
4645
runId: z.string(),
47-
viewing: z.boolean(),
4846
});
4947

5048
export const sendCommandInput = z.object({

0 commit comments

Comments
 (0)