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.

feat(today): rebuild the PostHog AI panel in quill (#119072)

Adam Leithfcc01ea1a3e8
diff --git a/frontend/src/layout/today/TodayAiChatTitleMenu.tsx b/frontend/src/layout/today/TodayAiChatTitleMenu.tsx
new file mode 100644
index 000000000000..d2fee3091c39
--- /dev/null
+++ b/frontend/src/layout/today/TodayAiChatTitleMenu.tsx
@@ -0,0 +1,66 @@
+import { useActions, useValues } from 'kea'
+
+import { IconChevronDown } from '@posthog/icons'
+import {
+ Button,
+ DropdownMenu,
+ DropdownMenuContent,
+ DropdownMenuGroup,
+ DropdownMenuItem,
+ DropdownMenuLabel,
+ DropdownMenuTrigger,
+ Spinner,
+ cn,
+} from '@posthog/quill'
+
+import { todayAiChatLogic } from './todayAiChatLogic'
+import { TodaySessionIcon } from './TodaySessionIcon'
+
+export function TodayAiChatTitleMenu(): JSX.Element {
+ const { chatTitle, recentGroups, recentLoading, activeItemId, unreadSessionIds } = useValues(todayAiChatLogic)
+ const { openRecentItem } = useActions(todayAiChatLogic)
+
+ return (
+ <DropdownMenu>
+ <DropdownMenuTrigger
+ render={
+ <Button className="min-w-0 shrink gap-1.5 px-1.5 font-semibold" data-attr="today-ai-chat-recents">
+ <span className="min-w-0 truncate">{chatTitle}</span>
+ <IconChevronDown className="size-3 shrink-0 text-muted-foreground" />
+ </Button>
+ }
+ />
+ <DropdownMenuContent className="w-72">
+ {recentGroups.length === 0 ? (
+ recentLoading ? (
+ <div className="flex items-center gap-2 px-2 py-1.5 text-muted-foreground">
+ <Spinner />
+ Loading chats
+ </div>
+ ) : (
+ <div className="px-2 py-1.5 text-muted-foreground">No chats yet</div>
+ )
+ ) : (
+ recentGroups.map((group) => (
+ <DropdownMenuGroup key={group.key}>
+ <DropdownMenuLabel>{group.label}</DropdownMenuLabel>
+ {group.items.map((item) => (
+ <DropdownMenuItem
+ key={item.id}
+ onClick={() => openRecentItem(item)}
+ data-attr="today-ai-chat-recent-item"
+ className={cn(item.id === activeItemId && 'bg-[var(--fill-selected)]')}
+ >
+ <span className="flex size-4 shrink-0 items-center justify-center">
+ <TodaySessionIcon item={item} unread={unreadSessionIds.has(item.id)} />
+ </span>
+ <span className="min-w-0 truncate">{item.title || 'Untitled chat'}</span>
+ </DropdownMenuItem>
+ ))}
+ </DropdownMenuGroup>
+ ))
+ )}
+ </DropdownMenuContent>
+ </DropdownMenu>
+ )
+}
diff --git a/frontend/src/layout/today/TodayAiPanel.tsx b/frontend/src/layout/today/TodayAiPanel.tsx
new file mode 100644
index 000000000000..0634ba0eab74
--- /dev/null
+++ b/frontend/src/layout/today/TodayAiPanel.tsx
@@ -0,0 +1,74 @@
+import { useValues } from 'kea'
+
+import { IconExternal, IconLock } from '@posthog/icons'
+import { Button, Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle } from '@posthog/quill'
+
+import { useOnMountEffect } from 'lib/hooks/useOnMountEffect'
+import { PhaiSidePanelChat } from 'scenes/max/components/PhaiSidePanelChat'
+import { maxGlobalLogic } from 'scenes/max/maxGlobalLogic'
+import { sidePanelMaxLogic } from 'scenes/max/maxLogic'
+
+import { SidePanelMax } from '~/layout/navigation-3000/sidepanel/panels/max/SidePanelMax'
+import { sidePanelStateLogic } from '~/layout/navigation-3000/sidepanel/sidePanelStateLogic'
+
+import { REPORT_AI_PANEL } from 'products/signals/frontend/inbox/inboxTaskKickoffLogic'
+import { SCOUT_AI_PANEL } from 'products/signals/frontend/inbox/logics/scoutAiLogic'
+
+export function TodayAiPanel(): JSX.Element {
+ const { isMaxAvailable, effectivePhaiView } = useValues(maxGlobalLogic)
+ const { selectedTabOptions } = useValues(sidePanelStateLogic)
+
+ // Closing the panel unmounts this tree, so hold the chat logic to keep the open chat and draft.
+ useOnMountEffect(() => {
+ sidePanelMaxLogic()
+ })
+
+ if (!isMaxAvailable) {
+ return (
+ <Empty className="flex-1">
+ <EmptyHeader>
+ <EmptyMedia variant="icon">
+ <IconLock />
+ </EmptyMedia>
+ <EmptyTitle>PostHog AI isn't set up yet</EmptyTitle>
+ <EmptyDescription>
+ PostHog AI runs on your own LLM provider key. Set <code>ANTHROPIC_API_KEY</code> for this
+ instance and restart PostHog to start chatting.
+ </EmptyDescription>
+ </EmptyHeader>
+ <EmptyContent>
+ <Button
+ variant="outline"
+ render={
+ // eslint-disable-next-line react/forbid-elements
+ <a
+ href="https://posthog.com/docs/self-host/configure/environment-variables?utm_medium=in-product&utm_campaign=max-not-configured"
+ target="_blank"
+ rel="noopener noreferrer"
+ data-attr="max-not-configured-configure-key"
+ />
+ }
+ >
+ Configuring environment variables
+ <IconExternal />
+ </Button>
+ </EmptyContent>
+ </Empty>
+ )
+ }
+
+ // The legacy chat, and the report and scout chats, keep their own panels until they move to the runner.
+ if (
+ effectivePhaiView === 'legacy' ||
+ selectedTabOptions === REPORT_AI_PANEL ||
+ selectedTabOptions === SCOUT_AI_PANEL
+ ) {
+ return <SidePanelMax header={null} />
+ }
+
+ return (
+ <div className="flex min-h-0 flex-1 flex-col">
+ <PhaiSidePanelChat />
+ </div>
+ )
+}
diff --git a/frontend/src/layout/today/TodayContextPanelContent.tsx b/frontend/src/layout/today/TodayContextPanelContent.tsx
index c13af96693b1..60d322190e71 100644
--- a/frontend/src/layout/today/TodayContextPanelContent.tsx
+++ b/frontend/src/layout/today/TodayContextPanelContent.tsx
@@ -9,10 +9,13 @@ import { ErrorBoundary } from '~/layout/ErrorBoundary'
import { SIDE_PANEL_TABS } from '~/layout/navigation-3000/sidepanel/sidePanelTabs'
import { SidePanelTab } from '~/types'
+import { TodayAiPanel } from './TodayAiPanel'
import { todayContextPanelLogic } from './todayContextPanelLogic'
// The quill rebuilds of the side panel tabs. Every other tab keeps its own panel.
-const QUILL_TAB_PANELS: Partial<Record<SidePanelTab, ComponentType>> = {}
+const QUILL_TAB_PANELS: Partial<Record<SidePanelTab, ComponentType>> = {
+ [SidePanelTab.Max]: TodayAiPanel,
+}
type SwitchDirection = 'forward' | 'backward'
diff --git a/frontend/src/layout/today/TodayContextPanelHeader.tsx b/frontend/src/layout/today/TodayContextPanelHeader.tsx
index a8b4d4ed3bab..f651a8607170 100644
--- a/frontend/src/layout/today/TodayContextPanelHeader.tsx
+++ b/frontend/src/layout/today/TodayContextPanelHeader.tsx
@@ -1,12 +1,15 @@
import { useActions, useValues } from 'kea'
-import { IconExpand45, IconExternal, IconSidePanel, IconX } from '@posthog/icons'
+import { IconExpand45, IconExternal, IconPlus, IconSidePanel, IconX } from '@posthog/icons'
import { Button, CardHeader, Tooltip, TooltipContent, TooltipTrigger, cn } from '@posthog/quill'
import { LinkPrimitive } from 'lib/lemon-ui/Link'
import { SIDE_PANEL_TABS } from '~/layout/navigation-3000/sidepanel/sidePanelTabs'
+import { SidePanelTab } from '~/types'
+import { todayAiChatLogic } from './todayAiChatLogic'
+import { TodayAiChatTitleMenu } from './TodayAiChatTitleMenu'
import { todayContextPanelLogic } from './todayContextPanelLogic'
interface TodayContextPanelHeaderProps {
@@ -51,8 +54,11 @@ function HeaderIconButton({
}
export function TodayContextPanelHeader({ docked, onDragStart }: TodayContextPanelHeaderProps): JSX.Element {
- const { activeTab, fullScreenUrl, canUndock } = useValues(todayContextPanelLogic)
+ const { activeTab, fullScreenUrl: tabFullScreenUrl, canUndock } = useValues(todayContextPanelLogic)
const { dock, undock, close, openFullScreen } = useActions(todayContextPanelLogic)
+ const { fullScreenUrl: aiFullScreenUrl } = useValues(todayAiChatLogic)
+ const { startNewChat, carryContextToFullScreen } = useActions(todayAiChatLogic)
+ const fullScreenUrl = activeTab === SidePanelTab.Max ? aiFullScreenUrl : tabFullScreenUrl
return (
<CardHeader
@@ -62,15 +68,30 @@ export function TodayContextPanelHeader({ docked, onDragStart }: TodayContextPan
)}
onPointerDown={onDragStart}
>
- <span className="flex h-7 min-w-0 items-center px-1.5 font-semibold">
- <span className="truncate">{SIDE_PANEL_TABS[activeTab].label}</span>
- </span>
+ {activeTab === SidePanelTab.Max ? (
+ <TodayAiChatTitleMenu />
+ ) : (
+ // As tall as the chat's title button, so the header keeps its height across tabs.
+ <span className="flex h-7 min-w-0 items-center px-1.5 font-semibold">
+ <span className="truncate">{SIDE_PANEL_TABS[activeTab].label}</span>
+ </span>
+ )}
<div className="ms-auto flex shrink-0 items-center gap-0.5">
+ {activeTab === SidePanelTab.Max && (
+ <HeaderIconButton label="New chat" onClick={startNewChat} dataAttr="today-ai-chat-new">
+ <IconPlus />
+ </HeaderIconButton>
+ )}
{fullScreenUrl && (
<HeaderIconButton
label="Open full screen"
dataAttr="today-context-panel-full-screen"
- onClick={openFullScreen}
+ onClick={() => {
+ if (activeTab === SidePanelTab.Max) {
+ carryContextToFullScreen()
+ }
+ openFullScreen()
+ }}
render={<LinkPrimitive to={fullScreenUrl} />}
>
<IconExpand45 />
diff --git a/frontend/src/layout/today/todayAiChatLogic.ts b/frontend/src/layout/today/todayAiChatLogic.ts
new file mode 100644
index 000000000000..4617e90af3b7
--- /dev/null
+++ b/frontend/src/layout/today/todayAiChatLogic.ts
@@ -0,0 +1,304 @@
+import { MakeLogicType, actions, connect, kea, listeners, path, selectors } from 'kea'
+import { router } from 'kea-router'
+import type { LocationChangedPayload } from 'kea-router/lib/types'
+import posthog from 'posthog-js'
+
+import { MAX_SIDE_PANEL_ID } from 'scenes/max/components/PhaiSidePanelChat'
+import { mainFocusUrl } from 'scenes/max/mainFocusUrl'
+import { PhaiViewMode, maxGlobalLogic } from 'scenes/max/maxGlobalLogic'
+import { SIDE_PANEL_PANEL_ID, maxLogic } from 'scenes/max/maxLogic'
+import { urls } from 'scenes/urls'
+
+import { sidePanelStateLogic } from '~/layout/navigation-3000/sidepanel/sidePanelStateLogic'
+
+import { attachedContextLogic } from 'products/posthog_ai/frontend/logics/attachedContextLogic'
+import { ActiveCreation, runnerPanelLogic } from 'products/posthog_ai/frontend/logics/runnerPanelLogic'
+import type { AttachedContextItem } from 'products/posthog_ai/frontend/types/contextTypes'
+import { REPORT_AI_PANEL } from 'products/signals/frontend/inbox/inboxTaskKickoffLogic'
+import { SCOUT_AI_PANEL } from 'products/signals/frontend/inbox/logics/scoutAiLogic'
+
+import type { TaskActivityDTOApi } from '../../../../products/tasks/frontend/generated/api.schemas'
+import { todayShellLogic } from './todayShellLogic'
+import { todaySpacesLogic } from './todaySpacesLogic'
+import { TodayWorkGroup, TodayWorkItem, groupByDay, sessionReadRequest } from './todayWorkItems'
+
+const FULL_SCREEN_CONTEXT_PROVIDER_ID = 'today-context-panel-full-screen'
+
+function timeOf(item: TodayWorkItem): number {
+ return item.timestamp ? new Date(item.timestamp).getTime() : 0
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface todayAiChatLogicValues {
+ contextItems: AttachedContextItem[] // attachedContextLogic
+ effectivePhaiView: PhaiViewMode // maxGlobalLogic
+ conversationId: string | null // maxLogic
+ legacyChatTitle: string | null // maxLogic
+ activeCreation: ActiveCreation | null // runnerPanelLogic
+ selectedTabOptions: string | null // sidePanelStateLogic
+ onAiPage: boolean // todayShellLogic
+ allRecentItems: TodayWorkItem[] // todaySpacesLogic
+ pinnedItems: TodayWorkItem[] // todaySpacesLogic
+ recentLoading: boolean // todaySpacesLogic
+ taskActivity: TaskActivityDTOApi[] // todaySpacesLogic
+ unreadSessionIds: Set<string> // todaySpacesLogic
+ activeItemId: string | null
+ chatTitle: string
+ fullScreenUrl: string | null
+ onTaskRunner: boolean
+ recentGroups: TodayWorkGroup[]
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface todayAiChatLogicActions {
+ deregisterContext: (providerId: string) => {
+ providerId: string
+ } // attachedContextLogic
+ registerContext: (
+ providerId: string,
+ items: AttachedContextItem[]
+ ) => {
+ items: AttachedContextItem[]
+ providerId: string
+ } // attachedContextLogic
+ openConversation: (conversationId: string) => {
+ conversationId: string
+ } // maxLogic
+ startNewConversation: () => {
+ value: true
+ } // maxLogic
+ clearActiveCreation: () => {
+ value: true
+ } // runnerPanelLogic
+ setActiveCreation: (creation: ActiveCreation) => {
+ creation: ActiveCreation
+ } // runnerPanelLogic
+ setHistoryExpanded: (expanded: boolean) => {
+ expanded: boolean
+ } // runnerPanelLogic
+ setSidePanelOptions: (options: string | null) => {
+ options: string | null
+ } // sidePanelStateLogic
+ markSessionRead: (
+ marker: import('../../../../products/tasks/frontend/generated/api.schemas').TaskActivityReadMarkerApi,
+ activityIds: string[]
+ ) => {
+ activityIds: string[]
+ marker: import('../../../../products/tasks/frontend/generated/api.schemas').TaskActivityReadMarkerApi
+ } // todaySpacesLogic
+ carryContextToFullScreen: () => {
+ value: true
+ }
+ openRecentItem: (item: TodayWorkItem) => {
+ item: TodayWorkItem
+ }
+ startNewChat: () => {
+ value: true
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface todayAiChatLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ recentGroups: (allRecentItems: TodayWorkItem[], pinnedItems: TodayWorkItem[]) => TodayWorkGroup[]
+ activeItemId: (
+ effectivePhaiView: PhaiViewMode,
+ activeCreation: ActiveCreation | null,
+ conversationId: string | null
+ ) => string | null
+ chatTitle: (
+ effectivePhaiView: PhaiViewMode,
+ activeItemId: string | null,
+ allRecentItems: TodayWorkItem[],
+ pinnedItems: TodayWorkItem[],
+ legacyChatTitle: string | null
+ ) => string
+ onTaskRunner: (effectivePhaiView: PhaiViewMode, selectedTabOptions: string | null) => boolean
+ fullScreenUrl: (
+ onTaskRunner: boolean,
+ activeCreation: ActiveCreation | null,
+ conversationId: string | null
+ ) => string | null
+ }
+ __keaTypeGenInternalReducerActions: {
+ 'location changed (kea.router)': ({
+ method,
+ pathname,
+ search,
+ searchParams,
+ hash,
+ hashParams,
+ initial,
+ url,
+ routerState,
+ }: LocationChangedPayload) => {
+ payload: {
+ hash: string
+ hashParams: Record<string, any>
+ initial: boolean
+ method: 'POP' | 'PUSH' | 'REPLACE'
+ pathname: string
+ routerState: Record<string, any>
+ search: string
+ searchParams: Record<string, any>
+ url: string
+ }
+ type: 'location changed (kea.router)'
+ }
+ }
+}
+
+export type todayAiChatLogicType = MakeLogicType<
+ todayAiChatLogicValues,
+ todayAiChatLogicActions,
+ Record<string, any>,
+ todayAiChatLogicMeta
+>
+
+/** The context panel's PostHog AI chat: which chat is open, its recent chats, and moving it to full screen. */
+export const todayAiChatLogic = kea<todayAiChatLogicType>([
+ path(['layout', 'today', 'todayAiChatLogic']),
+ connect(() => ({
+ values: [
+ todaySpacesLogic,
+ ['allRecentItems', 'pinnedItems', 'unreadSessionIds', 'recentLoading', 'taskActivity'],
+ maxGlobalLogic,
+ ['effectivePhaiView'],
+ maxLogic({ panelId: SIDE_PANEL_PANEL_ID }),
+ ['chatTitle as legacyChatTitle', 'conversationId'],
+ runnerPanelLogic({ panelId: MAX_SIDE_PANEL_ID }),
+ ['activeCreation'],
+ attachedContextLogic,
+ ['contextItems'],
+ todayShellLogic,
+ ['onAiPage'],
+ sidePanelStateLogic,
+ ['selectedTabOptions'],
+ ],
+ actions: [
+ sidePanelStateLogic,
+ ['setSidePanelOptions'],
+ todaySpacesLogic,
+ ['markSessionRead'],
+ maxLogic({ panelId: SIDE_PANEL_PANEL_ID }),
+ ['openConversation', 'startNewConversation'],
+ runnerPanelLogic({ panelId: MAX_SIDE_PANEL_ID }),
+ ['setActiveCreation', 'clearActiveCreation', 'setHistoryExpanded'],
+ attachedContextLogic,
+ ['registerContext', 'deregisterContext'],
+ ],
+ })),
+ actions({
+ openRecentItem: (item: TodayWorkItem) => ({ item }),
+ startNewChat: true,
+ carryContextToFullScreen: true,
+ }),
+ selectors({
+ recentGroups: [
+ (s) => [s.allRecentItems, s.pinnedItems],
+ (allRecentItems: TodayWorkItem[], pinnedItems: TodayWorkItem[]): TodayWorkGroup[] =>
+ groupByDay([...pinnedItems, ...allRecentItems].sort((first, second) => timeOf(second) - timeOf(first))),
+ ],
+ activeItemId: [
+ (s) => [s.effectivePhaiView, s.activeCreation, s.conversationId],
+ (
+ effectivePhaiView: PhaiViewMode,
+ activeCreation: ActiveCreation | null,
+ conversationId: string | null
+ ): string | null => (effectivePhaiView === 'new' ? (activeCreation?.taskId ?? null) : conversationId),
+ ],
+ chatTitle: [
+ (s) => [s.effectivePhaiView, s.activeItemId, s.allRecentItems, s.pinnedItems, s.legacyChatTitle],
+ (
+ effectivePhaiView: PhaiViewMode,
+ activeItemId: string | null,
+ allRecentItems: TodayWorkItem[],
+ pinnedItems: TodayWorkItem[],
+ legacyChatTitle: string | null
+ ): string => {
+ if (effectivePhaiView === 'legacy') {
+ return legacyChatTitle || 'PostHog AI'
+ }
+ if (!activeItemId) {
+ return 'New chat'
+ }
+ const item = [...pinnedItems, ...allRecentItems].find((recent) => recent.id === activeItemId)
+ return item?.title || 'Untitled chat'
+ },
+ ],
+ // Report and scout chats run on the task runner in either view, the same as the side panel's own header.
+ onTaskRunner: [
+ (s) => [s.effectivePhaiView, s.selectedTabOptions],
+ (effectivePhaiView: PhaiViewMode, selectedTabOptions: string | null): boolean =>
+ effectivePhaiView === 'new' ||
+ selectedTabOptions === REPORT_AI_PANEL ||
+ selectedTabOptions === SCOUT_AI_PANEL,
+ ],
+ fullScreenUrl: [
+ (s) => [s.onTaskRunner, s.activeCreation, s.conversationId],
+ (
+ onTaskRunner: boolean,
+ activeCreation: ActiveCreation | null,
+ conversationId: string | null
+ ): string | null => mainFocusUrl({ isNewView: onTaskRunner, activeCreation, conversationId }),
+ ],
+ }),
+ listeners(({ actions, values, cache }) => ({
+ startNewChat: () => {
+ if (values.onTaskRunner) {
+ actions.clearActiveCreation()
+ // An expanded task history would otherwise stay in place of the composer.
+ actions.setHistoryExpanded(false)
+ } else {
+ actions.startNewConversation()
+ }
+ },
+ openRecentItem: ({ item }) => {
+ // pinned: analytics event name
+ posthog.capture('today context panel recent opened', { kind: item.kind })
+ // A report or scout panel attaches its own entity's context, so it must not stay mounted on another chat.
+ if (values.selectedTabOptions) {
+ actions.setSidePanelOptions(null)
+ }
+ const newView = values.effectivePhaiView === 'new'
+ if (item.kind === 'session') {
+ if (newView && item.latestRunId) {
+ actions.setActiveCreation({ streamKey: item.latestRunId, taskId: item.id, runId: item.latestRunId })
+ // Read tracking follows the /ai URL, which an inline open never changes, so mark it here.
+ const request = sessionReadRequest(values.taskActivity, item.id)
+ if (request) {
+ actions.markSessionRead(request.marker, request.activityIds)
+ }
+ } else {
+ router.actions.push(urls.aiTask(item.id))
+ }
+ return
+ }
+ if (newView) {
+ router.actions.push(urls.ai(item.id))
+ } else {
+ actions.openConversation(item.id)
+ }
+ },
+ // The chat's context comes from the scene behind it, and that scene unmounts on the way to /ai. A copy of
+ // what the composer shows rides along, so the full screen chat still knows what the user was looking at.
+ carryContextToFullScreen: () => {
+ if (values.contextItems.length > 0) {
+ actions.registerContext(FULL_SCREEN_CONTEXT_PROVIDER_ID, values.contextItems)
+ cache.fullScreenContext = 'pending'
+ }
+ },
+ // Closing the panel changes the URL before the page leaves the scene, so the copy is dropped only once the
+ // user has reached /ai and then left it.
+ [router.actionTypes.locationChanged]: () => {
+ if (values.onAiPage) {
+ if (cache.fullScreenContext === 'pending') {
+ cache.fullScreenContext = 'shown'
+ }
+ } else if (cache.fullScreenContext === 'shown') {
+ cache.fullScreenContext = null
+ actions.deregisterContext(FULL_SCREEN_CONTEXT_PROVIDER_ID)
+ }
+ },
+ })),
+])
diff --git a/frontend/src/layout/today/todayContextPanelLogic.ts b/frontend/src/layout/today/todayContextPanelLogic.ts
index 3bd80f519d98..c265a30c6ebe 100644
--- a/frontend/src/layout/today/todayContextPanelLogic.ts
+++ b/frontend/src/layout/today/todayContextPanelLogic.ts
@@ -202,6 +202,7 @@ export const todayContextPanelLogic = kea<todayContextPanelLogicType>([
docked && selectedTab ? selectedTab : floatingActiveTab,
],
fullScreenUrl: [
+ // PostHog AI's URL comes from the chat logic, which the header reads only while the panel is open.
(s) => [s.activeTab, s.selectedNotebook],
(activeTab: SidePanelTab, selectedNotebook: string): string | null => {
switch (activeTab) {