/** * Main H.AI Agent Platform SDK class * Provides the easiest interface for developers to interact with the platform */ import { AgentPlatformClient } from './client'; import { AgentTask } from './task'; import { SDKConfig, StartTrajectory, TaskQuery, AvailableAgent, SubmitFeedback, FeedbackResponse, Page, FormFillData, DataExtractionData, WebSearchData, ShoppingData, UserInput, JWTTokens } from './types'; export declare class WebAgent { private client; constructor(config: SDKConfig); /** * Create WebAgent with authentication * This method checks for existing valid tokens and triggers authCallback if authentication is needed * * @param options Configuration for authentication * @returns Promise that resolves to WebAgent instance with login() method for triggering authentication * * @example * // Check auth on initialization and show login button if needed * const agent = await WebAgent.init({ * authCallback: (login) => { * // Show login button * const loginBtn = document.getElementById('login-btn'); * loginBtn.style.display = 'block'; * loginBtn.onclick = login; * } * }); * * // Agent is ready to use if already authenticated * const task = await agent.run('Navigate to google.com'); */ static init(options?: { portalUrl?: string; portalApiUrl?: string; agentPlatformUrl?: string; authCallback?: (login: () => Promise) => void; onTokenRefresh?: (tokens: JWTTokens) => void; onAuthError?: (error: string) => void; debug?: boolean; }): Promise; /** * Create WebAgent instance with traditional API key * @param apiKey Static API key * @param options Configuration options */ static fromApiKey(apiKey: string, options?: { baseUrl?: string; debug?: boolean; }): WebAgent; /** * Execute a web automation task (most common use case) * @param objective What you want the agent to accomplish * @param options Optional configuration */ run(objective: string, options?: { startUrl?: string; agentIdentifier?: string; viewportWidth?: number; viewportHeight?: number; timeout?: number; isPublic?: boolean; autoStart?: boolean; stepByStep?: boolean; }): Promise; /** * Execute a web automation task in step-by-step mode (starts paused) * @param objective What you want the agent to accomplish * @param options Optional configuration */ runStepByStep(objective: string, options?: { startUrl?: string; agentIdentifier?: string; viewportWidth?: number; viewportHeight?: number; timeout?: number; isPublic?: boolean; }): Promise; /** * Simple web automation with automatic completion waiting * @param objective What you want the agent to accomplish * @param options Optional configuration */ runAndWait(objective: string, options?: { startUrl?: string; agentIdentifier?: string; timeout?: number; waitTimeout?: number; }): Promise; /** * Send user input to a trajectory (human-in-the-loop) * @param taskId The trajectory ID * @param input User input as string or UserInput object */ sendUserInput(taskId: string, input: string | UserInput): Promise; /** * Create a new task */ createTask(request: StartTrajectory): Promise; /** * Get an existing task by ID */ getTask(id: string, requiresAuth?: boolean): Promise; /** * List tasks with filtering and pagination */ listTasks(query?: TaskQuery): Promise>; /** * Get your unique objectives (for filtering) */ getObjectives(): Promise; /** * List all available agents */ listAgents(): Promise; /** * Get the best agent for a specific task type */ getBestAgent(taskType?: 'web' | 'general'): Promise; /** * Submit feedback about the platform */ submitFeedback(feedback: SubmitFeedback): Promise; /** * Test connection and API key */ healthCheck(): Promise; /** * Access the underlying client for advanced usage */ get rawClient(): AgentPlatformClient; /** * Update JWT tokens (for when tokens are refreshed externally) */ setJWTTokens(tokens: JWTTokens): void; /** * Get current JWT tokens */ getJWTTokens(): JWTTokens | undefined; /** * Manually trigger a token refresh (for testing) */ refreshTokens(): Promise; /** * Quick web search task */ searchWeb(data: WebSearchData | string, site?: string): Promise; /** * Quick e-commerce task */ shopFor(data: ShoppingData | string, site?: string): Promise; /** * Quick form filling task */ fillForm(data: FormFillData | string, url?: string): Promise; /** * Quick data extraction task */ extractData(data: DataExtractionData | string, description?: string): Promise; /** * Run multiple tasks in parallel */ runBatch(tasks: Array<{ objective: string; startUrl?: string; agentIdentifier?: string; }>): Promise; /** * Wait for all tasks to complete */ waitForAllComplete(tasks: AgentTask[], timeoutMs?: number): Promise; } //# sourceMappingURL=web-agent.d.ts.map