[package]
name = "defect-llm"
version.workspace = true
edition.workspace = true
license.workspace = true
repository.workspace = true
description = "LLM provider implementations (Anthropic, Bedrock, OpenAI, DeepSeek) for the defect agent."

[lib]
# 关掉本 crate 的 doctest。本 crate 唯一的 doctest 来源是 `wire/*`——它们由
# `defect-llm-codegen` 从 OAS 生成（见 wire.rs，"不要手改"），doc 注释里夹带的
# 是 OpenAI/Anthropic 规范原文的 markdown/代码片段，并非可编译的 Rust 示例
# （如 openai.rs 的 `Request` 文档里那段 ` ``` ` 围栏文本会被 rustdoc 误当 Rust
# 跑而失败）。生成代码无法逐块标 `ignore`，rustdoc 也无"按模块关 doctest"的粒度，
# 故在 crate 级关闭。本 crate 的真实测试在 tests/ 与 #[cfg(test)] 单测，不受影响。
doctest = false

[dependencies]
defect-core.workspace = true
defect-http.workspace = true
futures.workspace = true
serde.workspace = true
serde_json.workspace = true
thiserror.workspace = true
tokio.workspace = true
tokio-util.workspace = true
tracing.workspace = true
# AWS 栈仅 provider-bedrock 用——整套 ~4.8MiB（含 aws-lc-sys 的 C/汇编 crypto），
# 设为 optional 由 feature 拉，关掉 bedrock 时整条 AWS 依赖从二进制消失。
aws-config = { workspace = true, optional = true }
aws-sdk-bedrockruntime = { workspace = true, optional = true }
aws-smithy-runtime-api = { workspace = true, optional = true }
aws-smithy-types = { workspace = true, optional = true }

# LLM 客户端栈：toac codegen 出的 wire/* + hyper transport
toac.workspace = true
sse-stream.workspace = true
http.workspace = true
http-body.workspace = true
http-body-util.workspace = true
bytes.workspace = true
hyper.workspace = true
tower.workspace = true

[features]
# 默认全开。按厂商裁剪：`--no-default-features --features provider-anthropic` 等。
default = ["provider-anthropic", "provider-bedrock", "provider-openai", "provider-deepseek"]

# 每家 provider 一个 feature，gate 对应 provider/ 子模块及其独占的 protocol/wire。
# 共享模块由"或"关系的多个 feature 任一开启即编入（见 protocol.rs / wire.rs 的 cfg）：
#   - anthropic_messages / wire::anthropic  ← anthropic | bedrock
#   - openai_chat / wire::openai            ← openai | deepseek
provider-anthropic = []
# bedrock 复用 anthropic 的 protocol/wire，并独占整个 AWS 栈。
provider-bedrock = [
    "provider-anthropic",
    "dep:aws-config",
    "dep:aws-sdk-bedrockruntime",
    "dep:aws-smithy-runtime-api",
    "dep:aws-smithy-types",
]
provider-openai = []
# deepseek 复用 openai 的 protocol/wire（deepseek_chat 依赖 openai_chat）。
provider-deepseek = ["provider-openai"]

[dev-dependencies]
# Examples and integration tests build a full agent/session to exercise providers
# end-to-end, so they need the agent runtime. Dev-deps are not propagated to downstream
# consumers, so `defect-llm` itself stays independent of `defect-agent`.
defect-agent.workspace = true
agent-client-protocol-schema.workspace = true
tracing-subscriber.workspace = true
wiremock.workspace = true

[lints]
workspace = true
