captchaforge 0.2.13

Automatic CAPTCHA detection and multi-strategy solving for chromiumoxide-driven headless browsers (Cloudflare Turnstile, reCAPTCHA v2/v3, hCaptcha, image grids, audio, sliders).
Documentation
/// CAPTCHA solving pipeline — layered short-circuit + multi-strategy chain.
///
/// Pre-chain layers:
///   0. Token cache — per-(domain, captcha_type) solved-token cache
///      with TTL and cookie replay on hit. Skip the rest of the chain
///      when fresh.
///
/// Strategies in default order:
///   1. Behavioral — realistic mouse + timing for Turnstile / reCAPTCHA
///      v3 / TOML-rule vendors recommending BehavioralBypass.
///   2. VLM — screenshot → Ollama qwen3-vl:30b → solve grid / text /
///      click CAPTCHAs.
///   3. Audio — click audio challenge → speech-to-text → type answer.
///   4. ThirdParty — 2captcha-compatible service (2captcha / CapMonster /
///      CapSolver). Inert without an API key.
///   5. Human — unsolved + screenshot for human-in-the-loop fallback.
///
/// Pattern store (bounded-α EMA) re-orders eligible solvers per
/// domain so the historically-best method runs first; vendor migrations
/// register within ~10 fresh samples instead of being averaged out by
/// historical wins.
//
// Shared dependencies re-exported at crate-internal visibility so that child
// modules can pick them up via `use super::*;` without duplicating imports.
pub(crate) use anyhow::{anyhow, Result};
pub(crate) use async_trait::async_trait;
pub(crate) use chromiumoxide::Page;
pub(crate) use serde::{Deserialize, Serialize};
pub(crate) use std::time::{Duration, Instant};

pub(crate) use crate::captcha_detect::CaptchaInfo;

pub(crate) mod audio;
pub(crate) mod behavioral;
pub(crate) mod util;
pub(crate) mod vlm;

mod cache;
mod chain;
pub mod akamai_interstitial;
mod cloudflare_interstitial;
mod math_captcha;
pub mod oracle;
mod pattern;
pub mod token_oracle;
mod pow;
mod race;
mod slider;
mod third_party;
mod turnstile_interactive;
mod types;
mod wait_for_token;

// ─── Curated public API ──────────────────────────────────────────────────────

pub use self::types::{CaptchaSolveResult, CaptchaSolver, CaptchaType, SolveConfig, SolveMethod};

pub use self::audio::AudioCaptchaSolver;
pub use self::behavioral::BehavioralCaptchaSolver;
pub use self::cache::{CacheStats, CachedToken, TokenCache};
pub use self::chain::{CaptchaSolverChain, ChainConfig};
pub use self::akamai_interstitial::{
    classify_abck, AbckValidity, AkamaiInterstitialSolver,
};
pub use self::cloudflare_interstitial::CloudflareInterstitialSolver;
pub use self::math_captcha::MathCaptchaSolver;
pub use self::oracle::{classify, take_snapshot, OutcomeClassification, PageSnapshot};
pub use self::pattern::{CaptchaPattern, PatternStore};
pub use self::pow::PowCaptchaSolver;
pub use self::race::RacingSolver;
pub use self::slider::{SliderCaptchaSolver, SliderSelectors};
pub use self::third_party::{ThirdPartyCaptchaSolver, ThirdPartyService};
pub use self::turnstile_interactive::{
    TurnstileInteractiveSolver, CHECKBOX_OFFSET_X, CHECKBOX_OFFSET_Y, TURNSTILE_IFRAME_SELECTOR,
};
pub use self::token_oracle::{
    classify_response as classify_token_response, TokenEncoding, TokenValidator, ValidationVerdict,
    ValidatorMethod,
};
pub use self::vlm::VlmCaptchaSolver;
pub use self::wait_for_token::WaitForTokenSolver;

// Internal re-export so submodules can access screenshot_b64 via `super::screenshot_b64`.
pub(crate) use self::util::screenshot_b64;