import * as z from "zod"; export const ComputerPointerAction = z.enum([ "move", "click", "double_click", "right_click", "down", "up", "type", "key", "scroll", ]); export type ComputerPointerAction = z.infer; /** Screen pixels; absent for keyboard steps that act wherever the pointer already is. */ export const ComputerPointerStep = z.object({ action: ComputerPointerAction, x: z.number().int().min(0).max(100_000).optional(), y: z.number().int().min(0).max(100_000).optional(), }); export type ComputerPointerStep = z.infer; export const MAX_COMPUTER_POINTER_STEPS = 48; /** * Payload of a `thread.computer` event with `kind: "pointer"`: where a bot is about to point, * click or type on its computer screen, so clients can draw its cursor over the live screen. */ export const ComputerPointerPayload = z.object({ kind: z.literal("pointer"), screen: z.object({ width: z.number().int().positive().max(100_000), height: z.number().int().positive().max(100_000), }), steps: z.array(ComputerPointerStep).min(1).max(MAX_COMPUTER_POINTER_STEPS), }); export type ComputerPointerPayload = z.infer;