feat(delegation): structured stall metadata + live per-child status in /agents

Completes #51690 on top of the salvaged #60378 timeout metadata:

- async_delegation: terminal 'stalled' events now carry structured
  stall context (stalled_after_quiet_seconds, stall_threshold_seconds,
  stall_phase idle|in_tool, stall_grace_seconds) on both single and
  batch paths, persisted in the durable row so restart-restored events
  keep it. Mirrors the sync path's timeout_seconds/timed_out_after_
  seconds/timeout_phase from #60378.
- list_async_delegations(): exposes seconds_since_progress and live
  children_activity (per-child api_calls, current_tool,
  seconds_since_activity) sampled from the dispatch's progress_fn
  outside the records lock; private monitor bookkeeping and callables
  never leak.
- /agents (CLI + gateway): background delegations render per-child
  activity rows, quiet-time hints, and the stalling state; gateway
  section is new (previously async delegations were invisible there).
  New locale key gateway.agents.background_delegations in all 17
  catalogs.

Tests: stall-metadata event shape, live-listing projection, gateway
/agents rendering (real registry dispatch, sabotage-verified), sync
timeout metadata fields, non-timeout None contract.
This commit is contained in:
teknium1
2026-07-26 16:32:49 -07:00
committed by Teknium
parent 8e163852d8
commit b792bd0529
23 changed files with 465 additions and 14 deletions
+1
View File
@@ -53,6 +53,7 @@ gateway:
more: "... 還有 {count} 個"
running_processes: "**執行中的背景程序:** {count}"
async_jobs: "**閘道非同步任務:** {count}"
background_delegations: "**背景委派:** {count}"
none: "沒有作用中的代理或執行中的任務。"
state_starting: "啟動中"
state_running: "執行中"