[package]
name = "sglang_router_rs"
version = "0.0.0"
edition = "2021"

[features]
default = ["grpc-client"]
grpc-client = []
grpc-server = []
vendored-openssl = ["openssl/vendored"]

[lints.rust]
unused_qualifications = "warn"

[lib]
name = "sglang_router_rs"
# Pure Rust library: Just omit crate-type (defaults to rlib)
# Python/C binding + Rust library: Use ["cdylib", "rlib"]
crate-type = ["cdylib", "rlib"]

[[bin]]
name = "sglang-router"
path = "src/main.rs"

[dependencies]
clap = { version = "4", features = ["derive", "env"] }
axum = { version = "0.8.4", features = ["macros", "ws", "tracing"] }
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"
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"
pyo3 = { version = "0.27.1", features = ["extension-module", "abi3-py38"] }
dashmap = "6.1.0"
lru = "0.16.2"
blake3 = "1.5"
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"
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"] }
ulid = "1.2.1"
parking_lot = "0.12.4"
rayon = "1.10"
thiserror = "2.0.12"
regex = "1.10"
url = "2.5.4"
validator = { version = "0.20.0", features = ["derive"] }
tokio-stream = { version = "0.1", features = ["sync"] }
anyhow = "1.0"
tokenizers = { version = "0.22.0" }
tiktoken-rs = { version = "0.7.0" }
minijinja = { version = "2.0", features = ["unstable_machinery", "json", "builtins"] }
minijinja-contrib = { version = "2.0", features = ["pycompat"] }
rustls = { version = "0.23", default-features = false, features = ["ring", "std"] }
openssl = "0.10.73"
hf-hub = { version = "0.4.3", features = ["tokio"] }
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"
oracle = { version = "0.6.3", features = ["chrono"] }
subtle = "2.6"
rustpython-parser = "0.4.0"
num-traits = "0.2"
openai-harmony = { git = "https://github.com/openai/harmony", tag = "v0.0.4" }

# gRPC and Protobuf dependencies
tonic = { version = "0.14.2", features = ["gzip", "transport"] }
prost = "0.14.1"
prost-types = "0.14.1"
tonic-prost = "0.14.2"
deadpool = { version = "0.12", features = ["managed", "rt_tokio_1"] }
backoff = { version = "0.4", features = ["tokio"] }
strum = { version = "0.26", features = ["derive"] }
once_cell = "1.21.3"

[build-dependencies]
tonic-prost-build = "0.14.2"
prost-build = "0.14.1"

[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"

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

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

[[bench]]
name = "tool_parser_benchmark"
harness = false
path = "benches/tool_parser_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.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
