[package]
name        = "klieo"
version     = "2.2.0"
edition     = "2021"
rust-version = "1.89"
description = "Open-source Rust agent framework — typed agents, durable inter-agent comms, local-first."
readme      = "README.md"
license     = "MIT"
keywords    = ["agent", "llm", "ai", "framework", "nats"]
categories  = ["asynchronous", "api-bindings"]
repository.workspace    = true
homepage.workspace      = true
documentation.workspace = true
publish                 = true

[dependencies]
klieo-core         = { path = "../klieo-core", version = "2" }
klieo-model-registry = { path = "../klieo-model-registry", version = "2.2" }
secrecy            = { workspace = true, optional = true }
bytes              = { workspace = true, optional = true }
dirs               = { workspace = true, optional = true }
tokio-util         = { workspace = true }
tracing            = { workspace = true }

# Foundation (W2)
klieo-tools         = { path = "../klieo-tools",         version = "2", optional = true }
klieo-macros        = { path = "../klieo-macros",        version = "2", optional = true }
klieo-llm-ollama    = { path = "../klieo-llm-ollama",    version = "2", optional = true }
klieo-memory-sqlite = { path = "../klieo-memory-sqlite", version = "2", optional = true }
klieo-bus-memory    = { path = "../klieo-bus-memory",    version = "2", optional = true }
klieo-bus-nats      = { path = "../klieo-bus-nats",      version = "2", optional = true }
klieo-tools-mcp     = { path = "../klieo-tools-mcp",     version = "2", optional = true }

# LLM providers (W3)
klieo-llm-openai    = { path = "../klieo-llm-openai",    version = "2", optional = true }
klieo-llm-anthropic = { path = "../klieo-llm-anthropic", version = "2", optional = true }
klieo-llm-gemini    = { path = "../klieo-llm-gemini",    version = "2", optional = true }

# Memory backends (W3)
klieo-memory-neo4j  = { path = "../klieo-memory-neo4j",  version = "2", optional = true }
klieo-memory-qdrant = { path = "../klieo-memory-qdrant", version = "2", optional = true }
klieo-embed-common  = { path = "../klieo-embed-common",  version = "2", optional = true }

# GraphRAG cluster
klieo-memory-graph         = { path = "../klieo-memory-graph",         version = "2", optional = true }
klieo-memory-graph-neo4j   = { path = "../klieo-memory-graph-neo4j",   version = "2", optional = true }
klieo-memory-graph-rag     = { path = "../klieo-memory-graph-rag",     version = "2", optional = true }
klieo-graph-projector      = { path = "../klieo-graph-projector",      version = "2", optional = true }

# Composition + protocol (W3)
klieo-flows         = { path = "../klieo-flows",         version = "2", optional = true }
klieo-a2a           = { path = "../klieo-a2a",           version = "2", optional = true }
klieo-spec          = { path = "../klieo-spec",          version = "2", optional = true }
klieo-eval          = { path = "../klieo-eval",          version = "2", optional = true }
klieo-hitl          = { path = "../klieo-hitl",          version = "2", optional = true }

# Auth (cluster 0.21)
klieo-auth-common   = { path = "../klieo-auth-common",   version = "2", optional = true }
klieo-auth-oauth    = { path = "../klieo-auth-oauth",    version = "2", optional = true }

# Ops layer (multi-tenant runtime + HTTP routes + server-side MCP)
klieo-ops           = { path = "../klieo-ops",           version = "2", optional = true }
klieo-ops-api       = { path = "../klieo-ops-api",       version = "2", optional = true }
klieo-mcp-server    = { path = "../klieo-mcp-server",    version = "2", optional = true }

# Observability + provenance (W3)
klieo-runlog        = { path = "../klieo-runlog",        version = "2", optional = true }
klieo-provenance    = { path = "../klieo-provenance",    version = "2", optional = true }
klieo-otel          = { path = "../klieo-otel",          version = "2", optional = true }

[features]
# Default = `local`: the laptop-dev set the README quickstart uses.
# Opt out with `default-features = false` to start from trait surfaces
# only; opt in to other impl crates feature-by-feature.
default = ["local"]

# Third-party re-export gates (auto-activated by capability features below)
secrecy        = ["dep:secrecy"]
bytes          = ["dep:bytes"]

# Foundation
tools          = ["dep:klieo-tools"]
macros         = ["dep:klieo-macros"]
llm-ollama     = ["dep:klieo-llm-ollama"]
memory-sqlite  = ["dep:klieo-memory-sqlite"]
bus-memory     = ["dep:klieo-bus-memory"]
bus-nats       = ["dep:klieo-bus-nats", "secrecy", "bytes"]
mcp            = ["dep:klieo-tools-mcp", "tools"]
# Streamable-HTTP MCP client transport for `AppBuilder::mcp_http`. Activates
# the `http` transport in `klieo-tools-mcp`. Requires `mcp`.
http           = ["mcp", "klieo-tools-mcp/http"]

# LLM providers
llm-openai     = ["dep:klieo-llm-openai", "secrecy"]
llm-anthropic  = ["dep:klieo-llm-anthropic", "secrecy"]
llm-gemini     = ["dep:klieo-llm-gemini", "secrecy"]

# Memory backends
memory-neo4j   = ["dep:klieo-memory-neo4j", "secrecy"]
memory-qdrant  = ["dep:klieo-memory-qdrant", "secrecy"]
embed-common   = ["dep:klieo-embed-common"]

# GraphRAG cluster (see ADR-035).
memory-graph        = ["dep:klieo-memory-graph"]
memory-graph-neo4j  = ["memory-graph", "memory-neo4j", "dep:klieo-memory-graph-neo4j"]
memory-graph-rag    = ["memory-graph", "memory-qdrant", "dep:klieo-memory-graph-rag"]
graph-projector     = ["memory-graph", "dep:klieo-graph-projector"]

# Composition + protocol
flows          = ["dep:klieo-flows"]
a2a            = ["dep:klieo-a2a"]
spec           = ["dep:klieo-spec"]
eval           = ["dep:klieo-eval"]
hitl           = ["dep:klieo-hitl"]

# Auth
auth-common    = ["dep:klieo-auth-common"]
oauth          = ["dep:klieo-auth-oauth"]

# Ops layer
ops            = ["dep:klieo-ops"]
ops-api        = ["ops", "dep:klieo-ops-api"]
mcp-server     = ["dep:klieo-mcp-server"]

# Observability + provenance
runlog              = ["dep:klieo-runlog"]
runlog-sqlite       = ["runlog", "klieo-runlog/sqlite"]
runlog-compaction-llm = ["runlog", "klieo-runlog/compaction-llm"]
provenance     = ["dep:klieo-provenance"]
otel           = ["dep:klieo-otel"]

# Cross-cutting: JsonSchema derives on public types.
# Activates klieo-provenance/schemars and klieo-runlog/schemars when those
# crates are already enabled. The `?` makes both activations conditional —
# if provenance or runlog are not in the feature set the no-op quietly.
schemars = [
    "klieo-provenance?/schemars",
    "klieo-runlog?/schemars",
]

# Aggregate features.
# `local` — the README quickstart set: laptop dev with Ollama + sqlite
# + in-process bus + tool macros. The default; matches what
# `App::local()` expects.
local          = ["tools", "macros", "llm-ollama", "memory-sqlite", "bus-memory"]
# `data-dir` — `App::local_at_data_dir()` shortcut. Pulls in the `dirs`
# crate so the umbrella can resolve the user's per-OS data directory.
# Implies the `local` set (Ollama + sqlite + bus-memory + tools).
data-dir       = ["local", "dep:dirs"]
# `all-foundation` — production-shaped baseline: tools + macros + Ollama
# + sqlite + in-process bus + NATS bus + MCP client + auth-common + ops
# layer (gates/escalation/worklog/etc.) + ops HTTP routes. Excludes
# additional LLM providers and server-side adapters.
all-foundation = ["tools", "macros", "llm-ollama", "memory-sqlite", "bus-memory", "bus-nats", "mcp", "auth-common", "ops", "ops-api"]
# `all-llm` — every LLM provider crate.
all-llm        = ["llm-ollama", "llm-openai", "llm-anthropic", "llm-gemini"]
# `all-memory` — every memory backend (incl. GraphRAG cluster, ADR-035).
all-memory     = [
    "memory-sqlite",
    "memory-neo4j",
    "memory-qdrant",
    "embed-common",
    "memory-graph",
    "memory-graph-neo4j",
    "memory-graph-rag",
]
# `all-observability` — RunLog + OTel + provenance.
all-observability = ["runlog", "otel", "provenance"]
# `full` — every impl crate. Heavy compile cost; for downstream integration tests.
full = [
    "all-foundation",
    "all-llm",
    "all-memory",
    "all-observability",
    "graph-projector",
    "flows",
    "a2a",
    "spec",
    "eval",
    "hitl",
    "oauth",
    "mcp-server",
]

memory-fastembed  = ["memory-sqlite", "klieo-memory-sqlite/fastembed"]
memory-sqlite-vec = ["memory-sqlite", "klieo-memory-sqlite/sqlite-vec"]

# `llm-rustls-tls` — opt-in pure-Rust TLS for every active LLM provider
# (`?` makes activation conditional on the provider feature already being
# enabled). Default TLS stack stays `native-tls` via each provider's
# `default = ["reqwest-default-tls"]`. Adopters running on musl / Alpine /
# FIPS who must avoid `native-tls` should pair this with
# `default-features = false` on the umbrella + individual LLM crates to
# fully opt out of `default-tls`.
llm-rustls-tls = [
    "klieo-llm-ollama?/reqwest-rustls-tls",
    "klieo-llm-openai?/reqwest-rustls-tls",
    "klieo-llm-anthropic?/reqwest-rustls-tls",
    "klieo-llm-gemini?/reqwest-rustls-tls",
]

test-utils = ["klieo-core/test-utils", "klieo-runlog?/test-utils"]

[dev-dependencies]
klieo              = { path = ".", features = ["all-foundation", "test-utils"] }
klieo-eval          = { path = "../klieo-eval", version = "2" }
tokio               = { workspace = true, features = ["macros", "rt-multi-thread"] }
tokio-util          = { workspace = true }
async-trait         = { workspace = true }
serde_json          = { workspace = true }
bytes               = { workspace = true }
tempfile            = { workspace = true }
wiremock            = { workspace = true }
tracing-subscriber  = "0.3"
hello-agent         = { path = "../../examples/hello-agent" }
klieo-tools-mcp    = { path = "../klieo-tools-mcp", features = ["test-utils"] }

[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]
