openclaw-agent-dashboard 1.0.32 → 1.0.34

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -591,6 +591,10 @@ async def get_collaboration():
591
591
  main_error = _get_agent_error_info(main_agent_id)
592
592
  main_stuck = _check_agent_stuck(main_agent_id)
593
593
 
594
+ main_ct = main_current_task if main_current_task else None
595
+ if main_status == 'idle':
596
+ main_ct = None
597
+
594
598
  main_agent = CollaborationNode(
595
599
  id=main_agent_id,
596
600
  type="agent",
@@ -598,7 +602,7 @@ async def get_collaboration():
598
602
  status=main_status,
599
603
  timestamp=int(__import__('time').time() * 1000),
600
604
  metadata=agent_models.get(main_agent_id),
601
- currentTask=main_current_task if main_current_task else None,
605
+ currentTask=main_ct,
602
606
  error=main_error,
603
607
  stuckWarning=main_stuck
604
608
  )
@@ -624,6 +628,9 @@ async def get_collaboration():
624
628
  current_task = _clean_task_name(run.get('task', ''))
625
629
  break
626
630
 
631
+ if status == 'idle':
632
+ current_task = ''
633
+
627
634
  # 获取错误和卡顿信息
628
635
  error_info = _get_agent_error_info(agent_id)
629
636
  stuck_info = _check_agent_stuck(agent_id)
@@ -8,7 +8,7 @@ sys.path.append(str(Path(__file__).parent.parent))
8
8
 
9
9
  import logging
10
10
  import time
11
- from typing import Literal, Dict, Any, List, Optional
11
+ from typing import Literal, Dict, Any, List
12
12
  from data.config_reader import get_agents_list, get_agent_config, get_main_agent_id
13
13
  from data.subagent_reader import is_agent_working, get_agent_runs
14
14
  from data.session_reader import (
@@ -108,8 +108,10 @@ def get_agents_with_status() -> list:
108
108
  agent_id = agent.get('id')
109
109
  status = calculate_agent_status(agent_id)
110
110
 
111
- # 获取当前任务
111
+ # 获取当前任务(仅工作中展示;空闲时不应残留已结束 run 的文案)
112
112
  current_task = get_current_task(agent_id)
113
+ if status == 'idle':
114
+ current_task = ''
113
115
 
114
116
  # 获取最后活跃时间
115
117
  last_active = get_last_active_time(agent_id)
@@ -133,13 +135,13 @@ def get_agents_with_status() -> list:
133
135
  def get_current_task(agent_id: str) -> str:
134
136
  """
135
137
  获取 Agent 当前任务描述。
136
- 优先 subagents/runs.json 中该 Agent 作为执行者的记录。
137
- 子 Agent 任务仅来自 runs(业务上不存在「仅有会话、无 run」的工作态)。
138
- 主 Agent 无 run 时不从会话摘 user 文案(user 提示常驻会话尾部,易被当成「当前任务」)。
138
+ 仅从未结束的 run(endedAt 为空)读取;已结束的 run 只代表历史,不应在空闲时仍当「当前任务」展示。
139
139
  """
140
- runs = get_agent_runs(agent_id, limit=1)
141
- if runs:
142
- task = runs[0].get('task', '') or ''
140
+ runs = get_agent_runs(agent_id, limit=40)
141
+ for run in runs:
142
+ if run.get('endedAt') is not None:
143
+ continue
144
+ task = run.get('task', '') or ''
143
145
  if len(task) > 60:
144
146
  task = task[:57] + '...'
145
147
  return task
@@ -376,6 +378,8 @@ async def get_changed_agents() -> List[Dict[str, Any]]:
376
378
  # 计算状态(会使用缓存)
377
379
  status = calculate_agent_status(agent_id)
378
380
  current_task = get_current_task(agent_id)
381
+ if status == 'idle':
382
+ current_task = ''
379
383
  last_active = get_last_active_time(agent_id)
380
384
  last_error = get_last_error(agent_id) if status == 'down' else None
381
385