/**
* Zod schemas for simulator tool inputs
*/
import { z } from 'zod';
/**
* Device identifier schema (UDID or "booted")
*/
export const DeviceIdentifierSchema = z.object({
device: z
.string()
.optional()
.default('booted')
.describe('Device UDID or "booted" for any booted device')
});
/**
* Boot device schema
*/
export const BootDeviceSchema = z.object({
device: z.string().describe('Device UDID or name to boot')
});
/**
* Shutdown device schema
*/
export const ShutdownDeviceSchema = z.object({
device: z.string().describe('Device UDID to shutdown')
});
/**
* Get device info schema
*/
export const GetDeviceInfoSchema = z.object({
device: z
.string()
.optional()
.default('booted')
.describe('Device UDID or "booted" for any booted device')
});
/**
* Screenshot schema
*/
export const ScreenshotSchema = z.object({
device: z
.string()
.optional()
.default('booted')
.describe('Device UDID or "booted"'),
quality: z
.number()
.int()
.min(1)
.max(100)
.optional()
.default(80)
.describe('JPEG quality (1-100)'),
maxWidth: z
.number()
.int()
.positive()
.optional()
.default(800)
.describe('Maximum width in pixels'),
maxHeight: z
.number()
.int()
.positive()
.optional()
.default(1400)
.describe('Maximum height in pixels')
});
/**
* Tap coordinates schema
*/
export const TapSchema = z.object({
device: z.string().optional().default('booted'),
x: z.number().describe('X coordinate'),
y: z.number().describe('Y coordinate')
});
/**
* Swipe schema
*/
export const SwipeSchema = z.object({
device: z.string().optional().default('booted'),
x1: z.number().describe('Start X coordinate'),
y1: z.number().describe('Start Y coordinate'),
x2: z.number().describe('End X coordinate'),
y2: z.number().describe('End Y coordinate'),
duration: z.number().optional().default(0.3).describe('Swipe duration in seconds')
});
/**
* Long press schema
*/
export const LongPressSchema = z.object({
device: z.string().optional().default('booted'),
x: z.number().describe('X coordinate'),
y: z.number().describe('Y coordinate'),
duration: z.number().optional().default(1.0).describe('Press duration in seconds')
});
/**
* Type text schema
*/
export const TypeTextSchema = z.object({
device: z.string().optional().default('booted'),
text: z.string().describe('Text to type')
});
/**
* Launch app schema
*/
export const LaunchAppSchema = z.object({
device: z.string().optional().default('booted'),
bundleId: z.string().describe('App bundle identifier (e.g., com.apple.mobilesafari)')
});
/**
* Terminate app schema
*/
export const TerminateAppSchema = z.object({
device: z.string().optional().default('booted'),
bundleId: z.string().describe('App bundle identifier')
});
/**
* Install app schema
*/
export const InstallAppSchema = z.object({
device: z.string().optional().default('booted'),
appPath: z.string().describe('Path to .app bundle')
});
/**
* Uninstall app schema
*/
export const UninstallAppSchema = z.object({
device: z.string().optional().default('booted'),
bundleId: z.string().describe('App bundle identifier')
});
/**
* Open URL schema
*/
export const OpenURLSchema = z.object({
device: z.string().optional().default('booted'),
url: z.string().url().describe('URL to open')
});
/**
* Get logs schema
*/
export const GetLogsSchema = z.object({
device: z.string().optional().default('booted'),
predicate: z
.string()
.optional()
.describe('Log predicate filter (e.g., "processImagePath CONTAINS \'MyApp\'")'),
lines: z
.number()
.int()
.positive()
.optional()
.default(100)
.describe('Number of recent lines to return'),
level: z
.enum(['debug', 'info', 'default', 'error', 'fault'])
.optional()
.describe('Minimum log level')
});