decideBrowserAction (src/browser-action-router.ts)

airi · services/computer-use-mcp/src/browser-action-router.ts · typescript · MIT
ai

Router deciding whether to use browser-dom or OS input for desktop actions.

// Source: https://github.com/moeru-ai/airi | License: MIT | Copyright 2024-PRESENT Neko Ayaka
// Provided via justclaw.it.com; keep this notice with the code.
/**
 * Browser action router — decides whether a desktop action should go through
 * the browser-dom bridge (DOM-level precision) or OS-level input.
 *
 * Routing rules are fixed, not heuristic:
 * - chrome_dom candidate with selector + bridge available → browser_dom
 * - Everything else → os_input
 * - Bridge unavailable → os_input (graceful fallback)
 *
 * Covers: click, type/setInputValue, checkCheckbox, selectOption.
 */

import type { DesktopTargetCandidate } from './desktop-grounding-types'

export interface BrowserActionDecision {
  /** Which execution path to use */
  route: 'browser_dom' | 'os_input'
  /** Human-readable ex

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key