UNPKG

smooth-operator-agent-tools

Version:

Node.js client library for Smooth Operator Agent Tools - a toolkit for programmers developing Computer Use Agents on Windows systems

88 lines (87 loc) 3.14 kB
import { ActionResponse, ChromeScriptResponse, ChromeTabDetails, SimpleResponse } from '../models/models'; import { SmoothOperatorClient } from '../smooth-operator-client'; /** * API endpoints for Chrome browser operations */ export declare class ChromeApi { private client; /** * Creates a new instance of the ChromeApi * @param client The SmoothOperatorClient instance */ constructor(client: SmoothOperatorClient); /** * Opens Chrome browser (Playwright-managed instance) * @param url Optional URL to navigate to immediately * @param strategy Optional strategy for opening Chrome * @returns SimpleResponse indicating success or failure */ openChrome(url?: string, strategy?: string): Promise<SimpleResponse>; /** * Gets detailed analysis of current Chrome tab including interactive elements * @returns ChromeTabDetails with CSS selectors for key elements */ explainCurrentTab(): Promise<ChromeTabDetails>; /** * Navigate to a URL in the current Chrome tab * @param url URL to navigate to * @returns Action response */ navigate(url: string): Promise<ActionResponse>; /** * Reload the current Chrome tab * @returns Action response */ reload(): Promise<ActionResponse>; /** * Open a new Chrome tab * @param url Optional URL to navigate to * @returns Action response */ newTab(url?: string): Promise<ActionResponse>; /** * Clicks element in Chrome tab using CSS selector * @param selector CSS selector from explainCurrentTab * @returns Action response with success status */ clickElement(selector: string): Promise<ActionResponse>; /** * Navigate back in the current Chrome tab * @returns Action response */ goBack(): Promise<ActionResponse>; /** * Simulate input in an element in the current Chrome tab * @param selector CSS selector of the element to input text into * @param text Text to input * @returns Action response */ simulateInput(selector: string, text: string): Promise<ActionResponse>; /** * Get the DOM of the current Chrome tab * @returns Action response with DOM content */ getDom(): Promise<ActionResponse>; /** * Get the text content of the current Chrome tab * @returns Action response with text content */ getText(): Promise<ActionResponse>; /** * Executes JavaScript in Chrome tab and returns result * @param script JavaScript code to run * @returns ChromeScriptResponse with execution result */ executeScript(script: string): Promise<ChromeScriptResponse>; /** * Generate and execute JavaScript based on a description * @param taskDescription Description of what the JavaScript should do * @returns ChromeScriptResponse with execution result */ generateAndExecuteScript(taskDescription: string): Promise<ChromeScriptResponse>; /** * Returns a string representation of the ChromeApi class. * @returns The string "ChromeApi". */ toString(): string; }