refactor: remove session auth, add DbType enum, native async broker

- Remove `auth`, `sessions-db` features and all tower-sessions/tower-sessions-sqlx-store deps
- Delete `src/session.rs` (InfraSessionStore)
- `ServerConfig`: remove `session_secret` field and `attach_session_layer()` helper
- `db.rs`: add explicit `DbType` enum to `DatabaseConfig`; `connect()` now matches on
  `db_type` instead of sniffing URL prefixes; remove `connect_sqlite()` standalone fn
- `broker/mod.rs`: replace `#[async_trait]` with native async fn (Rust 2024 AFIT)
- `broker/nats.rs`: remove `#[async_trait]` to match trait definition
- `ai/embeddings.rs`: remove sync `generate_embedding()` (wasteful thread spawn);
  keep only `generate_embedding_async()` as the public API
- Default features: `["logging", "db-sqlx", "auth", "http"]` → `["logging"]`
- Bump version to 0.1.11

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-05 01:36:52 +01:00
parent 7a72f5f54a
commit 0ea9aa7870
9 changed files with 53 additions and 296 deletions

View File

@@ -1,20 +1,18 @@
[package]
name = "k-core"
version = "0.1.10"
version = "0.1.11"
edition = "2024"
[features]
default = ["logging", "db-sqlx", "auth", "http"]
default = ["logging"]
logging = ["dep:tracing", "dep:tracing-subscriber"]
db-sqlx = ["dep:sqlx"]
postgres = ["db-sqlx", "sqlx/postgres", "tower-sessions-sqlx-store?/postgres"]
sqlite = ["db-sqlx", "sqlx/sqlite", "tower-sessions-sqlx-store?/sqlite"]
auth = ["dep:tower-sessions"]
sessions-db = ["auth", "dep:tower-sessions-sqlx-store"]
postgres = ["db-sqlx", "sqlx/postgres"]
sqlite = ["db-sqlx", "sqlx/sqlite"]
ai = ["dep:fastembed", "dep:qdrant-client"]
broker = []
broker-nats = ["broker", "dep:async-nats", "dep:futures-util", "dep:futures-core"]
http = ["dep:axum", "dep:tower", "dep:tower-http", "dep:time", "logging"]
http = ["dep:axum", "dep:tower", "dep:tower-http", "logging"]
[dependencies]
# Error handling
@@ -22,7 +20,7 @@ thiserror = "2.0.17"
anyhow = "1.0.100"
# Async
tokio = { version = "1.48.0", features = ["full"]}
tokio = { version = "1.48.0", features = ["full"] }
# Database
sqlx = { version = "0.8.6", features = [
@@ -39,10 +37,6 @@ tracing-subscriber = { version = "0.3.22", features = [
"fmt",
], optional = true }
# Auth
tower-sessions = { version = "0.14.0", optional = true }
tower-sessions-sqlx-store = { version = "0.15", optional = true}
# Utils
chrono = { version = "0.4.42", features = ["serde"] }
uuid = { version = "1.19.0", features = ["v4", "serde"] }
@@ -59,8 +53,7 @@ async-nats = { version = "0.45", optional = true }
# HTTP
axum = { version = "0.8.8", features = ["macros"], optional = true }
tower = { version = "0.5.2", optional = true }
tower-http = { version = "0.6.2", features = ["cors", "trace"], optional = true}
time = { version = "0.3", optional = true }
tower-http = { version = "0.6.2", features = ["cors", "trace"], optional = true }
futures-util = { version = "0.3", optional = true }
futures-core = {version = "0.3", optional = true }
futures-core = { version = "0.3", optional = true }