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:
@ -1,5 +1,4 @@
|
||||
import json
|
||||
from pathlib import Path
|
||||
|
||||
from beaver.engine import AgentLoop, EngineLoader
|
||||
from beaver.engine.providers import make_provider_bundle
|
||||
@ -139,9 +138,36 @@ def test_openai_compatible_qwen_config_keeps_openai_provider() -> None:
|
||||
assert bundle.main_provider._resolve_model("qwen-plus") == "openai/qwen-plus"
|
||||
|
||||
|
||||
def test_load_config_reads_stevenli_mcp_authz_identity() -> None:
|
||||
repo_root = Path(__file__).resolve().parents[4]
|
||||
config_path = repo_root / "app-instance" / "runtime" / "instances" / "stevenli" / "nanobot-home" / "config.json"
|
||||
def test_load_config_reads_mcp_authz_identity(tmp_path) -> None:
|
||||
config_path = tmp_path / "beaver-home" / "config.json"
|
||||
config_path.parent.mkdir()
|
||||
config_path.write_text(
|
||||
json.dumps(
|
||||
{
|
||||
"tools": {
|
||||
"mcpServers": {
|
||||
"outlook_mcp": {
|
||||
"url": "http://10.6.80.29:8000/mcp",
|
||||
"authMode": "oauth_backend_token",
|
||||
"authAudience": "mcp:outlook_mcp",
|
||||
"authScopes": ["list_tools", "tool:mail_list_messages"],
|
||||
"toolTimeout": 60,
|
||||
"sensitive": True,
|
||||
}
|
||||
}
|
||||
},
|
||||
"authz": {
|
||||
"enabled": True,
|
||||
"baseUrl": "http://nano-authz-service:19090",
|
||||
},
|
||||
"backend_identity": {
|
||||
"backend_id": "stevenli",
|
||||
"client_id": "stevenli",
|
||||
},
|
||||
}
|
||||
),
|
||||
encoding="utf-8",
|
||||
)
|
||||
config = load_config(config_path=config_path)
|
||||
|
||||
server = config.tools.mcp_servers["outlook_mcp"]
|
||||
|
||||
@ -6,7 +6,7 @@ from beaver.tools.builtins import CronTool
|
||||
from beaver.services.cron_service import CronService, compute_next_run, parse_schedule, schedule_from_api
|
||||
|
||||
|
||||
def test_parse_hermes_style_schedules() -> None:
|
||||
def test_parse_schedule_expressions() -> None:
|
||||
interval = parse_schedule("every 15m")
|
||||
assert interval.kind == "every"
|
||||
assert interval.every_ms == 15 * 60 * 1000
|
||||
|
||||
@ -1,13 +1,11 @@
|
||||
import asyncio
|
||||
import io
|
||||
import json
|
||||
import zipfile
|
||||
from types import SimpleNamespace
|
||||
|
||||
import pytest
|
||||
|
||||
from beaver.interfaces.web.app import _create_skill_upload_draft
|
||||
from beaver.services.hermes_migration import HermesMigrationService
|
||||
from beaver.services.skillhub_service import SkillHubService
|
||||
from beaver.skills.drafts import DraftService
|
||||
from beaver.skills.specs import SkillSpecStore
|
||||
@ -101,27 +99,6 @@ def test_upload_skill_zip_keeps_supporting_files_on_draft(tmp_path):
|
||||
assert upload_dir.endswith(draft["draft_id"])
|
||||
|
||||
|
||||
def test_hermes_migration_manifest_includes_no_credential_skill_and_skips_api_skill(tmp_path):
|
||||
repo = tmp_path / "hermes"
|
||||
safe = repo / "skills" / "safe"
|
||||
unsafe = repo / "skills" / "unsafe"
|
||||
safe.mkdir(parents=True)
|
||||
unsafe.mkdir(parents=True)
|
||||
safe.joinpath("SKILL.md").write_text("---\nname: safe\n---\nUse local files only.\n", encoding="utf-8")
|
||||
unsafe.joinpath("SKILL.md").write_text("---\nname: unsafe\n---\nRequires API_KEY.\n", encoding="utf-8")
|
||||
|
||||
store = SkillSpecStore(tmp_path / "workspace")
|
||||
manifest = HermesMigrationService(store).migrate(repo)
|
||||
included = {item["skill_name"] for item in manifest["included"]}
|
||||
skipped = {item.get("skill_name"): item["reason"] for item in manifest["skipped"]}
|
||||
|
||||
assert "safe" in included
|
||||
assert skipped["unsafe"] == "requires_external_credentials"
|
||||
assert store.get_skill_spec("safe") is not None
|
||||
manifest_path = tmp_path / "workspace" / "hermes_migration_manifest.json"
|
||||
assert json.loads(manifest_path.read_text(encoding="utf-8"))["source"] == "hermes-agent"
|
||||
|
||||
|
||||
def test_mcp_wrapper_metadata_preserves_server_id_with_underscores():
|
||||
tool_def = SimpleNamespace(name="auth_status", description="Auth", inputSchema={"type": "object", "properties": {}})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user