From 349b0d104dcf56d0dbc9ce6f62493c87fd1da1aa Mon Sep 17 00:00:00 2001 From: Autumn-27 <53844290+Autumn-27@users.noreply.github.com> Date: Fri, 7 Aug 2026 10:04:21 -0400 Subject: [PATCH] =?UTF-8?q?feat(agent):=20=E4=B8=BB=20agent=20=E9=BB=98?= =?UTF-8?q?=E8=AE=A4=E5=B7=A5=E5=85=B7=E9=9B=86=E5=A2=9E=E5=8A=A0=20report?= =?UTF-8?q?=5Ffinding/record=5Ffact?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - MainAgentTools 加入 addFinding/recordFact,主 agent 确证漏洞或事实时可直接登记 - report_finding 描述前置[重要]标注,强化调用约束 - gofmt 对齐 tools_insert 参数缩进与 import 顺序 Co-Authored-By: Claude Opus 5 (1M context) --- agent/tools.go | 2 +- agent/tools_insert.go | 15 ++++++++------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/agent/tools.go b/agent/tools.go index f30cdd5..52c9fbe 100644 --- a/agent/tools.go +++ b/agent/tools.go @@ -575,7 +575,7 @@ func (t *ToolSet) goalMet() actool.CoreTool { // --- worker write tools --- func (t *ToolSet) addFinding() actool.CoreTool { - return writeTool("report_finding", "发现漏洞时必须调用该工具!记录一个确认的漏洞发现。在任务上下文中 intent_id 必填(当前正在执行的意图 id);在会话上下文中 intent_id 可不填。", + return writeTool("report_finding", "[重要]发现漏洞时必须调用该工具进行记录!记录一个确认的漏洞发现。在任务上下文中 intent_id 必填(当前正在执行的意图 id);在会话上下文中 intent_id 可不填。", obj(map[string]any{ "vulnclass": str("漏洞类"), "severity": str("high|medium|low"), diff --git a/agent/tools_insert.go b/agent/tools_insert.go index f1df3b0..5ecff98 100644 --- a/agent/tools_insert.go +++ b/agent/tools_insert.go @@ -5,8 +5,8 @@ import ( "encoding/json" "strings" - actool "github.com/Autumn-27/norma/tool" "github.com/Autumn-27/artex/db" + actool "github.com/Autumn-27/norma/tool" ) // ===================================================================== @@ -90,16 +90,16 @@ func (t *ToolSet) insertAssets() actool.CoreTool { "description": "资产类型", }, // root_domain / subdomain - "domain": str("根域名或子域名(root_domain/subdomain 必填)"), - "icp": str("ICP 备案号(可选)"), - "record_type": str("DNS 解析类型:A/AAAA/CNAME/MX 等(subdomain 可选)"), + "domain": str("根域名或子域名(root_domain/subdomain 必填)"), + "icp": str("ICP 备案号(可选)"), + "record_type": str("DNS 解析类型:A/AAAA/CNAME/MX 等(subdomain 可选)"), "record_value": map[string]any{ "type": "array", "items": map[string]any{"type": "string"}, "description": "DNS 解析值列表(subdomain 可选,如 [\"1.2.3.4\",\"2.3.4.5\"])", }, // ip - "ip": str("IP 地址(ip 类型必填;service/endpoint 类型可填,用于关联 IP)"), + "ip": str("IP 地址(ip 类型必填;service/endpoint 类型可填,用于关联 IP)"), "bound_domains": map[string]any{ "type": "array", "items": map[string]any{"type": "string"}, @@ -121,8 +121,8 @@ func (t *ToolSet) insertAssets() actool.CoreTool { "app_icp": str("应用 ICP 备案(可选)"), "company_id": intp("归属企业 id(app 类型可选;app 无法靠 scope 自动归因,需显式指定。id 由 add_company_scope 返回)"), // service (http) - "url": str("完整 URL,含协议和端口(HTTP 服务必填;service_type 自动设为 http)"), - "status_code": intp("HTTP 响应状态码,如 200/301/403/404(可选)"), + "url": str("完整 URL,含协议和端口(HTTP 服务必填;service_type 自动设为 http)"), + "status_code": intp("HTTP 响应状态码,如 200/301/403/404(可选)"), "content_length": map[string]any{ "type": "integer", "description": "HTTP 响应体字节数(可选)", @@ -489,6 +489,7 @@ func (t *ToolSet) MainAgentTools() []actool.CoreTool { t.getWorkerOutput(), t.getWorkerTrace(), t.searchAllWorkerTraces(), t.addHint(), t.addIntent(), // asset management (handlers guard nil store internally) t.insertAssets(), t.addCompanyScope(), t.listAssets(), + t.addFinding(), t.recordFact(), } }