ARTEX - AI autonomous penetration testing system (English translation; upstream: Autumn-27/ARTEX, AGPL-3.0)
Go aiai-agentsautonomous-agentsbug-bountydockergolanglinuxllmmcpnextjspenetration-testingpentestpostgresqlreareactred-teamsecuritysecurity-automationsqlitetypescript
feat(tasks): 任务列表新增「运行中 Worker」列
Autumn-2757fa1dba3a9a
diff --git a/db/exploration.go b/db/exploration.goindex c90a290..a23792c 100644--- a/db/exploration.go+++ b/db/exploration.go@@ -1064,9 +1064,10 @@ type GoalCounts struct{ Total, Met int }// TaskListMetrics contains the aggregates rendered in task lists.type TaskListMetrics struct {- Tokens TokenUsage- LastActivity int64- Goals GoalCounts+ Tokens TokenUsage+ LastActivity int64+ Goals GoalCounts+ RunningIntents int // kind='intent' 且 state='running' 的条数,即运行中 Worker 数}// TaskListMetricsAll returns list aggregates for every live task in one query.@@ -1081,7 +1082,8 @@ func (d *DB) TaskListMetricsAll() (map[int64]TaskListMetrics, error) {COALESCE(token_metrics.cache_write_tokens,0),COALESCE(latest_activity.created_at,0),COALESCE(goal_metrics.total,0),- COALESCE(goal_metrics.met,0)+ COALESCE(goal_metrics.met,0),+ COALESCE(intent_metrics.running,0)FROM tasks taskLEFT JOIN LATERAL (SELECT SUM(input_tokens) AS input_tokens,@@ -1104,6 +1106,11 @@ func (d *DB) TaskListMetricsAll() (map[int64]TaskListMetrics, error) {FROM exploration_nodesWHERE exploration_id=task.exploration_id AND kind='goal') goal_metrics ON true+ LEFT JOIN LATERAL (+ SELECT COUNT(*) AS running+ FROM exploration_nodes+ WHERE exploration_id=task.exploration_id AND kind='intent' AND state='running'+ ) intent_metrics ON trueWHERE task.deleted_at IS NULL`)if err != nil {return nil, err@@ -1122,6 +1129,7 @@ func (d *DB) TaskListMetricsAll() (map[int64]TaskListMetrics, error) {&metrics.LastActivity,&metrics.Goals.Total,&metrics.Goals.Met,+ &metrics.RunningIntents,); err != nil {return nil, err}diff --git a/server/dto.go b/server/dto.goindex 596b808..2c77971 100644--- a/server/dto.go+++ b/server/dto.go@@ -50,6 +50,7 @@ type TaskDTO struct {Tokens TokenTotalDTO `json:"tokens"` // whole-task token consumptionGoalsTotal int `json:"goals_total"`GoalsMet int `json:"goals_met"`+ InFlight int `json:"in_flight"` // 运行中 Worker 数(state=running 的意图)LLMProfileID *int64 `json:"llm_profile_id,omitempty"` // LLM profile used for this task; nil = defaultLLMProfileIDs []int64 `json:"llm_profile_ids"`ActiveLLMProfileID *int64 `json:"active_llm_profile_id,omitempty"`diff --git a/server/server.go b/server/server.goindex 6fc4354..7abf506 100644--- a/server/server.go+++ b/server/server.go@@ -1064,6 +1064,7 @@ func (s *Server) listTasks(w http.ResponseWriter, r *http.Request) {}dto.GoalsTotal = metric.Goals.Totaldto.GoalsMet = metric.Goals.Met+ dto.InFlight = metric.RunningIntentsdtos = append(dtos, dto)}writeJSON(w, 200, map[string]any{"tasks": dtos, "active": active})diff --git a/web/src/app/(main)/function/tasks/page.tsx b/web/src/app/(main)/function/tasks/page.tsxindex 3eaac38..a5637bf 100644--- a/web/src/app/(main)/function/tasks/page.tsx+++ b/web/src/app/(main)/function/tasks/page.tsx@@ -948,6 +948,7 @@ export default function TasksPage() {onSort={sortTasksBy}/><TableHead className="text-center">目标进度</TableHead>+ <TableHead className="text-center">运行中 Worker</TableHead><SortableTaskHeadfield="created"label="创建时间"@@ -1210,6 +1211,13 @@ const TaskRow = React.memo(function TaskRow({<span className="text-muted-foreground">—</span>)}</TableCell>+ <TableCell className="text-center text-xs tabular-nums">+ {task.in_flight && task.in_flight > 0 ? (+ <span className="text-foreground font-medium">{task.in_flight}</span>+ ) : (+ <span className="text-muted-foreground">0</span>+ )}+ </TableCell><TableCell className="text-muted-foreground text-right text-xs whitespace-nowrap tabular-nums">{fmtDateTime(task.created_unix)}</TableCell>