feat(subagent): add session-owned task messaging and cancellation (#5985)

let's go!
This commit is contained in:
chengyongru authored and GitHub committed 2026-10-05 05:16:33 +08:00
1 parent f75470e72f
commit 6ff96f2a8f
93 files changed
+5632 -1156

No files matched your search

+8 -8
View File
@@ -95,7 +95,7 @@ def test_discover_finds_concrete_tools():
assert "CliAppsTool" in class_names
assert "MessageTool" in class_names
assert "MyTool" in class_names
assert "SpawnTool" in class_names
assert "SubagentTool" in class_names
assert "ExecSessionTool" in class_names
@@ -209,7 +209,7 @@ def test_fs_tool_create_respects_sandbox():
assert tool._allowed_dir == Path("/tmp/test")
# --- Task 5: MessageTool, SpawnTool, CronTool ---
# --- Message, subagent, and cron tool factories ---
async def test_message_tool_create():
@@ -221,13 +221,13 @@ async def test_message_tool_create():
assert isinstance(tool, MessageTool)
def test_spawn_tool_create():
from nanobot.agent.tools.spawn import SpawnTool
def test_subagent_tool_create():
from nanobot.agent.tools.subagent import SubagentTool
mock_mgr = MagicMock()
mock_config = MagicMock()
ctx = ToolContext(config=mock_config, workspace="/tmp", subagent_manager=mock_mgr)
tool = SpawnTool.create(ctx)
assert isinstance(tool, SpawnTool)
tool = SubagentTool.create(ctx)
assert isinstance(tool, SubagentTool)
def test_cron_tool_enabled_without_service():
@@ -407,7 +407,7 @@ def test_mcp_wrappers_not_discoverable():
# --- Task 10: Integration test ---
def test_loader_registers_same_tools_as_old_hardcoded():
def test_loader_registers_builtin_tools():
"""Verify the loader produces the same tool set as the old _register_default_tools."""
from nanobot.agent.tools.loader import ToolLoader
from nanobot.agent.tools.registry import ToolRegistry
@@ -448,7 +448,7 @@ def test_loader_registers_same_tools_as_old_hardcoded():
"read_file", "write_file", "edit_file", "list_dir",
"exec", "exec_session", "list_exec_sessions",
"web_search", "web_fetch",
"message", "spawn", "cron",
"message", "subagent", "cron",
"my",
}
actual = set(registered)