[package]
name = "sgl-model-gateway"
version = "0.3.2"
edition = "2021"

[features]
default = ["grpc-client"]
grpc-client = []
grpc-server = []

vendored-openssl = ["openssl/vendored"]

[lints.rust]
unused_qualifications = "warn"

[lib]
name = "smg"
crate-type = ["rlib"]

[[bin]]
name = "sgl-model-gateway"
path = "src/main.rs"

[[bin]]
name = "smg"
path = "src/main.rs"

[[bin]]
name = "amg"
path = "src/main.rs"

[dependencies]
clap = { version = "4", features = ["derive", "env"] }
axum = { version = "0.8.6", features = ["macros", "ws", "tracing"] }
axum-server = { version = "0.8.0", default-features = false, features = ["tls-rustls"] }
tower = { version = "0.5", features = ["full"] }
tower-http = { version = "0.6", features = ["trace", "compression-gzip", "cors", "timeout", "limit", "request-id", "util"] }
serde = { version = "1.0", features = ["derive"] }
serde_json = { version = "1.0", default-features = false, features = [
    "std",
    "preserve_order",
] }
bytes = "1.8.0"
http-body = "1.0"
rand = "0.9.2"
reqwest = { version = "0.12.8", features = ["stream", "blocking", "json", "rustls-tls"], default-features = false }
futures-util = "0.3"
futures = "0.3"
dashmap = "6.1.0"
blake3 = "1.5"
xxhash-rust = { version = "0.8", features = ["xxh3"] }
bytemuck = { version = "1.21", features = ["derive"] }
http = "1.1.0"
tokio = { version = "1.42.0", features = ["full"] }
async-trait = "0.1"
tracing = "0.1"
tracing-subscriber = { version = "0.3", features = ["env-filter", "json", "chrono"] }
tracing-log = "0.2"
tracing-appender = "0.2.3"
opentelemetry = "0.27"
opentelemetry_sdk = { version = "0.27", features = ["trace", "rt-tokio"] }
opentelemetry-otlp = { version = "0.27", features = ["trace", "grpc-tonic"] }
tracing-opentelemetry = "0.28"
chrono = "0.4"
kube = { version = "1.1.0", features = ["runtime", "derive"] }
k8s-openapi = { version = "0.25.0", features = ["v1_33"] }
metrics = "0.24.2"
metrics-exporter-prometheus = "0.17.0"
uuid = { version = "1.10", features = ["v4", "serde"] }
parking_lot = "0.12.4"
thiserror = "2.0.12"
regex = "1.10"
memchr = "2.7"  # SIMD-optimized byte pattern searching
url = "2.5.4"
validator = { version = "0.20.0", features = ["derive"] }
tokio-stream = { version = "0.1", features = ["sync"] }
anyhow = "1.0"
reasoning-parser = "=1.0.0"
openai-protocol = { version = "=1.0.0", features = ["axum"] }
tool-parser = "=1.0.0"
llm-tokenizer = "=1.0.0"
smg-auth = "=1.0.0"
wfaas = "=1.0.0"
data-connector = "=1.0.0"
smg-mcp = "=1.0.0"
smg-wasm = "=1.0.0"
smg-mesh = "=1.0.0"
rustls = { version = "0.23", default-features = false, features = ["ring", "std"] }
rustls-pemfile = "2.2"
openssl = "0.10.73"
rmcp = { version = "0.8.3", features = ["client", "server",
    "transport-child-process",
    "transport-sse-client-reqwest",
    "transport-streamable-http-client-reqwest",
    "transport-streamable-http-server",
    "transport-streamable-http-server-session",
    "reqwest",
    "auth"] }
serde_yaml = "0.9"
subtle = "2.6"
jsonwebtoken = { version = "9.3", default-features = false, features = ["use_pem"] }
num-traits = "0.2"
num-bigint = "0.4"
base64 = "0.22"
openai-harmony = { git = "https://github.com/openai/harmony", tag = "v0.0.4" }
openmetrics-parser = "0.4.4"
arc-swap = "1.7.1"

# gRPC and Protobuf dependencies
smg-grpc-client = "=1.0.0"
tonic = { version = "0.14.2", features = ["gzip", "transport"] }
prost = "0.14.1"
prost-types = "0.14.1"
tonic-prost = "0.14.2"
bitflags = "2.10.0"
once_cell = "1.21.3"

# CRDT for Mesh state synchronization
crdts = "7.3"
redis = { version = "0.27.6", features = ["tokio-comp", "json", "connection-manager"] }


# wasm dependencies
sha2 = "0.10"
wasmtime = { version = "38.0", features = ["component-model", "async"] }

[build-dependencies]
chrono = { version = "0.4", features = ["clock"] }
toml = "0.9"

[dev-dependencies]
criterion = { version = "0.5", features = ["html_reports"] }
tower = { version = "0.5", features = ["util"] }
http-body-util = "0.1"
portpicker = "0.1"
tempfile = "3.8"
lazy_static = "1.4"
wasm-encoder = "0.242"
npyz = { version = "0.8", features = ["npz"] }  # For reading numpy .npz files in golden tests
opentelemetry-proto = { version = "0.27", features = ["gen-tonic"] }
tonic-v12 = { version = "0.12.3", package = "tonic" }
serial_test = "3.0"
rsa = { version = "0.9", features = ["sha2"] }

[[bench]]
name = "consistent_hash_bench"
harness = false
path = "benches/consistent_hash_bench.rs"
[[bench]]
name = "wasm_middleware_latency"
harness = false
path = "benches/wasm_middleware_latency.rs"
[[bench]]
name = "request_processing"
harness = false
path = "benches/request_processing.rs"

[[bench]]
name = "router_registry_bench"
harness = false

[[bench]]
name = "manual_policy_benchmark"
harness = false
path = "benches/manual_policy_benchmark.rs"

[profile.release]
opt-level = "z"     # Optimize for size
lto = "fat"         # Full LTO for smaller binaries
codegen-units = 1   # Better optimization, slower compile
strip = true        # Strip debug symbols

[profile.ci]
inherits = "release"
opt-level = 2       # Lighter optimization (still fast runtime, much faster compile)
lto = "thin"        # Thin LTO - good balance
codegen-units = 16  # More parallelization for faster builds
strip = true

[profile.dev]
opt-level = 0
debug = 1
split-debuginfo = "unpacked"
incremental = true
codegen-units = 256

[profile.dev.package."*"]
opt-level = 2
debug = false


[profile.dev.build-override]
opt-level = 3
codegen-units = 1

[profile.dev-opt]
inherits = "dev"
opt-level = 1
