Implementation:A9T9 RPA searchImageInExtensionRouted
| Knowledge Sources | |
|---|---|
| Domains | Computer_Vision, Engine_Routing |
| Last Updated | 2026-10-22 00:00 GMT |
Overview
Concrete tool for routing image-search requests between the in-extension WASM engine and the native desktop CV engine, provided by the Ui.Vision vision2 router.
Description
The searchImageInExtensionRouted function (`src/services/vision2/router.ts`) is the routing layer that decides which computer-vision engine handles an image search request. For browser scope, it forwards to the WASM-based `searchImageInExtension`. For desktop scope, the `getNativeCVAPI` function (`src/services/desktop/index.ts`) provides access to the native desktop CV host via native messaging.
The routing decision is based on `cvScope` ('browser' vs 'desktop'). The desktop CV engine runs outside the browser via a native messaging host and handles screen-level template matching for desktop automation. Both engines return the same `ConvertResultItem[]` contract so the caller (`searchVision`) can consume results uniformly.
Usage
This router is called by `searchVision`. Use it directly when you need to route an image search without the full searchVision orchestration (screenshot capture, pattern loading).
Code Reference
Source Location
- Repository: A9T9/RPA
- File: src/services/vision2/router.ts (L11-L16); src/services/desktop/index.ts (L187, getNativeCVAPI)
Signature
export function searchImageInExtensionRouted(
req: SearchImageInExtensionRequest
): Promise<ConvertResultItem[]>
// Desktop native CV:
export function getNativeCVAPI(): NativeCVAPI
Import
import { searchImageInExtensionRouted } from '@/services/vision2/router'
import { getNativeCVAPI } from '@/services/desktop'
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| req | SearchImageInExtensionRequest | Yes | Search request with target/pattern images, area, scale |
| cvScope | string | Yes | 'browser' or 'desktop' — determines the engine |
Outputs
| Name | Type | Description |
|---|---|---|
| results | ConvertResultItem[] | Match results from the selected CV engine |
Usage Examples
Route a Browser-Scope Search
import { searchImageInExtensionRouted } from '@/services/vision2/router'
const results = await searchImageInExtensionRouted({
targetImageUrl: screenshotDataURI,
patternImageUrl: patternDataURI,
scaleDownRatio: 1.0,
patternScale: 1.0,
minSimilarity: 0.8,
allowSizeVariation: false,
pageOffset: { x: 0, y: 0 },
viewportOffset: { x: 0, y: 0 }
})