import { z } from 'zod'; import { taskSchema, taskStatusSchema } from './task'; export const listTasksQuerySchema = z.object({ status: taskStatusSchema.optional(), }); export type ListTasksQuery = z.infer; export const listTasksResponseSchema = z.object({ items: z.array(taskSchema), }); export type ListTasksResponse = z.infer; export const getTaskQuerySchema = z.object({ with_output: z.coerce.boolean().optional(), output_bytes: z.coerce.number().int().nonnegative().optional(), }); export type GetTaskQuery = z.infer; export const getTaskResponseSchema = taskSchema; export type GetTaskResponse = z.infer; export const cancelTaskResultSchema = z.object({ cancelled: z.literal(true), }); export type CancelTaskResult = z.infer; export const detachTaskResultSchema = z.object({ detached: z.boolean(), status: taskStatusSchema, }); export type DetachTaskResult = z.infer; export const taskAlreadyFinishedDataSchema = z.object({ cancelled: z.literal(false), }); export type TaskAlreadyFinishedData = z.infer;