Repository Public
1import { isTerminal, type RiskClass, type RunStatus } from '@aos/shared';2import type { Tone } from '@/components/ui/badge';34export const RUN_STATUS: Record<RunStatus, { label: string; tone: Tone; pulse?: boolean; hint: string }> = {5 queued: { label: 'Queued', tone: 'neutral', hint: 'Waiting for a worker to claim the run.' },6 running: { label: 'Running', tone: 'accent', pulse: true, hint: 'The agent is working.' },7 waiting: { label: 'Needs you', tone: 'info', pulse: true, hint: 'The run is suspended until you approve, deny or answer.' },8 done: { label: 'Done', tone: 'success', hint: 'Finished with every done criterion passing.' },9 partial: { label: 'Partial', tone: 'warning', hint: 'Finished without meeting every done criterion.' },10 blocked: { label: 'Blocked', tone: 'warning', hint: 'The agent could not continue.' },11 failed: { label: 'Failed', tone: 'error', hint: 'The run ended with an error.' },12 cancelled: { label: 'Cancelled', tone: 'muted', hint: 'Cancelled by the owner.' },13 budget_exhausted: { label: 'Budget exhausted', tone: 'warning', hint: 'Stopped at its budget, turn or time limit.' },14};15export const isActive = (s: RunStatus): boolean => !isTerminal(s);1617export const RISK: Record<RiskClass, { label: string; tone: Tone; hint: string }> = {18 read: { label: 'Read', tone: 'neutral', hint: 'Reads inside the workspace. Changes nothing.' },19 workspace_write: { label: 'Workspace write', tone: 'accent', hint: 'Changes files inside the sandboxed workspace, on the mission branch.' },20 network: { label: 'Network', tone: 'warning', hint: 'Can reach the network from the sandbox.' },21 external: { label: 'External effect', tone: 'error', hint: 'Has an effect outside the workspace that cannot be undone from here.' },22};23export const riskOf = (v: unknown): RiskClass | null => (typeof v === 'string' && v in RISK ? (v as RiskClass) : null);2425export const TIER_LABEL = { frontier: 'Frontier', main: 'Main', worker: 'Worker', volume: 'Volume' } as const;26export const PROVIDER_LABEL = { anthropic: 'Anthropic', openai: 'OpenAI' } as const;27export const EFFORT_LABEL = { low: 'Low', medium: 'Medium', high: 'High', xhigh: 'Extra high', max: 'Max' } as const;28