Crate webpuppet

Crate webpuppet 

Source
Expand description

§webpuppet

Browser automation library for AI provider web interfaces.

This crate provides programmatic control of Chromium-based browsers to interact with AI chat providers through their web UIs. It handles authentication, session management, and response extraction for research and development workflows.

§Supported Browsers

Chromium-based (Full CDP automation): Brave, Chrome, Chromium, Edge, Opera, Vivaldi

Detection only: Firefox (Gecko), Safari (WebKit, macOS only)

Cross-platform: Linux, macOS, Windows (including Flatpak/Snap on Linux)

§Features

  • Multi-provider support: Claude, Grok, Gemini, ChatGPT, Perplexity, NotebookLM, Kaggle
  • Browser automation: CDP (Chrome DevTools Protocol) via chromiumoxide
  • Browser detection: Automatic detection with platform-specific paths
  • Session persistence: Secure credential and cookie storage with AES-256-GCM
  • Rate limiting: Configurable request throttling with humanized delays
  • Content security: Response screening for security threats
  • Permission controls: Domain allowlisting and operation restrictions

§Security Considerations

⚠️ IMPORTANT: This library automates third-party web interfaces. Users must comply with provider terms of service and applicable laws.

  • Credentials stored in OS keyring with AES-256-GCM encryption (never plaintext)
  • Browser profiles sandboxed per provider
  • Rate limiting prevents abuse detection
  • All automation is local (no external API calls)
  • Permission controls block unauthorized operations

§Example

use webpuppet::{WebPuppet, Provider, PromptRequest};

#[tokio::main]
async fn main() -> anyhow::Result<()> {
    let puppet = WebPuppet::new()
        .with_provider(Provider::Claude)
        .headless(true)
        .build()
        .await?;

    let response = puppet.prompt(PromptRequest {
        message: "Explain io_uring async I/O in Rust".into(),
        context: Some("Focus on memory safety".into()),
        ..Default::default()
    }).await?;

    println!("Response: {}", response.text);
    Ok(())
}

Re-exports§

pub use browser::BrowserDetector;
pub use browser::BrowserInstallation;
pub use browser::BrowserLaunchConfig;
pub use browser::BrowserType;
pub use config::Config;
pub use credentials::CredentialStore;
pub use error::Error;
pub use error::Result;
pub use intervention::InterventionConfig;
pub use intervention::InterventionDetector;
pub use intervention::InterventionHandler;
pub use intervention::InterventionReason;
pub use intervention::InterventionState;
pub use permissions::Operation;
pub use permissions::PermissionDecision;
pub use permissions::PermissionGuard;
pub use permissions::PermissionPolicy;
pub use providers::Provider;
pub use providers::ProviderTrait;
pub use puppet::PromptRequest;
pub use puppet::PromptResponse;
pub use puppet::WebPuppet;
pub use ratelimit::RateLimiter;
pub use security::ContentScreener;
pub use security::ScreeningConfig;
pub use security::ScreeningResult;
pub use security::SecurityIssue;
pub use session::Session;

Modules§

browser
Browser detection and configuration for system browsers.
config
Configuration for webpuppet browser automation.
credentials
Secure credential storage using OS keyring.
error
Error types for webpuppet operations.
intervention
Human intervention system for browser automation.
permissions
Permission and guardrails system for webpuppet operations.
providers
Provider trait and implementations for AI web UIs.
puppet
WebPuppet - main automation orchestrator.
ratelimit
Rate limiting for provider requests.
security
Content security screening and prompt injection filtering.
session
Browser session management with real chromiumoxide integration.