: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 { useMountedLogic } from 'kea'
import { MAX_SIDE_PANEL_ID } from '~/layout/ai/aiPanelIds'
import { SidePanelRunner } from 'products/posthog_ai/frontend/api/runner'
import { phaiSidePanelComposerSeedLogic } from '../phaiSidePanelComposerSeedLogic'
/**
* The new posthog_ai side-panel experience: task-based, built on the `products/posthog_ai/frontend` runner
* surface (composer -> pending thread -> live run) rather than Max's conversation logics
* (`maxThreadLogic`/`askMax`/the conversations API). The legacy conversation chat remains behind the
* `effectivePhaiView` toggle (see `maxGlobalLogic`). `scenes/max` hosts this only until the Max scene is
* replaced outright by the posthog_ai product surface.
*/
export function PhaiSidePanelChat(): JSX.Element {
// Bridges the legacy `initialMaxPrompt` side-panel option into this panel's new composer (see the logic).
useMountedLogic(phaiSidePanelComposerSeedLogic({ panelId: MAX_SIDE_PANEL_ID }))
return (
// `flex-1 min-h-0`, NOT `h-full`: the side panel hosts this inside a ScrollArea whose content
// grows with its children (`min-height: auto`), so a percentage height resolves against the
// grown box — the runner then inflates to its full thread height and its internal scrollers
// never engage (and `overscroll-contain` on the thread swallows wheel events entirely).
// Taking remaining flex space instead (zero min-content contribution) keeps the panel clamped
// to the viewport so the thread/history scroll internally as designed.
<div className="flex flex-col flex-1 min-h-0">
<SidePanelRunner panelId={MAX_SIDE_PANEL_ID} />
</div>
)
}