refactor(beaver): 移除Hermes相关引用和迁移代码,完善Beaver后端主线实现
移除了所有Hermes相关的命名引用,包括: - 从.gitignore中清理相关构建缓存文件 - 将README中的beaver-home路径配置更新 - 完善backend/README.md文档说明Beaver后端主线实现 - 移除Hermes风格的相关注释和兼容性代码 - 清理nanobot环境变量兼容性处理 - 删除技能迁移和服务迁移相关功能代码 - 更新测试用例中相关命名和函数名 BREAKING CHANGE: 移除了Hermes迁移相关API和CLI命令,不再支持nanobot环境变量兼容性
This commit is contained in:
@ -20,6 +20,7 @@ from __future__ import annotations
|
||||
|
||||
from abc import ABC, abstractmethod
|
||||
from dataclasses import dataclass, field
|
||||
import inspect
|
||||
import json
|
||||
from typing import Any
|
||||
|
||||
@ -181,9 +182,21 @@ class ObjectBackedTool(BaseTool):
|
||||
arguments["current_session_id"] = context.session_id
|
||||
if "workspace" not in arguments and hasattr(self.backend, "workspace"):
|
||||
arguments["workspace"] = context.workspace
|
||||
if "metadata" not in arguments:
|
||||
if "metadata" not in arguments and self._backend_accepts_argument("metadata"):
|
||||
arguments["metadata"] = context.metadata
|
||||
|
||||
def _backend_accepts_argument(self, name: str) -> bool:
|
||||
try:
|
||||
signature = inspect.signature(self.backend.execute)
|
||||
except (TypeError, ValueError):
|
||||
return False
|
||||
for parameter in signature.parameters.values():
|
||||
if parameter.kind == inspect.Parameter.VAR_KEYWORD:
|
||||
return True
|
||||
if parameter.name == name:
|
||||
return True
|
||||
return False
|
||||
|
||||
@staticmethod
|
||||
def _normalize_output(content: Any) -> dict[str, Any]:
|
||||
"""把后端工具返回值转成统一 success/content/error 语义。
|
||||
|
||||
@ -33,7 +33,7 @@ CRON_TOOL_PARAMETERS: dict[str, Any] = {
|
||||
},
|
||||
"schedule": {
|
||||
"type": "string",
|
||||
"description": "Hermes-style schedule, for example 'every 15m', '0 9 * * *', or an ISO datetime.",
|
||||
"description": "Schedule expression, for example 'every 15m', '0 9 * * *', or an ISO datetime.",
|
||||
},
|
||||
"every_seconds": {
|
||||
"type": "integer",
|
||||
|
||||
@ -59,7 +59,7 @@ def memory_tool(
|
||||
old_text: str | None = None,
|
||||
store: MemoryStore | None = None,
|
||||
) -> str:
|
||||
"""分发 Hermes 风格的 CRUD memory API,并返回 JSON 字符串。
|
||||
"""分发 CRUD memory API,并返回 JSON 字符串。
|
||||
|
||||
这里统一采用 JSON 返回,是为了兼容常见 tool-calling 场景:
|
||||
- LLM 更容易消费结构化结果
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
"""Beaver 内置 session_search tool。
|
||||
|
||||
这个工具对应 Hermes-agent 的跨会话检索能力,目标不是把所有历史内容塞回主上下文,
|
||||
这个工具提供跨会话检索能力,目标不是把所有历史内容塞回主上下文,
|
||||
而是按需从过去的 session 中找回“之前发生过什么”。
|
||||
|
||||
当前实现保留了几个关键行为:
|
||||
@ -28,7 +28,7 @@ class SessionSearchDB(Protocol):
|
||||
"""session_search 依赖的最小数据库契约。
|
||||
|
||||
这里没有直接绑定某个具体 SQLite 实现,而是先定义行为接口。
|
||||
这样后面无论你接的是 Hermes 风格 state DB、还是 Beaver 自己的 transcript store,
|
||||
这样后面无论你接的是当前 SQLite state DB、还是其他 transcript store,
|
||||
只要满足这些方法就能工作。
|
||||
"""
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
"""Beaver 内置 skill_view tool。
|
||||
|
||||
这个工具对应 Hermes 风格的显式 skill loading path:
|
||||
这个工具对应显式 skill loading path:
|
||||
1. skill 正文默认不会长期塞进 system prompt
|
||||
2. 模型若想查看某个 skill 的完整正文或支持文件,必须显式调用 `skill_view`
|
||||
|
||||
|
||||
Reference in New Issue
Block a user