: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.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
import { TodayWorkItem } from './todayWorkItems'
export interface TodaySessionDot {
/** `hollow` is settled, `solid` wants a look, `failed` is red, `spinner` is starting or working. */
mark: 'hollow' | 'solid' | 'failed' | 'spinner'
/** Barely there, for a run somebody stopped. */
faint: boolean
label: string
}
const STARTING_LABELS: Record<string, string> = { not_started: 'Starting', queued: 'Queued' }
/**
* A session's state as one dot, like the PostHog Desktop task rows. The dot shows attention and activity only,
* so every settled state shares the same quiet ring.
*/
export function todaySessionDot(
item: Pick<TodayWorkItem, 'status' | 'runEnvironment' | 'runMode'>,
unread: boolean
): TodaySessionDot {
const { status } = item
const startingLabel = status ? STARTING_LABELS[status] : undefined
if (status === 'failed') {
return { mark: 'failed', faint: false, label: 'Failed' }
}
// A local run can stay `queued` after the agent finishes, so only a cloud run shows the spinner.
if (startingLabel && item.runEnvironment === 'cloud') {
return { mark: 'spinner', faint: false, label: startingLabel }
}
// An interactive run stays `in_progress` between turns, so only a background run shows the spinner.
if (status === 'in_progress' && item.runMode !== 'interactive') {
return { mark: 'spinner', faint: false, label: 'Working' }
}
if (unread) {
return { mark: 'solid', faint: false, label: 'Unread' }
}
if (status === 'cancelled') {
return { mark: 'hollow', faint: true, label: 'Stopped' }
}
return { mark: 'hollow', faint: false, label: status === 'completed' ? 'Completed' : (startingLabel ?? 'Idle') }
}