feat(web): split plan page from tasks (FE-6)

- Nav overview group: 首页 / 任务 / 计划 / Agent 会话; tasks page drops the plan tab
- /console/tasks?tab=plan[&job=] redirects to /console/schedules[?job=]
- Plan page: 自动任务 compact grouped list (switch, interval preset/custom, last result,
  countdown, failure reason, run now/skip/run records) and Agent 巡检 cards (goal,
  allowlist, budget, upstream/model, trigger, cost per run, recent sessions); split stats
- Home plan band: two counts linking to #auto / #checks
- Docs: console-ia §7.4a, glossary, schedules runbook; smoke routes

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
rootandClaude Opus 5.5 committed 2026-09-29 17:13:54 +08:00
1 parent c3aaf901ad
commit baf2d6ea04
22 files changed
+1030 -417

No files matched your search

+28
View File
@@ -413,3 +413,31 @@ export function useRunInvocationAudit(runId: string, enabled: boolean, version =
},
});
}
/**
* 巡检触发的最近会话(trigger=schedule,createdBy = schedule:<定时任务 id>):
* 计划页的巡检卡片、首页计划带按定时任务分组取费用、模型与最近结果。一次取最近 100 条。
*/
export function useScheduleAgentRuns() {
return useQuery({
queryKey: [...agentKeys.runs(undefined, "schedule"), "plan"],
queryFn: ({ signal }) =>
apiParsed(RunPage, AGENT_BASE, { params: cleanParams({ trigger: "schedule", limit: 100 }), signal }),
select: (page) => page.items,
staleTime: 30 * TTL_SECOND,
refetchInterval: 60 * TTL_SECOND,
});
}
/** 按定时任务 id 分组(新 → 旧,保持接口顺序) */
export function groupRunsBySchedule(runs: AgentRun[]): Map<string, AgentRun[]> {
const out = new Map<string, AgentRun[]>();
for (const r of runs) {
const id = r.createdBy?.startsWith("schedule:") ? r.createdBy.slice("schedule:".length) : null;
if (!id) continue;
const list = out.get(id);
if (list) list.push(r);
else out.set(id, [r]);
}
return out;
}