/** * Cloud events system for browser-use TypeScript * * This module provides cloud integration events for: * - Agent task lifecycle management * - File uploads (GIFs, screenshots, etc.) * - Step tracking and analytics * - Session management * - Base64 file handling with size validation */ import { z } from 'zod'; /** * Base event schema with common fields */ export declare const BaseEventSchema: z.ZodObject<{ id: z.ZodDefault; user_id: z.ZodDefault; device_id: z.ZodDefault>; created_at: z.ZodDefault; }, "strip", z.ZodTypeAny, { id: string; created_at: Date; device_id: string | null; user_id: string; }, { id?: string | undefined; created_at?: Date | undefined; device_id?: string | null | undefined; user_id?: string | undefined; }>; export type BaseEvent = z.infer; /** * Update Agent Task Event - Updates existing task status */ export declare const UpdateAgentTaskEventSchema: z.ZodObject<{ id: z.ZodDefault; user_id: z.ZodDefault; device_id: z.ZodDefault>; created_at: z.ZodDefault; } & { task_id: z.ZodString; stopped: z.ZodOptional; paused: z.ZodOptional; done_output: z.ZodOptional; finished_at: z.ZodOptional; agent_state: z.ZodOptional>; user_feedback_type: z.ZodOptional; user_comment: z.ZodOptional; gif_url: z.ZodOptional; }, "strip", z.ZodTypeAny, { id: string; created_at: Date; device_id: string | null; user_id: string; task_id: string; paused?: boolean | undefined; stopped?: boolean | undefined; done_output?: string | undefined; finished_at?: Date | undefined; agent_state?: Record | undefined; user_feedback_type?: string | undefined; user_comment?: string | undefined; gif_url?: string | undefined; }, { task_id: string; id?: string | undefined; paused?: boolean | undefined; stopped?: boolean | undefined; created_at?: Date | undefined; device_id?: string | null | undefined; user_id?: string | undefined; done_output?: string | undefined; finished_at?: Date | undefined; agent_state?: Record | undefined; user_feedback_type?: string | undefined; user_comment?: string | undefined; gif_url?: string | undefined; }>; export type UpdateAgentTaskEvent = z.infer; /** * Create Agent Output File Event - For uploading files (GIFs, etc.) */ export declare const CreateAgentOutputFileEventSchema: z.ZodObject<{ id: z.ZodDefault; user_id: z.ZodDefault; device_id: z.ZodDefault>; created_at: z.ZodDefault; } & { task_id: z.ZodString; file_name: z.ZodString; file_content: z.ZodOptional; content_type: z.ZodOptional; }, "strip", z.ZodTypeAny, { id: string; created_at: Date; file_name: string; device_id: string | null; user_id: string; task_id: string; file_content?: string | undefined; content_type?: string | undefined; }, { file_name: string; task_id: string; id?: string | undefined; created_at?: Date | undefined; device_id?: string | null | undefined; user_id?: string | undefined; file_content?: string | undefined; content_type?: string | undefined; }>; export type CreateAgentOutputFileEvent = z.infer; /** * Validator for base64 file content size */ export declare function validateFileContentSize(content: string | undefined): string | undefined; /** * Create Agent Step Event - Tracks individual agent steps */ export declare const CreateAgentStepEventSchema: z.ZodObject<{ id: z.ZodDefault; user_id: z.ZodDefault; device_id: z.ZodDefault>; created_at: z.ZodDefault; } & { agent_task_id: z.ZodString; step: z.ZodNumber; evaluation_previous_goal: z.ZodString; memory: z.ZodString; next_goal: z.ZodString; actions: z.ZodArray, "many">; screenshot_url: z.ZodOptional; url: z.ZodDefault; }, "strip", z.ZodTypeAny, { url: string; id: string; evaluation_previous_goal: string; memory: string; next_goal: string; created_at: Date; step: number; device_id: string | null; user_id: string; agent_task_id: string; actions: Record[]; screenshot_url?: string | undefined; }, { evaluation_previous_goal: string; memory: string; next_goal: string; step: number; agent_task_id: string; actions: Record[]; url?: string | undefined; id?: string | undefined; created_at?: Date | undefined; device_id?: string | null | undefined; user_id?: string | undefined; screenshot_url?: string | undefined; }>; export type CreateAgentStepEvent = z.infer; /** * Validator for screenshot URL/base64 content size */ export declare function validateScreenshotSize(content: string | undefined): string | undefined; /** * Create Agent Task Event - Creates new task records */ export declare const CreateAgentTaskEventSchema: z.ZodObject<{ id: z.ZodDefault; user_id: z.ZodDefault; device_id: z.ZodDefault>; created_at: z.ZodDefault; } & { agent_session_id: z.ZodString; llm_model: z.ZodString; stopped: z.ZodDefault; paused: z.ZodDefault; task: z.ZodString; done_output: z.ZodOptional; scheduled_task_id: z.ZodOptional; started_at: z.ZodDefault; finished_at: z.ZodOptional; agent_state: z.ZodDefault>; user_feedback_type: z.ZodOptional; user_comment: z.ZodOptional; gif_url: z.ZodOptional; }, "strip", z.ZodTypeAny, { id: string; paused: boolean; stopped: boolean; created_at: Date; task: string; device_id: string | null; user_id: string; agent_state: Record; agent_session_id: string; llm_model: string; started_at: Date; done_output?: string | undefined; finished_at?: Date | undefined; user_feedback_type?: string | undefined; user_comment?: string | undefined; gif_url?: string | undefined; scheduled_task_id?: string | undefined; }, { task: string; agent_session_id: string; llm_model: string; id?: string | undefined; paused?: boolean | undefined; stopped?: boolean | undefined; created_at?: Date | undefined; device_id?: string | null | undefined; user_id?: string | undefined; done_output?: string | undefined; finished_at?: Date | undefined; agent_state?: Record | undefined; user_feedback_type?: string | undefined; user_comment?: string | undefined; gif_url?: string | undefined; scheduled_task_id?: string | undefined; started_at?: Date | undefined; }>; export type CreateAgentTaskEvent = z.infer; /** * Create Agent Session Event - Session management */ export declare const CreateAgentSessionEventSchema: z.ZodObject<{ id: z.ZodDefault; user_id: z.ZodDefault; device_id: z.ZodDefault>; created_at: z.ZodDefault; } & { browser_session_id: z.ZodString; browser_session_live_url: z.ZodString; browser_session_cdp_url: z.ZodString; browser_session_stopped: z.ZodDefault; browser_session_stopped_at: z.ZodOptional; is_source_api: z.ZodOptional; browser_state: z.ZodDefault>; browser_session_data: z.ZodOptional>; }, "strip", z.ZodTypeAny, { id: string; created_at: Date; device_id: string | null; user_id: string; browser_session_id: string; browser_session_live_url: string; browser_session_cdp_url: string; browser_session_stopped: boolean; browser_state: Record; browser_session_stopped_at?: Date | undefined; is_source_api?: boolean | undefined; browser_session_data?: Record | undefined; }, { browser_session_id: string; browser_session_live_url: string; browser_session_cdp_url: string; id?: string | undefined; created_at?: Date | undefined; device_id?: string | null | undefined; user_id?: string | undefined; browser_session_stopped?: boolean | undefined; browser_session_stopped_at?: Date | undefined; is_source_api?: boolean | undefined; browser_state?: Record | undefined; browser_session_data?: Record | undefined; }>; export type CreateAgentSessionEvent = z.infer; /** * Cloud Events Factory - Creates events from agent instances */ export declare class CloudEventsFactory { /** * Create UpdateAgentTaskEvent from agent instance */ static createUpdateAgentTaskEvent(agent: any, // Placeholder for Agent type taskId: string, updates: Partial>): UpdateAgentTaskEvent; /** * Create CreateAgentOutputFileEvent from file path */ static createAgentOutputFileEvent(agent: any, // Placeholder for Agent type taskId: string, filePath: string): Promise; /** * Create CreateAgentStepEvent from agent step data */ static createAgentStepEvent(agent: any, // Placeholder for Agent type modelOutput: any, actions: any[], browserStateSummary: any): CreateAgentStepEvent; /** * Create CreateAgentTaskEvent from agent instance */ static createAgentTaskEvent(agent: any, // Placeholder for Agent type task: string): CreateAgentTaskEvent; /** * Create CreateAgentSessionEvent from agent instance */ static createAgentSessionEvent(agent: any, // Placeholder for Agent type browserSession: any): CreateAgentSessionEvent; } /** * Cloud Events Manager - Handles event emission and processing */ export declare class CloudEventsManager { private events; private listeners; /** * Emit an event */ emit(eventType: string, event: BaseEvent): void; /** * Add event listener */ on(eventType: string, listener: Function): void; /** * Remove event listener */ off(eventType: string, listener: Function): void; /** * Get all events */ getEvents(): BaseEvent[]; /** * Clear all events */ clearEvents(): void; /** * Export events as JSON */ exportEvents(): string; } export declare const cloudEventsManager: CloudEventsManager; //# sourceMappingURL=cloudEvents.d.ts.map