mirror of
https://github.com/hanzoai/dev.git
synced 2026-10-25 03:32:32 +00:00
Make hanzo-node natively serve the canonical Hanzo inference engine (OpenAI / Anthropic / Responses HTTP API) in-process, alongside the existing gRPC server, behind a new default-off `engine` Cargo feature. Purely additive: with the feature off the node builds and behaves exactly as before. - Cargo.toml: optional path-deps on hanzo-server-core (default-features=false) and hanzo-engine; `engine` feature gating them; cuda/cudnn/metal/rocm/vulkan/ accelerate/mkl/nccl/flash-attn[-v3] features each forwarding to the matching engine + server-core features (mirrors hanzo-server/Cargo.toml). default = []. - .cargo/config.toml: rustflags target-cpu=native (engine's candle fork needs it). - lib.rs: add EngineConfig (enabled/cpu/engine_api_addr default 0.0.0.0:36900, + cfg-gated ModelSelected) to NodeConfig; cfg-gated hanzo_state on HanzoNode built in new() via HanzoForServerBuilder; start() runs gRPC + axum engine API concurrently (spawn + tokio::join!) when state is present, else unchanged. All engine code is #[cfg(feature = "engine")]; errors map to crate::Error, no unwrap/expect. - bin: --engine-port/HANZO_ENGINE_ADDR, --model/HANZO_ENGINE_MODEL, --engine-cpu; logs the engine URL on startup. Validation (CPU box, GPU-blocked, no weights): - cargo check -p hanzo-node (no features): pass, 0 warnings. - cargo check -p hanzo-node --features engine: pass; warnings only from upstream hanzo-engine/hanzo-server-core, none from hanzo-node. GPU feature graphs (cuda/rocm/metal/...) resolve via cargo metadata but are not compiled here (no GPU toolchains).
126 lines
3.2 KiB
TOML
126 lines
3.2 KiB
TOML
[workspace]
|
|
# This crate is standalone, not part of the parent workspace
|
|
|
|
[package]
|
|
name = "hanzo-node"
|
|
version = "0.1.0"
|
|
edition = "2021"
|
|
description = "Hanzo Node - RPC-based compute node for Hanzo Platform"
|
|
authors = ["Hanzo AI <[email protected]>"]
|
|
license = "Apache-2.0"
|
|
|
|
[lib]
|
|
name = "hanzo_node"
|
|
path = "src/lib.rs"
|
|
|
|
[[bin]]
|
|
name = "hanzo-node"
|
|
path = "src/bin/hanzo-node.rs"
|
|
|
|
[dependencies]
|
|
# Async runtime
|
|
tokio = { version = "1", features = [
|
|
"rt-multi-thread",
|
|
"macros",
|
|
"sync",
|
|
"time",
|
|
"signal",
|
|
"fs",
|
|
"io-util",
|
|
"net",
|
|
] }
|
|
|
|
# gRPC
|
|
tonic = { version = "0.12" }
|
|
prost = "0.13"
|
|
|
|
# P2P networking
|
|
libp2p = { version = "0.54", features = [
|
|
"tokio",
|
|
"tcp",
|
|
"noise",
|
|
"yamux",
|
|
"identify",
|
|
"kad",
|
|
"gossipsub",
|
|
"mdns",
|
|
"macros",
|
|
] }
|
|
|
|
# Storage
|
|
sled = "0.34"
|
|
parking_lot = "0.12"
|
|
|
|
# Cryptography (KMS)
|
|
ring = "0.17"
|
|
async-trait = "0.1"
|
|
|
|
# Serialization
|
|
serde = { version = "1", features = ["derive"] }
|
|
serde_json = "1"
|
|
|
|
# Error handling
|
|
thiserror = "2"
|
|
anyhow = "1"
|
|
|
|
# Logging and tracing
|
|
tracing = { version = "0.1", features = ["log"] }
|
|
tracing-subscriber = { version = "0.3", features = ["fmt", "env-filter"] }
|
|
|
|
# Utilities
|
|
uuid = { version = "1", features = ["v4", "serde"] }
|
|
chrono = { version = "0.4", features = ["serde"] }
|
|
bytes = "1"
|
|
|
|
# HTTP for health check
|
|
axum = { version = "0.8", features = ["tokio"] }
|
|
tower = "0.5"
|
|
|
|
# Streaming
|
|
async-stream = "0.3"
|
|
tokio-stream = "0.1"
|
|
futures = "0.3"
|
|
|
|
# Canonical inference engine (optional, default-off behind the `engine` feature).
|
|
# Path-deps into the sibling `engine` workspace; compiled only when `engine` is on.
|
|
hanzo-server-core = { path = "../../../engine/hanzo-server-core", optional = true, default-features = false }
|
|
hanzo-engine = { path = "../../../engine/hanzo-engine", optional = true }
|
|
|
|
[build-dependencies]
|
|
tonic-build = "0.12"
|
|
|
|
[dev-dependencies]
|
|
tempfile = "3"
|
|
tokio-test = "0.4"
|
|
|
|
[features]
|
|
default = []
|
|
full = ["mlx"]
|
|
mlx = [] # Optional MLX acceleration support
|
|
|
|
# Embed the canonical Hanzo inference engine in-process (serves the OpenAI/
|
|
# Anthropic/Responses HTTP API alongside gRPC). Default-off and purely additive:
|
|
# with `engine` disabled the node builds and behaves exactly as before.
|
|
engine = ["dep:hanzo-server-core", "dep:hanzo-engine"]
|
|
|
|
# Hardware acceleration backends. Each forwards to the matching engine feature.
|
|
# Mirror of hanzo-server/Cargo.toml. All imply `engine`.
|
|
cuda = ["engine", "hanzo-server-core/cuda", "hanzo-engine/cuda"]
|
|
cudnn = ["engine", "hanzo-server-core/cudnn", "hanzo-engine/cudnn"]
|
|
metal = ["engine", "hanzo-server-core/metal", "hanzo-engine/metal"]
|
|
rocm = ["engine", "hanzo-server-core/rocm", "hanzo-engine/rocm"]
|
|
vulkan = ["engine", "hanzo-server-core/vulkan", "hanzo-engine/vulkan"]
|
|
accelerate = ["engine", "hanzo-server-core/accelerate", "hanzo-engine/accelerate"]
|
|
mkl = ["engine", "hanzo-server-core/mkl", "hanzo-engine/mkl"]
|
|
nccl = ["engine", "hanzo-server-core/nccl", "hanzo-engine/nccl"]
|
|
flash-attn = ["cuda", "hanzo-server-core/flash-attn", "hanzo-engine/flash-attn"]
|
|
flash-attn-v3 = ["cuda", "hanzo-server-core/flash-attn-v3", "hanzo-engine/flash-attn-v3"]
|
|
|
|
[lints.rust]
|
|
# Match hanzo-dev linting style
|
|
|
|
[lints.clippy]
|
|
expect_used = "deny"
|
|
unwrap_used = "deny"
|
|
uninlined_format_args = "deny"
|