[package]
name = "phostt"
version = "0.2.0"
edition = "2024"
description = "Local STT server powered by Zipformer-vi RNN-T — on-device Vietnamese speech recognition via ONNX Runtime"
license = "MIT"
repository = "https://github.com/ekhodzitsky/phostt"
readme = "README.md"
authors = ["Eugene Khodzitsky <eugene.khodzitsky@gmail.com>"]
keywords = ["stt", "speech-recognition", "zipformer", "onnx", "vietnamese"]
categories = ["multimedia::audio", "command-line-utilities"]

[features]
default = []
coreml = ["ort/coreml"]
cuda = ["ort/cuda"]
diarization = []
ffi = ["ort/nnapi"]
[dependencies]
# ONNX Runtime
ort = "2.0.0-rc.12"

# Async runtime
tokio = { version = "1", features = ["full"] }

# Async MPMC channel — backs the SessionPool (FIFO + close semantics)
async-channel = "2"

# HTTP + WebSocket server (single port via axum)
axum = { version = "0.8", features = ["ws", "multipart"] }
futures-util = "0.3"

# CLI
clap = { version = "4", features = ["derive", "env"] }

# HTTP client for model download
reqwest = { version = "0.13", features = ["stream"] }

# Serialization
serde = { version = "1", features = ["derive"] }
serde_json = "1"

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

# Error handling
anyhow = "1"

# Cryptographic hashing for model verification
sha2 = "0.10"

# FFT for mel spectrogram. `kaldi-native-fbank` brings its own
# `realfft`/`rustfft` planner internally, but rustfft is kept as a direct
# dependency for legacy callers that use the `Fft` trait.
rustfft = "6"

# Kaldi-compatible FBANK feature extractor (pure Rust port of
# kaldi-native-fbank, the same library sherpa-onnx uses for Zipformer
# preprocessing). Provides povey window + preemphasis + Slaney mel banks
# bit-for-bit aligned with the upstream pipeline that produced the
# Zipformer-vi weights, plus an OnlineFeature wrapper used by streaming.
kaldi-native-fbank = "0.1"

# High-quality audio resampling
rubato = "0.16"

# Async stream adapters (ReceiverStream for SSE)
tokio-stream = "0.1"

# Cancellation + task tracking for graceful WS/SSE drain on shutdown.
# `rt` pulls in `CancellationToken` + `TaskTracker` (tokio-util 0.7).
tokio-util = { version = "0.7", features = ["rt"] }

# Audio file reading (for `transcribe` command)
symphonia = { version = "0.5", features = ["aac", "isomp4", "mp3", "ogg", "flac", "pcm", "wav"] }

# Bundle extraction for the upstream sherpa-onnx Zipformer-vi release tarball
# (`*.tar.bz2`). `bzip2` links against system libbz2 (preinstalled on macOS,
# `libbz2-dev` on Debian); `tar` is pure Rust.
tar = "0.4"
bzip2 = "0.6"

# Explicit pin for zero-copy byte buffers shared with symphonia (used by the
# REST upload decode path). Already transitive via axum/tokio; pinning makes
# the dependency direct so the zero-copy decode contract is discoverable.
bytes = "1"

# Per-IP rate limiting (token bucket, optional — off by default).
# Implemented in `src/server/rate_limit.rs`; `dashmap` gives lock-free reads.
dashmap = "6"


[dev-dependencies]
tempfile = "3"
tokio-tungstenite = "0.29"
criterion = { version = "0.5", features = ["html_reports"] }
tract-onnx = "0.22.1"
# `tracing-subscriber` is declared in `[dependencies]`; cargo already exposes
# it to integration tests, so no separate dev-dep is needed.

[profile.release]
lto = true
codegen-units = 1
strip = true

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