feat: set_goals 升级为受管领域工具(可 web 管理,默认绑 goals+mainagent)+ 主 agent 加目标复活任务

- set_goals 从目标拆解器内联提交工具,改为入 tools 目录的领域工具:直接写 goal 节点、
  连任务根(RelSpawns)、notify 唤醒 planner;支持单条/批量;origin 按来源区分
  (拆解器=goals、主 agent 运行时=human)。新 key 走 SeedTool 首插入,旧库无需迁移。
- 默认绑定 goals + mainagent:目录 seed 新增 goals 项并入 order,MainAgentTools 纳入;
  DecomposeGoals 统一改用同一受管工具直接落库,createGoals 只保留无产出兜底。
- 主 agent 通过 set_goals 新增目标时,把终态(done/failed/timeout)/暂停的任务拉回
  running 继续跑:新增 ToolSet.resumeTask 回调(仅 mainagent 接线),经 resumeTaskForGoal
  置 running + engine.Run(幂等/重启后重起循环)+ 解除暂停。拆解器/worker 不触发。
- mainagent 提示词补充 set_goals 用法。
This commit is contained in:
Autumn-27 committed 2026-08-17 09:01:19 -04:00
1 parent 1029c4a84c
commit 2ac176b96a
7 files changed
+184 -45

No files matched your search

+4 -1
View File
@@ -37,6 +37,9 @@ func builtinToolsByAgent() map[string][]actool.CoreTool {
"mainagent": ts.MainAgentTools(),
"planner": ts.PlannerTools(),
"worker": ts.WorkerTools(),
// goals(目标拆解器)默认绑 set_goals:它靠这个工具把拆出的目标写进图。
// 与 mainagent 共用同一受管工具,web 端可改描述/schema、按 agent 勾选。
"goals": {ts.setGoals()},
// auto 默认绑漏洞上报 + 资产管理工具,其他域工具可在 UI 按需勾选。
// 新库由此 seed 写入;老库由 seedAutoDefaultBindings 迁移。
"auto": {ts.addFinding(), ts.insertAssets(), ts.addCompanyScope(), ts.listAssets(), ts.listCompanies()},
@@ -50,7 +53,7 @@ func builtinToolsByAgent() map[string][]actool.CoreTool {
// list_assets 三者都有)合成一条,Agents 取并集。顺序稳定(mainagent→planner→worker)。
func BuiltinToolSeeds() []ToolSeed {
byAgent := builtinToolsByAgent()
order := []string{"mainagent", "planner", "worker", "auto", "pentest"}
order := []string{"mainagent", "goals", "planner", "worker", "auto", "pentest"}
type acc struct {
tool actool.CoreTool