[package]
name = "brainwires-tool-system"
description = "Built-in tool implementations for the Brainwires Agent Framework"
version.workspace = true
edition.workspace = true
license.workspace = true
rust-version.workspace = true
repository.workspace = true
homepage.workspace = true
authors.workspace = true
readme = "README.md"
documentation = "https://docs.rs/brainwires-tool-system"
keywords = ["ai-tools", "llm", "file-operations", "code-search", "validation"]
categories = ["development-tools"]

[dependencies]
# Always available
brainwires-core.workspace = true

# Serialization
serde = { workspace = true }
serde_json = { workspace = true }

# Error handling
anyhow.workspace = true
thiserror = { workspace = true }

# Async traits
async-trait.workspace = true

# Async runtime
tokio = { version = "1.43", features = ["time"] }

# File operations (native only)
walkdir = { version = "2", optional = true }
diffy = { version = "0.4", optional = true }
glob = { version = "0.3", optional = true }

# Code search
regex = "1"
ignore = { version = "0.4", optional = true }

# Git operations (native only)
git2 = { version = "0.20", optional = true }

# Web operations (native only)
reqwest = { workspace = true, optional = true }

# Security (native only)
zeroize = { version = "1", features = ["derive"], optional = true }
sha2 = { workspace = true }
hex = { workspace = true }

# Identifiers (for TransactionManager staging dir names)
uuid = { workspace = true }

# Logging
tracing.workspace = true

# Scripting engine (behind orchestrator or orchestrator-wasm feature)
rhai = { version = "1.23", default-features = false, features = ["serde", "std"], optional = true }
web-time = { version = "1.1", optional = true }

# OpenAPI spec parsing (behind openapi feature)
openapiv3 = { version = "2", optional = true }
serde_yml = { version = "0.0.12", optional = true }

# Email tools (behind email feature)
lettre = { version = "0.11", default-features = false, features = ["tokio1-native-tls", "smtp-transport", "builder"], optional = true }
async-imap = { version = "0.11", default-features = false, features = ["runtime-tokio"], optional = true }
imap-proto = { version = "0.16", optional = true }
tokio-native-tls = { version = "0.3", optional = true }
native-tls = { version = "0.2", optional = true }
futures = { workspace = true, optional = true }
mailparse = { version = "0.15", optional = true }
base64 = { version = "0.22", optional = true }

# Calendar tools (behind calendar feature)
icalendar = { version = "0.16", optional = true }

# Feature-gated dependencies
brainwires-cognition = { workspace = true, optional = true }
brainwires-code-interpreters = { workspace = true, optional = true }
brainwires-mcp = { workspace = true, optional = true }

[dev-dependencies]
tokio = { workspace = true, features = ["full", "test-util"] }
tempfile = "3"
criterion = { version = "0.5", features = ["html_reports"] }

[features]
default = ["native"]
native = [
    "dep:git2", "dep:walkdir", "dep:ignore", "dep:reqwest",
    "dep:glob", "dep:diffy", "dep:zeroize",
    "tokio/process", "tokio/fs",
    "brainwires-core/native",
]
wasm = ["brainwires-core/wasm"]
orchestrator = ["dep:rhai", "rhai/sync"]
orchestrator-wasm = ["dep:rhai", "dep:web-time"]
rag = ["dep:brainwires-cognition", "brainwires-cognition/rag", "brainwires-cognition/lancedb-backend", "brainwires-cognition/tree-sitter-languages"]
interpreters = ["dep:brainwires-code-interpreters"]
openapi = ["dep:openapiv3", "dep:serde_yml", "dep:reqwest"]
email = ["dep:lettre", "dep:async-imap", "dep:imap-proto", "dep:tokio-native-tls", "dep:native-tls", "dep:futures", "dep:mailparse", "dep:base64"]
calendar = ["dep:icalendar", "dep:reqwest"]
browser = ["dep:brainwires-mcp", "native"]
full = ["orchestrator", "rag", "interpreters", "openapi", "email", "calendar", "browser"]

[[bench]]
name = "token_comparison"
harness = false
required-features = ["orchestrator"]

[[example]]
name = "expense_aggregation"
required-features = ["orchestrator"]

[[example]]
name = "file_operations"
required-features = ["orchestrator"]

[[example]]
name = "multi_api"
required-features = ["orchestrator"]

[[example]]
name = "tool_registry"

[[example]]
name = "tool_prehook"
