932a06f512
- 定义 16 个 features + 4 个快捷组合,default = ["full"] 保持向后兼容 - 12 个重型依赖 optional 化(tokio/reqwest/rusqlite 等) - 全模块 #[cfg(feature)] 门控注入(llm/tools/memory/agent/engine) - 将 LlmProvider trait 及关联类型移出 provider 模块归属 llm(ADR-1) - 为 session.rs bundle() 方法添加 engine feature 门控 - 更新 12 个内部文件 + 4 个示例文件的 import 路径 - 向后兼容:provider.rs 保留 pub use 重导出老路径
76 lines
2.8 KiB
TOML
76 lines
2.8 KiB
TOML
[package]
|
||
name = "agcore"
|
||
version = "0.3.0"
|
||
edition = "2024"
|
||
|
||
[features]
|
||
default = ["full"]
|
||
|
||
# === 模块级 features ===
|
||
document = []
|
||
llm-types = []
|
||
prompt = ["llm-types"]
|
||
llm = ["llm-types", "tokio", "async-stream", "futures-core", "tokio-stream"]
|
||
tools = ["llm-types", "futures", "tokio-util", "tokio"]
|
||
tools-mcp = ["tools", "reqwest"]
|
||
# memory 模块依赖 llm(conversation/vector_store 使用 compact/embedding)、tokio(knowledge.rs 使用 Mutex)、time(types.rs 使用 OffsetDateTime)
|
||
memory = ["document", "llm", "tokio", "time"]
|
||
memory-sqlite = ["memory", "rusqlite", "time"]
|
||
agent = ["llm", "tools", "memory", "futures-util"]
|
||
engine = ["agent"]
|
||
|
||
# === Provider features ===
|
||
# Provider features — openai/anthropic 额外依赖 bytes(流式解析)和 futures-util(Stream 组合)
|
||
provider-openai = ["llm", "reqwest", "bytes", "futures-util"]
|
||
provider-anthropic = ["llm", "reqwest", "bytes", "futures-util"]
|
||
# deepseek/qwen 使用 openai_compat 适配层,不需要 bytes 和 futures-util
|
||
provider-deepseek = ["llm", "reqwest"]
|
||
provider-qwen = ["llm", "reqwest"]
|
||
provider-ollama = ["llm", "reqwest"]
|
||
|
||
# === 工具 features ===
|
||
tracing-init = ["tracing-subscriber"]
|
||
|
||
# === 快捷组合 ===
|
||
full = [
|
||
"document", "llm-types", "prompt", "llm",
|
||
"tools", "tools-mcp",
|
||
"memory", "memory-sqlite",
|
||
"agent", "engine",
|
||
"provider-openai", "provider-anthropic", "provider-deepseek",
|
||
"provider-qwen", "provider-ollama",
|
||
"tracing-init",
|
||
]
|
||
light = ["llm", "provider-openai", "tools", "tools-mcp", "memory", "agent", "engine", "prompt", "document"]
|
||
chat = ["agent", "provider-openai"]
|
||
multi = ["engine", "provider-openai"]
|
||
|
||
[dependencies]
|
||
# 始终编译的轻量依赖(5 个,不参与门控)
|
||
serde = { version = "1", features = ["derive"] }
|
||
serde_json = "1"
|
||
thiserror = "2"
|
||
async-trait = "0.1"
|
||
tracing = "0.1"
|
||
|
||
# 12 个重型依赖(全部 optional)
|
||
tokio = { version = "1", features = ["rt", "rt-multi-thread", "sync", "time", "macros", "process", "io-util"], optional = true }
|
||
reqwest = { version = "0.12", features = ["json", "stream"], optional = true }
|
||
rusqlite = { version = "0.32", features = ["bundled"], optional = true }
|
||
tracing-subscriber = { version = "0.3", features = ["env-filter"], optional = true }
|
||
tokio-stream = { version = "0.1", optional = true }
|
||
futures = { version = "0.3", optional = true }
|
||
futures-util = { version = "0.3", optional = true }
|
||
futures-core = { version = "0.3", optional = true }
|
||
bytes = { version = "1", optional = true }
|
||
async-stream = { version = "0.3", optional = true }
|
||
tokio-util = { version = "0.7", features = ["rt"], optional = true }
|
||
time = { version = "0.3", features = ["serde", "parsing", "formatting", "macros"], optional = true }
|
||
|
||
[dev-dependencies]
|
||
tokio = { version = "1", features = ["rt", "rt-multi-thread", "macros"] }
|
||
dotenvy = "0.15.7"
|
||
wiremock = "0.6"
|
||
temp-env = "0.3"
|
||
tempfile = "3"
|