Types
ReferenceAll supporting types used throughout the Automation API
This page documents all supporting types, interfaces, and type aliases used by the Automation API.
File Types
Types used by agent.utils.files methods.
FileInfo
Basic file or directory information returned by list().
interface FileInfo { name: string; // File or directory name path: string; // Full absolute path isDirectory: boolean; // true if directory isFile: boolean; // true if file size: number; // Size in bytes (0 for directories) lastModified: number; // Last modified timestamp}DirectoryInfo
Detailed information about a directory.
interface DirectoryInfo { exists: true; path: string; name: string; isDirectory: true; isFile: false; lastModified: number; canRead: boolean; canWrite: boolean; fileCount: number; // Number of files directoryCount: number; // Number of subdirectories totalItems: number; // Total items (files + directories)}FilePathInfo
Detailed information about a file.
interface FilePathInfo { exists: true; path: string; name: string; isDirectory: false; isFile: true; lastModified: number; canRead: boolean; canWrite: boolean; size: number;}PathNotFoundInfo
Returned when a path doesn't exist.
interface PathNotFoundInfo { exists: false; error?: string; // Optional error message}FileHashes
Hash values for a file.
interface FileHashes { md5: string; // MD5 hash sha1: string; // SHA-1 hash sha256: string; // SHA-256 hash size: number; // File size}FileHashError
Error returned when hashing fails.
interface FileHashError { error: string;}Info Types
Types used by agent.info methods.
AutomationInfo
Metadata about the running automation.
interface AutomationInfo { name: string; // Automation name description: string; // Automation description launchId: string; // Unique ID for this execution agent?: { // Optional agent details id: string; commitId: string; token: string; jobTaskId: string; }; serverBaseUrl: string; // Server URL for API calls}DeviceInfo
Hardware and configuration info about the device.
interface DeviceInfo { id: string; // Unique device ID brand: string; // Device brand (e.g., "Samsung") model: string; // Device model sdkVersion: number; // Android SDK version processor: string; // CPU info numberOfCores: number; // CPU cores ramMb: number; // RAM in MB country: string; // Device country isEmulator: boolean; // true if emulator width: number; // Screen width in pixels height: number; // Screen height in pixels}Email Type
Email message returned by readIMAPEmails().
interface Email { id: string; // Unique email ID subject: string; // Email subject from: string; // Sender email address fromName: string; // Sender display name to: string[]; // Recipients cc: string[]; // CC recipients bcc: string[]; // BCC recipients date: number; // Timestamp (Unix ms) body: string; // Email body content isHtml: boolean; // true if body is HTML isRead: boolean; // Read status hasAttachments: boolean; // Has attachments attachmentNames: string[]; // Attachment file names}OCR Types
Hierarchical types returned by agent.actions.recognizeText(). The structure follows: TextJSON → TextBlockJSON → LineJSON → ElementJSON → SymbolJSON.
TextJSON
Root OCR result containing all recognized text.
interface TextJSON { text: string; // Complete recognized text textBlocks: TextBlockJSON[]; // Array of text blocks}TextBlockJSON
A block of text (paragraph or distinct region).
interface TextBlockJSON { text: string; // Text content of the block recognizedLanguage: string; // Detected language boundingBox?: RectJSON; // Bounding box on screen lines: LineJSON[]; // Lines within the block}LineJSON
A single line of text.
interface LineJSON { text: string; // Text content of the line angle: number; // Rotation angle confidence: number; // Recognition confidence (0-1) recognizedLanguage: string; // Detected language boundingBox?: RectJSON; // Bounding box on screen elements: ElementJSON[]; // Words/elements in the line}ElementJSON
A word or element within a line.
interface ElementJSON { text: string; // Text content (usually a word) angle: number; // Rotation angle confidence: number; // Recognition confidence (0-1) recognizedLanguage: string; // Detected language boundingBox?: RectJSON; // Bounding box on screen symbols: SymbolJSON[]; // Individual characters}SymbolJSON
A single character.
interface SymbolJSON { text: string; // Single character angle: number; // Rotation angle confidence: number; // Recognition confidence (0-1) recognizedLanguage: string; // Detected language boundingBox?: RectJSON; // Bounding box on screen}RectJSON
Bounding box coordinates.
interface RectJSON { left: number; // Left edge top: number; // Top edge right: number; // Right edge bottom: number; // Bottom edge}Callback Types
Function types for event callbacks in agent.utils.
NotificationCallback
Callback for receiving system notifications.
type NotificationCallback = ( id: string, // Notification ID packageName: string, // Source app package channelId: string, // Notification channel extras: any // Notification data (title, text, etc.)) => void;NetworkCallback
Callback for network state changes.
type NetworkCallback = ( networkAvailable: boolean // true if network is available) => void;ToastCallback
Callback for receiving toast messages.
type ToastCallback = ( packageName: string, // Source app package data: { message: string } // Toast message) => void;Other Types
MultiTapSequenceItem
Item in a multi-tap sequence for agent.actions.multiTap().
interface MultiTapSequenceItem { x: number; // X coordinate to tap y: number; // Y coordinate to tap delay: number; // Delay in ms after this tap}Usage Examples
const info = agent.utils.files.getPathInfo("/sdcard/Download");
if (info.exists) { if (info.isDirectory) { // TypeScript knows this is DirectoryInfo console.log("Contains", info.totalItems, "items"); } else { // TypeScript knows this is FilePathInfo console.log("File size:", info.size); }} else { // TypeScript knows this is PathNotFoundInfo console.log("Path not found:", info.error);}const { screenshot } = await agent.actions.screenshot(1080, 1920, 90);const result = await agent.actions.recognizeText(screenshot);
// Access full textconsole.log("Full text:", result.text);
// Iterate through hierarchyfor (const block of result.textBlocks) { console.log("Block:", block.text);
for (const line of block.lines) { console.log(" Line:", line.text, "confidence:", line.confidence);
// Get bounding box for the line if (line.boundingBox) { const { left, top, right, bottom } = line.boundingBox; console.log(" Position:", left, top, "to", right, bottom); } }}