修改了nanobot,往Hermes agent的风格走,进度1/3

This commit is contained in:
2026-04-20 18:11:14 +08:00
parent cdfc222c9f
commit 36882a7d7b
261 changed files with 12659 additions and 604 deletions

View File

@ -0,0 +1,40 @@
from beaver.engine import AgentLoop
from beaver.foundation.events import InboundMessage, MessageBus, OutboundMessage
from beaver.interfaces.gateway.main import run_gateway
from beaver.interfaces.web.app import create_app
from beaver.interfaces.web.schemas import WebChatRequest, WebChatResponse
def test_agent_loop_boots() -> None:
loop = AgentLoop()
loaded = loop.boot()
assert "echo" in loaded.tools
assert "memory" in loaded.tools
assert "session_search" in loaded.tools
def test_web_app_factory() -> None:
app = create_app()
assert app.title == "Beaver Backend"
def test_gateway_entry_imports() -> None:
assert callable(run_gateway)
def test_message_bus_imports() -> None:
bus = MessageBus()
assert isinstance(bus, MessageBus)
assert InboundMessage(channel="test", content="hello").channel == "test"
assert OutboundMessage(channel="test", content="ok", session_id=None, finish_reason="stop").content == "ok"
def test_web_schema_imports() -> None:
assert WebChatRequest(message="hello").message == "hello"
assert WebChatResponse(
session_id="s",
run_id="r",
output_text="ok",
finish_reason="stop",
tool_iterations=0,
).output_text == "ok"