agent-Specialization/modules
JOJO 811974d6e7 feat(multi-agent): 在现有架构上直接实现多智能体模式实验功能
放弃完全隔离策略,改为在现有 MainTerminal/SubAgentManager/SubAgentTask 主链路
按对话级开关 metadata.multi_agent_mode=true 增加多智能体分支。

新增模块:
- modules/multi_agent/__init__.py: 模块入口
- modules/multi_agent/role_store.py: 角色 Markdown Frontmatter 解析与归档
- modules/multi_agent/state.py: 多智能体会话状态机与消息格式化
- modules/multi_agent/prompts.py: 主智能体(Team Leader) + 子智能体提示词
- modules/multi_agent/tools.py: 9 个主智能体工具 + 4 个子智能体工具定义
- server/multi_agent.py: /multiagent/new 页面 + /api/multiagent/* 蓝图

现有代码改动:
- modules/sub_agent/task.py: 扩展 multi_agent_mode/multi_agent_state/display_name 字段,
  增加 ask_master/ask_other_agent/answer_other_agent/list_active_sub_agents 工具处理逻辑,
  子智能体自然结束 assistant 输出即本轮结束(不调用 finish_task),上下文保留。
- modules/sub_agent/manager.py: create_sub_agent 增加 multi_agent_mode/role_id/display_name 参数,
  增加 get_or_create_multi_agent_state/get_multi_agent_state/inject_message_to_sub_agent/_on_multi_agent_task_done 方法。
- core/main_terminal_parts/tools_definition/agent_tools.py: 多智能体模式下用 modules.multi_agent.tools 替换旧版工具集。
- core/main_terminal_parts/context/messages.py: 多智能体模式下追加 Team Leader 系统提示词。
- core/main_terminal_parts/tools_execution.py: create_sub_agent handler 增加多智能体分支,新增 send_message_to_sub_agent/ask_sub_agent/answer_sub_agent_question/create_custom_agent/list_agents/list_active_sub_agents handler。
- core/web_terminal.py: load_conversation 时检测 metadata.multi_agent_mode 设置 self.multi_agent_mode。
- server/app_legacy.py: 注册 multi_agent_bp 蓝图。

前端改动:
- static/src/auth/LoginApp.vue: 登录页增加'多智能体模式(beta)'按钮
- static/src/app/methods/ui/route.ts: 识别 /multiagent/new 和 /multiagent/conv_xxx 路径,进入多智能体模式并创建带 metadata.multi_agent_mode=true 的对话
- static/src/app/state.ts: 增加 multiAgentMode 状态字段

数据:
- ~/.astrion/astrion/host/mutiagents/agents/: 4 个预置角色 ui-operator / full-stack-engineer / code-reviewer / researcher
- ~/.astrion/astrion/host/mutiagents/conversations/: 会话数据

验证:所有 Python 文件语法检查通过;冒烟测试 test.test_server_refactor_smoke 6 项全通过;前端构建通过(6.04s);模块导入与功能断言测试全部通过。
2026-07-12 03:26:02 +08:00
..
__pycache__ <fix thinking chunk> 2025-11-19 20:47:56 +08:00
file_manager feat(versioning): 重构版本控制为对话级浅备份 + 可选完全备份 2026-07-07 12:07:44 +08:00
mcp_client_manager fix(mcp_client_manager): restore missing imports and dataclass decorators after split 2026-06-25 11:56:19 +08:00
multi_agent feat(multi-agent): 在现有架构上直接实现多智能体模式实验功能 2026-07-12 03:26:02 +08:00
persistent_terminal fix(frontend): 修复刷新后AI等待提示与终端侧边栏重复问题 2026-06-22 20:35:00 +08:00
sub_agent feat(multi-agent): 在现有架构上直接实现多智能体模式实验功能 2026-07-12 03:26:02 +08:00
terminal_ops fix(terminal_ops): ssh 远程命令中避免重写 /Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/bin/python3.9/pip 路径 2026-06-24 17:33:12 +08:00
admin_policy_manager.py fix(mcp): split categories by server and preserve toggle states 2026-04-27 01:42:40 +08:00
api_user_manager.py refactor(paths): 统一迁移运行态数据路径到 Astrion 命名空间 2026-07-10 00:35:15 +08:00
approval_agent.py refactor(paths): 统一迁移运行态数据路径到 Astrion 命名空间 2026-07-10 00:35:15 +08:00
auto_approval_service.py fix(permission,docker): enforce docker-specific approval flow and polish permission menu layout 2026-05-11 22:56:10 +08:00
background_command_manager.py feat: 宿主机模式网络沙箱 2026-06-19 00:22:30 +08:00
balance_client.py refactor(config): 统一配置源,迁移数据到 ~/.agents/agents/ 2026-06-13 21:37:02 +08:00
container_file_proxy.py fix(prompt): merge disabled-tool notice into leading system prompts 2026-05-09 18:56:49 +08:00
container_monitor.py docs: refresh readme and phase2 summary 2025-11-23 21:24:09 +08:00
custom_tool_executor.py refactor: remove run_python tool, consolidate all execution to run_command 2026-06-07 16:23:01 +08:00
custom_tool_registry.py feat: add custom tools guide and id validation 2026-01-05 21:46:55 +08:00
easter_egg_manager.py feat: modularize easter egg effects 2025-11-22 13:07:54 +08:00
goal_review_agent.py refactor(paths): 统一迁移运行态数据路径到 Astrion 命名空间 2026-07-10 00:35:15 +08:00
goal_state_manager.py feat(goal): add autonomous goal mode workflow 2026-05-30 12:51:42 +08:00
gui_file_manager.py chore: initial import 2025-11-14 16:44:12 +08:00
host_sandbox_policy.py refactor(paths): 统一迁移运行态数据路径到 Astrion 命名空间 2026-07-10 00:35:15 +08:00
host_sandbox_runner.py feat(sandbox): macOS host sandbox deny-list for sensitive paths 2026-07-09 16:25:04 +08:00
host_workspace_manager.py feat: support setting default workspace/project from frontend 2026-06-19 21:48:24 +08:00
mcp_server_registry.py fix(mcp): split categories by server and preserve toggle states 2026-04-27 01:42:40 +08:00
memory_manager.py feat: index-based memory tool with append/replace/delete 2025-12-14 17:56:18 +08:00
ocr_client.py fix: allow WebTerminal init without OCR API key (openai>=2.40 requires key) 2026-06-19 01:35:39 +08:00
personalization_manager.py feat(ui): 极简模式展开高度限制开关与个人空间持久化 2026-07-11 19:58:35 +08:00
search_engine.py fix(search): 移除 web_search 的 Tavily AI 摘要 2026-06-22 00:18:29 +08:00
shallow_versioning.py fix(versioning): 修复浅备份文件修改归属错误及列表/详情不一致 2026-07-09 18:45:40 +08:00
skill_hint_manager.py chore: add docs and remove sub_agent 2026-03-17 22:46:43 +08:00
skills_manager.py refactor(paths): 统一迁移运行态数据路径到 Astrion 命名空间 2026-07-10 00:35:15 +08:00
terminal_manager.py fix(frontend): 修复刷新后AI等待提示与终端侧边栏重复问题 2026-06-22 20:35:00 +08:00
todo_manager.py feat: support batch todo updates 2026-01-30 18:50:02 +08:00
tool_approval_manager.py feat(permission): add auto-approval mode with approval agent, UI flow, and docs sync 2026-05-11 17:55:27 +08:00
toolbox_container.py refactor: remove run_python tool, consolidate all execution to run_command 2026-06-07 16:23:01 +08:00
upload_security.py feat: add upload quarantine scanning and ui toasts 2025-11-24 14:31:13 +08:00
usage_tracker.py fix: improve api error diagnostics and raise model quotas 2026-03-06 17:02:19 +08:00
user_container_manager.py feat(security): harden host execution model with sandbox/direct controls 2026-05-10 19:19:01 +08:00
user_manager.py feat: support setting default workspace/project from frontend 2026-06-19 21:48:24 +08:00
user_question_manager.py feat: add blocking user question tool 2026-05-28 16:30:55 +08:00
versioning_manager.py refactor(paths): 统一迁移运行态数据路径到 Astrion 命名空间 2026-07-10 00:35:15 +08:00
webpage_extractor.py chore: initial import 2025-11-14 16:44:12 +08:00