Skip to main content
Desktop automation session, desktop namespace entrypoint, and desktop types. Entrypoint source: sdk/src/desktop.ts
import { ... } from '@bctrl/sdk/desktop';

Export Index

ExportKindSourceNotes
Boundstypepackages/schemas/src/results/desktop.tsRe-exported from non-SDK source
BrowserLaunchResulttypepackages/schemas/src/results/desktop.tsRe-exported from non-SDK source
CuaActiontypepackages/schemas/src/results/cua.tsRe-exported from non-SDK source
CuaAgentConfigtypepackages/schemas/src/rpc/cua.tsRe-exported from non-SDK source
CuaPredictClickResulttypepackages/schemas/src/results/cua.tsRe-exported from non-SDK source
CuaRunOptionstypepackages/schemas/src/rpc/cua.tsRe-exported from non-SDK source
CuaRunResulttypepackages/schemas/src/results/cua.tsRe-exported from non-SDK source
desktopvariablesdk/src/drivers/desktop/index.ts-
DesktopClipboardclasssdk/src/drivers/desktop/session.tsClipboard operations for desktop automation.
DesktopConnectOptionsinterfacesdk/src/drivers/desktop/index.ts-
DesktopCuaclasssdk/src/drivers/desktop/session.tsCUA (Computer Use Agent) - AI-powered desktop automation. Similar to Stagehand for browser automation, CUA provides: - run(): Execute multi-step tasks with AI guidance - predictClick(): Find elements using vision
DesktopKeyboardclasssdk/src/drivers/desktop/session.tsKeyboard control for desktop automation. Provides typing, key presses, and hotkey combinations.
DesktopMouseclasssdk/src/drivers/desktop/session.tsMouse control for desktop automation. Provides move, click, drag, and scroll operations.
DesktopScreenclasssdk/src/drivers/desktop/session.tsScreen control for desktop automation. Provides capture and display information.
DesktopSessionclasssdk/src/drivers/desktop/session.ts-
DesktopWindowclasssdk/src/drivers/desktop/session.tsWindow management for desktop automation. Provides listing, focusing, and resizing windows.
Pointtypepackages/schemas/src/results/desktop.tsRe-exported from non-SDK source
Sizetypepackages/schemas/src/results/desktop.tsRe-exported from non-SDK source
WindowInfotypepackages/schemas/src/results/desktop.tsRe-exported from non-SDK source

Classes

DesktopClipboard

Source: sdk/src/drivers/desktop/session.ts
class DesktopClipboard
Clipboard operations for desktop automation.

Constructor

new (session: DesktopSession)

Methods

read
Read text from the clipboard.
read(): Promise<string>
write
Write text to the clipboard.
write(text: string): Promise<void>

DesktopCua

Source: sdk/src/drivers/desktop/session.ts
class DesktopCua
CUA (Computer Use Agent) - AI-powered desktop automation. Similar to Stagehand for browser automation, CUA provides:
  • run(): Execute multi-step tasks with AI guidance
  • predictClick(): Find elements using vision

Constructor

new (session: DesktopSession)

Methods

close
Close the CUA agent and clean up resources.
close(): Promise<void>
init
Initialize the CUA agent. Must be called before using run() or predictClick().
init(config?: CuaAgentConfig): Promise<{ success: boolean; model: string }>
predictClick
Predict where to click to accomplish a task. Uses vision model to find elements on screen. Returns coordinates that can be used with mouse.move() and mouse.click().
predictClick(instruction: string): Promise<CuaPredictClickResult>
run
Run a computer-use task with AI guidance. Like Stagehand’s act() but for desktop automation. The AI will analyze the screen and execute steps to complete the task.
run(instruction: string, options?: CuaRunOptions): Promise<CuaRunResult>

DesktopKeyboard

Source: sdk/src/drivers/desktop/session.ts
class DesktopKeyboard
Keyboard control for desktop automation. Provides typing, key presses, and hotkey combinations.

Constructor

new (session: DesktopSession)

Methods

down
Hold down a key.
down(key: string): Promise<void>
hotkey
Press a hotkey combination.
hotkey(...keys: string[]): Promise<void>
press
Press a single key.
press(key: string): Promise<void>
type
Type a string of text.
type(text: string): Promise<void>
up
Release a held key.
up(key: string): Promise<void>

DesktopMouse

Source: sdk/src/drivers/desktop/session.ts
class DesktopMouse
Mouse control for desktop automation. Provides move, click, drag, and scroll operations.

Constructor

new (session: DesktopSession)

Methods

click
Click at the current mouse position.
click(button?: 'left' | 'right' | 'middle'): Promise<void>
doubleClick
Double-click at the current mouse position.
doubleClick(): Promise<void>
drag
Drag from one position to another.
drag(fromX: number, fromY: number, toX: number, toY: number): Promise<void>
move
Move the mouse to the specified coordinates.
move(x: number, y: number): Promise<void>
position
Get the current mouse position.
position(): Promise<Point>
scroll
Scroll at the current mouse position. Positive values scroll down/right, negative scroll up/left.
scroll(deltaX: number, deltaY: number): Promise<void>

DesktopScreen

Source: sdk/src/drivers/desktop/session.ts
class DesktopScreen
Screen control for desktop automation. Provides capture and display information.

Constructor

new (session: DesktopSession)

Methods

capture
Capture the screen or a region.
capture(region?: { x: number; y: number; width: number; height: number }): Promise<Buffer>
size
Get the primary screen size.
size(): Promise<Size>

DesktopSession

Source: sdk/src/drivers/desktop/session.ts
class DesktopSession

Constructor

new (sessionId: string, hostId: string, baseUrl: string, options?: { apiKey?: string })

Properties

NameTypeNotes
baseUrlstringreadonly
clipboardDesktopClipboardgetter • Clipboard read/write
cuaDesktopCuagetter • CUA (Computer Use Agent) - AI-powered desktop automation. Similar to Stagehand for browser automation.
hostIdstringreadonly
idstringreadonly
keyboardDesktopKeyboardgetter • Keyboard control (type, press, hotkey)
mouseDesktopMousegetter • Mouse control (move, click, drag, scroll)
screenDesktopScreengetter • Screen capture and display info
windowDesktopWindowgetter • Window management (list, focus, resize)

Methods

close
Close the desktop session and clean up resources.
close(): Promise<void>
closeBrowser
Close a launched browser.
closeBrowser(): Promise<void>
isBrowserRunning
Check if a browser is running.
isBrowserRunning(): Promise<boolean>
launchBrowser
Launch a browser that can be controlled via Playwright-style API. The browser runs on the desktop agent’s machine.
launchBrowser(options?: {
    executablePath?: string;
    headless?: boolean;
    userDataDir?: string;
    args?: string[];
  }): Promise<BrowserLaunchResult>
rpc
Send an RPC call to the desktop agent.
rpc<T>(method: string, args: unknown[], target?: 'desktop' | 'cua'): Promise<T>

DesktopWindow

Source: sdk/src/drivers/desktop/session.ts
class DesktopWindow
Window management for desktop automation. Provides listing, focusing, and resizing windows.

Constructor

new (session: DesktopSession)

Methods

active
Get the currently active (focused) window.
active(): Promise<WindowInfo | null>
bounds
Get window bounds.
bounds(handle: number): Promise<Bounds>
close
Close a window.
close(handle: number): Promise<void>
focus
Focus a window by handle.
focus(handle: number): Promise<void>
list
List all visible windows.
list(): Promise<WindowInfo[]>
maximize
Maximize a window.
maximize(handle: number): Promise<void>
minimize
Minimize a window.
minimize(handle: number): Promise<void>
restore
Restore a minimized/maximized window.
restore(handle: number): Promise<void>
setBounds
Set window bounds.
setBounds(handle: number, bounds: Partial<Bounds>): Promise<void>

Variables

desktop

Source: sdk/src/drivers/desktop/index.ts
const desktop: { connect(options: DesktopConnectOptions): Promise<DesktopSession>; }

Interfaces

DesktopConnectOptions

Source: sdk/src/drivers/desktop/index.ts
export interface DesktopConnectOptions {
  /** API key for authentication */
  apiKey: string;
  /**
   * Target environment.
   * Defaults to `production` (`https://api.bctrl.ai`).
   * Use `development` for a local control plane on `http://localhost:3000`.
   */
  environment?: BctrlEnvironment;
  /**
   * Control plane origin or API base URL.
   * If you pass an origin, the SDK appends `/v1` automatically.
   */
  baseUrl?: string;
}

External Re-exports

ExportKindSourceNotes
Boundstypepackages/schemas/src/results/desktop.tsRe-exported from non-SDK source
BrowserLaunchResulttypepackages/schemas/src/results/desktop.tsRe-exported from non-SDK source
CuaActiontypepackages/schemas/src/results/cua.tsRe-exported from non-SDK source
CuaAgentConfigtypepackages/schemas/src/rpc/cua.tsRe-exported from non-SDK source
CuaPredictClickResulttypepackages/schemas/src/results/cua.tsRe-exported from non-SDK source
CuaRunOptionstypepackages/schemas/src/rpc/cua.tsRe-exported from non-SDK source
CuaRunResulttypepackages/schemas/src/results/cua.tsRe-exported from non-SDK source
Pointtypepackages/schemas/src/results/desktop.tsRe-exported from non-SDK source
Sizetypepackages/schemas/src/results/desktop.tsRe-exported from non-SDK source
WindowInfotypepackages/schemas/src/results/desktop.tsRe-exported from non-SDK source