Your lightweight open-source personal agent.
Python agent-frameworkai-agentai-agentschatbotchatopsdiscord-botllm-agentsllmslocal-llmmcpmodel-context-protocolmulti-agentopenai-compatibleopenclawpersonal-ai-assistantpythonself-hostedtelegram-bot-ai-assistantwebuiworkflow-automation
feat(webui): add compact batch archive actions
chengyongrud1451e30e9d5
diff --git a/docs/webui.md b/docs/webui.mdindex 1bc4917a8..8865ba183 100644--- a/docs/webui.md+++ b/docs/webui.md@@ -91,6 +91,8 @@ The sidebar is the topic switcher. Each topic keeps its own history, title, workDrag topics within a sidebar group to reorder them. **Rename** edits a topic title in place; a failed save keeps the draft for retry.+Use **Select** in a topic's action menu to archive or delete several topics with one confirmation. Click outside the topic rows and toolbar, or press **Esc**, to leave selection mode. Cancelling a confirmation keeps your selection. Archiving removes pins and hides topics from the default list while keeping their conversations. Use **Show archived** to find them again; selecting only archived topics offers **Unarchive**.+### Conversation groups and panesOpen a topic's sidebar action menu and choose **Create group** to turn it into a conversation group. Use **Add pane** in the workbench header to start another topic alongside it. A group holds up to four panes. To bring in an existing topic, drag it onto the group or use **Move to** in its action menu.diff --git a/webui/src/App.tsx b/webui/src/App.tsxindex a5279e4a3..5aa27a47b 100644--- a/webui/src/App.tsx+++ b/webui/src/App.tsx@@ -20,7 +20,7 @@ import { LazyRemoteConnectionsPage } from "@/components/remote/LazyRemoteConnectimport { LanguageSwitcher } from "@/components/LanguageSwitcher";import { SidebarResizeHandle, SIDEBAR_MIN_WIDTH, SIDEBAR_MAX_WIDTH } from "@/components/SidebarResizeHandle";import { matchSidebarShortcut } from "@/lib/sidebar-shortcuts";-import type { SidebarDeleteItem } from "@/components/ChatList";+import type { SidebarDeleteDecision, SidebarDeleteItem } from "@/components/ChatList";import type { SettingsSectionKey } from "@/components/settings/SettingsView";import { StartupShell } from "@/components/StartupShell";import { ComposerDraftStore, clearStoredComposerDrafts } from "@/lib/composer-draft";@@ -1264,6 +1264,7 @@ function Shell({const [pendingDelete, setPendingDelete] = useState<{items: SidebarDeleteItem[];automations?: SessionAutomationJob[];+ onDecision?: SidebarDeleteDecision;} | null>(null);const [pendingTabRename, setPendingTabRename] = useState<{key: string;@@ -2069,24 +2070,23 @@ function Shell({[pendingProjectRename, updateSidebarState],);- const onToggleArchive = useCallback(- (key: string) => {+ const onArchiveMany = useCallback(+ (keys: string[], archive: boolean) => {+ const selected = new Set(keys);void updateSidebarState((current) => {const archived = new Set(current.archived_keys);- const pinned = current.pinned_keys.filter((item) => item !== key);- if (archived.has(key)) {- archived.delete(key);- } else {- archived.add(key);+ for (const key of selected) {+ if (archive) archived.add(key);+ else archived.delete(key);}return {...current,- pinned_keys: pinned,+ pinned_keys: current.pinned_keys.filter((key) => !selected.has(key)),archived_keys: Array.from(archived),};});- if (activeKey === key && !sidebarState.archived_keys.includes(key)) {- const archived = new Set([...sidebarState.archived_keys, key]);+ if (archive && activeKey && selected.has(activeKey)) {+ const archived = new Set([...sidebarState.archived_keys, ...selected]);const next = topicSessions.find((session) => !archived.has(session.key));navigate({view: "chat",@@ -2098,6 +2098,10 @@ function Shell({[activeKey, navigate, sidebarState.archived_keys, topicSessions, updateSidebarState],);+ const onToggleArchive = useCallback((key: string) => {+ onArchiveMany([key], !sidebarState.archived_keys.includes(key));+ }, [onArchiveMany, sidebarState.archived_keys]);+const onToggleArchived = useCallback(() => {void updateSidebarState((current) => ({...current,@@ -2387,6 +2391,7 @@ function Shell({const onConfirmDelete = useCallback(async () => {if (!pendingDelete) return;+ pendingDelete.onDecision?.(true);const items = pendingDelete.items;const deletingKeys = new Set(items.map((item) => item.key));const hasAutomations = (pendingDelete.automations?.length ?? 0) > 0;@@ -2440,7 +2445,7 @@ function Shell({}}, [pendingDelete, deleteChat, activeKey, activeTabState, navigate, topicSessions, filePreviewStore, draftStore]);- const onRequestDeleteMany = useCallback(async (items: SidebarDeleteItem[]) => {+ const onRequestDeleteMany = useCallback(async (items: SidebarDeleteItem[], onDecision?: SidebarDeleteDecision) => {const uniqueItems = Array.from(new Map(items.map((item) => [item.key, item])).values());if (uniqueItems.length === 0) return;const automationResults = await Promise.allSettled(@@ -2449,11 +2454,20 @@ function Shell({const automations = automationResults.flatMap((result) => (result.status === "fulfilled" ? result.value : []));- setPendingDelete({ items: uniqueItems, automations });+ let decision = onDecision;+ setPendingDelete({+ items: uniqueItems,+ automations,+ onDecision: (confirmed) => {+ const notify = decision;+ decision = undefined;+ notify?.(confirmed);+ },+ });}, [getSessionAutomations]);- const onRequestDelete = useCallback((key: string, label: string) => {- void onRequestDeleteMany([{ key, label }]);+ const onRequestDelete = useCallback((key: string, label: string, onDecision?: SidebarDeleteDecision) => {+ void onRequestDeleteMany([{ key, label }], onDecision);}, [onRequestDeleteMany]);const visiblePairingRequests = useMemo(@@ -2792,6 +2806,7 @@ function Shell({onTogglePin,onRequestRename,onToggleArchive,+ onArchiveMany,onRequestRenameTab,paneGroups: sidebarPaneGroups,onSelectPane: onSelectSidebarPane,@@ -3178,7 +3193,10 @@ function Shell({title={pendingDelete.items[0]?.label ?? ""}count={pendingDelete.items.length}automations={pendingDelete.automations}- onCancel={() => setPendingDelete(null)}+ onCancel={() => {+ pendingDelete.onDecision?.(false);+ setPendingDelete(null);+ }}onConfirm={onConfirmDelete}/></Suspense>diff --git a/webui/src/components/ArchiveConfirm.tsx b/webui/src/components/ArchiveConfirm.tsxnew file mode 100644index 000000000..535a8a532--- /dev/null+++ b/webui/src/components/ArchiveConfirm.tsx@@ -0,0 +1,60 @@+import { Archive, ArchiveRestore } from "lucide-react";+import { useTranslation } from "react-i18next";++import {+ AlertDialog,+ AlertDialogAction,+ AlertDialogCancel,+ AlertDialogContent,+ AlertDialogDescription,+ AlertDialogFooter,+ AlertDialogHeader,+ AlertDialogTitle,+} from "@/components/ui/alert-dialog";++export function ArchiveConfirm({+ count,+ archive,+ onCancel,+ onConfirm,+}: {+ count: number;+ archive: boolean;+ onCancel: () => void;+ onConfirm: () => void;+}) {+ const { t } = useTranslation();+ const Icon = archive ? Archive : ArchiveRestore;+ const titleKey = archive+ ? count > 1 ? "archiveConfirm.titleMany" : "archiveConfirm.title"+ : count > 1 ? "archiveConfirm.unarchiveTitleMany" : "archiveConfirm.unarchiveTitle";+ return (+ <AlertDialog open onOpenChange={(open) => { if (!open) onCancel(); }}>+ <AlertDialogContent+ className="w-[min(calc(100vw-2rem),24rem)] gap-0 p-5 text-center"+ onEscapeKeyDown={(event) => event.stopPropagation()}+ >+ <AlertDialogHeader className="items-center space-y-0 text-center">+ <Icon className="mb-4 h-6 w-6 text-muted-foreground" strokeWidth={1.8} aria-hidden />+ <AlertDialogTitle className="text-center text-[20px] font-semibold leading-tight tracking-[-0.02em] text-foreground">+ {t(titleKey, { count })}+ </AlertDialogTitle>+ <AlertDialogDescription className="mt-3 max-w-[17rem] text-center text-[14px] leading-6 text-muted-foreground">+ {t(archive ? "archiveConfirm.description" : "archiveConfirm.unarchiveDescription")}+ </AlertDialogDescription>+ </AlertDialogHeader>+ <AlertDialogFooter className="mt-6 !grid grid-cols-1 gap-2 sm:grid-cols-2">+ <AlertDialogCancel onClick={onCancel} className="mt-0 w-full min-w-0">+ {t("common.cancel")}+ </AlertDialogCancel>+ <AlertDialogAction+ onClick={onConfirm}+ className="w-full min-w-0 !whitespace-normal bg-foreground text-center text-background hover:bg-foreground/90"+ >+ {t(archive ? "chat.archive" : "chat.unarchive")}+ </AlertDialogAction>+ </AlertDialogFooter>+ </AlertDialogContent>+ </AlertDialog>+ );+}diff --git a/webui/src/components/ChatList.tsx b/webui/src/components/ChatList.tsxindex 8fe290178..9ab1f86cc 100644--- a/webui/src/components/ChatList.tsx+++ b/webui/src/components/ChatList.tsx@@ -48,6 +48,7 @@ import {} from "@/components/ui/tooltip";import { MAX_WORKBENCH_PANES } from "@/components/workbench/workbench-model";import { SidebarTopicRename } from "@/components/SidebarTopicRename";+import { ArchiveConfirm } from "@/components/ArchiveConfirm";import { SkeletonStatus } from "@/components/settings/shared/SkeletonStatus";import { LoadingRing } from "@/components/ui/loading-ring";import {@@ -189,6 +190,8 @@ export interface SidebarDeleteItem {label: string;}+export type SidebarDeleteDecision = (confirmed: boolean) => void;+function droppablePaneKey(dataTransfer: DataTransfer,group: SidebarPaneGroup,@@ -225,12 +228,13 @@ interface ChatListProps {activeKey: string | null;onSelect: (key: string) => void;onCloseTemporaryChat?: (key: string) => void;- onRequestDelete: (key: string, label: string) => void;- onRequestDeleteMany?: (items: SidebarDeleteItem[]) => void;+ onRequestDelete: (key: string, label: string, onDecision?: SidebarDeleteDecision) => void;+ onRequestDeleteMany?: (items: SidebarDeleteItem[], onDecision?: SidebarDeleteDecision) => void;onTogglePin: (key: string) => void;onRequestRename: (key: string, title: string) => Promise<void>;onRequestRenameTab?: (key: string, label: string) => void;onToggleArchive: (key: string) => void;+ onArchiveMany?: (keys: string[], archive: boolean) => void;paneGroups?: Record<string, SidebarPaneGroup>;onSelectPane?: (tabKey: string, paneKey: string) => void;onCreateTab?: (paneKey: string) => void;@@ -276,6 +280,7 @@ export const ChatList = memo(function ChatList({onRequestRename,onRequestRenameTab,onToggleArchive,+ onArchiveMany,paneGroups = {},onSelectPane,onCreateTab,@@ -308,6 +313,7 @@ export const ChatList = memo(function ChatList({const { t } = useTranslation();const [visibleLimit, setVisibleLimit] = useState(INITIAL_VISIBLE_SESSIONS);const scrollViewportRef = useRef<HTMLDivElement>(null);+ const selectionBarRef = useRef<HTMLDivElement>(null);useLayoutEffect(() => {const viewport = scrollViewportRef.current;if (!viewport) return;@@ -343,6 +349,11 @@ export const ChatList = memo(function ChatList({);const [paneDropTarget, setPaneDropTarget] = useState<string | null>(null);const [deleteSelectionMode, setDeleteSelectionMode] = useState(false);+ const [deleteConfirmationPending, setDeleteConfirmationPending] = useState(false);+ const [pendingArchive, setPendingArchive] = useState<{+ keys: string[];+ archive: boolean;+ } | null>(null);const [openActionMenuId, setOpenActionMenuId] = useState<string | null>(null);const [renamingTopic, setRenamingTopic] = useState<{ key: string } | null>(null);const renamingKey = renamingTopic?.key ?? null;@@ -364,6 +375,12 @@ export const ChatList = memo(function ChatList({() => new Set(),);const deleteSelectionAnchorRef = useRef<string | null>(null);+ const selectionConfirmationPending = pendingArchive !== null || deleteConfirmationPending;+ const closeDeleteSelection = useCallback(() => {+ setDeleteSelectionMode(false);+ setSelectedDeleteKeys(new Set());+ deleteSelectionAnchorRef.current = null;+ }, []);useEffect(() => {const clearPaneDropTarget = () => setPaneDropTarget(null);@@ -484,14 +501,26 @@ export const ChatList = memo(function ChatList({if (!deleteSelectionMode) return;setOpenActionMenuId(null);const onKeyDown = (event: KeyboardEvent) => {- if (event.key !== "Escape") return;- setDeleteSelectionMode(false);- setSelectedDeleteKeys(new Set());- deleteSelectionAnchorRef.current = null;+ if (event.key !== "Escape" || selectionConfirmationPending) return;+ closeDeleteSelection();+ };+ const onClick = (event: MouseEvent) => {+ if (selectionConfirmationPending) return;+ const target = event.target;+ if (target instanceof Node && selectionBarRef.current?.contains(target)) return;+ const row = target instanceof Element+ ? target.closest("[data-chat-row], [data-workbench-tab]")+ : null;+ if (row && scrollViewportRef.current?.contains(row)) return;+ closeDeleteSelection();};window.addEventListener("keydown", onKeyDown);- return () => window.removeEventListener("keydown", onKeyDown);- }, [deleteSelectionMode]);+ document.addEventListener("click", onClick, true);+ return () => {+ window.removeEventListener("keydown", onKeyDown);+ document.removeEventListener("click", onClick, true);+ };+ }, [closeDeleteSelection, deleteSelectionMode, selectionConfirmationPending]);useEffect(() => {writeCollapsedPaneGroups(collapsedPaneGroups);@@ -631,6 +660,7 @@ export const ChatList = memo(function ChatList({shiftKey = false,targetKey = keys[0],) => {+ if (selectionConfirmationPending) return;const validKeys = keys.filter((key) => deleteItemsByKey.has(key));const anchorKey = deleteSelectionAnchorRef.current;const range = shiftKey && anchorKey && targetKey@@ -652,25 +682,25 @@ export const ChatList = memo(function ChatList({});if (!range) deleteSelectionAnchorRef.current = targetKey ?? null;};- const closeDeleteSelection = () => {- setDeleteSelectionMode(false);- setSelectedDeleteKeys(new Set());- deleteSelectionAnchorRef.current = null;- };- const requestDeleteItems = (items: SidebarDeleteItem[]) => {+ const requestDeleteItems = (items: SidebarDeleteItem[], onDecision?: SidebarDeleteDecision) => {if (items.length === 0) return;- if (onRequestDeleteMany) onRequestDeleteMany(items);- else if (items.length === 1) onRequestDelete(items[0].key, items[0].label);+ if (onRequestDeleteMany) onRequestDeleteMany(items, onDecision);+ else if (items.length === 1) onRequestDelete(items[0].key, items[0].label, onDecision);};- const requestDeleteKeys = (keys: string[]) => {+ const requestDeleteKeys = (keys: string[], onDecision?: SidebarDeleteDecision) => {requestDeleteItems(keys.map((key) => deleteItemsByKey.get(key))- .filter((item): item is SidebarDeleteItem => item !== undefined));+ .filter((item): item is SidebarDeleteItem => item !== undefined), onDecision);};const confirmDeleteSelection = () => {- requestDeleteKeys(Array.from(selectedDeleteKeys));- closeDeleteSelection();+ setDeleteConfirmationPending(true);+ requestDeleteKeys(Array.from(selectedDeleteKeys), (confirmed) => {+ setDeleteConfirmationPending(false);+ if (confirmed) closeDeleteSelection();+ });};+ const allSelectedArchived = selectedDeleteKeys.size > 0+ && Array.from(selectedDeleteKeys).every((key) => archivedPanes.has(key) || archived.has(key));return (<div ref={scrollViewportRef} className="sidebar-scroll-fade sidebar-scrollbar h-full min-h-0 min-w-0 overflow-x-hidden overflow-y-auto overscroll-contain pb-2"><SidebarSelectionHighlight@@ -1161,36 +1191,60 @@ export const ChatList = memo(function ChatList({) : null}{deleteSelectionMode ? (<div+ ref={selectionBarRef}data-testid="delete-selection-bar"- className="sticky bottom-2 z-30 mx-1 mt-3 flex min-h-11 items-center gap-2 rounded-floating border border-sidebar-border/80 bg-popover/95 p-1.5 pl-2 shadow-[0_10px_30px_rgba(15,23,42,0.14)] backdrop-blur-xl"+ aria-busy={deleteConfirmationPending}+ className="sticky bottom-2 z-30 mx-1 mt-3 flex min-h-11 items-center gap-1 rounded-floating border border-sidebar-border/80 bg-popover/95 p-1.5 pl-3 shadow-[0_10px_30px_rgba(15,23,42,0.14)] backdrop-blur-xl">- <button- type="button"- onClick={closeDeleteSelection}- aria-label={t("chat.cancelSelection", {- defaultValue: "Cancel selection",- })}- className="inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-full text-sidebar-muted-foreground transition-colors media-hover:hover:text-foreground"- >- <X className="h-4 w-4" aria-hidden />- </button>- <span className="min-w-0 flex-1 truncate px-1 text-[12.5px] font-medium text-foreground/85">+ <span className="min-w-0 flex-1 truncate pr-2 text-[12.5px] font-medium text-foreground/85">{t("chat.selectedCount", {defaultValue: "{{count}} selected",count: selectedDeleteKeys.size,})}</span>- <button- type="button"- disabled={selectedDeleteKeys.size === 0}- onClick={confirmDeleteSelection}- className="inline-flex h-8 shrink-0 items-center gap-1.5 rounded-full bg-destructive px-3 text-[12px] font-semibold text-destructive-foreground transition-colors media-hover:hover:bg-destructive/90 disabled:pointer-events-none disabled:opacity-40"- >- <Trash2 className="h-3.5 w-3.5" aria-hidden />- {t("chat.deleteSelected", { defaultValue: "Delete" })}- </button>+ {onArchiveMany ? (+ <HoverHint content={t(allSelectedArchived ? "chat.unarchive" : "chat.archive")}>+ <button+ type="button"+ aria-label={t(allSelectedArchived ? "chat.unarchive" : "chat.archive")}+ disabled={selectedDeleteKeys.size === 0 || deleteConfirmationPending}+ onClick={() => setPendingArchive({+ keys: Array.from(selectedDeleteKeys),+ archive: !allSelectedArchived,+ })}+ className="touch-target inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-full text-foreground transition-colors media-hover:hover:bg-sidebar-accent disabled:pointer-events-none disabled:opacity-40"+ >+ {allSelectedArchived+ ? <ArchiveRestore className="h-4 w-4" aria-hidden />+ : <Archive className="h-4 w-4" aria-hidden />}+ </button>+ </HoverHint>+ ) : null}+ <HoverHint content={t("chat.delete")}>+ <button+ type="button"+ aria-label={t("chat.delete")}+ disabled={selectedDeleteKeys.size === 0 || deleteConfirmationPending}+ onClick={confirmDeleteSelection}+ className="touch-target inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-full text-destructive transition-colors media-hover:hover:bg-destructive/10 disabled:pointer-events-none disabled:opacity-40"+ >+ <Trash2 className="h-4 w-4" aria-hidden />+ </button>+ </HoverHint></div>) : null}+ {pendingArchive ? (+ <ArchiveConfirm+ count={pendingArchive.keys.length}+ archive={pendingArchive.archive}+ onCancel={() => setPendingArchive(null)}+ onConfirm={() => {+ onArchiveMany?.(pendingArchive.keys, pendingArchive.archive);+ setPendingArchive(null);+ closeDeleteSelection();+ }}+ />+ ) : null}</SidebarSelectionHighlight></div>);diff --git a/webui/src/components/DeleteConfirm.tsx b/webui/src/components/DeleteConfirm.tsxindex ce1eac2ae..3ccd28092 100644--- a/webui/src/components/DeleteConfirm.tsx+++ b/webui/src/components/DeleteConfirm.tsx@@ -42,6 +42,7 @@ export function DeleteConfirm({<AlertDialog open={open} onOpenChange={(o) => (!o ? onCancel() : undefined)}><AlertDialogContentclassName="w-[min(calc(100vw-2rem),24rem)] gap-0 p-5 text-center"+ onEscapeKeyDown={(event) => event.stopPropagation()}><AlertDialogHeader className="items-center space-y-0 text-center"><Trash2diff --git a/webui/src/components/Sidebar.tsx b/webui/src/components/Sidebar.tsxindex 172d7e9b3..a7c459500 100644--- a/webui/src/components/Sidebar.tsx+++ b/webui/src/components/Sidebar.tsx@@ -20,6 +20,7 @@ import { useTranslation } from "react-i18next";import {ChatList,+ type SidebarDeleteDecision,type SidebarDeleteItem,type SidebarPaneGroup,} from "@/components/ChatList";@@ -49,12 +50,13 @@ interface SidebarProps {onNewChat: () => void;onSelect: (key: string) => void;onCloseTemporaryChat?: (key: string) => void;- onRequestDelete: (key: string, label: string) => void;- onRequestDeleteMany?: (items: SidebarDeleteItem[]) => void;+ onRequestDelete: (key: string, label: string, onDecision?: SidebarDeleteDecision) => void;+ onRequestDeleteMany?: (items: SidebarDeleteItem[], onDecision?: SidebarDeleteDecision) => void;onTogglePin: (key: string) => void;onRequestRename: (key: string, title: string) => Promise<void>;onRequestRenameTab?: (key: string, label: string) => void;onToggleArchive: (key: string) => void;+ onArchiveMany?: (keys: string[], archive: boolean) => void;paneGroups?: Record<string, SidebarPaneGroup>;onSelectPane?: (tabKey: string, paneKey: string) => void;onCreateTab?: (paneKey: string) => void;@@ -289,6 +291,7 @@ export function Sidebar(props: SidebarProps) {onRequestRename={props.onRequestRename}onRequestRenameTab={props.onRequestRenameTab}onToggleArchive={props.onToggleArchive}+ onArchiveMany={props.onArchiveMany}paneGroups={props.paneGroups}onSelectPane={props.onSelectPane}onCreateTab={props.onCreateTab}diff --git a/webui/src/dev/gallery/standalone.tsx b/webui/src/dev/gallery/standalone.tsxindex 9a1225607..f46e1d870 100644--- a/webui/src/dev/gallery/standalone.tsx+++ b/webui/src/dev/gallery/standalone.tsx@@ -70,7 +70,15 @@ function ChatsPreview() {activeKey={active} onSelect={setActive} pinnedKeys={pinned} archivedKeys={archived} showArchived={mode === "archived"}loading={mode === "loading"}onTogglePin={(key) => setPinned(toggle(pinned, key))} onToggleArchive={(key) => setArchived(toggle(archived, key))}- onRequestDelete={(key) => setSessions((items) => items.filter((item) => item.key !== key))}+ onRequestDelete={(key, _label, onDecision) => {+ onDecision?.(true);+ setSessions((items) => items.filter((item) => item.key !== key));+ }}+ onRequestDeleteMany={(items, onDecision) => {+ onDecision?.(true);+ const keys = new Set(items.map((item) => item.key));+ setSessions((current) => current.filter((item) => !keys.has(item.key)));+ }}onRequestRename={async (key, label) => {setSessions((items) => items.map((item) => item.key === key ? { ...item, title: label } : item));setRenamed(label);diff --git a/webui/src/i18n/locales/en/common.json b/webui/src/i18n/locales/en/common.jsonindex 0322877fb..43473207f 100644--- a/webui/src/i18n/locales/en/common.json+++ b/webui/src/i18n/locales/en/common.json@@ -1883,9 +1883,7 @@"showArchived": "Show archived","hideArchived": "Hide archived","select": "Select",- "cancelSelection": "Cancel selection","selectedCount": "{{count}} selected",- "deleteSelected": "Delete","delete": "Delete","newChat": "New topic","groups": {@@ -1898,6 +1896,14 @@"archived": "Archived"}},+ "archiveConfirm": {+ "title": "Archive this topic?",+ "titleMany": "Archive {{count}} topics?",+ "unarchiveTitle": "Unarchive this topic?",+ "unarchiveTitleMany": "Unarchive {{count}} topics?",+ "description": "Conversations are kept. You can unarchive them at any time.",+ "unarchiveDescription": "These topics will return to the sidebar."+ },"deleteConfirm": {"title": "Delete this topic?","titleMany": "Delete {{count}} conversations?",diff --git a/webui/src/i18n/locales/es/common.json b/webui/src/i18n/locales/es/common.jsonindex 120f443fd..775c4dfe1 100644--- a/webui/src/i18n/locales/es/common.json+++ b/webui/src/i18n/locales/es/common.json@@ -1678,9 +1678,7 @@"showArchived": "Mostrar archivados","hideArchived": "Ocultar archivados","select": "Seleccionar",- "cancelSelection": "Cancelar selección","selectedCount": "{{count}} seleccionados",- "deleteSelected": "Eliminar","delete": "Eliminar","newChat": "Nuevo tema","groups": {@@ -1693,6 +1691,14 @@"archived": "Archivados"}},+ "archiveConfirm": {+ "title": "¿Archivar este tema?",+ "titleMany": "¿Archivar {{count}} temas?",+ "unarchiveTitle": "¿Desarchivar este tema?",+ "unarchiveTitleMany": "¿Desarchivar {{count}} temas?",+ "description": "Las conversaciones se conservan. Puedes desarchivarlas en cualquier momento.",+ "unarchiveDescription": "Estos temas volverán a la barra lateral."+ },"deleteConfirm": {"title": "¿Eliminar este chat?","titleMany": "¿Eliminar {{count}} conversaciones?",diff --git a/webui/src/i18n/locales/fr/common.json b/webui/src/i18n/locales/fr/common.jsonindex 1fa217094..e993d36f9 100644--- a/webui/src/i18n/locales/fr/common.json+++ b/webui/src/i18n/locales/fr/common.json@@ -1677,9 +1677,7 @@"showArchived": "Afficher les archives","hideArchived": "Masquer les archives","select": "Sélectionner",- "cancelSelection": "Annuler la sélection","selectedCount": "{{count}} sélectionnés",- "deleteSelected": "Supprimer","delete": "Supprimer","newChat": "Nouveau sujet","groups": {@@ -1692,6 +1690,14 @@"archived": "Archivés"}},+ "archiveConfirm": {+ "title": "Archiver ce sujet ?",+ "titleMany": "Archiver {{count}} sujets ?",+ "unarchiveTitle": "Désarchiver ce sujet ?",+ "unarchiveTitleMany": "Désarchiver {{count}} sujets ?",+ "description": "Les conversations sont conservées. Vous pouvez les désarchiver à tout moment.",+ "unarchiveDescription": "Ces sujets réapparaîtront dans la barre latérale."+ },"deleteConfirm": {"title": "Supprimer cette discussion ?","titleMany": "Supprimer {{count}} conversations ?",diff --git a/webui/src/i18n/locales/id/common.json b/webui/src/i18n/locales/id/common.jsonindex 791cc8587..86ca75938 100644--- a/webui/src/i18n/locales/id/common.json+++ b/webui/src/i18n/locales/id/common.json@@ -1677,9 +1677,7 @@"showArchived": "Tampilkan yang diarsipkan","hideArchived": "Sembunyikan yang diarsipkan","select": "Pilih",- "cancelSelection": "Batalkan pilihan","selectedCount": "{{count}} dipilih",- "deleteSelected": "Hapus","delete": "Hapus","newChat": "Topik baru","groups": {@@ -1692,6 +1690,14 @@"archived": "Diarsipkan"}},+ "archiveConfirm": {+ "title": "Arsipkan topik ini?",+ "titleMany": "Arsipkan {{count}} topik?",+ "unarchiveTitle": "Batalkan arsip topik ini?",+ "unarchiveTitleMany": "Batalkan arsip {{count}} topik?",+ "description": "Percakapan tetap tersimpan. Anda dapat membatalkan arsipnya kapan saja.",+ "unarchiveDescription": "Topik ini akan kembali muncul di bilah samping."+ },"deleteConfirm": {"title": "Hapus obrolan ini?","titleMany": "Hapus {{count}} percakapan?",diff --git a/webui/src/i18n/locales/ja/common.json b/webui/src/i18n/locales/ja/common.jsonindex 18e093f8d..ea9c0be0f 100644--- a/webui/src/i18n/locales/ja/common.json+++ b/webui/src/i18n/locales/ja/common.json@@ -1677,9 +1677,7 @@"showArchived": "アーカイブ済みを表示","hideArchived": "アーカイブ済みを隠す","select": "選択",- "cancelSelection": "選択を解除","selectedCount": "{{count}} 件を選択中",- "deleteSelected": "削除","delete": "削除","newChat": "新しいトピック","groups": {@@ -1692,6 +1690,14 @@"archived": "アーカイブ済み"}},+ "archiveConfirm": {+ "title": "このトピックをアーカイブしますか?",+ "titleMany": "{{count}} 件のトピックをアーカイブしますか?",+ "unarchiveTitle": "このトピックのアーカイブを解除しますか?",+ "unarchiveTitleMany": "{{count}} 件のトピックのアーカイブを解除しますか?",+ "description": "会話履歴は保持され、いつでもアーカイブを解除できます。",+ "unarchiveDescription": "これらのトピックがサイドバーに再表示されます。"+ },"deleteConfirm": {"title": "このチャットを削除しますか?","titleMany": "{{count}} 件の会話を削除しますか?",diff --git a/webui/src/i18n/locales/ko/common.json b/webui/src/i18n/locales/ko/common.jsonindex 02c73b141..32b36843c 100644--- a/webui/src/i18n/locales/ko/common.json+++ b/webui/src/i18n/locales/ko/common.json@@ -1677,9 +1677,7 @@"showArchived": "보관된 항목 표시","hideArchived": "보관된 항목 숨기기","select": "선택",- "cancelSelection": "선택 취소","selectedCount": "{{count}}개 선택됨",- "deleteSelected": "삭제","delete": "삭제","newChat": "새 주제","groups": {@@ -1692,6 +1690,14 @@"archived": "보관됨"}},+ "archiveConfirm": {+ "title": "이 주제를 보관할까요?",+ "titleMany": "주제 {{count}}개를 보관할까요?",+ "unarchiveTitle": "이 주제의 보관을 해제할까요?",+ "unarchiveTitleMany": "주제 {{count}}개의 보관을 해제할까요?",+ "description": "대화 기록은 유지되며 언제든지 보관을 해제할 수 있습니다.",+ "unarchiveDescription": "이 주제들이 사이드바에 다시 표시됩니다."+ },"deleteConfirm": {"title": "이 채팅을 삭제할까요?","titleMany": "대화 {{count}}개를 삭제할까요?",diff --git a/webui/src/i18n/locales/pt-BR/common.json b/webui/src/i18n/locales/pt-BR/common.jsonindex acead6b23..7c9232a1f 100644--- a/webui/src/i18n/locales/pt-BR/common.json+++ b/webui/src/i18n/locales/pt-BR/common.json@@ -1691,9 +1691,7 @@"showArchived": "Mostrar arquivadas","hideArchived": "Ocultar arquivadas","select": "Selecionar",- "cancelSelection": "Cancelar seleção","selectedCount": "{{count}} selecionados",- "deleteSelected": "Excluir","delete": "Excluir","newChat": "Novo tópico","groups": {@@ -1706,6 +1704,14 @@"archived": "Arquivadas"}},+ "archiveConfirm": {+ "title": "Arquivar este tópico?",+ "titleMany": "Arquivar {{count}} tópicos?",+ "unarchiveTitle": "Desarquivar este tópico?",+ "unarchiveTitleMany": "Desarquivar {{count}} tópicos?",+ "description": "As conversas são mantidas. Você pode desarquivá-las a qualquer momento.",+ "unarchiveDescription": "Estes tópicos voltarão à barra lateral."+ },"deleteConfirm": {"title": "Excluir esta conversa?","titleMany": "Excluir {{count}} conversas?",diff --git a/webui/src/i18n/locales/vi/common.json b/webui/src/i18n/locales/vi/common.jsonindex 2a43e9d9d..f82bfdad8 100644--- a/webui/src/i18n/locales/vi/common.json+++ b/webui/src/i18n/locales/vi/common.json@@ -1677,9 +1677,7 @@"showArchived": "Hiện mục đã lưu trữ","hideArchived": "Ẩn mục đã lưu trữ","select": "Chọn",- "cancelSelection": "Hủy chọn","selectedCount": "Đã chọn {{count}} mục",- "deleteSelected": "Xóa","delete": "Xóa","newChat": "Chủ đề mới","groups": {@@ -1692,6 +1690,14 @@"archived": "Đã lưu trữ"}},+ "archiveConfirm": {+ "title": "Lưu trữ chủ đề này?",+ "titleMany": "Lưu trữ {{count}} chủ đề?",+ "unarchiveTitle": "Bỏ lưu trữ chủ đề này?",+ "unarchiveTitleMany": "Bỏ lưu trữ {{count}} chủ đề?",+ "description": "Lịch sử trò chuyện vẫn được giữ lại. Bạn có thể bỏ lưu trữ bất cứ lúc nào.",+ "unarchiveDescription": "Các chủ đề này sẽ xuất hiện lại trên thanh bên."+ },"deleteConfirm": {"title": "Xóa cuộc trò chuyện này?","titleMany": "Xóa {{count}} cuộc trò chuyện?",diff --git a/webui/src/i18n/locales/zh-CN/common.json b/webui/src/i18n/locales/zh-CN/common.jsonindex bbba39cfb..c1fa3a69a 100644--- a/webui/src/i18n/locales/zh-CN/common.json+++ b/webui/src/i18n/locales/zh-CN/common.json@@ -1883,9 +1883,7 @@"showArchived": "显示归档","hideArchived": "隐藏归档","select": "选择",- "cancelSelection": "取消选择","selectedCount": "已选择 {{count}} 项",- "deleteSelected": "删除","delete": "删除","newChat": "新建话题","groups": {@@ -1898,6 +1896,14 @@"archived": "已归档"}},+ "archiveConfirm": {+ "title": "归档此话题?",+ "titleMany": "归档 {{count}} 个话题?",+ "unarchiveTitle": "取消归档此话题?",+ "unarchiveTitleMany": "取消归档 {{count}} 个话题?",+ "description": "聊天记录会保留,可随时取消归档。",+ "unarchiveDescription": "这些话题将重新显示在侧栏中。"+ },"deleteConfirm": {"title": "删除这个话题?","titleMany": "删除这 {{count}} 个对话?",diff --git a/webui/src/i18n/locales/zh-TW/common.json b/webui/src/i18n/locales/zh-TW/common.jsonindex 304580eed..a81667868 100644--- a/webui/src/i18n/locales/zh-TW/common.json+++ b/webui/src/i18n/locales/zh-TW/common.json@@ -1677,9 +1677,7 @@"showArchived": "顯示封存","hideArchived": "隱藏封存","select": "選取",- "cancelSelection": "取消選取","selectedCount": "已選取 {{count}} 項",- "deleteSelected": "刪除","delete": "刪除","newChat": "新增話題","groups": {@@ -1692,6 +1690,14 @@"archived": "已封存"}},+ "archiveConfirm": {+ "title": "封存此話題?",+ "titleMany": "封存 {{count}} 個話題?",+ "unarchiveTitle": "取消封存此話題?",+ "unarchiveTitleMany": "取消封存 {{count}} 個話題?",+ "description": "聊天記錄會保留,可隨時取消封存。",+ "unarchiveDescription": "這些話題將重新顯示在側欄中。"+ },"deleteConfirm": {"title": "刪除這個話題?","titleMany": "刪除這 {{count}} 個對話?",diff --git a/webui/src/tests/app-layout.test.tsx b/webui/src/tests/app-layout.test.tsxindex 36631fb49..d370935f4 100644--- a/webui/src/tests/app-layout.test.tsx+++ b/webui/src/tests/app-layout.test.tsx@@ -2375,6 +2375,40 @@ describe("App layout", () => {expect(document.body.style.pointerEvents).not.toBe("none");}, 15_000);+ it("archives selected topics in one sidebar update and navigates outside the full selection", async () => {+ mockSessions = ["a", "b", "c"].map((id) => ({+ key: `websocket:chat-${id}`, channel: "websocket", chatId: `chat-${id}`,+ createdAt: "2026-04-16T10:00:00Z", updatedAt: "2026-04-16T10:00:00Z",+ title: `Topic ${id}`, preview: `Message ${id}`,+ }));+ mockFetchRoutes({+ "/api/webui/sidebar-state": { pinned_keys: ["websocket:chat-a", "websocket:chat-b"] },+ });+ window.history.replaceState(null, "", "/#/chat/websocket%3Achat-a");+ render(<App />);+ await waitFor(() => expect(connectSpy).toHaveBeenCalled());+ act(() => statusHandlers.forEach((handler) => handler("open")));+ const sidebar = screen.getByRole("navigation", { name: "Sidebar navigation" });+ await within(sidebar).findByRole("button", { name: "Topic a" });+ fireEvent.pointerDown(within(sidebar).getByLabelText("Topic actions for Topic a"), { button: 0 });+ fireEvent.click(await screen.findByRole("menuitem", { name: "Select" }));+ fireEvent.click(within(sidebar).getByRole("button", { name: "Topic b" }));+ fireEvent.click(within(sidebar).getByRole("button", { name: "Archive" }));+ const dialog = await screen.findByRole("alertdialog", { name: "Archive 2 topics?" });+ expect(setSidebarStateSpy).not.toHaveBeenCalled();+ fireEvent.click(within(dialog).getByRole("button", { name: "Archive" }));++ await waitFor(() => expect(setSidebarStateSpy).toHaveBeenCalledTimes(1));+ expect(setSidebarStateSpy).toHaveBeenCalledWith(expect.objectContaining({+ archived_keys: ["websocket:chat-a", "websocket:chat-b"], pinned_keys: [],+ }));+ expect(window.location.hash).toBe("#/chat/websocket%3Achat-c");+ expect(within(sidebar).getByRole("button", { name: "Topic c" })).toBeInTheDocument();+ expect(within(sidebar).queryByRole("button", { name: "Topic a" })).not.toBeInTheDocument();+ expect(within(sidebar).queryByRole("button", { name: "Topic b" })).not.toBeInTheDocument();+ expect(deleteChatSpy).not.toHaveBeenCalled();+ });+it("deletes multiple selected topics through one confirmation", async () => {mockSessions = [{@@ -2414,9 +2448,23 @@ describe("App layout", () => {fireEvent.click(within(sidebar).getByRole("button", { name: "Second chat" }));expect(within(sidebar).getByText("2 selected")).toBeInTheDocument();+ const automationReads: Array<(jobs: SessionAutomationJob[]) => void> = [];+ getSessionAutomationsSpy.mockImplementation(() => new Promise((resolve) => automationReads.push(resolve)));+ fireEvent.click(within(sidebar).getByRole("button", { name: "Delete" }));+ fireEvent.click(document.body);+ expect(screen.getByTestId("delete-selection-bar")).toHaveTextContent("2 selected");+ expect(deleteChatSpy).not.toHaveBeenCalled();+ await act(async () => automationReads.forEach((resolve) => resolve([])));+ expect(await screen.findByText("Delete 2 conversations?")).toBeInTheDocument();+ fireEvent.keyDown(screen.getByRole("alertdialog"), { key: "Escape" });+ expect(screen.getByTestId("delete-selection-bar")).toHaveTextContent("2 selected");+ expect(deleteChatSpy).not.toHaveBeenCalled();++ getSessionAutomationsSpy.mockResolvedValue([]);fireEvent.click(within(sidebar).getByRole("button", { name: "Delete" }));expect(await screen.findByText("Delete 2 conversations?")).toBeInTheDocument();fireEvent.click(screen.getByRole("button", { name: "Delete" }));+ expect(screen.queryByTestId("delete-selection-bar")).not.toBeInTheDocument();await waitFor(() => expect(deleteChatSpy).toHaveBeenCalledTimes(2));expect(deleteChatSpy.mock.calls.map(([key]) => key)).toEqual([diff --git a/webui/src/tests/chat-list.test.tsx b/webui/src/tests/chat-list.test.tsxindex f5b59620e..e4651a802 100644--- a/webui/src/tests/chat-list.test.tsx+++ b/webui/src/tests/chat-list.test.tsx@@ -1,4 +1,4 @@-import { fireEvent, render, screen, within } from "@testing-library/react";+import { act, fireEvent, render, screen, within } from "@testing-library/react";import { afterEach, describe, expect, it, vi } from "vitest";import { ChatList } from "@/components/ChatList";@@ -806,8 +806,114 @@ describe("ChatList", () => {{ key: "websocket:root", label: "Root topic" },{ key: "websocket:child", label: "Research pane" },{ key: "websocket:target", label: "Target tab" },- ]);+ ], expect.any(Function));+ expect(screen.getByText("3 selected")).toBeInTheDocument();+ act(() => onRequestDeleteMany.mock.calls[0][1](true));+ expect(screen.queryByTestId("delete-selection-bar")).not.toBeInTheDocument();+ });++ it.each([+ { archivedKeys: [], action: "Archive", archive: true },+ { archivedKeys: ["websocket:root", "websocket:child"], action: "Unarchive", archive: false },+ { archivedKeys: ["websocket:child"], action: "Archive", archive: true },+ ])("confirms $action for selected panes without toggling mixed archive states", async ({ archivedKeys, action, archive }) => {+ const onArchiveMany = vi.fn();+ render(<ChatList+ sessions={[session({ chatId: "root", title: "Root topic" })]}+ activeKey="websocket:root"+ paneGroups={{+ "websocket:root": {+ tabKey: "websocket:root",+ title: "Root topic",+ activePaneKey: "websocket:root",+ panes: [+ { key: "websocket:root", chatId: "root", title: "Root topic" },+ { key: "websocket:child", chatId: "child", title: "Research pane" },+ ],+ },+ }}+ archivedPaneKeys={archivedKeys}+ onSelect={vi.fn()}+ onRequestDelete={vi.fn()}+ onTogglePin={vi.fn()}+ onRequestRename={vi.fn()}+ onToggleArchive={vi.fn()}+ onArchiveMany={onArchiveMany}+ />);++ fireEvent.pointerDown(screen.getByRole("button", { name: "Root topic pane actions" }), { button: 0 });+ fireEvent.click(await screen.findByRole("menuitem", { name: "Select" }));+ fireEvent.click(screen.getByRole("button", { name: "Group: Root topic" }));+ const bar = screen.getByTestId("delete-selection-bar");+ fireEvent.click(within(bar).getByRole("button", { name: action }));+ const dialog = screen.getByRole("alertdialog");+ expect(dialog).toHaveAccessibleName(`${action} 2 topics?`);+ fireEvent.click(document.body);+ expect(screen.getByText("2 selected")).toBeInTheDocument();+ expect(onArchiveMany).not.toHaveBeenCalled();+ if (archive) fireEvent.click(within(dialog).getByRole("button", { name: "Cancel" }));+ else fireEvent.keyDown(dialog, { key: "Escape" });+ expect(screen.getByText("2 selected")).toBeInTheDocument();+ expect(screen.getByRole("button", { name: "Research pane" })).toHaveAttribute("aria-pressed", "true");+ expect(onArchiveMany).not.toHaveBeenCalled();++ fireEvent.click(within(bar).getByRole("button", { name: action }));+ fireEvent.click(within(screen.getByRole("alertdialog")).getByRole("button", { name: action }));+ expect(onArchiveMany).toHaveBeenCalledTimes(1);+ expect(onArchiveMany).toHaveBeenCalledWith(["websocket:root", "websocket:child"], archive);+ expect(screen.queryByTestId("delete-selection-bar")).not.toBeInTheDocument();+ });++ it("disables batch archive when all topics are deselected", async () => {+ render(<ChatList+ sessions={[session({ chatId: "first", title: "First topic" })]}+ activeKey={null}+ onSelect={vi.fn()}+ onRequestDelete={vi.fn()}+ onTogglePin={vi.fn()}+ onRequestRename={vi.fn()}+ onToggleArchive={vi.fn()}+ onArchiveMany={vi.fn()}+ />);+ fireEvent.pointerDown(screen.getByRole("button", { name: "Topic actions for First topic" }), { button: 0 });+ fireEvent.click(await screen.findByRole("menuitem", { name: "Select" }));+ fireEvent.click(screen.getByRole("button", { name: "First topic" }));+ expect(screen.getByRole("button", { name: "Archive" })).toBeDisabled();+ expect(screen.getByRole("button", { name: "Delete" })).toBeDisabled();+ });++ it.each(["outside action", "list whitespace"])("exits selection from %s without consuming the click", async (target) => {+ const outsideAction = vi.fn();+ const onSelect = vi.fn();+ const { container } = render(<>+ <button onClick={outsideAction}>Outside action</button>+ <ChatList+ sessions={[session({ chatId: "first", title: "First topic" })]}+ activeKey={null}+ onSelect={onSelect}+ onRequestDelete={vi.fn()}+ onTogglePin={vi.fn()}+ onRequestRename={vi.fn()}+ onToggleArchive={vi.fn()}+ onArchiveMany={vi.fn()}+ />+ </>);+ fireEvent.pointerDown(screen.getByRole("button", { name: "Topic actions for First topic" }), { button: 0 });+ fireEvent.click(await screen.findByRole("menuitem", { name: "Select" }));+ expect(screen.getByText("1 selected")).toBeInTheDocument();+ fireEvent.click(screen.getByRole("button", { name: "First topic" }));+ expect(screen.getByText("0 selected")).toBeInTheDocument();+ fireEvent.click(screen.getByRole("button", { name: "First topic" }));+ expect(screen.getByText("1 selected")).toBeInTheDocument();+ expect(onSelect).not.toHaveBeenCalled();++ fireEvent.click(target === "outside action"+ ? screen.getByRole("button", { name: "Outside action" })+ : container.querySelector("[data-chat-list-content]")!);expect(screen.queryByTestId("delete-selection-bar")).not.toBeInTheDocument();+ expect(outsideAction).toHaveBeenCalledTimes(target === "outside action" ? 1 : 0);+ fireEvent.click(screen.getByRole("button", { name: "First topic" }));+ expect(onSelect).toHaveBeenCalledWith("websocket:first");});it("selects a contiguous session range with Shift-click", async () => {