Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 10 additions & 12 deletions apps/code/src/main/services/cloud-task/schemas.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import type { CloudTaskUpdatePayload, TaskRun } from "@shared/types";
import {
type CloudTaskUpdatePayload,
isTerminalStatus,
type TaskRunStatus,
TERMINAL_STATUSES,
} from "@shared/types";
import { z } from "zod";

export type { CloudTaskUpdatePayload };

// --- Terminal statuses ---

export const TERMINAL_STATUSES = ["completed", "failed", "cancelled"] as const;
export type { CloudTaskUpdatePayload, TaskRunStatus };
export { TERMINAL_STATUSES, isTerminalStatus };

// --- Events ---

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

export type TaskRunStatus = TaskRun["status"];

// --- tRPC Schemas ---

export const watchInput = z.object({
taskId: z.string(),
runId: z.string(),
apiHost: z.string(),
teamId: z.number(),
viewing: z.boolean().optional(),
});

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

export const onUpdateInput = z.object({
export const retryInput = z.object({
taskId: z.string(),
runId: z.string(),
});

export const setViewingInput = z.object({
export const onUpdateInput = z.object({
taskId: z.string(),
runId: z.string(),
viewing: z.boolean(),
});

export const sendCommandInput = z.object({
Expand Down
Loading
Loading