feat(bench): 起题前按 host 清旧资产防跨题污染 + 提示词补 CTF 场景/深挖引导 + v2 基准脚手架

- scheduler: create_task 前调 delete_assets_by_host,清复用 IP 上旧题残留(级联删 service/endpoint)
- planner/worker prompt: 标注 CTF 场景;planner 补否定结论时的深挖自省
- kali_tools: 补预装 python 库说明 + 无网/找命令提示
- server/goals.go: 抽 launchTask 统一 seed+种子意图+异步目标分解
- 新增 v2 基准: Dockerfile.bench.v2 / entrypoint_v2.sh / seed_v2.sh / tec_benchmark_v2.md
This commit is contained in:
Autumn-27 committed 2026-08-13 12:24:38 -04:00
1 parent c85b2397e8
commit 4c42c70a84
9 files changed
+652 -3

No files matched your search

+31
View File
@@ -2,6 +2,7 @@ package server
import (
"context"
"fmt"
"log"
"strconv"
"strings"
@@ -15,6 +16,36 @@ type goalSpec struct {
VulnClass string
}
// launchTask runs the shared post-creation sequence for a task created via ANY
// path (HTTP createTask 或 orchestration spawn_task),避免两处复制粘贴:
// 1. seed 根资产,喂给事件驱动 loop;
// 2. 可选种子意图,worker 免等首轮 planner 直接开跑;
// 3. 后台异步做目标分解(发「第 0 轮目标拆解」round + LLM 分解步骤 + 逐条 goal,页面可见),
// 分解完再 engine.Run —— 引擎在 goal 节点就绪后才启动,避免 planner 抢在 goal 之前跑的竞态。
//
// 异步(goroutine)所以调用方立即返回,两条路径行为一致:秒建任务、后台拆目标。
func (s *Server) launchTask(t *Task, seedText string, seedFirstIntent bool) {
s.seed(t, seedText)
if seedFirstIntent {
s.seedFirstIntent(t)
}
go func() {
s.engine.emitActivity(t, db.Activity{Worker: "planner", Kind: "round",
Summary: "第 0 轮目标拆解"})
goals := s.createGoals(s.ctx, t, func(r db.Activity) {
s.engine.emitActivity(t, r)
})
for _, g := range goals {
summary := g.Text
if g.VulnClass != "" {
summary = fmt.Sprintf("[%s] %s", g.VulnClass, g.Text)
}
s.engine.emitActivity(t, db.Activity{Worker: "planner", Kind: "text", Summary: summary})
}
s.engine.Run(s.ctx, t)
}()
}
// createGoals materializes the goal node(s) under the task root (rel objective).
// Decomposition is done ENTIRELY by the LLM (the project requires an LLM). There is
// no rule-based fallback splitter — it only ever produced garbage (shredded URLs,