import { useSyncExternalStore } from "react"; import type { Decision } from "../../shared/ipc"; import { remainingSeconds, riskLabel, type ApprovalStore } from "../lib/store"; type Props = { store: ApprovalStore }; export function ApprovalReact({ store }: Props) { const state = useSyncExternalStore(store.subscribe, store.getState); const current = state.pending[0]; const queue = state.pending.slice(1); const remaining = current ? remainingSeconds(current.expiresAt, state.now) : 0; const decide = (decision: Decision): void => { if (current) void store.decide(current.id, decision); }; return (
队列已清空。用上方按钮模拟新的工具调用。
)}{item.tool}
{riskLabel(item.risk)}
{tool}
{record.tool}
{record.outcome}
{record.auto && 自动}