eoka 0.17.0

Stealth browser automation for Rust. Puppeteer/Playwright alternative with anti-bot bypass.
Documentation
//! Deadline-bounded actions with explicit, observable completion conditions.
pub(crate) mod call;
mod destination;
pub(crate) mod dispatch;
mod locator;
mod perform;
mod runner;
mod types;

pub use call::ActionCall;
pub(crate) use locator::{
    all_elements, call_on, first_element, first_visibility, is_visible, Visibility,
};
pub use locator::{ControlState, Locator};
pub use types::*;

use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::Arc;
use tokio::sync::{Mutex, OwnedMutexGuard};

#[derive(Default)]
pub(crate) struct ActionState {
    pub gate: Arc<Mutex<()>>,
    pub cleanup_failed: AtomicBool,
}

impl ActionState {
    /// Take the per-target input gate, refusing while an earlier cleanup failed.
    pub(crate) async fn admit(&self) -> crate::Result<OwnedMutexGuard<()>> {
        let gate = self.gate.clone().lock_owned().await;
        if self.cleanup_failed.load(Ordering::Acquire) {
            return Err(crate::Error::input_state(
                "Previous action input cleanup failed; release_all_inputs is required",
            ));
        }
        Ok(gate)
    }
}