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.

1.4 KB
Raw Blame
import { MakeLogicType, actions, kea, path, reducers } from 'kea'

// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
export interface visionDockPreferenceLogicValues {
    preferredSummarizerId: string | null
}

// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
export interface visionDockPreferenceLogicActions {
    setPreferredSummarizerId: (scannerId: string | null) => {
        scannerId: string | null
    }
}

export type visionDockPreferenceLogicType = MakeLogicType<
    visionDockPreferenceLogicValues,
    visionDockPreferenceLogicActions
>

// Persisted across recordings. The path is the storage key, so renaming this logic resets the pick.

export const visionDockPreferenceLogic = kea<visionDockPreferenceLogicType>([
    path(['products', 'replay_vision', 'frontend', 'logics', 'visionDockPreferenceLogic']),

    actions({
        setPreferredSummarizerId: (scannerId: string | null) => ({ scannerId }),
    }),

    reducers({
        // Holds a scanner id, BUILT_IN_SUMMARIZER, or null for "never chose". Resolved against the
        // team's current scanner list by `resolveSummarizer`, so a stale id falls back on its own.
        preferredSummarizerId: [
            null as string | null,
            { persist: true },
            {
                setPreferredSummarizerId: (_: string | null, { scannerId }: { scannerId: string | null }) => scannerId,
            },
        ],
    }),
])