feat(tools): planner 默认绑定 list_assets
新库经 PlannerTools() 并入 list_assets 绑定;老库由 seedPlannerListAssetsBinding() 一次性回填(flag 幂等,不覆盖用户解绑)。 planner 现同时具备 list_assets(DSL 全库检索)与 list_untested_assets(范围内未测)。
This commit is contained in:
1 parent
f29b37c5b1
commit
3d71196774
2 files changed
+21
No files matched your search
@@ -1947,6 +1947,9 @@ func (t *ToolSet) PlannerTools() []actool.CoreTool {
|
||||
t.addFinding(),
|
||||
// list_companies:查看企业列表 + scope + 资产数(拿 company_id / 理解归属范围)。
|
||||
t.listCompanies(),
|
||||
// list_assets:规划时按 DSL 检索全资产库(配合 list_untested_assets 的"范围内未测"视角,
|
||||
// 补上"按域名/指纹/端口/状态码等条件在整库里查"的能力)。
|
||||
t.listAssets(),
|
||||
// add_company_scope:规划时可把域名/IP/CIDR/ICP/关键词纳入某公司的资产范围(自动认领命中资产)。
|
||||
t.addCompanyScope(),
|
||||
// add_task_scope:主动把整根域/整公司/某子域/IP 纳入本任务测试范围(覆盖度分母)。
|
||||
|
||||
@@ -448,6 +448,7 @@ func (s *Server) seedOrchestrationTools() {
|
||||
s.refreshBuiltinToolSchemas()
|
||||
s.seedAutoDefaultBindings()
|
||||
s.seedPlannerDefaultBindings()
|
||||
s.seedPlannerListAssetsBinding()
|
||||
s.seedCompanyScopeRebind()
|
||||
s.seedAutoReportFindingBinding()
|
||||
s.unbindGoalMetDefault()
|
||||
@@ -719,6 +720,23 @@ func (s *Server) seedPlannerDefaultBindings() {
|
||||
_ = s.m.pg.SetSetting(flag, "true")
|
||||
}
|
||||
|
||||
// seedPlannerListAssetsBinding adds "planner" to list_assets's binding ONCE
|
||||
// (guarded by a settings flag), so existing DBs — whose list_assets row was seeded
|
||||
// as auto/pentest-only — also let the planner query the asset store by DSL. Fresh
|
||||
// DBs already get it via PlannerTools(); this only backfills without overriding a
|
||||
// user unbind.
|
||||
func (s *Server) seedPlannerListAssetsBinding() {
|
||||
const flag = "planner_list_assets_v1"
|
||||
if v, _, _ := s.m.pg.GetSetting(flag); v == "true" {
|
||||
return
|
||||
}
|
||||
if err := s.m.pg.AddAgentToToolBinding("planner", []string{"list_assets"}); err != nil {
|
||||
log.Printf("[planner] list_assets 默认绑定失败: %v", err)
|
||||
return
|
||||
}
|
||||
_ = s.m.pg.SetSetting(flag, "true")
|
||||
}
|
||||
|
||||
// seedCompanyScopeRebind changes add_company_scope's default binding ONCE on
|
||||
// existing DBs (guarded by a settings flag): the tool moves off worker and onto
|
||||
// planner — defining a company's asset scope is a planning/main/auto concern, not
|
||||
|
||||
Reference in new issue
Block a user