terminate_sub_agent 彻底化: - 通过 _sub_agent_instances 找到活实例直接 cancel 其 _task(原实现只查 _running_tasks,多 manager 并存时拿不到句柄导致 cancel 未送达) - 实例置 _cancelled 并从注册表移除,防止 inject 找到活实例直接复活 - MultiAgentState 同步标记 terminated(原实现不写,侧边栏一直显示 idle) - output.json 改写为 terminated 终态快照(原实现保留陈旧 idle 快照, 会被 _check_task_status 读回复活任务记录) - 新增 control.json 跨 manager 击杀/软停止信号通道,子智能体运行循环 每个 idle tick / 每轮开始自行消费 注入/复活路径拒绝终结者: - inject_message_to_sub_agent 检查最新任务记录,terminated 拒绝注入并 清理孤儿实例;_revive_sub_agent 排除 terminated 记录 - send_message_to_sub_agent 工具返回明确的'已被终结'错误 - stop_sub_agent / soft_stop_all_agents 跳过 terminated,本地无实例时 经 control.json 让对端 manager 上的实例自行软停止 terminated 吸收态防护: - _check_task_status/_handle_running_snapshot 不再用陈旧快照覆盖终结记录 - output.json 为 terminated 时同步本地记录(跨 manager 终结广播) - reconcile_task_states 的 idle/running 修正跳过终态任务 - MultiAgentState.mark_status 禁止 terminated 被覆盖回 idle/running - 硬取消路径 output.json 写 terminated 而非 failed,避免 failed 被复活 |
||
|---|---|---|
| .. | ||
| __init__.py | ||
| creation.py | ||
| manager.py | ||
| prompts.py | ||
| state.py | ||
| stats.py | ||
| task.py | ||
| toolkit.py | ||
| tools.py | ||