扩展与贡献清单
本文列出常见扩展应修改的代码位置。分层与编排权威见 架构。具体设计决策(例如仅 AgentRuntime 负责多轮编排)见仓库内 docs/adr/(不参与 VitePress 构建)。
新增默认工具
- 在
crates/tools中实现anycode_core::traits::Tool。 - 在
crates/tools/src/registry.rs注册 —— 遵守文件顶部 checklist(ins!、DEFAULT_TOOL_IDS、测试等)。 - 若工具涉及写盘、子 Agent、网络等敏感能力,在
crates/tools/src/catalog.rs的SECURITY_SENSITIVE_TOOL_IDS中登记,以便bootstrap统一注册SecurityLayer策略。 - 运行
cargo test -p anycode-tools与cargo test --workspace。
新 LLM 提供商或传输方式
- 在
crates/llm实现LLMClient(可参考crates/llm/src/providers/)。 - 在
transport_for_provider_id/MultiProviderLlmClient等处接入路由(lib.rs、provider_catalog.rs等)。 - 在
crates/llm补充测试。
新通道(微信 / Web 等)
- 在
crates/channels实现ChannelHandler。 - 主 CLI 未必已依赖
channels;在用户可见入口就绪时于crates/cli组合根接线。
记忆后端与 pipeline
- file / hybrid / noop:由 CLI
bootstrap的build_memory_layer配置(crates/cli/src/bootstrap/mod.rs)。 - pipeline(向量与可选 embedding):领域类型见
crates/core/src/memory_pipeline.rs,实现见crates/memory。详见 ADR 001。
速查表
| 目标 | 优先打开的文件 |
|---|---|
| 工具注册 | crates/tools/src/registry.rs |
| 目录与敏感工具 ID | crates/tools/src/catalog.rs |
| 运行时组装 | crates/cli/src/bootstrap/runtime.rs |
| Agent 多轮循环 | crates/agent/src/runtime/session.rs、mod.rs |
