Skip to main content

Module wait

Module wait 

Source
Expand description

computer_wait — block until an element reaches a state, or time out with a diagnosis.

This is a standalone OBSERVATION tool (like [super::apps] and [super::snapshot]): it sends no input and moves nothing, so it is allowed in every mode including Ask. It replaces poll-loops (snapshot → check → snapshot …, each a full round trip) with one blocking call: wait until a selector reaches a state, or fail with the condition AND the last observed state so the model can decide the next move without another probe.

Every xa11y call is blocking (platform accessibility APIs are synchronous), so it runs on tokio’s blocking pool like every other tool in this module.

Constants§

DEFAULT_WAIT_MS
Default wait before giving up: long enough for dialogs to open and spinners to finish, short enough that a stuck call wastes one round trip, not a minute.
MAX_WAIT_MS
Hard cap on a single wait: a stuck condition must not pin the agent loop (or the blocking pool) for minutes. Chain calls for longer waits.

Functions§

validate
Input validation for computer_wait: an element target (selector + exactly one app scope), a 1-based nth, and a timeout within the cap.
wait
Run computer_wait on tokio’s blocking pool.