refactor(llm): 移除 ToolDefinition 别名与遗留 deprecation 抑制点
完成 ToolDef IR 切换的最后清理:移除 ToolDefinition 别名与 OpenaiToolDefinition 的公共 re-export;各调用点(cycle/registry/mcp/agent) 直接使用 ToolDef 并清理对应的 #[allow(deprecated)] 抑制点;新增 roundtrip 测试验证 ToolDef 序列化兼容性。
This commit is contained in:
+2
-4
@@ -7,14 +7,12 @@
|
||||
//! - **不绑定业务循环**:`submit_turn` 在 `AgentSession` 上,不在 trait 上
|
||||
|
||||
use crate::agent::runtime::RuntimeBundle;
|
||||
#[allow(deprecated)]
|
||||
use crate::llm::types::ToolDefinition;
|
||||
use crate::llm::types::tool::ToolDef;
|
||||
|
||||
/// Agent 角色抽象。
|
||||
///
|
||||
/// 实现此 trait 即可接入 Agent Runtime。典型实现是 struct 持有静态配置(name、system prompt 模板),
|
||||
/// 也可以是基于配置动态生成的轻量实现。
|
||||
#[allow(deprecated)]
|
||||
pub trait Agent: Send + Sync {
|
||||
/// 角色名(用于日志、调试、UI 展示)。
|
||||
fn name(&self) -> &str;
|
||||
@@ -26,7 +24,7 @@ pub trait Agent: Send + Sync {
|
||||
///
|
||||
/// **默认实现**:从 `bundle.tool_registry` 取全部工具(最常用模式)。
|
||||
/// **子 trait / 具体实现可覆盖**:做白名单、过滤、按状态动态调整等。
|
||||
fn tool_definitions(&self, bundle: &RuntimeBundle) -> Vec<ToolDefinition> {
|
||||
fn tool_definitions(&self, bundle: &RuntimeBundle) -> Vec<ToolDef> {
|
||||
bundle.tool_registry.definitions()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user