Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

935 B
Raw Blame
import type { ChatSessionStatus } from '@/model/types'
import type { ThemeColors } from '@/ui/theme'

export interface SessionStatusDisplay {
    label: string
    dotColor: string
}

const SESSION_STATUS: Record<ChatSessionStatus, { label: string; dot: keyof ThemeColors }> = {
    working: { label: 'Working', dot: 'blue' },
    queued: { label: 'Queued', dot: 'blue' },
    starting: { label: 'Starting', dot: 'blue' },
    // The app's alert accent stands in for the web app's red, which this palette only has for diffs.
    failed: { label: 'Failed', dot: 'orange' },
    completed: { label: 'Completed', dot: 'tertiary' },
    stopped: { label: 'Stopped', dot: 'tertiary' },
    idle: { label: 'Idle', dot: 'tertiary' },
}

export function sessionStatusDisplay(status: ChatSessionStatus, colors: ThemeColors): SessionStatusDisplay {
    const { label, dot } = SESSION_STATUS[status]
    return { label, dotColor: colors[dot] }
}