import { useQuery } from "@tanstack/react-query"; import { grokBotApi } from "@/api/grokBot"; import { Link } from "@/lib/router"; /** Reports observed Paperclip activity; this is not a provider availability indicator. */ export function GrokBotWorkSummary({ companyId, agentId }: { companyId: string; agentId: string }) { const state = useQuery({ queryKey: ["grok-binding", companyId, agentId], queryFn: ({ signal }) => grokBotApi.connection(companyId, agentId, signal), retry: false, refetchInterval: 10000 }); const data = state.data, binding = data?.binding, routine = binding?.routine; return
{state.error &&

Connection status could not be refreshed. {state.error.message}

}

{data?.recoveryNeeded ? "Recovery needed" : binding?.assignment?.status === "offered" ? "Awaiting acknowledgement" : binding?.assignment ? "Working in Grok Bot" : routine?.verified ? "No active Paperclip work session" : "Connection setup incomplete"}

{data?.currentTask && {data.currentTask.identifier}: {data.currentTask.title}}

Queued tasks: {data?.queuedTaskCount ?? "Checking…"}

Last contact: {routine?.lastContactAt ? new Date(routine.lastContactAt).toLocaleString() : "Not observed"}

Shows Paperclip-reported activity. Open the Grok Bot desktop app to inspect the Bot’s complete activity.

; }