feat: show active task count in /status output
This commit is contained in:
committed by
Xubin Ren
parent
b60e8dc0ba
commit
634f4b45c1
@@ -74,6 +74,12 @@ async def cmd_status(ctx: CommandContext) -> OutboundMessage:
|
||||
search_usage_text = usage.format()
|
||||
except Exception:
|
||||
pass # Never let usage fetch break /status
|
||||
active_tasks = loop._active_tasks.get(ctx.key, [])
|
||||
task_count = sum(1 for t in active_tasks if not t.done())
|
||||
try:
|
||||
task_count += loop.subagents.get_running_count_by_session(ctx.key)
|
||||
except Exception:
|
||||
pass
|
||||
return OutboundMessage(
|
||||
channel=ctx.msg.channel,
|
||||
chat_id=ctx.msg.chat_id,
|
||||
@@ -84,6 +90,7 @@ async def cmd_status(ctx: CommandContext) -> OutboundMessage:
|
||||
session_msg_count=len(session.get_history(max_messages=0)),
|
||||
context_tokens_estimate=ctx_est,
|
||||
search_usage_text=search_usage_text,
|
||||
active_task_count=task_count,
|
||||
),
|
||||
metadata={**dict(ctx.msg.metadata or {}), "render_as": "text"},
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user