[package]
name = "zeroclaw"
version = "0.1.0"
edition = "2021"
authors = ["theonlyhennygod"]
license = "MIT"
description = "Zero overhead. Zero compromise. 100% Rust. The fastest, smallest AI assistant."
repository = "https://github.com/zeroclaw-labs/zeroclaw"
readme = "README.md"
keywords = ["ai", "agent", "cli", "assistant", "chatbot"]
categories = ["command-line-utilities", "api-bindings"]

[dependencies]
# CLI - minimal and fast
clap = { version = "4.5", features = ["derive"] }

# Async runtime - feature-optimized for size
tokio = { version = "1.42", default-features = false, features = ["rt-multi-thread", "macros", "time", "net", "io-util", "sync", "process", "io-std", "fs", "signal"] }

# HTTP client - minimal features
reqwest = { version = "0.12", default-features = false, features = ["json", "rustls-tls", "blocking", "multipart", "stream"] }

# Serialization
serde = { version = "1.0", default-features = false, features = ["derive"] }
serde_json = { version = "1.0", default-features = false, features = ["std"] }

# Config
directories = "5.0"
toml = "1.0"
shellexpand = "3.1"

# Logging - minimal
tracing = { version = "0.1", default-features = false }
tracing-subscriber = { version = "0.3", default-features = false, features = ["fmt", "ansi", "env-filter"] }

# Observability - Prometheus metrics
prometheus = { version = "0.14", default-features = false }

# Base64 encoding (screenshots, image data)
base64 = "0.22"

# Optional Rust-native browser automation backend
fantoccini = { version = "0.22.0", optional = true, default-features = false, features = ["rustls-tls"] }

# Error handling
anyhow = "1.0"
thiserror = "2.0"

# UUID generation
uuid = { version = "1.11", default-features = false, features = ["v4", "std"] }

# Authenticated encryption (AEAD) for secret store
chacha20poly1305 = "0.10"

# HMAC for webhook signature verification
hmac = "0.12"
sha2 = "0.10"
hex = "0.4"

# CSPRNG for secure token generation
rand = "0.8"

# Fast mutexes that don't poison on panic
parking_lot = "0.12"

# Async traits
async-trait = "0.1"

# Protobuf encode/decode (Feishu WS long-connection frame codec)
prost = { version = "0.14", default-features = false }

# Memory / persistence
rusqlite = { version = "0.38", features = ["bundled"] }
chrono = { version = "0.4", default-features = false, features = ["clock", "std", "serde"] }
chrono-tz = "0.10"
cron = "0.12"

# Interactive CLI prompts
dialoguer = { version = "0.12", features = ["fuzzy-select"] }
console = "0.15"

# Hardware discovery (device path globbing)
glob = "0.3"

# Discord WebSocket gateway
tokio-tungstenite = { version = "0.24", features = ["rustls-tls-webpki-roots"] }
futures-util = { version = "0.3", default-features = false, features = ["sink"] }
futures = "0.3"
hostname = "0.4.2"
lettre = { version = "0.11.19", default-features = false, features = ["builder", "smtp-transport", "rustls-tls"] }
mail-parser = "0.11.2"
rustls = "0.23"
rustls-pki-types = "1.14.0"
tokio-rustls = "0.26.4"
webpki-roots = "1.0.6"

# HTTP server (gateway) — replaces raw TCP for proper HTTP/1.1 compliance
axum = { version = "0.8", default-features = false, features = ["http1", "json", "tokio", "query", "ws"] }
tower = { version = "0.5", default-features = false }
tower-http = { version = "0.6", default-features = false, features = ["limit", "timeout"] }
http-body-util = "0.1"

# OpenTelemetry — OTLP trace + metrics export
opentelemetry = { version = "0.31", default-features = false, features = ["trace", "metrics"] }
opentelemetry_sdk = { version = "0.31", default-features = false, features = ["trace", "metrics"] }
opentelemetry-otlp = { version = "0.31", default-features = false, features = ["trace", "metrics", "http-proto", "reqwest-client", "reqwest-rustls-webpki-roots"] }

# USB device enumeration (hardware discovery)
nusb = { version = "0.2", default-features = false, optional = true }

# Serial port for peripheral communication (STM32, etc.)
tokio-serial = { version = "5", default-features = false, optional = true }

# probe-rs for STM32/Nucleo memory read (Phase B)
probe-rs = { version = "0.30", optional = true }

# PDF extraction for datasheet RAG (optional, enable with --features rag-pdf)
pdf-extract = { version = "0.10", optional = true }

# Raspberry Pi GPIO / Landlock (Linux only) — target-specific to avoid compile failure on macOS
[target.'cfg(target_os = "linux")'.dependencies]
rppal = { version = "0.14", optional = true }
landlock = { version = "0.4", optional = true }

[features]
default = ["hardware"]
hardware = ["nusb", "tokio-serial"]
peripheral-rpi = ["rppal"]
# Browser backend feature alias used by cfg(feature = "browser-native")
browser-native = ["dep:fantoccini"]
# Backward-compatible alias for older invocations
fantoccini = ["browser-native"]
# Sandbox feature aliases used by cfg(feature = "sandbox-*")
sandbox-landlock = ["dep:landlock"]
sandbox-bubblewrap = []
# Backward-compatible alias for older invocations
landlock = ["sandbox-landlock"]
# probe = probe-rs for Nucleo memory read (adds ~50 deps; optional)
probe = ["dep:probe-rs"]
# rag-pdf = PDF ingestion for datasheet RAG
rag-pdf = ["dep:pdf-extract"]
[profile.release]
opt-level = "z"      # Optimize for size
lto = "thin"         # Lower memory use during release builds
codegen-units = 1    # Serialized codegen for low-memory devices (e.g., Raspberry Pi 3 with 1GB RAM)
                     # Higher values (e.g., 8) compile faster but require more RAM during compilation
strip = true          # Remove debug symbols
panic = "abort"      # Reduce binary size

[profile.release-fast]
inherits = "release"
codegen-units = 8    # Parallel codegen for faster builds on powerful machines (16GB+ RAM recommended)
                     # Use: cargo build --profile release-fast

[profile.dist]
inherits = "release"
opt-level = "z"
lto = "fat"
codegen-units = 1
strip = true
panic = "abort"

[dev-dependencies]
tokio-test = "0.4"
tempfile = "3.14"
