import type { AgentSpendBucket, AgentSpendKind } from "@umt/contracts"; import { BellRing, Bot } from "lucide-react"; import { Link } from "react-router"; import { useAgentSpend, useAttention } from "~/api/attention.ts"; import { ErrorState, LoadingState } from "~/components/console/empty-state.tsx"; import { settingsPath } from "~/components/console/nav.ts"; import { AttentionList, attentionRows } from "~/components/dashboard/attention-summary.tsx"; import { formatRelative } from "~/lib/labels.ts"; import { humanizeReason } from "~/lib/reasons.ts"; // 运行状态页(2026-10-06):「需要关注」汇总(整理需要处理、等你批准、系统健康,系统健康逐条列出、恢复后自动消失) // 与智能体用量(今天 / 最近 7 天按会话类型;不设上限,只展示)。 function Slab({ id, title, icon: Icon, children, }: { id?: string; title: string; icon: typeof Bot; children: React.ReactNode; }) { return (

{title}

{children}
); } export function AttentionCard() { const q = useAttention(); const rows = attentionRows(q.data); const health = q.data?.health.items ?? []; return ( {q.isPending ? ( ) : q.isError ? ( q.refetch()} /> ) : rows.length === 0 ? (

没有需要处理的整理记录,也没有等你批准的操作;站点、下载器和下载目录都正常。

) : ( <> {health.length ? (
    {health.map((d) => (
  • {d.title}

    {d.summary ? (

    {humanizeReason(d.summary)}

    ) : null}

    {formatRelative(d.createdAt)}起,恢复后自动消失

  • ))}
) : null} )}
); } const KIND_LABEL: Record = { chat: "对话", patrol: "巡检", investigate: "后台调查", organize_identify: "整理识别", subagent: "子会话", }; const usd = (n: number) => `$${n < 0.01 && n > 0 ? n.toFixed(4) : n.toFixed(2)}`; function SpendBlock({ label, b }: { label: string; b: AgentSpendBucket }) { return (

{label}

{usd(b.costUsd)} {b.runs} 次

{b.byKind.length ? ( ) : null}
); } /** 智能体用量(设置页「用量与限制」也用) */ export function AgentSpendSummary() { const q = useAgentSpend(); if (q.isPending) return ; if (q.isError) return q.refetch()} />; if (!q.data.last7d.runs) return

最近 7 天智能体没有运行。

; return (
); } export function AgentSpendCard() { return (

不设次数和花费上限,只限制单次的工具调用次数与时长。 调整

); }