Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
fix: ui for agent chat (#21510)
ecmadao9b044035d6ff
diff --git a/frontend/src/locales/en-US.json b/frontend/src/locales/en-US.jsonindex 1079c115fc..fdd446cc66 100644--- a/frontend/src/locales/en-US.json+++ b/frontend/src/locales/en-US.json@@ -22,7 +22,7 @@}},"agent": {- "active-only-chats": "Active only",+ "active-only-chats": "View active chats","ai-not-configured": {"configure": "Configure","contact-admin": "Contact your workspace admin to configure AI.",@@ -31,7 +31,7 @@},"archive-all-chats": "Archive all chats","archive-chat": "Archive chat",- "archived-only-chats": "Archived only",+ "archived-only-chats": "View archived chats","args": "Args","assistant-title": "AI Assistant","cancel": "Cancel",diff --git a/frontend/src/locales/es-ES.json b/frontend/src/locales/es-ES.jsonindex f45b7f561e..d900e59660 100644--- a/frontend/src/locales/es-ES.json+++ b/frontend/src/locales/es-ES.json@@ -22,7 +22,7 @@}},"agent": {- "active-only-chats": "Solo activos",+ "active-only-chats": "Ver chats activos","ai-not-configured": {"configure": "Configurar","contact-admin": "Contacte al administrador de su espacio de trabajo para configurar la IA.",@@ -31,7 +31,7 @@},"archive-all-chats": "Archivar todos los chats","archive-chat": "Archivar chat",- "archived-only-chats": "Solo archivados",+ "archived-only-chats": "Ver chats archivados","args": "Argumentos","assistant-title": "Asistente de IA","cancel": "Cancelar",diff --git a/frontend/src/locales/ja-JP.json b/frontend/src/locales/ja-JP.jsonindex ba355e548e..befa90fbde 100644--- a/frontend/src/locales/ja-JP.json+++ b/frontend/src/locales/ja-JP.json@@ -22,7 +22,7 @@}},"agent": {- "active-only-chats": "アクティブのみ",+ "active-only-chats": "アクティブなチャットを表示","ai-not-configured": {"configure": "設定","contact-admin": "ワークスペース管理者に AI の設定を依頼してください。",@@ -31,7 +31,7 @@},"archive-all-chats": "すべてのチャットをアーカイブ","archive-chat": "チャットをアーカイブ",- "archived-only-chats": "アーカイブ済みのみ",+ "archived-only-chats": "アーカイブ済みのチャットを表示","args": "引数","assistant-title": "AI アシスタント","cancel": "キャンセル",diff --git a/frontend/src/locales/vi-VN.json b/frontend/src/locales/vi-VN.jsonindex 801e120db6..8f7db9464d 100644--- a/frontend/src/locales/vi-VN.json+++ b/frontend/src/locales/vi-VN.json@@ -22,7 +22,7 @@}},"agent": {- "active-only-chats": "Chỉ hoạt động",+ "active-only-chats": "Xem các cuộc trò chuyện đang hoạt động","ai-not-configured": {"configure": "Cấu hình","contact-admin": "Liên hệ quản trị viên không gian làm việc để cấu hình AI.",@@ -31,7 +31,7 @@},"archive-all-chats": "Lưu trữ tất cả cuộc trò chuyện","archive-chat": "Lưu trữ cuộc trò chuyện",- "archived-only-chats": "Chỉ đã lưu trữ",+ "archived-only-chats": "Xem các cuộc trò chuyện đã lưu trữ","args": "Tham số","assistant-title": "Trợ lý AI","cancel": "Hủy",diff --git a/frontend/src/locales/zh-CN.json b/frontend/src/locales/zh-CN.jsonindex 9d34c3c0b2..a9750043c8 100644--- a/frontend/src/locales/zh-CN.json+++ b/frontend/src/locales/zh-CN.json@@ -22,7 +22,7 @@}},"agent": {- "active-only-chats": "仅活跃",+ "active-only-chats": "查看活跃对话","ai-not-configured": {"configure": "配置","contact-admin": "请联系工作区管理员配置 AI。",@@ -31,7 +31,7 @@},"archive-all-chats": "归档所有对话","archive-chat": "归档对话",- "archived-only-chats": "仅已归档",+ "archived-only-chats": "查看已归档对话","args": "参数","assistant-title": "AI 助手","cancel": "取消",diff --git a/frontend/src/modules/agent/components/AgentInput.test.tsx b/frontend/src/modules/agent/components/AgentInput.test.tsxindex 3ccd2d4a2f..513e52320b 100644--- a/frontend/src/modules/agent/components/AgentInput.test.tsx+++ b/frontend/src/modules/agent/components/AgentInput.test.tsx@@ -366,6 +366,8 @@ describe("AgentInput", () => {expect(placeholder?.textContent).toBe("agent.input-placeholder");expect(placeholder?.className).toContain("truncate");expect(placeholder?.className).toContain("pointer-events-none");+ expect(placeholder?.className).toContain("inset-y-0");+ expect(placeholder?.className).toContain("items-center");const textarea = container.querySelector("textarea");expect(textarea).toBeInstanceOf(HTMLTextAreaElement);@@ -389,6 +391,9 @@ describe("AgentInput", () => {const row = container.querySelector("[data-agent-input-row]");expect(row?.className).toContain("items-end");+ expect(container.querySelector("textarea")?.className).toContain(+ "h-9"+ );expect(container.querySelector("textarea")?.className).toContain("min-h-9");diff --git a/frontend/src/modules/agent/components/AgentInput.tsx b/frontend/src/modules/agent/components/AgentInput.tsxindex ebc8f176f4..780a1ef4c8 100644--- a/frontend/src/modules/agent/components/AgentInput.tsx+++ b/frontend/src/modules/agent/components/AgentInput.tsx@@ -778,7 +778,7 @@ export function AgentInput() {<div className="relative w-full">{!input && (<div- className="pointer-events-none absolute inset-x-3 top-1.5 z-10 truncate text-sm leading-5 text-control-light"+ className="pointer-events-none absolute inset-x-3 inset-y-0 z-10 flex items-center truncate text-sm leading-5 text-control-light"data-agent-input-placeholder>{inputPlaceholder}@@ -789,7 +789,7 @@ export function AgentInput() {ref={textareaRef}value={input}rows={1}- className="block min-h-9 max-h-[134px] w-full resize-none overflow-y-hidden rounded-xs border px-3 py-1.5 text-sm leading-5 outline-none focus:ring-1 focus:ring-accent disabled:opacity-50"+ className="block h-9 min-h-9 max-h-[134px] w-full resize-none overflow-y-hidden rounded-xs border px-3 py-1.5 text-sm leading-5 outline-none focus:ring-1 focus:ring-accent disabled:opacity-50"aria-label={inputPlaceholder}disabled={isCurrentChatRunning || isAIConfigurationBlocked}onChange={(e) => {diff --git a/frontend/src/modules/agent/components/AgentWindow.test.tsx b/frontend/src/modules/agent/components/AgentWindow.test.tsxindex 5106107cec..236634c3cf 100644--- a/frontend/src/modules/agent/components/AgentWindow.test.tsx+++ b/frontend/src/modules/agent/components/AgentWindow.test.tsx@@ -135,6 +135,60 @@ afterEach(() => {});describe("AgentWindow", () => {+ test("uses an accessible panel separator for the chat sidebar", () => {+ const { render, unmount } = renderIntoContainer(<AgentWindow />);++ render();++ const separator = document.body.querySelector(+ "[data-agent-sidebar-resize]"+ );++ expect(separator).toHaveAttribute("role", "separator");+ expect(separator).toHaveAttribute("data-separator");+ expect(separator).not.toBeInstanceOf(HTMLButtonElement);++ unmount();+ });++ test("uses compact borderless controls in the chat sidebar header", () => {+ const { render, unmount } = renderIntoContainer(<AgentWindow />);++ render();++ const actions = document.body.querySelector(+ "[data-agent-chat-sidebar-actions]"+ ) as HTMLDivElement | null;+ const controls = actions?.querySelectorAll("button");++ expect(controls).toHaveLength(2);+ expect(controls?.[0]?.className).toContain("h-6");+ expect(controls?.[0]?.className).not.toContain("border");+ expect(controls?.[0]?.querySelector("svg")?.className.baseVal).toContain(+ "size-3.5"+ );+ expect(controls?.[1]?.className).toContain("size-6");+ expect(controls?.[1]?.className).not.toContain("border");+ expect(controls?.[1]?.querySelector("svg")?.className.baseVal).toContain(+ "size-3.5"+ );++ unmount();+ });++ test("keeps the selected chat row stable while its actions are revealed", () => {+ const { render, unmount } = renderIntoContainer(<AgentWindow />);++ render();++ const title = document.body.querySelector("[data-agent-chat-title]");+ const titleButton = title?.closest("button");++ expect(titleButton?.className).toContain("hover:bg-transparent");++ unmount();+ });+test("mounts the agent shell into the agent layer root", () => {const { render, unmount } = renderIntoContainer(<AgentWindow />);diff --git a/frontend/src/modules/agent/components/AgentWindow.tsx b/frontend/src/modules/agent/components/AgentWindow.tsxindex a73f8b7c38..1d3437a18a 100644--- a/frontend/src/modules/agent/components/AgentWindow.tsx+++ b/frontend/src/modules/agent/components/AgentWindow.tsx@@ -9,6 +9,12 @@ import {} from "react";import { createPortal } from "react-dom";import { useTranslation } from "react-i18next";+import {+ Panel,+ Group as PanelGroup,+ type PanelImperativeHandle,+ Separator as PanelResizeHandle,+} from "react-resizable-panels";import { HumanizeTs } from "@/components/HumanizeTs";import { Button } from "@/components/ui/button";import { Input } from "@/components/ui/input";@@ -118,8 +124,6 @@ export function AgentWindow() {bounds: { x: 0, y: 0, width: 0, height: 0 },direction: "se",});- const isSidebarResizingRef = useRef(false);- const sidebarResizeStartRef = useRef({ x: 0, width: 0 });const resizeObserverRef = useRef<ResizeObserver | null>(null);// --- Clamping helpers ---@@ -228,9 +232,15 @@ export function AgentWindow() {height: `${displayWindowState.size.height}px`,};- const sidebarStyle: React.CSSProperties = {- width: `${clampedSidebarWidth}px`,- };+ const maxSidebarWidth = Math.max(+ MIN_SIDEBAR_WIDTH,+ displayWindowState.size.width - MIN_MAIN_PANEL_WIDTH+ );+ const minSidebarWidth = Math.min(MIN_SIDEBAR_WIDTH, maxSidebarWidth);+ const minMainPanelWidth = Math.min(+ MIN_MAIN_PANEL_WIDTH,+ Math.max(1, displayWindowState.size.width - minSidebarWidth)+ );// --- Derived chat data ---@@ -534,17 +544,15 @@ export function AgentWindow() {// and only commit to the Zustand store on pointerup, avoiding per-frame// immer drafts + React re-renders.- const sidebarRef = useRef<HTMLElement>(null);+ const sidebarPanelRef = useRef<PanelImperativeHandle | null>(null);const dragCleanupRef = useRef<(() => void) | null>(null);const resizeCleanupRef = useRef<(() => void) | null>(null);- const sidebarResizeCleanupRef = useRef<(() => void) | null>(null);// Cleanup drag/resize listeners on unmountuseEffect(() => {return () => {dragCleanupRef.current?.();resizeCleanupRef.current?.();- sidebarResizeCleanupRef.current?.();};}, []);@@ -679,52 +687,6 @@ export function AgentWindow() {[canResizeWindow, syncStoreToDisplayState]);- // --- Sidebar resize ----- const startSidebarResize = useCallback(- (event: React.PointerEvent<HTMLButtonElement>) => {- if (event.button !== 0) return;- event.preventDefault();- event.stopPropagation();- syncStoreToDisplayState();- isSidebarResizingRef.current = true;- sidebarResizeStartRef.current = {- x: event.clientX,- width: clampedSidebarWidth,- };-- const onSidebarResize = (e: PointerEvent) => {- if (!isSidebarResizingRef.current || !sidebarRef.current) return;- const dx = e.clientX - sidebarResizeStartRef.current.x;- const newWidth = sidebarResizeStartRef.current.width + dx;- const windowWidth = windowRef.current?.offsetWidth ?? 0;- const maxSW = Math.max(- MIN_SIDEBAR_WIDTH,- windowWidth - MIN_MAIN_PANEL_WIDTH- );- const minSW = Math.min(MIN_SIDEBAR_WIDTH, maxSW);- const clamped = Math.min(maxSW, Math.max(minSW, Math.round(newWidth)));- sidebarRef.current.style.width = `${clamped}px`;- useAgentStore.getState().setSidebarWidth(clamped);- };-- const stopSidebarResize = () => {- isSidebarResizingRef.current = false;- document.removeEventListener("pointermove", onSidebarResize);- document.removeEventListener("pointerup", stopSidebarResize);- document.removeEventListener("pointercancel", stopSidebarResize);- sidebarResizeCleanupRef.current = null;- useAgentStore.getState().saveWindowState();- };-- document.addEventListener("pointermove", onSidebarResize);- document.addEventListener("pointerup", stopSidebarResize);- document.addEventListener("pointercancel", stopSidebarResize);- sidebarResizeCleanupRef.current = stopSidebarResize;- },- [syncStoreToDisplayState, clampedSidebarWidth]- );-// --- Viewport resize ---useEffect(() => {@@ -842,6 +804,21 @@ export function AgentWindow() {}}, [displayWindowState.size.width]);+ useEffect(() => {+ const panel = sidebarPanelRef.current;+ if (!panel) return;+ if (Math.round(panel.getSize().inPixels) !== clampedSidebarWidth) {+ panel.resize(clampedSidebarWidth);+ }+ }, [clampedSidebarWidth]);++ const saveSidebarWidth = useCallback(() => {+ const width = sidebarPanelRef.current?.getSize().inPixels;+ if (!width || !Number.isFinite(width)) return;+ useAgentStore.getState().setSidebarWidth(clampSidebarWidth(width));+ useAgentStore.getState().saveWindowState();+ }, [clampSidebarWidth]);+// --- Mount: load window state ---useEffect(() => {@@ -956,236 +933,244 @@ export function AgentWindow() {</div>{/* Body */}- <div className="flex min-h-0 flex-1 overflow-hidden bg-background">+ <PanelGroup+ orientation="horizontal"+ className="min-h-0 flex-1 bg-background"+ onLayoutChanged={(_, meta) => {+ if (meta.isUserInteraction) saveSidebarWidth();+ }}+ >{/* Sidebar */}- <aside- ref={sidebarRef}- className="flex shrink-0 flex-col border-r border-block-border bg-control-bg"- style={sidebarStyle}+ <Panel+ id="agent-chat-sidebar"+ panelRef={sidebarPanelRef}+ defaultSize={clampedSidebarWidth}+ minSize={minSidebarWidth}+ maxSize={maxSidebarWidth}+ groupResizeBehavior="preserve-pixel-size">- {/* Sidebar header */}- <div className="border-b border-block-border px-3 py-3">- <div className="flex items-center justify-between gap-x-2">- <div>- <h2 className="text-xs font-semibold uppercase tracking-wide text-control-light">- {t("agent.chat-list-label")}- </h2>- </div>- <div- className="flex items-center gap-x-2"- data-agent-chat-sidebar-actions- >- <AgentTooltip content={t("agent.new-chat")}>- <Button- appearance="outline"- size="sm"- className="text-control-light"- aria-label={t("agent.new-chat")}- disabled={isChatCreationDisabled}- onClick={createChat}- >- <Plus className="size-4" aria-hidden="true" />- </Button>- </AgentTooltip>- <AgentDropdownMenu>- <AgentTooltip content={t("common.more")}>- <AgentDropdownMenuTrigger- className="inline-flex size-7 items-center justify-center rounded-xs border border-control-border bg-transparent text-control-light outline-hidden hover:bg-control-bg focus-visible:ring-2 focus-visible:ring-accent disabled:pointer-events-none disabled:opacity-50"- aria-label={t("common.more")}- onClick={(event) => event.stopPropagation()}+ <aside className="flex size-full flex-col border-r border-block-border bg-control-bg">+ {/* Sidebar header */}+ <div className="border-b border-block-border px-3 py-3">+ <div className="flex items-center justify-between gap-x-2">+ <div>+ <h2 className="text-xs font-semibold uppercase tracking-wide text-control-light">+ {t("agent.chat-list-label")}+ </h2>+ </div>+ <div+ className="flex items-center gap-x-1"+ data-agent-chat-sidebar-actions+ >+ <AgentTooltip content={t("agent.new-chat")}>+ <Button+ appearance="secondary"+ size="xs"+ className="px-1 text-control-light hover:bg-control-bg-hover"+ aria-label={t("agent.new-chat")}+ disabled={isChatCreationDisabled}+ onClick={createChat}>- <EllipsisVertical- className="size-4"- aria-hidden="true"- />- </AgentDropdownMenuTrigger>+ <Plus className="size-3.5" aria-hidden="true" />+ </Button></AgentTooltip>- <AgentDropdownMenuContent>- {showArchivedOnly ? (- <>- <AgentDropdownMenuItem- data-agent-unarchive-all-chats- disabled={isUnarchiveAllDisabled}- onClick={(event) => {- event.stopPropagation();- unarchiveAllChats();- }}- >- {t("agent.unarchive-all-chats")}- </AgentDropdownMenuItem>+ <AgentDropdownMenu>+ <AgentTooltip content={t("common.more")}>+ <AgentDropdownMenuTrigger+ className="inline-flex size-6 items-center justify-center rounded-xs text-control-light outline-hidden hover:bg-control-bg-hover focus-visible:ring-2 focus-visible:ring-accent disabled:pointer-events-none disabled:opacity-50"+ aria-label={t("common.more")}+ onClick={(event) => event.stopPropagation()}+ >+ <EllipsisVertical+ className="size-3.5"+ aria-hidden="true"+ />+ </AgentDropdownMenuTrigger>+ </AgentTooltip>+ <AgentDropdownMenuContent>+ {showArchivedOnly ? (+ <>+ <AgentDropdownMenuItem+ data-agent-unarchive-all-chats+ disabled={isUnarchiveAllDisabled}+ onClick={(event) => {+ event.stopPropagation();+ unarchiveAllChats();+ }}+ >+ {t("agent.unarchive-all-chats")}+ </AgentDropdownMenuItem>+ <AgentDropdownMenuItem+ data-agent-delete-all-chats+ className="text-error data-highlighted:bg-error/10"+ disabled={isDeleteAllDisabled}+ onClick={(event) => {+ event.stopPropagation();+ setIsDeleteAllArchivedChatsDialogOpen(true);+ }}+ >+ {t("agent.delete-all-chats")}+ </AgentDropdownMenuItem>+ </>+ ) : (<AgentDropdownMenuItem- data-agent-delete-all-chats- className="text-error data-highlighted:bg-error/10"- disabled={isDeleteAllDisabled}+ data-agent-archive-all-chats+ disabled={isArchiveAllDisabled}onClick={(event) => {event.stopPropagation();- setIsDeleteAllArchivedChatsDialogOpen(true);+ archiveAllChats();}}>- {t("agent.delete-all-chats")}+ {t("agent.archive-all-chats")}</AgentDropdownMenuItem>- </>- ) : (+ )}+ <AgentDropdownMenuSeparator /><AgentDropdownMenuItem- data-agent-archive-all-chats- disabled={isArchiveAllDisabled}+ data-agent-chat-list-modeonClick={(event) => {event.stopPropagation();- archiveAllChats();+ toggleChatListMode();}}>- {t("agent.archive-all-chats")}+ {showArchivedOnly+ ? t("agent.active-only-chats")+ : t("agent.archived-only-chats")}</AgentDropdownMenuItem>- )}- <AgentDropdownMenuSeparator />- <AgentDropdownMenuItem- data-agent-chat-list-mode- onClick={(event) => {- event.stopPropagation();- toggleChatListMode();- }}- >- {showArchivedOnly- ? t("agent.active-only-chats")- : t("agent.archived-only-chats")}- </AgentDropdownMenuItem>- </AgentDropdownMenuContent>- </AgentDropdownMenu>+ </AgentDropdownMenuContent>+ </AgentDropdownMenu>+ </div></div></div>- </div>- {/* Chat list */}- <div className="min-h-0 flex-1 overflow-y-auto px-2 py-2">- <div className="flex flex-col gap-y-1" data-agent-chat-list>- {displayedChats.map((chat) => (- <div- key={chat.id}- className={`group w-full rounded-xs px-3 py-2 text-left text-sm transition-colors ${- chat.id === currentChatId- ? "bg-accent/10 text-accent"- : "text-control hover:bg-background"- }`}- data-agent-chat-row={chat.id}- >- {chat.id === currentChatId && isRenamingCurrentChat ? (- <Input- ref={renameInputRef}- value={renamingTitle}- onChange={(e) => setRenamingTitle(e.target.value)}- className="h-7 text-sm"- placeholder={t("agent.rename-chat-placeholder")}- data-agent-inline-rename-input- onBlur={commitRenameCurrentChat}- onKeyDown={onRenameKeydown}- />- ) : (- <div className="flex items-start gap-x-2">- <Button- appearance="secondary"- size="md"- type="button"- className="h-auto min-w-0 flex-1 flex-col items-start p-0 text-left whitespace-normal disabled:cursor-not-allowed disabled:opacity-60"- disabled={- !useAgentStore.getState().canSelectChat(chat.id)- }- aria-current={- chat.id === currentChatId ? "true" : undefined- }- onClick={() => handleChatRowClick(chat.id)}- >- <div- className="w-full truncate font-medium"- data-agent-chat-title- >- {getChatLabel(chat)}- </div>- <span- className={`mt-1 block w-full truncate text-xs ${- chat.id === currentChatId- ? "text-accent/80"- : "text-control-light"- }`}- data-agent-chat-updated-ts+ {/* Chat list */}+ <div className="min-h-0 flex-1 overflow-y-auto px-2 py-2">+ <div className="flex flex-col gap-y-1" data-agent-chat-list>+ {displayedChats.map((chat) => (+ <div+ key={chat.id}+ className={`group w-full rounded-xs px-3 py-2 text-left text-sm transition-colors ${+ chat.id === currentChatId+ ? "bg-accent/10 text-accent"+ : "text-control hover:bg-control-bg-hover"+ }`}+ data-agent-chat-row={chat.id}+ >+ {chat.id === currentChatId && isRenamingCurrentChat ? (+ <Input+ ref={renameInputRef}+ value={renamingTitle}+ onChange={(e) => setRenamingTitle(e.target.value)}+ className="h-7 text-sm"+ placeholder={t("agent.rename-chat-placeholder")}+ data-agent-inline-rename-input+ onBlur={commitRenameCurrentChat}+ onKeyDown={onRenameKeydown}+ />+ ) : (+ <div className="flex items-start gap-x-2">+ <Button+ appearance="secondary"+ size="md"+ type="button"+ className="h-auto min-w-0 flex-1 flex-col items-start p-0 text-left whitespace-normal hover:bg-transparent disabled:cursor-not-allowed disabled:opacity-60"+ disabled={+ !useAgentStore.getState().canSelectChat(chat.id)+ }+ aria-current={+ chat.id === currentChatId ? "true" : undefined+ }+ onClick={() => handleChatRowClick(chat.id)}>- <AgentTooltip- content={formatAbsoluteDateTime(chat.updatedTs)}+ <div+ className="w-full truncate font-medium"+ data-agent-chat-title>- <HumanizeTs- ts={Math.floor(chat.updatedTs / 1000)}- tooltip={false}- />- </AgentTooltip>- </span>- </Button>- <div className="pointer-events-none flex shrink-0 items-center gap-x-2 opacity-0 transition-opacity group-hover:pointer-events-auto group-hover:opacity-100 group-focus-within:pointer-events-auto group-focus-within:opacity-100">- {chat.archived ? (- <>- <SidebarIconButton- tooltip={t("agent.unarchive-chat")}- ariaLabel={t("agent.unarchive-chat")}- dataAttr="data-agent-unarchive-chat"- onClick={() => unarchiveChat(chat.id)}+ {getChatLabel(chat)}+ </div>+ <span+ className={`mt-1 block w-full truncate text-xs ${+ chat.id === currentChatId+ ? "text-accent/80"+ : "text-control-light"+ }`}+ data-agent-chat-updated-ts+ >+ <AgentTooltip+ content={formatAbsoluteDateTime(chat.updatedTs)}>- <Undo2- className="size-3.5"- aria-hidden="true"+ <HumanizeTs+ ts={Math.floor(chat.updatedTs / 1000)}+ tooltip={false}/>- </SidebarIconButton>- <ConfirmDialog- message={t("agent.delete-chat-confirmation")}- onConfirm={() => deleteChat(chat.id)}- triggerLabel={t("agent.delete-chat")}- triggerDataAttr="data-agent-delete-chat"- triggerVariant="icon"+ </AgentTooltip>+ </span>+ </Button>+ <div className="pointer-events-none flex shrink-0 items-center gap-x-2 opacity-0 transition-opacity group-hover:pointer-events-auto group-hover:opacity-100 group-focus-within:pointer-events-auto group-focus-within:opacity-100">+ {chat.archived ? (+ <>+ <SidebarIconButton+ tooltip={t("agent.unarchive-chat")}+ ariaLabel={t("agent.unarchive-chat")}+ dataAttr="data-agent-unarchive-chat"+ onClick={() => unarchiveChat(chat.id)}+ >+ <Undo2+ className="size-3.5"+ aria-hidden="true"+ />+ </SidebarIconButton>+ <ConfirmDialog+ message={t("agent.delete-chat-confirmation")}+ onConfirm={() => deleteChat(chat.id)}+ triggerLabel={t("agent.delete-chat")}+ triggerDataAttr="data-agent-delete-chat"+ triggerVariant="icon"+ >+ <Trash2+ className="size-3.5"+ aria-hidden="true"+ />+ </ConfirmDialog>+ </>+ ) : (+ <SidebarIconButton+ tooltip={t("agent.archive-chat")}+ ariaLabel={t("agent.archive-chat")}+ dataAttr="data-agent-archive-chat"+ onClick={() => archiveChat(chat.id)}>- <Trash2+ <ArchiveclassName="size-3.5"aria-hidden="true"/>- </ConfirmDialog>- </>- ) : (- <SidebarIconButton- tooltip={t("agent.archive-chat")}- ariaLabel={t("agent.archive-chat")}- dataAttr="data-agent-archive-chat"- onClick={() => archiveChat(chat.id)}- >- <Archive- className="size-3.5"- aria-hidden="true"- />- </SidebarIconButton>- )}+ </SidebarIconButton>+ )}+ </div></div>- </div>- )}- </div>- ))}+ )}+ </div>+ ))}+ </div></div>- </div>- </aside>+ </aside>+ </Panel>{/* Sidebar resize handle */}- <Button- appearance="secondary"- size="xs"- type="button"- data-agent-window-action+ <PanelResizeHandledata-agent-sidebar-resize- className="group relative w-1 shrink-0 cursor-col-resize bg-control-bg transition-colors hover:bg-accent/10 [touch-action:none]"- onPointerDown={startSidebarResize}+ className="group relative w-1 shrink-0 cursor-ew-resize bg-control-bg transition-colors hover:bg-accent/10"><span className="pointer-events-none absolute inset-y-0 left-1/2 w-px -translate-x-1/2 bg-transparent transition-colors group-hover:bg-accent" />- </Button>+ </PanelResizeHandle>{/* Main panel */}- <div className="flex min-w-0 flex-1 flex-col">- <AgentChat className="min-h-0 flex-1" />- <AgentInput />- </div>- </div>+ <Panel id="agent-chat-main" minSize={minMainPanelWidth}>+ <div className="flex size-full min-w-0 flex-col">+ <AgentChat className="min-h-0 flex-1" />+ <AgentInput />+ </div>+ </Panel>+ </PanelGroup></div>{canResizeWindow &&@@ -1315,11 +1300,11 @@ function SidebarIconButton({if (dataAttr) dataProps[dataAttr] = true;return (- <AgentTooltip content={tooltip}>+ <AgentTooltip content={tooltip} delayDuration={500}><Buttonappearance="secondary"size="xs"- className="text-control-light hover:bg-background"+ className="text-control-light hover:bg-control-bg-hover"aria-label={ariaLabel}onClick={(event) => {event.stopPropagation();diff --git a/frontend/src/modules/agent/store/agent.test.ts b/frontend/src/modules/agent/store/agent.test.tsindex f1a0902708..7fbd26f78a 100644--- a/frontend/src/modules/agent/store/agent.test.ts+++ b/frontend/src/modules/agent/store/agent.test.ts@@ -4,6 +4,7 @@ import type { AgentState } from "./agent";import {AGENT_STATE_KEY,AGENT_WINDOW_KEY,+ AGENT_WINDOW_LAYOUT_VERSION,createAgentStore,selectLoading,selectOrderedChats,@@ -70,13 +71,13 @@ describe("useAgentStore (Zustand)", () => {expect(s(store).chats[0].totalTokensUsed).toBe(0);});- test("uses viewport-relative medium window defaults when no saved window state exists", () => {+ test("uses larger bottom-right window defaults when no saved window state exists", () => {setViewportSize(1440, 900);const store = createAgentStore();- expect(s(store).size).toEqual({ width: 788, height: 625 });- expect(s(store).position).toEqual({ x: 326, y: 138 });+ expect(s(store).size).toEqual({ width: 605, height: 451 });+ expect(s(store).position).toEqual({ x: 819, y: 433 });expect(s(store).sidebarWidth).toBe(200);});@@ -86,13 +87,36 @@ describe("useAgentStore (Zustand)", () => {const store = createAgentStore();expect(s(store).size).toEqual({ width: 398, height: 400 });- expect(s(store).position).toEqual({ x: 16, y: 25 });+ expect(s(store).position).toEqual({ x: 16, y: 34 });+ });++ test("moves outdated stored windows to the current default layout", () => {+ setViewportSize(1440, 900);+ localStorage.setItem(+ AGENT_WINDOW_KEY,+ JSON.stringify({+ layoutVersion: AGENT_WINDOW_LAYOUT_VERSION - 1,+ position: { x: 120, y: 240 },+ size: { width: 480, height: 640 },+ sidebarWidth: 280,+ })+ );++ const store = createAgentStore();++ expect(s(store).position).toEqual({ x: 819, y: 433 });+ expect(s(store).size).toEqual({ width: 605, height: 451 });+ expect(s(store).sidebarWidth).toBe(280);+ expect(localStorage.getItem(AGENT_WINDOW_KEY)).toContain(+ `"layoutVersion":${AGENT_WINDOW_LAYOUT_VERSION}`+ );});- test("loads persisted window state", () => {+ test("loads persisted window state from the current layout version", () => {localStorage.setItem(AGENT_WINDOW_KEY,JSON.stringify({+ layoutVersion: AGENT_WINDOW_LAYOUT_VERSION,position: { x: 120, y: 240 },size: { width: 480, height: 640 },sidebarWidth: 280,@@ -117,6 +141,7 @@ describe("useAgentStore (Zustand)", () => {localStorage.setItem(AGENT_WINDOW_KEY,JSON.stringify({+ layoutVersion: AGENT_WINDOW_LAYOUT_VERSION,position: { x: 120, y: 140 },size: { width: 480, height: 540 },sidebarWidth: 200,diff --git a/frontend/src/modules/agent/store/agent.ts b/frontend/src/modules/agent/store/agent.tsindex 2f95056242..00a1175374 100644--- a/frontend/src/modules/agent/store/agent.ts+++ b/frontend/src/modules/agent/store/agent.ts@@ -18,6 +18,7 @@ import {export const AGENT_STATE_KEY = "bb-agent-state-v2";export const AGENT_WINDOW_KEY = "bb-agent-window";+export const AGENT_WINDOW_LAYOUT_VERSION = 3;interface PersistedAgentState {currentChatId: string | null;@@ -1120,6 +1121,7 @@ export const createAgentStore = () => {storage.setItem(AGENT_WINDOW_KEY,JSON.stringify({+ layoutVersion: AGENT_WINDOW_LAYOUT_VERSION,position: state.position,size: state.size,sidebarWidth: state.sidebarWidth,@@ -1133,12 +1135,17 @@ export const createAgentStore = () => {if (!saved) return;try {const state = JSON.parse(saved) as {+ layoutVersion?: number;position?: { x?: number; y?: number };size?: { width?: number; height?: number };sidebarWidth?: number;};+ const isCurrentLayout =+ state.layoutVersion === AGENT_WINDOW_LAYOUT_VERSION;+ const defaultWindowState = getInitialWindowState();set((draft) => {if (+ isCurrentLayout &&typeof state.position?.x === "number" &&typeof state.position?.y === "number") {@@ -1148,6 +1155,7 @@ export const createAgentStore = () => {};}if (+ isCurrentLayout &&typeof state.size?.width === "number" &&typeof state.size?.height === "number") {@@ -1155,11 +1163,15 @@ export const createAgentStore = () => {width: state.size.width,height: state.size.height,};+ } else if (!isCurrentLayout) {+ draft.position = defaultWindowState.position;+ draft.size = defaultWindowState.size;}if (typeof state.sidebarWidth === "number") {draft.sidebarWidth = state.sidebarWidth;}});+ if (!isCurrentLayout) get().saveWindowState();} catch {storage?.removeItem(AGENT_WINDOW_KEY);}diff --git a/frontend/src/modules/agent/window.ts b/frontend/src/modules/agent/window.tsindex 75b58c2ead..d08283e62c 100644--- a/frontend/src/modules/agent/window.ts+++ b/frontend/src/modules/agent/window.ts@@ -7,10 +7,10 @@ export const MIN_HEIGHT = 400;export const WINDOW_MARGIN = 16;export const DEFAULT_SIDEBAR_WIDTH = 200;-const DEFAULT_WIDTH_RATIO = 0.56;-const DEFAULT_HEIGHT_RATIO = 0.72;-const MAX_DEFAULT_WIDTH = 960;-const MAX_DEFAULT_HEIGHT = 820;+const DEFAULT_WIDTH_RATIO = 0.43;+const DEFAULT_HEIGHT_RATIO = 0.52;+const MAX_DEFAULT_WIDTH = 750;+const MAX_DEFAULT_HEIGHT = 590;const clampDefaultDimension = (preferred: number,@@ -97,11 +97,15 @@ export const getDefaultAgentWindowState = ();return {- position: getCenteredAgentWindowPosition(+ position: clampAgentWindowPosition(viewportWidth,viewportHeight,width,- height+ height,+ {+ x: viewportWidth - width - WINDOW_MARGIN,+ y: viewportHeight - height - WINDOW_MARGIN,+ }),size: {width,diff --git a/frontend/src/routes/workspace/EnvironmentsPage.tsx b/frontend/src/routes/workspace/EnvironmentsPage.tsxindex ae3e35c2b8..a26bfb40a0 100644--- a/frontend/src/routes/workspace/EnvironmentsPage.tsx+++ b/frontend/src/routes/workspace/EnvironmentsPage.tsx@@ -246,7 +246,7 @@ function RolloutPolicyConfig({{rolloutPolicy.roles.map((role) => (<spankey={role}- className="inline-flex items-center gap-x-1 rounded-xs bg-control-bg px-2 py-1 text-sm"+ className="inline-flex h-7 items-center gap-x-1 rounded-xs bg-control-bg px-2 text-sm">{displayPolicyRoleTitle(role)}{canUpdatePolicy && (diff --git a/frontend/src/routes/workspace/GroupsPage.test.tsx b/frontend/src/routes/workspace/GroupsPage.test.tsxindex 0cc156c749..dbddb3cc85 100644--- a/frontend/src/routes/workspace/GroupsPage.test.tsx+++ b/frontend/src/routes/workspace/GroupsPage.test.tsx@@ -25,6 +25,13 @@ type CapturedBeforeEachGuard = (const mocks = vi.hoisted(() => ({beforeEachGuard: undefined as CapturedBeforeEachGuard | undefined,+ pagedGroups: [] as Array<{+ email: string;+ members: Array<{ member: string; role: number }>;+ name: string;+ source: string;+ title: string;+ }>,routerPush: vi.fn(),routerReplace: vi.fn(),}));@@ -121,6 +128,15 @@ vi.mock("@/components/ui/button", () => ({}) => createElement("button", { disabled, onClick }, children),}));+vi.mock("@/components/ui/copy-button", () => ({+ CopyButton: ({ content }: { content: string }) =>+ createElement("button", {+ "data-content": content,+ "data-testid": "copy-group-email",+ type: "button",+ }),+}));+vi.mock("@/components/ui/input", () => ({Input: (props: InputHTMLAttributes<HTMLInputElement>) =>createElement("input", props),@@ -196,7 +212,7 @@ vi.mock("@/hooks/useAppState", () => ({vi.mock("@/hooks/usePagedData", () => ({PagedTableFooter: () => null,usePagedData: () => ({- dataList: [],+ dataList: mocks.pagedGroups,hasMore: false,isFetchingMore: false,isLoading: false,@@ -293,6 +309,7 @@ let root: ReturnType<typeof createRoot>;beforeEach(() => {vi.clearAllMocks();mocks.beforeEachGuard = undefined;+ mocks.pagedGroups = [];container = document.createElement("div");document.body.appendChild(container);root = createRoot(container);@@ -569,3 +586,44 @@ describe("GroupsPage create group sheet", () => {expect(mocks.routerReplace).not.toHaveBeenCalled();});});++describe("GroupsPage group table", () => {+ it("renders a copy action for a group name", async () => {+ mocks.pagedGroups = [+ {+ email: "[email protected]",+ members: [],+ name: "groups/[email protected]",+ source: "",+ title: "Bytebase Developers",+ },+ ];++ await renderPage();++ expect(+ container.querySelector("[data-testid='copy-group-email']")+ ).toHaveAttribute("data-content", "groups/[email protected]");+ });++ it("renders a copy action for a non-email group", async () => {+ mocks.pagedGroups = [+ {+ email: "",+ members: [],+ name: "groups/0b354368-73b8-439f-b207-d4df282d3cc7",+ source: "",+ title: "Non-email Group",+ },+ ];++ await renderPage();++ expect(+ container.querySelector("[data-testid='copy-group-email']")+ ).toHaveAttribute(+ "data-content",+ "groups/0b354368-73b8-439f-b207-d4df282d3cc7"+ );+ });+});diff --git a/frontend/src/routes/workspace/GroupsPage.tsx b/frontend/src/routes/workspace/GroupsPage.tsxindex 749bf0b0b5..ac3e292f7d 100644--- a/frontend/src/routes/workspace/GroupsPage.tsx+++ b/frontend/src/routes/workspace/GroupsPage.tsx@@ -28,6 +28,7 @@ import {} from "@/components/ui/alert-dialog";import { Badge } from "@/components/ui/badge";import { Button } from "@/components/ui/button";+import { CopyButton } from "@/components/ui/copy-button";import { FormError, FormField, FormFieldGroup } from "@/components/ui/form";import { Input } from "@/components/ui/input";import { SearchInput } from "@/components/ui/search-input";@@ -380,9 +381,16 @@ function GroupRow({<Badge className="text-xs px-1.5 py-0">{group.source}</Badge>)}</div>- <span className="textinfolabel text-xs">- <HighlightLabelText text={group.name} keyword={searchText} />- </span>+ <div className="flex items-center gap-x-1 min-w-0">+ <span className="textinfolabel text-xs truncate">+ <HighlightLabelText text={group.name} keyword={searchText} />+ </span>+ {group.name && (+ <div onClick={(event) => event.stopPropagation()}>+ <CopyButton content={group.name} />+ </div>+ )}+ </div></div></div></TableCell>diff --git a/frontend/src/routes/workspace/MCPPage.test.tsx b/frontend/src/routes/workspace/MCPPage.test.tsxindex dac47eb008..84ef7f3ccb 100644--- a/frontend/src/routes/workspace/MCPPage.test.tsx+++ b/frontend/src/routes/workspace/MCPPage.test.tsx@@ -23,7 +23,7 @@ vi.mock("@/components/ExternalUrlAlert", () => ({ ExternalUrlAlert: () => null }vi.mock("./mcp/MCPAccessPolicySection", () => ({MCPAccessPolicySection: () => null,}));-vi.mock("@/utils", () => ({ isDev: () => false, cn: (...a: unknown[]) => a.join(" ") }));+vi.mock("@/utils", () => ({ cn: (...a: unknown[]) => a.join(" ") }));const { MCPPage } = await import("./MCPPage");diff --git a/frontend/src/routes/workspace/UsersPage.tsx b/frontend/src/routes/workspace/UsersPage.tsxindex cd1e0e6a18..620604e637 100644--- a/frontend/src/routes/workspace/UsersPage.tsx+++ b/frontend/src/routes/workspace/UsersPage.tsx@@ -300,7 +300,7 @@ function UserGroupsCell({<Badgekey={groupName}variant="secondary"- className="text-xs px-1.5 py-0 cursor-pointer"+ className="text-xs cursor-pointer"// The parent TableRow is a row-click button — stop propagation so// clicking a group badge navigates to the group without also// opening the user detail sheet.