GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • ADK for TypeScript: API Reference

This view

  • Original page
  • New address

GeezerVison is showing adk.dev — BaseComputer | ADK for TypeScript: API Reference - v2.5.0

  • BaseComputer

Class BaseComputerAbstract

Defines an interface for computer environments.

This abstract base class defines the standard interface for controlling computer environments, including web browsers and other interactive systems. Coordinates passed to the action methods are absolute pixel values, scaled to the width and height returned by screenSize.

The optional methods (doubleClick, tripleClick, middleClick, rightClick, mouseDown, mouseUp, keyDown and keyUp) are exposed to the model only when a subclass implements them.

The Gemini 3.x actions click, move, type, scroll, take_screenshot, press_key and hotkey are always exposed. Each one calls the subclass method of the same name (click, move, type, scroll, takeScreenshot, pressKey, hotkey) when it is defined, and otherwise calls the matching predefined method.

  • Defined in core/src/tools/computer_use/base_computer.ts:86

Constructors

constructor

  • new BaseComputer(): BaseComputer

    Returns BaseComputer

    • Defined in core/src/tools/computer_use/base_computer.ts:90

Properties

Readonly[BASE_COMPUTER_SIGNATURE_SYMBOL]

"[BASE_COMPUTER_SIGNATURE_SYMBOL]": true

A unique symbol to identify ADK base computer class.

  • Defined in core/src/tools/computer_use/base_computer.ts:88

Methods

Optionalclick

  • click?(x: number, y: number, button?: string): Promise<ComputerState>

    Clicks at a specific x, y coordinate with the given mouse button.

    When defined, the click action calls this instead of clickAt and passes the model's button.

    Parameters

    • x: number
    • y: number
    • Optionalbutton: string

    Returns Promise<ComputerState>

    • Defined in core/src/tools/computer_use/base_computer.ts:320

AbstractclickAt

  • clickAt(x: number, y: number): Promise<ComputerState>

    Clicks at a specific x, y coordinate on the webpage.

    Parameters

    • x: number

      The x-coordinate to click at.

    • y: number

      The y-coordinate to click at.

    Returns Promise<ComputerState>

    The current state after clicking.

    • Defined in core/src/tools/computer_use/base_computer.ts:134

close

  • close(): Promise<void>

    Cleans up the resources of the computer.

    Returns Promise<void>

    • Defined in core/src/tools/computer_use/base_computer.ts:98

AbstractcurrentState

  • currentState(): Promise<ComputerState>

    Returns the current state of the current webpage.

    Returns Promise<ComputerState>

    The current environment state.

    • Defined in core/src/tools/computer_use/base_computer.ts:288

OptionaldoubleClick

  • doubleClick?(x: number, y: number, button?: string): Promise<ComputerState>

    Double-clicks at a specific x, y coordinate.

    Parameters

    • x: number
    • y: number
    • Optionalbutton: string

    Returns Promise<ComputerState>

    • Defined in core/src/tools/computer_use/base_computer.ts:291

AbstractdragAndDrop

  • dragAndDrop(
        x: number,
        y: number,
        destinationX: number,
        destinationY: number,
    ): Promise<ComputerState>

    Drags an element from an x, y coordinate and drops it at a destination coordinate.

    Parameters

    • x: number

      The x-coordinate to start dragging from.

    • y: number

      The y-coordinate to start dragging from.

    • destinationX: number

      The x-coordinate to drop at.

    • destinationY: number

      The y-coordinate to drop at.

    Returns Promise<ComputerState>

    The current state after drag and drop.

    • Defined in core/src/tools/computer_use/base_computer.ts:276

Abstractenvironment

  • environment(): Promise<ComputerEnvironment>

    Returns the environment of the computer.

    Returns Promise<ComputerEnvironment>

    • Defined in core/src/tools/computer_use/base_computer.ts:118

AbstractgoBack

  • goBack(): Promise<ComputerState>

    Navigates back to the previous webpage in the browser history.

    Returns Promise<ComputerState>

    The current state after navigating back.

    • Defined in core/src/tools/computer_use/base_computer.ts:230

AbstractgoForward

  • goForward(): Promise<ComputerState>

    Navigates forward to the next webpage in the browser history.

    Returns Promise<ComputerState>

    The current state after navigating forward.

    • Defined in core/src/tools/computer_use/base_computer.ts:237

Optionalhotkey

  • hotkey?(keys: string[]): Promise<ComputerState>

    Presses a combination of keyboard keys simultaneously.

    When defined, the hotkey action calls this instead of keyCombination.

    Parameters

    • keys: string[]

    Returns Promise<ComputerState>

    • Defined in core/src/tools/computer_use/base_computer.ts:372

AbstracthoverAt

  • hoverAt(x: number, y: number): Promise<ComputerState>

    Hovers at a specific x, y coordinate on the webpage.

    May be used to explore sub-menus that appear on hover.

    Parameters

    • x: number

      The x-coordinate to hover at.

    • y: number

      The y-coordinate to hover at.

    Returns Promise<ComputerState>

    The current state after hovering.

    • Defined in core/src/tools/computer_use/base_computer.ts:145

initialize

  • initialize(): Promise<void>

    Initializes the computer.

    Returns Promise<void>

    • Defined in core/src/tools/computer_use/base_computer.ts:95

AbstractkeyCombination

  • keyCombination(keys: string[]): Promise<ComputerState>

    Presses keyboard keys and combinations, such as "control+c" or "enter".

    Parameters

    • keys: string[]

      The keys to press in combination.

    Returns Promise<ComputerState>

    The current state after the key press.

    • Defined in core/src/tools/computer_use/base_computer.ts:264

OptionalkeyDown

  • keyDown?(key: string): Promise<ComputerState>

    Presses a keyboard key down and holds it.

    Parameters

    • key: string

    Returns Promise<ComputerState>

    • Defined in core/src/tools/computer_use/base_computer.ts:309

OptionalkeyUp

  • keyUp?(key: string): Promise<ComputerState>

    Releases a keyboard key.

    Parameters

    • key: string

    Returns Promise<ComputerState>

    • Defined in core/src/tools/computer_use/base_computer.ts:312

OptionalmiddleClick

  • middleClick?(x: number, y: number, button?: string): Promise<ComputerState>

    Clicks the middle mouse button at a specific x, y coordinate.

    Parameters

    • x: number
    • y: number
    • Optionalbutton: string

    Returns Promise<ComputerState>

    • Defined in core/src/tools/computer_use/base_computer.ts:297

OptionalmouseDown

  • mouseDown?(x: number, y: number, button?: string): Promise<ComputerState>

    Presses a mouse button down at a specific x, y coordinate.

    Parameters

    • x: number
    • y: number
    • Optionalbutton: string

    Returns Promise<ComputerState>

    • Defined in core/src/tools/computer_use/base_computer.ts:303

OptionalmouseUp

  • mouseUp?(x: number, y: number, button?: string): Promise<ComputerState>

    Releases a mouse button at a specific x, y coordinate.

    Parameters

    • x: number
    • y: number
    • Optionalbutton: string

    Returns Promise<ComputerState>

    • Defined in core/src/tools/computer_use/base_computer.ts:306

Optionalmove

  • move?(x: number, y: number): Promise<ComputerState>

    Moves the cursor to a specific x, y coordinate.

    When defined, the move action calls this instead of hoverAt.

    Parameters

    • x: number
    • y: number

    Returns Promise<ComputerState>

    • Defined in core/src/tools/computer_use/base_computer.ts:327

Abstractnavigate

  • navigate(url: string): Promise<ComputerState>

    Navigates directly to a specified URL.

    Parameters

    • url: string

      The URL to navigate to.

    Returns Promise<ComputerState>

    The current state after navigation.

    • Defined in core/src/tools/computer_use/base_computer.ts:256

AbstractopenWebBrowser

  • openWebBrowser(): Promise<ComputerState>

    Opens the web browser.

    Returns Promise<ComputerState>

    The current state after opening the browser.

    • Defined in core/src/tools/computer_use/base_computer.ts:125

prepare

  • prepare(_toolContext: Context): Promise<void>

    Called before each tool invocation to prepare resources.

    Override this to set up session-level resources (a sandbox, tokens, and so on), using the state of toolContext for persistence across invocations.

    Parameters

    • _toolContext: Context

      The tool context with session state access.

    Returns Promise<void>

    • Defined in core/src/tools/computer_use/base_computer.ts:108

OptionalpressKey

  • pressKey?(key: string): Promise<ComputerState>

    Presses a single keyboard key.

    When defined, the press_key action calls this instead of keyCombination.

    Parameters

    • key: string

    Returns Promise<ComputerState>

    • Defined in core/src/tools/computer_use/base_computer.ts:364

OptionalrightClick

  • rightClick?(x: number, y: number, button?: string): Promise<ComputerState>

    Clicks the right mouse button at a specific x, y coordinate.

    Parameters

    • x: number
    • y: number
    • Optionalbutton: string

    Returns Promise<ComputerState>

    • Defined in core/src/tools/computer_use/base_computer.ts:300

AbstractscreenSize

  • screenSize(): Promise<[number, number]>

    Returns the screen size of the environment.

    Returns Promise<[number, number]>

    A tuple of (width, height) in pixels.

    • Defined in core/src/tools/computer_use/base_computer.ts:115

Optionalscroll

  • scroll?(
        x: number,
        y: number,
        direction: ScrollDirection,
        magnitudeInPixels?: number,
    ): Promise<ComputerState>

    Scrolls at a specific x, y coordinate by a number of pixels.

    When defined, the scroll action calls this instead of scrollAt. magnitudeInPixels is undefined when the model does not say.

    Parameters

    • x: number
    • y: number
    • direction: ScrollDirection
    • OptionalmagnitudeInPixels: number

    Returns Promise<ComputerState>

    • Defined in core/src/tools/computer_use/base_computer.ts:343

AbstractscrollAt

  • scrollAt(
        x: number,
        y: number,
        direction: ScrollDirection,
        magnitude: number,
    ): Promise<ComputerState>

    Scrolls up, down, right, or left at an x, y coordinate by magnitude.

    Parameters

    • x: number

      The x-coordinate to scroll at.

    • y: number

      The y-coordinate to scroll at.

    • direction: ScrollDirection

      The direction to scroll.

    • magnitude: number

      The amount to scroll.

    Returns Promise<ComputerState>

    The current state after scrolling.

    • Defined in core/src/tools/computer_use/base_computer.ts:210

AbstractscrollDocument

  • scrollDocument(direction: ScrollDirection): Promise<ComputerState>

    Scrolls the entire webpage up, down, left or right.

    Parameters

    • direction: ScrollDirection

      The direction to scroll.

    Returns Promise<ComputerState>

    The current state after scrolling.

    • Defined in core/src/tools/computer_use/base_computer.ts:199

Abstractsearch

  • search(): Promise<ComputerState>

    Directly jumps to a search engine home page.

    Used when you need to start with a search, for example because the current website doesn't have the information needed or a new task is being started.

    Returns Promise<ComputerState>

    The current state after navigating to search.

    • Defined in core/src/tools/computer_use/base_computer.ts:248

OptionaltakeScreenshot

  • takeScreenshot?(): Promise<ComputerState>

    Takes a screenshot of the current state.

    When defined, the take_screenshot action calls this instead of currentState.

    Returns Promise<ComputerState>

    • Defined in core/src/tools/computer_use/base_computer.ts:356

OptionaltripleClick

  • tripleClick?(x: number, y: number, button?: string): Promise<ComputerState>

    Triple-clicks at a specific x, y coordinate.

    Parameters

    • x: number
    • y: number
    • Optionalbutton: string

    Returns Promise<ComputerState>

    • Defined in core/src/tools/computer_use/base_computer.ts:294

Optionaltype

  • type?(text: string, pressEnter?: boolean): Promise<ComputerState>

    Types text into the currently focused element.

    When defined, the type action calls this instead of typeText. pressEnter is undefined when the model does not say.

    Parameters

    • text: string
    • OptionalpressEnter: boolean

    Returns Promise<ComputerState>

    • Defined in core/src/tools/computer_use/base_computer.ts:335

typeText

  • typeText(text: string, pressEnter?: boolean): Promise<ComputerState>

    Types text into the currently focused element.

    By default, this calls keyCombination once per character in text (and once for "Enter" when pressEnter is true). Because keyCombination is designed for key names and typically captures a new screenshot on every call, this fallback costs one round trip and screenshot per character, and relies on the backend accepting single characters in keyCombination. Subclasses should override this method to use native bulk text input.

    Parameters

    • text: string

      The text to type.

    • pressEnter: boolean = false

      Whether to press ENTER after typing.

    Returns Promise<ComputerState>

    The current state after typing.

    • Defined in core/src/tools/computer_use/base_computer.ts:182

AbstracttypeTextAt

  • typeTextAt(
        x: number,
        y: number,
        text: string,
        pressEnter?: boolean,
        clearBeforeTyping?: boolean,
    ): Promise<ComputerState>

    Types text at a specific x, y coordinate.

    Parameters

    • x: number

      The x-coordinate to type at.

    • y: number

      The y-coordinate to type at.

    • text: string

      The text to type.

    • OptionalpressEnter: boolean

      Whether to press ENTER after typing. The toolset passes true when the model does not say.

    • OptionalclearBeforeTyping: boolean

      Whether to clear existing content before typing. The toolset passes true when the model does not say.

    Returns Promise<ComputerState>

    The current state after typing.

    • Defined in core/src/tools/computer_use/base_computer.ts:159

Abstractwait

  • wait(seconds: number): Promise<ComputerState>

    Waits for n seconds to allow unfinished webpage processes to complete.

    Parameters

    • seconds: number

      The number of seconds to wait.

    Returns Promise<ComputerState>

    The current state after waiting.

    • Defined in core/src/tools/computer_use/base_computer.ts:223
Constructors
constructor
Properties
[BASE_COMPUTER_SIGNATURE_SYMBOL]
Methods
clickclickAtclosecurrentStatedoubleClickdragAndDropenvironmentgoBackgoForwardhotkeyhoverAtinitializekeyCombinationkeyDownkeyUpmiddleClickmouseDownmouseUpmovenavigateopenWebBrowserpreparepressKeyrightClickscreenSizescrollscrollAtscrollDocumentsearchtakeScreenshottripleClicktypetypeTexttypeTextAtwait
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.