Skip to main content

Module act

Module act 

Source
Expand description

computer_act — semantic actions AND keyboard as one pipeline on the accessibility tree (no screen coordinates involved).

One step is EITHER a semantic action on the element matched by selector (auto-waiting for visible + enabled), OR a keyboard action (key/text via the SHARED keyboard engine), OR a wait pause — and steps chain via then with shell && semantics, each only if the previous succeeded, the first failure aborting the chain with the exact failing step and everything that completed.

This file is ONLY the pipeline: chain walking, wait steps and step classification. The step KINDS live in their components — semantic dispatch in super::touch, keyboard dispatch in super::keyboard — so each can be reused by other tools without carrying this pipeline along.

The schema skeleton (then → then → wait) is IDENTICAL to computer_control’s on purpose: the model learns the pipeline shape once and carries it across both tools — only each tool’s particular step kind differs (semantic actions here, pointer actions there).

FOCUS CAVEAT: a semantic press focuses the target on many toolkits but NOT reliably on every one — the one mechanism that always moves OS keyboard focus is a real click, which is computer_control’s job. If chained typing keeps missing the field, click the field element there instead.

Cancellation caveat: the blocking actions run on tokio’s blocking pool and CANNOT be interrupted by dropping the future. If the caller aborts an act that is still auto-waiting, the underlying spawn_blocking task keeps running and the action may still fire once the element appears. Callers that need hard cancellation must gate the tool call itself (the harness-level authorization), not rely on future drops.

Constants§

ACT_CHAIN_MAX_DEPTH
Maximum number of steps in a then pipeline (the root step included) — the same cap computer_control uses, so the two pipelines behave alike.

Functions§

act
Run a semantic pipeline on an accessibility-tree element: actions, keyboard steps and waits chained via then, executed sequentially in ONE call with && semantics.