feat(ui): rework the chat dock header and empty state; fix resize tracking

This commit is contained in:
sam committed 2026-11-13 12:52:16 +11:00
1 parent 55e477794e
commit 260732f400
9 files changed
+268 -137

No files matched your search

+1 -1
View File
@@ -108,7 +108,7 @@ watch(() => accounts.status?.user, (user) => {
<BreadcrumbItem><SectionCrumb :hidden="hidden" /></BreadcrumbItem>
</BreadcrumbList>
</Breadcrumb>
<div class="ml-auto flex shrink-0 items-center gap-2">
<div class="ml-auto flex shrink-0 items-center gap-3">
<ConnectionPill />
<CommandPalette :hidden="hidden" @new-task="newTaskOpen = true" />
<NewTaskDialog v-if="!hidden.includes('/workflows')" v-model:open="newTaskOpen" />
+33 -12
View File
@@ -1,38 +1,59 @@
<script setup lang="ts">
import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip";
import { MessageCirclePlus } from "@lucide/vue";
import { Menu, SquarePen } from "@lucide/vue";
import { computed, ref } from "vue";
import { Button } from "@/components/ui/button";
import ChatSessionActions from "./ChatSessionActions.vue";
import ChatSessionList from "./ChatSessionList.vue";
import { newChat } from "./state";
import { sessionTitle } from "./session";
import { currentSession, newChat, sessions, useEscapeLayer } from "./state";
/**
* One row for everything that is not the conversation: which conversation is
* open, and the controls that are consulted rather than used constantly.
*
* Whatever the dock adds to the row, such as its hide control, comes after.
* One row for everything that is not the conversation: the drawer of
* conversations, which one is open, and icon controls on the right. The dock
* fills the slots: `start` before the drawer button, `actions` before the more
* menu, and `end` last.
*/
const drawer = ref(false);
useEscapeLayer(drawer);
const title = computed(() => {
const open = sessions.value.find((s) => s.session_id === currentSession.value);
return open ? sessionTitle(open) : "New chat";
});
</script>
<template>
<div class="flex items-center gap-1 border-b px-3 py-2">
<ChatSessionList />
<div class="flex items-center gap-0.5 px-2 py-1.5">
<slot name="start" />
<Tooltip>
<TooltipTrigger as-child>
<Button
variant="ghost"
size="icon-sm"
class="flex-none"
aria-label="New chat"
@click="newChat"
aria-label="Conversations"
:aria-expanded="drawer"
@click="drawer = true"
>
<MessageCirclePlus />
<Menu />
</Button>
</TooltipTrigger>
<TooltipContent>Conversations</TooltipContent>
</Tooltip>
<span class="min-w-0 flex-1 truncate px-1 text-label font-medium" :title="title">{{ title }}</span>
<Tooltip>
<TooltipTrigger as-child>
<Button variant="ghost" size="icon-sm" class="flex-none" aria-label="New chat" @click="newChat">
<SquarePen />
</Button>
</TooltipTrigger>
<TooltipContent>New chat</TooltipContent>
</Tooltip>
<slot name="actions" />
<ChatSessionActions />
<slot />
<slot name="end" />
<ChatSessionList v-if="drawer" @close="drawer = false" />
</div>
</template>
+12 -6
View File
@@ -18,6 +18,8 @@ import {
addTaskTag,
clearPageTag,
pageTag,
placeholderHint,
messages,
composerText,
editQueued,
menuTrigger,
@@ -222,7 +224,7 @@ function onKeydown(event: KeyboardEvent): void {
</Tooltip>
</li>
</ul>
<ul v-if="pageTag || taskTags.length" aria-label="Message context" class="mb-2 flex flex-wrap gap-1">
<ul v-if="!flat && (pageTag || taskTags.length)" aria-label="Message context" class="mb-2 flex flex-wrap gap-1">
<li
v-if="pageTag"
class="flex max-w-full items-center gap-1 rounded-md border border-border bg-muted px-2 py-0.5 text-label"
@@ -243,10 +245,11 @@ function onKeydown(event: KeyboardEvent): void {
/></Button>
</li>
</ul>
<!-- Beside the field, not in the empty transcript, so the prompts stay
reachable without scrolling up; hidden in the collapsed bar on a
phone-width screen, where the strip would crowd the field. -->
<ChatSuggestions :class="flat ? 'max-md:hidden' : ''" />
<!-- An empty conversation lists the prompts itself; once it has messages
they sit beside the field so they stay reachable without scrolling up.
The minimised bar is the field alone; the page context still goes with
the message. -->
<ChatSuggestions v-if="!flat && messages.length" />
<div
:class="
cn(
@@ -255,11 +258,14 @@ function onKeydown(event: KeyboardEvent): void {
)
"
>
<div v-if="$slots.start" class="mb-1.5 flex flex-none items-center">
<slot name="start" />
</div>
<Textarea
ref="field"
:model-value="composerText"
rows="1"
placeholder="Message Archie"
:placeholder="placeholderHint || 'Message Archie'"
aria-label="Message Archie"
role="combobox"
aria-controls="slash-palette"
+100 -64
View File
@@ -1,11 +1,18 @@
<script setup lang="ts">
import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip";
import { ChevronDown, ChevronUp, GripVertical, PanelLeft, PanelRight, Square } from "@lucide/vue";
import { ChevronDown, ChevronUp, GripVertical, PanelLeft, PanelRight, PictureInPicture2 } from "@lucide/vue";
import { useEventListener, useMediaQuery, useStorage, useWindowSize } from "@vueuse/core";
import { computed, nextTick, onMounted, onUnmounted, ref, watch } from "vue";
import { Badge } from "@/components/ui/badge";
import { Button } from "@/components/ui/button";
import {
DropdownMenu,
DropdownMenuContent,
DropdownMenuRadioGroup,
DropdownMenuRadioItem,
DropdownMenuTrigger,
} from "@/components/ui/dropdown-menu";
import { useLiveResource } from "@/stores/session";
import { cn } from "@/lib/utils";
import ChatBar from "./ChatBar.vue";
@@ -36,7 +43,7 @@ import {
type Rect,
type ResizeDir,
} from "./ChatDockLayout";
import { escapeOwnedByLayer, isSending, reloadTranscript, useChat } from "./state";
import { escapeOwnedByLayer, isSending, reloadTranscript, useChat, useEscapeLayer } from "./state";
import { setDockOpen, unseenCount } from "./unseen";
/**
@@ -53,8 +60,8 @@ import { setDockOpen, unseenCount } from "./unseen";
* On a desktop-width screen the expanded conversation is a free-floating
* window: the header drags it anywhere, all eight edges and corners resize it
* (pointer and keyboard), and dragging near a side edge shows the pinned
* split, committing on release. Left / Float / Right in the header switch
* modes explicitly; pinned, the page reflows beside the dock instead of
* split, committing on release. The header's position menu picks Left, Float
* or Right outright; pinned, the page reflows beside the dock instead of
* sitting under it. Ctrl+/ toggles the window, Escape collapses it, and the
* collapsed bar stays where it was and drags too. The layout (mode, x, y,
* width, height) is remembered per browser under "archie.chat.dock.v2", which
@@ -211,11 +218,13 @@ onUnmounted(() => {
document.documentElement.style.removeProperty("--chat-pin-r");
});
const MODES: { mode: DockMode; label: string; icon: typeof PanelLeft; aria: string; title: string }[] = [
{ mode: "left", label: "Left", icon: PanelLeft, aria: "Pin chat to left edge", title: "Dock left, reflowing the page beside it" },
{ mode: "float", label: "Float", icon: Square, aria: "Float window", title: "Float the window, dragging and resizing freely" },
{ mode: "right", label: "Right", icon: PanelRight, aria: "Pin chat to right edge", title: "Dock right, reflowing the page beside it" },
const MODES: { mode: DockMode; label: string; icon: typeof PanelLeft }[] = [
{ mode: "left", label: "Left", icon: PanelLeft },
{ mode: "float", label: "Float", icon: PictureInPicture2 },
{ mode: "right", label: "Right", icon: PanelRight },
];
const positionOpen = ref(false);
useEscapeLayer(positionOpen);
function setMode(next: DockMode): void {
if (!desktop.value) return;
layout.value = { ...layout.value, mode: next };
@@ -226,6 +235,8 @@ function setMode(next: DockMode): void {
// a double-click on it never moves the dock.
const dragging = ref(false);
const snapTarget = ref<"left" | "right" | null>(null);
// A resize follows the pointer directly; the position transition would lag it.
const resizing = ref(false);
function startDrag(event: PointerEvent): void {
if (!desktop.value || event.button !== 0 || !event.isPrimary) return;
@@ -337,8 +348,18 @@ const DIR_LABEL: Record<ResizeDir, string> = {
// The minimised bar keeps its height, so only its width edges resize it.
const visibleDirs = computed<ResizeDir[]>(() => (expanded.value ? [...RESIZE_DIRS] : ["e", "w"]));
function applyResize(dir: ResizeDir, dx: number, dy: number): void {
const rect = resizeRect(winRect.value, dir, dx, dy, vw.value, vh.value);
// The rectangle a resize starts from. Minimised, the bar can sit at an edge
// rather than at the stored x, so its rendered x and width are the origin, or
// the first move would jump it.
function resizeOrigin(): Rect {
const rect = winRect.value;
if (expanded.value || !dock.value) return rect;
const bar = dock.value.getBoundingClientRect();
return { ...rect, x: bar.left, w: bar.width };
}
function applyResize(origin: Rect, dir: ResizeDir, dx: number, dy: number): void {
const rect = resizeRect(origin, dir, dx, dy, vw.value, vh.value);
layout.value = { ...layout.value, mode: "float", x: rect.x, y: rect.y, w: rect.w, h: rect.h };
}
@@ -346,8 +367,13 @@ function startResize(dir: ResizeDir, event: PointerEvent): void {
if (!desktop.value || event.button !== 0 || !event.isPrimary) return;
const handle = event.currentTarget as HTMLElement;
handle.setPointerCapture(event.pointerId);
const move = (e: PointerEvent): void => applyResize(dir, e.clientX - event.clientX, e.clientY - event.clientY);
// The delta is measured from the press, so it applies to the rectangle as it
// was then; applying it to the live rectangle compounded every move.
const origin = resizeOrigin();
resizing.value = true;
const move = (e: PointerEvent): void => applyResize(origin, dir, e.clientX - event.clientX, e.clientY - event.clientY);
const end = (): void => {
resizing.value = false;
handle.removeEventListener("pointermove", move);
handle.removeEventListener("pointerup", end);
handle.removeEventListener("pointercancel", end);
@@ -363,7 +389,7 @@ function onHandleKey(dir: ResizeDir, event: KeyboardEvent): void {
const step = keyStep(event.shiftKey);
const dx = event.key === "ArrowRight" ? step : event.key === "ArrowLeft" ? -step : 0;
const dy = event.key === "ArrowDown" ? step : event.key === "ArrowUp" ? -step : 0;
applyResize(dir, dx, dy);
applyResize(resizeOrigin(), dir, dx, dy);
}
// The pinned split keeps its single divider, which resizes the pin width.
@@ -371,11 +397,14 @@ function startPinResize(event: PointerEvent): void {
if (!desktop.value || event.button !== 0 || !event.isPrimary) return;
const handle = event.currentTarget as HTMLElement;
handle.setPointerCapture(event.pointerId);
const w0 = pinW.value;
resizing.value = true;
const move = (e: PointerEvent): void => {
const delta = e.clientX - event.clientX;
layout.value = { ...layout.value, w: clampWidth(layout.value.w + (mode.value === "left" ? delta : -delta)) };
layout.value = { ...layout.value, w: clampWidth(w0 + (mode.value === "left" ? delta : -delta)) };
};
const end = (): void => {
resizing.value = false;
handle.removeEventListener("pointermove", move);
handle.removeEventListener("pointerup", end);
handle.removeEventListener("pointercancel", end);
@@ -407,7 +436,7 @@ function onPinKey(event: KeyboardEvent): void {
<div
:class="cn(
'pointer-events-none fixed z-40 transition-[left,top,bottom,width,height] duration-200 ease-out motion-reduce:transition-none',
dragging && 'transition-none',
(dragging || resizing) && 'transition-none',
!desktop && 'inset-x-0 bottom-4 flex justify-center px-3 max-md:bottom-2',
)"
:style="wrapStyle"
@@ -459,55 +488,59 @@ function onPinKey(event: KeyboardEvent): void {
@pointerdown="onHeaderPointerDown"
@dblclick="togglePin"
>
<div v-if="desktop" class="flex justify-center pt-1.5" aria-hidden="true">
<span class="h-1 w-8 rounded-full bg-border-strong" />
</div>
<ChatBar>
<div v-if="desktop" class="flex flex-none items-center gap-0.5" role="group" aria-label="Chat window position">
<Button
v-for="m in MODES"
:key="m.mode"
variant="ghost"
size="xs"
:aria-pressed="mode === m.mode"
:aria-label="m.aria"
:title="m.title"
:class="mode === m.mode && 'bg-muted text-foreground'"
@click="setMode(m.mode)"
>
<component :is="m.icon" aria-hidden="true" />{{ m.label }}
</Button>
</div>
<Tooltip v-if="desktop">
<TooltipTrigger as-child>
<Button
variant="ghost"
size="icon-sm"
class="flex-none"
data-move-handle
aria-label="Move chat"
title="Drag to move. Arrow keys move; Shift moves further."
@keydown="moveByKey"
>
<GripVertical />
</Button>
</TooltipTrigger>
<TooltipContent>Move chat</TooltipContent>
</Tooltip>
<Tooltip>
<TooltipTrigger as-child>
<Button
variant="ghost"
size="icon-sm"
class="flex-none"
aria-label="Hide conversation"
@click="expanded = false"
>
<ChevronDown />
</Button>
</TooltipTrigger>
<TooltipContent>Hide conversation</TooltipContent>
</Tooltip>
<template v-if="desktop" #start>
<Tooltip>
<TooltipTrigger as-child>
<Button
variant="ghost"
size="icon-sm"
class="flex-none cursor-grab active:cursor-grabbing"
data-move-handle
aria-label="Move chat"
title="Drag to move. Arrow keys move; Shift moves further."
@keydown="moveByKey"
>
<GripVertical />
</Button>
</TooltipTrigger>
<TooltipContent>Move chat</TooltipContent>
</Tooltip>
</template>
<template v-if="desktop" #actions>
<DropdownMenu v-model:open="positionOpen">
<!-- No Tooltip around the trigger: nested in TooltipTrigger the menu
loses its anchor and opens off-screen, as MoreMenu found. -->
<DropdownMenuTrigger as-child>
<Button variant="ghost" size="icon-sm" class="flex-none" aria-label="Chat position" title="Position">
<component :is="MODES.find((m) => m.mode === mode)?.icon ?? PictureInPicture2" />
</Button>
</DropdownMenuTrigger>
<DropdownMenuContent align="end" class="min-w-36">
<DropdownMenuRadioGroup :model-value="mode" @update:model-value="setMode($event as DockMode)">
<DropdownMenuRadioItem v-for="m in MODES" :key="m.mode" :value="m.mode">
<component :is="m.icon" />{{ m.label }}
</DropdownMenuRadioItem>
</DropdownMenuRadioGroup>
</DropdownMenuContent>
</DropdownMenu>
</template>
<template #end>
<Tooltip>
<TooltipTrigger as-child>
<Button
variant="ghost"
size="icon-sm"
class="flex-none"
aria-label="Hide conversation"
@click="expanded = false"
>
<ChevronDown />
</Button>
</TooltipTrigger>
<TooltipContent>Hide conversation</TooltipContent>
</Tooltip>
</template>
</ChatBar>
</div>
<div
@@ -519,12 +552,13 @@ function onPinKey(event: KeyboardEvent): void {
</div>
<div @focusin="expanded = true" @pointerdown="onBarPointerDown">
<ChatComposer :open="false" :flat="!expanded">
<template v-if="!expanded" #actions>
<Tooltip v-if="desktop">
<template v-if="!expanded && desktop" #start>
<Tooltip>
<TooltipTrigger as-child>
<Button
variant="ghost"
size="icon-sm"
class="-ml-1.5 cursor-grab active:cursor-grabbing"
data-move-handle
aria-label="Move chat"
title="Drag to move. Arrow keys move; Shift moves further."
@@ -535,6 +569,8 @@ function onPinKey(event: KeyboardEvent): void {
</TooltipTrigger>
<TooltipContent>Move chat</TooltipContent>
</Tooltip>
</template>
<template v-if="!expanded" #actions>
<Tooltip>
<TooltipTrigger as-child>
<Button
+17 -6
View File
@@ -1,17 +1,28 @@
<script setup lang="ts">
import { computed } from "vue";
import { useAccountsStore } from "@/accounts/accounts";
import Logo from "@/components/topbar/Logo.vue";
import ChatSuggestions from "./ChatSuggestions.vue";
/**
* What the panel opens on before there is a conversation: the mark. The
* suggested prompts live beside the composer (ChatSuggestions), where they
* are reachable whether or not the transcript is empty.
* What the panel opens on before there is a conversation: the mark, a greeting
* and the prompts for this page. Once the conversation has messages the
* prompts move beside the composer.
*/
const accounts = useAccountsStore();
const greeting = computed(() => {
const first = accounts.status?.user?.display_name.trim().split(/\s+/)[0];
return first ? `How can I help, ${first}?` : "How can I help?";
});
</script>
<template>
<div class="w-full self-center justify-self-center py-6 text-center">
<div aria-hidden="true" class="mb-3 flex justify-center">
<Logo :open="false" />
<div class="w-full self-center justify-self-center px-1 py-6">
<div aria-hidden="true" class="mb-4 flex justify-center">
<Logo :open="false" class="text-[4rem]!" />
</div>
<h2 class="mb-5 text-center text-xl font-semibold tracking-tight">{{ greeting }}</h2>
<ChatSuggestions list />
</div>
</template>
+60 -38
View File
@@ -1,48 +1,70 @@
<script setup lang="ts">
import {
Select,
SelectContent,
SelectGroup,
SelectItem,
SelectTrigger,
SelectValue,
} from "@/components/ui/select";
import { History } from "@lucide/vue";
import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip";
import { Check, History, SquarePen, X } from "@lucide/vue";
import { onMounted, ref } from "vue";
import { Button } from "@/components/ui/button";
import { sessionTitle } from "./session";
import { currentSession, selectSession, sessions } from "./state";
import { currentSession, newChat, selectSession, sessions } from "./state";
/**
* Which conversation is open, and how to switch. A select rather than a list:
* the panel is small, and choosing between a handful of conversations is a
* control, not a place to be.
*
* reka-ui refuses an empty string as an item value -- it is how the component
* spells "nothing selected" -- and a session id is never empty, so the ids pass
* through unchanged.
* The conversation drawer the bar's menu button opens over the panel: a new
* conversation first, then every conversation to switch to. It covers the
* panel rather than dropping down, so long titles get the panel's width.
*/
const emit = defineEmits<{ close: [] }>();
// Focus moves into the drawer, so Escape and Tab act on it straight away. The
// drawer itself takes it, not its first button, whose tooltip would open.
const nav = ref<HTMLElement | null>(null);
onMounted(() => nav.value?.focus());
function choose(id: string): void {
selectSession(id);
emit("close");
}
function start(): void {
newChat();
emit("close");
}
</script>
<template>
<div class="min-w-0 flex-1">
<Select
:model-value="currentSession"
:disabled="!sessions.length"
@update:model-value="selectSession(String($event))"
<nav
ref="nav"
tabindex="-1"
aria-label="Conversations"
class="outline-none absolute inset-0 z-20 flex flex-col gap-0.5 overflow-y-auto rounded-[inherit] bg-popover p-2"
@pointerdown.stop
@dblclick.stop
@keydown.esc.stop.prevent="emit('close')"
>
<Tooltip>
<TooltipTrigger as-child>
<Button variant="ghost" size="icon-sm" class="mb-1" aria-label="Close conversations" @click="emit('close')">
<X />
</Button>
</TooltipTrigger>
<TooltipContent>Close</TooltipContent>
</Tooltip>
<Button variant="ghost" size="sm" class="justify-start" @click="start">
<SquarePen data-icon="inline-start" />New chat
</Button>
<div class="mt-2 flex items-center gap-2 px-2 py-1 text-caption text-fg-muted">
<History class="size-3.5" aria-hidden="true" />Chats
</div>
<Button
v-for="session in sessions"
:key="session.session_id"
variant="ghost"
size="sm"
class="justify-start pl-7 font-normal"
:aria-current="session.session_id === currentSession ? 'true' : undefined"
@click="choose(session.session_id)"
>
<SelectTrigger size="sm" class="w-full border-0 bg-transparent px-1.5 font-medium shadow-none hover:bg-muted" aria-label="Conversation">
<span class="flex min-w-0 items-center gap-1.5"><History class="size-3.5 shrink-0 text-fg-muted" aria-hidden="true" /><SelectValue placeholder="No conversations yet" /></span>
</SelectTrigger>
<SelectContent position="popper">
<SelectGroup>
<SelectItem
v-for="session in sessions"
:key="session.session_id"
:value="session.session_id"
>
{{ sessionTitle(session) }}
</SelectItem>
</SelectGroup>
</SelectContent>
</Select>
</div>
<span class="min-w-0 flex-1 truncate text-left">{{ sessionTitle(session) }}</span>
<Check v-if="session.session_id === currentSession" class="flex-none" aria-hidden="true" />
</Button>
</nav>
</template>
+41 -8
View File
@@ -1,29 +1,58 @@
<script setup lang="ts">
import { computed } from "vue";
import { MessageSquare } from "@lucide/vue";
import { computed, onUnmounted } from "vue";
import { useRoute } from "vue-router";
import { Button } from "@/components/ui/button";
import { sendMessage } from "./state";
import { placeholderHint, sendMessage } from "./state";
import { suggestionsForRoute } from "./suggestions";
/**
* The suggested prompts for the page the operator is on, rendered beside the
* composer so they stay reachable with a conversation already open, without
* scrolling to the top of the transcript. A click sends the prompt as its own
* message (sendMessage's textOverride path sends at once while no turn runs)
* rather than filling the field.
* The suggested prompts for the page the operator is on. The empty
* conversation lists them (`list`); beside the composer they are chips. A click
* sends the prompt as its own message (sendMessage's textOverride path sends at
* once while no turn runs) rather than filling the field, and resting on one
* previews it as the composer's placeholder.
*/
defineProps<{ list?: boolean }>();
const route = useRoute();
const prompts = computed(() => suggestionsForRoute(route));
function send(prompt: string): void {
placeholderHint.value = "";
void sendMessage({ textOverride: prompt });
}
function preview(prompt: string): void {
placeholderHint.value = prompt;
}
function clear(): void {
placeholderHint.value = "";
}
onUnmounted(clear);
</script>
<template>
<ul v-if="prompts.length && list" class="flex flex-col gap-1 text-left" aria-label="Suggested prompts">
<li v-for="prompt in prompts" :key="prompt">
<Button
variant="ghost"
class="h-auto w-full justify-start gap-3 py-1.5 whitespace-normal text-left font-normal"
@click="send(prompt)"
@pointerenter="preview(prompt)"
@pointerleave="clear"
@focus="preview(prompt)"
@blur="clear"
>
<span class="flex size-7 flex-none items-center justify-center rounded-md border" aria-hidden="true">
<MessageSquare class="size-3.5" />
</span>
{{ prompt }}
</Button>
</li>
</ul>
<div
v-if="prompts.length"
v-else-if="prompts.length"
class="mb-2 flex flex-wrap gap-1.5"
role="group"
aria-label="Suggested prompts"
@@ -35,6 +64,10 @@ function send(prompt: string): void {
size="sm"
class="h-auto max-w-full whitespace-normal text-left"
@click="send(prompt)"
@pointerenter="preview(prompt)"
@pointerleave="clear"
@focus="preview(prompt)"
@blur="clear"
>
{{ prompt }}
</Button>
+2
View File
@@ -206,6 +206,8 @@ export const sessions = ref<ChatSession[]>([]);
export const currentSession = ref("");
export const messages = ref<ChatMessage[]>([]);
const drafts = ref<Record<string, string>>({});
/** A suggested prompt the pointer or focus rests on, previewed as the composer placeholder. */
export const placeholderHint = ref("");
/** The unsent text of the open conversation; each conversation keeps its own. */
export const composerText = computed({
get: () => drafts.value[currentSession.value] ?? "",
+2 -2
View File
@@ -206,11 +206,11 @@ test("chat More menu opens on screen and its items run", { timeout: 90000 }, asy
// Pick the open conversation first, so the menu's commands have a
// session to act on (selectSession itself streams /resume s1).
await cdp.evaluate(`(() => {
document.querySelector('button[aria-label="Conversation"]').click();
document.querySelector('button[aria-label="Conversations"]').click();
})()`);
await new Promise((r) => setTimeout(r, 800));
await cdp.evaluate(`(() => {
const item = [...document.querySelectorAll('[data-slot="select-item"]')].find((el) => el.innerText.includes("Test session"));
const item = [...document.querySelectorAll('nav[aria-label="Conversations"] button')].find((el) => el.innerText.includes("Test session"));
if (item) item.click();
})()`);
await cdp.evaluate(`(async () => {