[package]
edition = "2021"
name    = "sd-core"
version = "2.0.0-alpha.2"
autobins = true

[features]
default = ["wasm"]
# FFmpeg support for video thumbnails and audio extraction
ffmpeg = ["dep:sd-ffmpeg"]
# Whisper speech recognition engine (internal dependency)
whisper = ["dep:whisper-rs", "dep:hound", "dep:rubato"]
# Speech-to-text transcription (requires audio extraction + recognition)
speech-to-text = ["ffmpeg", "whisper"]
# AI features umbrella (heavy deps, can be disabled for lite builds or mobile)
ai = ["speech-to-text"]
# HEIF image support (extends sd-images with HEIF format)
heif = ["sd-images/heif"]
# Mobile platform support (excludes wasm which doesn't work on iOS)
mobile = []
# CLI support (clap is now always available)
cli = []
# WASM plugin system (disabled on mobile)
wasm = ["dep:wasmer", "dep:wasmer-middlewares"]


[dependencies]
# Async runtime
async-channel = { workspace = true }
async-trait   = "0.1"
futures       = "0.3"
tokio         = { version = "1.40", features = ["full"] }

# Database
sea-orm = { version = "1.1", features = [
	"macros",
	"runtime-tokio-rustls",
	"sqlx-sqlite",
	"uuid",
	"with-chrono",
	"with-json"
] }
sea-orm-migration = { version = "1.1", features = ["runtime-tokio-rustls", "sqlx-sqlite"] }
sqlx = { version = "0.8", features = ["runtime-tokio-rustls", "sqlite"] }

# API (temporarily disabled)
# axum = "0.7"

# Serialization
int-enum = "1.1"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"

# HTTP client (for model downloads)
reqwest = { version = "0.11", features = ["stream"] }
specta = { git = "https://github.com/jamiepine/specta", branch = "main", features = [
	"chrono",
	"derive",
	"export",
	"serde",
	"serde_json",
	"uuid"
] }
specta-serde = { git = "https://github.com/jamiepine/specta", branch = "main" }
specta-swift = { git = "https://github.com/jamiepine/specta", branch = "main" }
specta-typescript = { git = "https://github.com/jamiepine/specta", branch = "main" }
strum = { version = "0.26", features = ["derive"] }
toml = "0.8"
hostname = "^0.4"


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

# Text processing
regex = "1.11"


# File operations
blake3 = "1.5"  # Content addressing
bytes  = "1.7"  # Efficient byte buffers for I/O operations
hex    = "0.4"  # Hex encoding for volume fingerprints
notify = "6.1"  # File system watching
sha2   = "0.10" # SHA-256 hashing for CAS IDs

# Cloud storage integration
opendal = { version = "0.54", features = [
	"services-s3",
	"services-gdrive",
	"services-onedrive",
	"services-dropbox",
	"services-azblob",
	"services-gcs",
] }

# Logging
tracing            = "0.1"
tracing-appender   = "0.2"
tracing-subscriber = { version = "0.3", features = ["env-filter"] }

# WASM Plugin System
wasmer             = { version = "4.2", optional = true }
wasmer-middlewares = { version = "4.2", optional = true }

# Indexer rules engine
futures-concurrency = "7.6"
gix-ignore          = { version = "0.11", features = ["serde"] }
globset             = { version = "0.4", features = ["serde1"] }

# Job system dependencies
inventory      = "0.3"                              # Automatic job registration
job-derive     = { path = "../crates/job-derive" }  # Job derive macros
rmp            = "0.8"                              # MessagePack core types
rmp-serde      = "1.3"                              # MessagePack serialization for job state
sd-task-system = { path = "../crates/task-system" }

# Vector database for memory files (optional for now)
# lancedb = "0.15"  # Embedded vector database (conflicts with gpui)

# Media processing dependencies
blurhash         = "0.2"
image            = "0.25"
sd-ffmpeg        = { path = "../crates/ffmpeg", optional = true }
sd-fs-watcher    = { path = "../crates/fs-watcher" }
sd-images        = { path = "../crates/images" }
sd-media-metadata = { path = "../crates/media-metadata" }
tokio-rustls     = "0.26"
webp             = "0.3"

# Speech-to-text dependencies (optional, behind whisper feature)
whisper-rs = { version = "0.15.1", optional = true }
hound      = { version = "3.5", optional = true }   # WAV file reading
rubato     = { version = "0.16", optional = true }  # Audio resampling to 16kHz

# Networking
# Iroh P2P networking
iroh = { version = "0.95.1", features = ["discovery-local-network"] }

# Serialization for protocols
serde_cbor = "0.11"

# Cryptography for signing (backward compatibility)
ed25519-dalek = "2.1"

# Cryptography and networking utilities
aes-gcm      = "0.10"                                           # AES-GCM encryption for secure storage
argon2       = "0.5"                                            # Password derivation
async-stream = "0.3"                                            # File streaming
backoff      = "0.4"                                            # Retry logic
bincode      = { version = "2.0.0-rc.3", features = ["serde"] } # Efficient encoding with serde compat
ring         = "0.16"                                           # Crypto primitives
tokio-stream = "0.1"                                            # Async streams

# BIP39 wordlist support
bip39 = "2.0"

# Additional cryptography
chacha20poly1305 = "0.10" # Authenticated encryption for chunk-level security
hkdf             = "0.12" # Key derivation function for session keys
hmac             = "0.12"
x25519-dalek     = "2.0"

# Network utilities
if-watch         = "3.0"
local-ip-address = "0.5"
# colored already defined above

# Utils
chrono    = { version = "0.4", features = ["serde"] }
dirs      = "5.0"
once_cell = "1.20"
rand      = "0.8"                                                        # Random number generation for secure delete
sysinfo   = "0.31"                                                       # Cross-platform system information
tempfile  = "3.14"                                                       # Temporary directories for testing
uuid      = { version = "1.11", features = ["serde", "v4", "v5", "v7"] }

# High-performance ephemeral index
memmap2      = "0.9"  # Memory-mapped file support for arena storage
smallvec     = { version = "1.13", features = ["serde"] } # Small vector optimization for children arrays
parking_lot  = "0.12" # Fast mutex for name cache
num_cpus     = "1.16" # CPU count for parallel walker
postcard     = { version = "1", features = ["use-std"] } # Zero-copy binary serialization for snapshots
zstd         = { version = "0.13", features = ["zstdmt"] } # Multithreaded compression for snapshots
whoami    = "1.5"

# Secure storage
keyring = "3.6"  # Only for device key in keychain
redb = "2.2"     # Encrypted KV store for library keys, credentials, etc.

# CLI dependencies
clap           = { version = "4.5", features = ["derive", "env"] }
colored        = "2.1"
comfy-table    = "7.1"
console        = "0.15"
dialoguer      = "0.11"
indicatif      = "0.17"
owo-colors     = "4.1"
supports-color = "3.0"

[build-dependencies]
chrono         = { version = "0.4", features = ["serde"] }
colored        = "2.1"
comfy-table    = "7.1"
console        = "0.15"
crossterm      = "0.28"
dialoguer      = "0.11"
indicatif      = "0.17"
owo-colors     = "4.1"
ratatui        = "0.29"
serde_json     = "1.0"
supports-color = "3.0"
vergen         = { version = "8", features = ["cargo", "git", "gitcl"] }

# Platform specific
[target.'cfg(unix)'.dependencies]
libc = "0.2"

[target.'cfg(windows)'.dependencies]
windows-sys = { version = "0.52", features = ["Win32_Storage_FileSystem", "Win32_Foundation", "Win32_Security"] }

[target.'cfg(any(target_os = "macos", target_os = "ios"))'.dependencies]
whisper-rs = { version = "0.15.1", features = ["metal"], optional = true }

# iOS-specific dependencies for volume detection via Objective-C FFI
[target.'cfg(target_os = "ios")'.dependencies]
objc2 = "0.6"
objc2-foundation = { version = "0.3", features = [
	"NSFileManager",
	"NSURL",
	"NSString",
	"NSArray",
	"NSValue",
	"NSDictionary",
	"NSError",
] }
objc2-ui-kit = { version = "0.3", features = ["UIDevice"] }

[[bin]]
name = "spacedrive"
path = "src/bin/cli.rs"

[[bin]]
name = "sd-daemon"
path = "src/bin/daemon.rs"


[dev-dependencies]
pretty_assertions = "1.4"
tempfile          = "3.14"
