⭐️⭐️⭐️ Open-source, self-hosted alternative to Linear and Plane. Project management and issue tracking where teams and AI agents work side by side to plan and ship products.
TypeScript agenticagileai-agentsbug-reportingbug-trackerganttissue-trackerjirajira-alternativekanbanlinearlinear-alternativeopen-sourceproduct-managementproject-managementroadmapself-hostedsprint-planningteam-collaborationtrello-alternative
import { Radio, Webhook } from 'lucide-react';
import { useTranslations } from 'next-intl';
import type { AiAgent } from '@/lib/api/endpoints/agents';
import { cn } from '@/lib/utils';
import { formatDurationShort } from '@/utils/dates';
import { isRunnerOnline } from './runnerOnline';
// Whether an external agent's runner is connected right now. The agent has no runner
// until someone starts one, so "never connected" is a normal state and reads
// differently from "went offline". An agent whose tasks are sent to its endpoint has no
// runner to be connected, and says so instead. `compact` drops to the bare state for
// places that already say what it is about, such as a section header.
//
// The strings sit in the settings namespace, where the runner is set up; the chat shows
// the same three states rather than wording its own.
export function AgentRunnerStatus({
agent,
compact = false,
}: {
// Null while the agent is still being created: nothing can have connected yet.
agent: AiAgent | null;
compact?: boolean;
}) {
const t = useTranslations('teams.agents');
const lastSeen = agent?.lastSeenAt ?? null;
const online = isRunnerOnline(agent);
if (agent?.invocationUrl) {
return (
<span className="inline-flex items-center gap-1.5 text-xs text-muted-foreground">
<Webhook className="size-3 shrink-0" />
{compact ? t('runnerStateUrl') : t('runnerUrl')}
</span>
);
}
let label: string;
if (online) label = compact ? t('runnerStateOnline') : t('runnerOnline');
else if (lastSeen) label = compact ? t('runnerStateOffline') : t('runnerOffline');
else label = compact ? t('runnerStateNone') : t('runnerNever');
return (
<span className="inline-flex items-center gap-1.5 text-xs text-muted-foreground">
<Radio
className={cn('size-3 shrink-0', online ? 'text-emerald-500' : 'text-muted-foreground/60')}
/>
{label}
{/* How long it has been gone is the useful half of "offline", so it survives
the compact form — shortened to the bare duration. */}
{!online && lastSeen && (
<span className="text-muted-foreground/70">
{compact
? `· ${formatDurationShort(lastSeen)}`
: `· ${t('runnerSeen', { time: formatDurationShort(lastSeen) })}`}
</span>
)}
</span>
);
}