Skip to content

armgit / jan

Public Imported from GitHub
0

Jan is an open source alternative to ChatGPT that runs 100% offline on your computer.

feat(web-app): one sidebar history for chats and Cowork, no tabs

Akarshan Biswasa568e4f5b5bd
diff --git a/web-app/src/components/left-sidebar/NavChats.tsx b/web-app/src/components/left-sidebar/NavChats.tsx
deleted file mode 100644
index 1d8ccc499..000000000
--- a/web-app/src/components/left-sidebar/NavChats.tsx
+++ /dev/null
@@ -1,70 +0,0 @@
-import {
- SidebarGroup,
- SidebarGroupLabel,
- SidebarMenu,
- SidebarGroupAction,
-} from "@/components/ui/sidebar"
-import {
- DropdownMenu,
- DropdownMenuContent,
- DropdownMenuTrigger,
-} from "@/components/ui/dropdown-menu"
-import { MoreHorizontal, Loader2 } from "lucide-react"
-import { useMemo, useState } from "react"
-import { useTranslation } from '@/i18n/react-i18next-compat'
-import { useThreads } from "@/hooks/useThreads"
-import ThreadList from "@/containers/ThreadList"
-import { DeleteAllThreadsDialog } from "@/containers/dialogs/DeleteAllThreadsDialog"
-
-export function NavChats() {
- const { t } = useTranslation()
- const getFilteredThreads = useThreads((state) => state.getFilteredThreads)
- const threads = useThreads((state) => state.threads)
- const isLoadingThreads = useThreads((state) => state.isLoadingThreads)
- const deleteAllThreads = useThreads((state) => state.deleteAllThreads)
- const [dropdownOpen, setDropdownOpen] = useState(false)
-
- const threadsWithoutProject = useMemo(() => {
- return getFilteredThreads('').filter((thread) => !thread.metadata?.project)
- // eslint-disable-next-line react-hooks/exhaustive-deps
- }, [getFilteredThreads, threads])
-
- if (threadsWithoutProject.length === 0) {
- if (isLoadingThreads) {
- return (
- <SidebarGroup className="group-data-[collapsible=icon]:hidden">
- <SidebarGroupLabel>{t('common:chats')}</SidebarGroupLabel>
- <div className="flex items-center justify-center py-2">
- <Loader2 className="size-4 animate-spin text-muted-foreground" />
- </div>
- </SidebarGroup>
- )
- }
- return null
- }
-
- return (
- <SidebarGroup className="group-data-[collapsible=icon]:hidden">
- <SidebarGroupLabel>{t('common:chats')}</SidebarGroupLabel>
- {threadsWithoutProject.length > 1 &&
- <DropdownMenu open={dropdownOpen} onOpenChange={setDropdownOpen}>
- <DropdownMenuTrigger asChild>
- <SidebarGroupAction className="hover:bg-sidebar-foreground/8">
- <MoreHorizontal className="text-muted-foreground" />
- <span className="sr-only">More</span>
- </SidebarGroupAction>
- </DropdownMenuTrigger>
- <DropdownMenuContent side="right" align="start">
- <DeleteAllThreadsDialog
- onDeleteAll={deleteAllThreads}
- onDropdownClose={() => setDropdownOpen(false)}
- />
- </DropdownMenuContent>
- </DropdownMenu>
- }
- <SidebarMenu>
- <ThreadList threads={threadsWithoutProject} />
- </SidebarMenu>
- </SidebarGroup>
- )
-}
diff --git a/web-app/src/components/left-sidebar/NavCowork.tsx b/web-app/src/components/left-sidebar/NavCowork.tsx
deleted file mode 100644
index 4fdf3eb65..000000000
--- a/web-app/src/components/left-sidebar/NavCowork.tsx
+++ /dev/null
@@ -1,312 +0,0 @@
-import {
- SidebarMenu,
- SidebarMenuButton,
- SidebarMenuItem,
- SidebarMenuAction,
- SidebarGroup,
- SidebarGroupLabel,
- useSidebar,
-} from '@/components/ui/sidebar'
-import {
- DropdownMenu,
- DropdownMenuContent,
- DropdownMenuItem,
- DropdownMenuTrigger,
-} from '@/components/ui/dropdown-menu'
-import {
- Dialog,
- DialogContent,
- DialogDescription,
- DialogFooter,
- DialogHeader,
- DialogTitle,
-} from '@/components/ui/dialog'
-import { Button } from '@/components/ui/button'
-import { stopAgentSessionMonitors } from '@/lib/agentTools'
-import { dropMonitorLane } from '@/lib/coworkMonitor'
-import { useTranslation } from '@/i18n/react-i18next-compat'
-import { useNavigate } from '@tanstack/react-router'
-import { route } from '@/constants/routes'
-import {
- Box,
- SlidersHorizontal,
- MoreHorizontal,
- Trash2,
- Loader2,
- type LucideIcon,
-} from 'lucide-react'
-import {
- MessageCircleIcon,
- type MessageCircleIconHandle,
-} from '@/components/animated-icon/message-circle'
-import {
- SettingsIcon,
- type SettingsIconHandle,
-} from '@/components/animated-icon/settings'
-import {
- AnimatedLucideIcon,
- type AnimatedLucideIconHandle,
- type AnimatedLucidePreset,
-} from '@/components/animated-icon/animated-lucide'
-import {
- useCoworkSessions,
- type CoworkSession,
-} from '@/hooks/useCoworkSessions'
-import { useCoworkRun, useIsSessionActive } from '@/hooks/useCoworkRun'
-import { memo, useCallback, useMemo, useRef, useState } from 'react'
-import SkillsManagerDialog from '@/containers/dialogs/SkillsManagerDialog'
-
-type CoworkNavItem = {
- title: string
- icon: LucideIcon
- preset: AnimatedLucidePreset
- onClick: () => void
-}
-
-// Leaving a session behind is the moment an abandoned empty one becomes
-// unreachable (it has no sidebar row) — sweep those out of the store, keeping
-// any session whose first run is still streaming its turns in useCoworkRun.
-const pruneEmpty = () => {
- const running = Object.keys(useCoworkRun.getState().runId)
- useCoworkSessions.getState().pruneEmptySessions(running)
-}
-
-// Own component (not inlined in a .map()) so it can be memoized: each row's
-// running state comes from its own per-session selector (useIsSessionActive),
-// so a session starting or stopping a run only re-renders its own row, not the
-// whole session list — mirroring ThreadList.tsx's memoized ThreadItem +
-// useIsThreadActive.
-const SessionItem = memo(function SessionItem({
- session,
- isCurrent,
- isMobile,
- onSelect,
- onRequestDelete,
-}: {
- session: CoworkSession
- isCurrent: boolean
- isMobile: boolean
- onSelect: (id: string) => void
- onRequestDelete: (pending: { id: string; title: string }) => void
-}) {
- const { t } = useTranslation()
- const isRunning = useIsSessionActive(session.id)
-
- return (
- <SidebarMenuItem>
- <SidebarMenuButton
- isActive={isCurrent}
- onClick={() => onSelect(session.id)}
- >
- {isRunning && (
- <Loader2 className="size-3 shrink-0 animate-spin text-muted-foreground" />
- )}
- <span className="truncate">{session.title}</span>
- </SidebarMenuButton>
- <DropdownMenu>
- <DropdownMenuTrigger asChild>
- <SidebarMenuAction
- showOnHover
- className="hover:bg-sidebar-foreground/8"
- >
- <MoreHorizontal />
- <span className="sr-only">More</span>
- </SidebarMenuAction>
- </DropdownMenuTrigger>
- <DropdownMenuContent
- className="w-48"
- side={isMobile ? 'bottom' : 'right'}
- align={isMobile ? 'end' : 'start'}
- >
- <DropdownMenuItem
- variant="destructive"
- onSelect={() =>
- onRequestDelete({ id: session.id, title: session.title })
- }
- >
- <Trash2 />
- <span>{t('common:deleteSession')}</span>
- </DropdownMenuItem>
- </DropdownMenuContent>
- </DropdownMenu>
- </SidebarMenuItem>
- )
-})
-
-function CoworkNavItemRow({ item }: { item: CoworkNavItem }) {
- const iconRef = useRef<AnimatedLucideIconHandle>(null)
-
- return (
- <SidebarMenuItem>
- <SidebarMenuButton
- onBlur={() => iconRef.current?.stopAnimation()}
- onClick={item.onClick}
- onFocus={() => iconRef.current?.startAnimation()}
- onMouseEnter={() => iconRef.current?.startAnimation()}
- onMouseLeave={() => iconRef.current?.stopAnimation()}
- >
- <AnimatedLucideIcon
- ref={iconRef}
- icon={item.icon}
- preset={item.preset}
- className="text-foreground/70"
- size={16}
- />
- <span>{item.title}</span>
- </SidebarMenuButton>
- </SidebarMenuItem>
- )
-}
-
-export function NavCowork() {
- const { t } = useTranslation()
- const navigate = useNavigate()
- const { isMobile } = useSidebar()
- const sessions = useCoworkSessions((s) => s.sessions)
- const currentId = useCoworkSessions((s) => s.currentId)
- // A session only earns a sidebar row once it has messages. A first run's
- // turns are transient in useCoworkRun until committed, so a streaming
- // session stays listed via its active run — otherwise switching away
- // mid-first-run would make it unreachable.
- const runIds = useCoworkRun((s) => s.runId)
- const visibleSessions = useMemo(
- () => sessions.filter((s) => s.turns.length > 0 || runIds[s.id] != null),
- [sessions, runIds]
- )
- const [skillsOpen, setSkillsOpen] = useState(false)
- // Session pending deletion; drives the confirm dialog (null = closed).
- const [pendingDelete, setPendingDelete] = useState<{
- id: string
- title: string
- } | null>(null)
-
- const newSessionIconRef = useRef<MessageCircleIconHandle>(null)
- const settingsIconRef = useRef<SettingsIconHandle>(null)
- // A new conversation starts on the home composer; /cowork/$sessionId only
- // opens sessions that already exist.
- const newSession = () => {
- navigate({ to: route.home })
- }
- const selectSession = useCallback(
- (id: string) => {
- useCoworkSessions.getState().selectSession(id)
- pruneEmpty()
- navigate({ to: route.coworkSession, params: { sessionId: id } })
- },
- [navigate]
- )
-
- const items: CoworkNavItem[] = [
- {
- title: t('common:artifacts'),
- icon: Box,
- preset: 'box',
- onClick: () => navigate({ to: route.artifacts }),
- },
- {
- title: t('common:customize'),
- icon: SlidersHorizontal,
- preset: 'sliders',
- onClick: () => setSkillsOpen(true),
- },
- ]
-
- const confirmDelete = () => {
- if (pendingDelete) {
- const sid = pendingDelete.id
- // Watchers are the session's, so they go with it: stopped in Rust, their
- // lane forgotten, their rail entries dropped.
- void stopAgentSessionMonitors(sid)
- dropMonitorLane(sid)
- useCoworkRun.getState().clearMonitors(sid)
- useCoworkSessions.getState().deleteSession(sid)
- }
- setPendingDelete(null)
- }
-
- return (
- <>
- <SidebarMenu>
- <SidebarMenuItem>
- <SidebarMenuButton
- onClick={newSession}
- onMouseEnter={() => newSessionIconRef.current?.startAnimation()}
- onMouseLeave={() => newSessionIconRef.current?.stopAnimation()}
- >
- <MessageCircleIcon
- ref={newSessionIconRef}
- className="text-foreground/70"
- size={16}
- />
- <span>{t('common:newSession')}</span>
- </SidebarMenuButton>
- </SidebarMenuItem>
- {items.map((item) => (
- <CoworkNavItemRow key={item.title} item={item} />
- ))}
- <SidebarMenuItem>
- <SidebarMenuButton
- onClick={() => navigate({ to: route.settings.general })}
- onMouseEnter={() => settingsIconRef.current?.startAnimation()}
- onMouseLeave={() => settingsIconRef.current?.stopAnimation()}
- >
- <SettingsIcon
- ref={settingsIconRef}
- className="text-foreground/70"
- size={16}
- />
- <span>{t('common:settings')}</span>
- </SidebarMenuButton>
- </SidebarMenuItem>
- </SidebarMenu>
-
- {/* px-0: the group's own p-2 would indent the session rows past the nav
- rows above it, which share the header's px-1. */}
- {visibleSessions.length > 0 && (
- <SidebarGroup className="px-0 group-data-[collapsible=icon]:hidden">
- <SidebarGroupLabel>{t('common:sessions')}</SidebarGroupLabel>
- <SidebarMenu>
- {visibleSessions.map((session) => (
- <SessionItem
- key={session.id}
- session={session}
- isCurrent={session.id === currentId}
- isMobile={isMobile}
- onSelect={selectSession}
- onRequestDelete={setPendingDelete}
- />
- ))}
- </SidebarMenu>
- </SidebarGroup>
- )}
-
- <SkillsManagerDialog open={skillsOpen} onOpenChange={setSkillsOpen} />
-
- <Dialog
- open={pendingDelete !== null}
- onOpenChange={(open) => !open && setPendingDelete(null)}
- >
- <DialogContent>
- <DialogHeader>
- <DialogTitle>{t('common:deleteSessionTitle')}</DialogTitle>
- <DialogDescription>
- {t('common:deleteSessionBody', { title: pendingDelete?.title })}
- </DialogDescription>
- </DialogHeader>
- <DialogFooter>
- <Button
- variant="ghost"
- size="sm"
- onClick={() => setPendingDelete(null)}
- >
- {t('common:cancel')}
- </Button>
- <Button variant="destructive" size="sm" onClick={confirmDelete}>
- {t('common:delete')}
- </Button>
- </DialogFooter>
- </DialogContent>
- </Dialog>
- </>
- )
-}
diff --git a/web-app/src/components/left-sidebar/NavCoworkTools.tsx b/web-app/src/components/left-sidebar/NavCoworkTools.tsx
new file mode 100644
index 000000000..4c0fa6695
--- /dev/null
+++ b/web-app/src/components/left-sidebar/NavCoworkTools.tsx
@@ -0,0 +1,90 @@
+import { useRef, useState } from 'react'
+import { BookOpen, Box, type LucideIcon } from 'lucide-react'
+import { useNavigate } from '@tanstack/react-router'
+import {
+ SidebarMenuButton,
+ SidebarMenuItem,
+} from '@/components/ui/sidebar'
+import {
+ AnimatedLucideIcon,
+ type AnimatedLucideIconHandle,
+ type AnimatedLucidePreset,
+} from '@/components/animated-icon/animated-lucide'
+import SkillsManagerDialog from '@/containers/dialogs/SkillsManagerDialog'
+import { useTranslation } from '@/i18n/react-i18next-compat'
+import { route } from '@/constants/routes'
+
+type Item = {
+ title: string
+ icon: LucideIcon
+ preset: AnimatedLucidePreset
+ testId: string
+ onClick: () => void
+}
+
+function ToolRow({ item }: { item: Item }) {
+ const iconRef = useRef<AnimatedLucideIconHandle>(null)
+ return (
+ <SidebarMenuItem>
+ <SidebarMenuButton
+ data-testid={item.testId}
+ onBlur={() => iconRef.current?.stopAnimation()}
+ onClick={item.onClick}
+ onFocus={() => iconRef.current?.startAnimation()}
+ onMouseEnter={() => iconRef.current?.startAnimation()}
+ onMouseLeave={() => iconRef.current?.stopAnimation()}
+ >
+ <AnimatedLucideIcon
+ ref={iconRef}
+ icon={item.icon}
+ preset={item.preset}
+ // index.css shrinks every svg.lucide to 14px; a utility overrides it so
+ // these rows match the 16px icons in the rest of the menu.
+ className="size-4 shrink-0 text-foreground/70 [&_svg]:size-4"
+ size={16}
+ />
+ <span className="min-w-0 truncate leading-5">{item.title}</span>
+ </SidebarMenuButton>
+ </SidebarMenuItem>
+ )
+}
+
+/**
+ * Artifacts and Skills, the entries of the one sidebar that unified threads use
+ * too. They show on every build and never replace the rest of the navigation.
+ */
+export function NavCoworkTools({ section = 'customize' }: { section?: 'artifacts' | 'customize' }) {
+ const { t } = useTranslation()
+ const navigate = useNavigate()
+ const [skillsOpen, setSkillsOpen] = useState(false)
+
+ const items: Item[] = [
+ {
+ title: t('common:artifacts'),
+ icon: Box,
+ preset: 'box',
+ testId: 'nav-artifacts',
+ onClick: () => navigate({ to: route.artifacts }),
+ },
+ {
+ title: t('common:skills'),
+ icon: BookOpen,
+ preset: 'sliders',
+ testId: 'nav-customize',
+ onClick: () => setSkillsOpen(true),
+ },
+ ]
+
+ const visibleItems = items.filter((item) => item.testId === `nav-${section}`)
+ // Both sections are rows in NavMain's menu, not nested menus.
+ return (
+ <>
+ {visibleItems.map((item) => (
+ <ToolRow key={item.title} item={item} />
+ ))}
+ {section === 'customize' && (
+ <SkillsManagerDialog open={skillsOpen} onOpenChange={setSkillsOpen} />
+ )}
+ </>
+ )
+}
diff --git a/web-app/src/components/left-sidebar/NavHistory.tsx b/web-app/src/components/left-sidebar/NavHistory.tsx
new file mode 100644
index 000000000..d6ce1d10e
--- /dev/null
+++ b/web-app/src/components/left-sidebar/NavHistory.tsx
@@ -0,0 +1,295 @@
+import { memo, useCallback, useMemo, useState } from 'react'
+import { useNavigate, useParams } from '@tanstack/react-router'
+import { Loader2, MoreHorizontal, Pencil, Trash2 } from 'lucide-react'
+import {
+ SidebarGroup,
+ SidebarGroupLabel,
+ SidebarMenu,
+ SidebarMenuAction,
+ SidebarMenuButton,
+ SidebarMenuItem,
+ SidebarGroupAction,
+ useSidebar,
+} from '@/components/ui/sidebar'
+import {
+ DropdownMenu,
+ DropdownMenuContent,
+ DropdownMenuItem,
+ DropdownMenuTrigger,
+} from '@/components/ui/dropdown-menu'
+import {
+ Dialog,
+ DialogContent,
+ DialogDescription,
+ DialogFooter,
+ DialogHeader,
+ DialogTitle,
+} from '@/components/ui/dialog'
+import { Button } from '@/components/ui/button'
+import { useTranslation } from '@/i18n/react-i18next-compat'
+import { route } from '@/constants/routes'
+import { isDeletedByDeleteAll, useThreads } from '@/hooks/useThreads'
+import { useThreadManagement } from '@/hooks/useThreadManagement'
+import { useCoworkSessions } from '@/hooks/useCoworkSessions'
+import { useCoworkRun, useIsSessionActive } from '@/hooks/useCoworkRun'
+import { deleteCoworkConversation, hasCoworkSession } from '@/lib/coworkDelete'
+import { isCoworkThread } from '@/lib/threadMode'
+import { ThreadItem } from '@/containers/ThreadList'
+import { RenameThreadDialog } from '@/containers/dialogs/RenameThreadDialog'
+import { DeleteAllThreadsDialog } from '@/containers/dialogs/DeleteAllThreadsDialog'
+import { mergeHistory } from '@/lib/mergeHistory'
+
+/**
+ * One history for every conversation, newest first. It replaces the Home/Cowork
+ * tabs, the chat list and the separate Cowork session list.
+ *
+ * A Cowork conversation is a thread too (coworkSync mirrors it into the thread
+ * list), so it is listed once, from `useThreads`, and opens `/cowork/$sessionId`.
+ * `mergeHistory` adds a session-store row only for a conversation with no thread
+ * yet (a first run still streaming) or whose thread is gone.
+ */
+
+type PendingDelete = { id: string; title: string; collision: boolean }
+
+const CoworkRow = memo(function CoworkRow({
+ id,
+ title,
+ unavailable,
+ isCurrent,
+ isMobile,
+ onRequestDelete,
+}: {
+ id: string
+ title: string
+ unavailable?: string
+ isCurrent: boolean
+ isMobile: boolean
+ onRequestDelete: (pending: PendingDelete) => void
+}) {
+ const { t } = useTranslation()
+ const navigate = useNavigate()
+ const isRunning = useIsSessionActive(id)
+ const [renameOpen, setRenameOpen] = useState(false)
+ const displayTitle = title || t('common:newThread')
+ return (
+ <SidebarMenuItem>
+ <SidebarMenuButton
+ isActive={isCurrent}
+ className="data-[active=true]:bg-sidebar-foreground/10 dark:data-[active=true]:bg-sidebar-accent"
+ data-testid={`history-cowork-${id}`}
+ onClick={() =>
+ navigate({
+ to: route.coworkSession,
+ params: { sessionId: id },
+ })
+ }
+ >
+ {isRunning && (
+ <Loader2 className="size-3 shrink-0 animate-spin text-muted-foreground" />
+ )}
+ <span className="truncate" title={displayTitle}>
+ {displayTitle}
+ </span>
+ </SidebarMenuButton>
+ <DropdownMenu>
+ <DropdownMenuTrigger asChild>
+ <SidebarMenuAction showOnHover className="hover:bg-sidebar-foreground/8">
+ <MoreHorizontal />
+ <span className="sr-only">{t('common:sidebar.more')}</span>
+ </SidebarMenuAction>
+ </DropdownMenuTrigger>
+ <DropdownMenuContent
+ className="w-48"
+ side={isMobile ? 'bottom' : 'right'}
+ align={isMobile ? 'end' : 'start'}
+ >
+ {/* Persistence refuses writes for an unavailable session, so a rename
+ would look saved and revert on restart. */}
+ {!unavailable && (
+ <DropdownMenuItem onSelect={() => setRenameOpen(true)}>
+ <Pencil />
+ <span>{t('common:rename')}</span>
+ </DropdownMenuItem>
+ )}
+ <DropdownMenuItem
+ variant="destructive"
+ onSelect={() =>
+ onRequestDelete({
+ id,
+ title: displayTitle,
+ collision: unavailable === 'id-collision',
+ })
+ }
+ >
+ <Trash2 />
+ <span>{t('common:deleteSession')}</span>
+ </DropdownMenuItem>
+ </DropdownMenuContent>
+ </DropdownMenu>
+ <RenameThreadDialog
+ // The dialog only reads the id. A live session persists its title (and
+ // the mirrored thread follows); a thread without a session in the store
+ // is renamed through the thread list.
+ thread={{ id, title } as Thread}
+ plainTitleForRename={title}
+ onRename={(threadId, next) => {
+ if (hasCoworkSession(threadId)) {
+ useCoworkSessions.getState().setTitle(threadId, next)
+ } else {
+ useThreads.getState().renameThread(threadId, next)
+ }
+ }}
+ open={renameOpen}
+ onOpenChange={setRenameOpen}
+ withoutTrigger
+ />
+ </SidebarMenuItem>
+ )
+})
+
+export function NavHistory() {
+ const { t } = useTranslation()
+ const { isMobile } = useSidebar()
+ const navigate = useNavigate()
+ const threads = useThreads((s) => s.threads)
+ const isLoadingThreads = useThreads((s) => s.isLoadingThreads)
+ const deleteAllThreads = useThreads((s) => s.deleteAllThreads)
+ const { folders, foldersLoaded } = useThreadManagement()
+ const sessions = useCoworkSessions((s) => s.sessions)
+ const runIds = useCoworkRun((s) => s.runId)
+ // The active row follows the URL, not a lingering store selection.
+ const activeSessionId = useParams({
+ strict: false,
+ select: (p) => (p as { sessionId?: string }).sessionId,
+ })
+ const [menuOpen, setMenuOpen] = useState(false)
+ const [pendingDelete, setPendingDelete] = useState<PendingDelete | null>(null)
+
+ const rows = useMemo(
+ () =>
+ mergeHistory(
+ Object.values(threads).filter((t) => t.id !== 'temporary-chat'),
+ sessions,
+ runIds,
+ foldersLoaded ? new Set(folders.map((f) => f.id)) : null
+ ),
+ [threads, sessions, runIds, folders, foldersLoaded]
+ )
+
+ const confirmDelete = useCallback(() => {
+ if (pendingDelete) {
+ const { id, collision } = pendingDelete
+ if (collision) {
+ // A collision placeholder shares its id with an unrelated chat: remove
+ // only the placeholder, and never stop that chat's run or shell.
+ useCoworkSessions.getState().deleteSession(id)
+ } else if (hasCoworkSession(id)) {
+ // Stops the run, its shell and its watchers, then removes the session
+ // through the store so coworkSync journals it and deletes the thread.
+ deleteCoworkConversation(id)
+ } else {
+ useThreads.getState().deleteThread(id)
+ }
+ // Deleting the conversation on screen must leave its route, as deleting a
+ // chat thread does; otherwise the page sits on a dead id.
+ if (id === activeSessionId) navigate({ to: route.home })
+ }
+ setPendingDelete(null)
+ }, [pendingDelete, activeSessionId, navigate])
+
+ if (rows.length === 0) {
+ if (!isLoadingThreads) return null
+ return (
+ <SidebarGroup className="px-1 group-data-[collapsible=icon]:hidden">
+ <SidebarGroupLabel>{t('common:chatsAndTasks')}</SidebarGroupLabel>
+ <div className="flex items-center justify-center py-2">
+ <Loader2 className="size-4 animate-spin text-muted-foreground" />
+ </div>
+ </SidebarGroup>
+ )
+ }
+
+ // Offer Delete All only when it would actually delete something.
+ const deletableCount = rows.filter(
+ (r) => r.kind === 'thread' && isDeletedByDeleteAll(r.thread)
+ ).length
+
+ return (
+ <SidebarGroup className="px-1 group-data-[collapsible=icon]:hidden">
+ <SidebarGroupLabel>{t('common:chatsAndTasks')}</SidebarGroupLabel>
+ {deletableCount > 1 && (
+ <DropdownMenu open={menuOpen} onOpenChange={setMenuOpen}>
+ <DropdownMenuTrigger asChild>
+ <SidebarGroupAction className="hover:bg-sidebar-foreground/8">
+ <MoreHorizontal className="text-muted-foreground" />
+ <span className="sr-only">{t('common:sidebar.more')}</span>
+ </SidebarGroupAction>
+ </DropdownMenuTrigger>
+ <DropdownMenuContent side="right" align="start">
+ <DeleteAllThreadsDialog
+ onDeleteAll={deleteAllThreads}
+ onDropdownClose={() => setMenuOpen(false)}
+ />
+ </DropdownMenuContent>
+ </DropdownMenu>
+ )}
+ <SidebarMenu>
+ {rows.map((row) => {
+ if (row.kind === 'session') {
+ return (
+ <CoworkRow
+ key={`session:${row.id}`}
+ id={row.id}
+ title={row.session.title}
+ unavailable={row.session.unavailable}
+ isCurrent={row.id === activeSessionId}
+ isMobile={isMobile}
+ onRequestDelete={setPendingDelete}
+ />
+ )
+ }
+ if (isCoworkThread(row.thread)) {
+ // The session store is the authority for what is live; the mirror
+ // thread supplies the row while the session is not loaded.
+ const session = sessions.find((s) => s.id === row.id)
+ return (
+ <CoworkRow
+ key={`thread:${row.id}`}
+ id={row.id}
+ title={session?.title ?? row.thread.title}
+ unavailable={session?.unavailable}
+ isCurrent={row.id === activeSessionId}
+ isMobile={isMobile}
+ onRequestDelete={setPendingDelete}
+ />
+ )
+ }
+ // Chat rows keep ThreadList's item (rename, move to project, delete).
+ return <ThreadItem key={`thread:${row.id}`} thread={row.thread} isMobile={isMobile} />
+ })}
+ </SidebarMenu>
+
+ <Dialog
+ open={pendingDelete !== null}
+ onOpenChange={(open) => !open && setPendingDelete(null)}
+ >
+ <DialogContent>
+ <DialogHeader>
+ <DialogTitle>{t('common:deleteSessionTitle')}</DialogTitle>
+ <DialogDescription>
+ {t('common:deleteSessionBody', { title: pendingDelete?.title })}
+ </DialogDescription>
+ </DialogHeader>
+ <DialogFooter>
+ <Button variant="ghost" size="sm" onClick={() => setPendingDelete(null)}>
+ {t('common:cancel')}
+ </Button>
+ <Button variant="destructive" size="sm" onClick={confirmDelete}>
+ {t('common:delete')}
+ </Button>
+ </DialogFooter>
+ </DialogContent>
+ </Dialog>
+ </SidebarGroup>
+ )
+}
diff --git a/web-app/src/components/left-sidebar/NavMain.tsx b/web-app/src/components/left-sidebar/NavMain.tsx
index 3362b8d34..ea8ad79a3 100644
--- a/web-app/src/components/left-sidebar/NavMain.tsx
+++ b/web-app/src/components/left-sidebar/NavMain.tsx
@@ -79,7 +79,7 @@ const getNavMainItems = (
onClick: onNewChat,
testId: 'new-chat-button',
shortcut: (
- <KbdGroup className="ml-auto scale-90 gap-0">
+ <KbdGroup className="ml-auto shrink-0 scale-90 gap-0">
<Kbd className="bg-transparent size-3">
<PlatformMetaKey />
</Kbd>
@@ -92,7 +92,7 @@ const getNavMainItems = (
animatedIcon: BotIcon,
onClick: onJanClaw,
shortcut: (
- <KbdGroup className="ml-auto scale-90 gap-0">
+ <KbdGroup className="ml-auto shrink-0 scale-90 gap-0">
<Kbd className="bg-transparent size-3">
<PlatformMetaKey />
</Kbd>
@@ -105,7 +105,7 @@ const getNavMainItems = (
animatedIcon: FolderPlusIcon,
onClick: onNewProject,
shortcut: (
- <KbdGroup className="ml-auto scale-90 gap-0">
+ <KbdGroup className="ml-auto shrink-0 scale-90 gap-0">
<Kbd className="bg-transparent size-3">
<PlatformMetaKey />
</Kbd>
@@ -118,7 +118,7 @@ const getNavMainItems = (
animatedIcon: SearchIcon,
onClick: onSearch,
shortcut: (
- <KbdGroup className="ml-auto scale-90 gap-0">
+ <KbdGroup className="ml-auto shrink-0 scale-90 gap-0">
<Kbd className="bg-transparent size-3">
<PlatformMetaKey />
</Kbd>
@@ -150,8 +150,8 @@ function NavMainItemWithAnimatedIcon({
const content = (
<>
- <AnimatedIcon ref={iconRef} className="text-foreground/70" size={16} />
- <span>{label}</span>
+ <AnimatedIcon ref={iconRef} className="size-4 shrink-0 text-foreground/70" size={16} />
+ <span className="min-w-0 truncate leading-5">{label}</span>
{item.shortcut}
</>
)
@@ -172,7 +172,13 @@ function NavMainItemWithAnimatedIcon({
)
}
-export function NavMain() {
+export function NavMain({
+ afterSearch,
+ beforeSettings,
+}: {
+ afterSearch?: React.ReactNode
+ beforeSettings?: React.ReactNode
+}) {
const { t } = useTranslation()
const navigate = useNavigate()
const { addFolder } = useThreadManagement()
@@ -207,11 +213,14 @@ export function NavMain() {
{navMainItems.map((item) => {
if (item.animatedIcon) {
return (
- <NavMainItemWithAnimatedIcon
- key={item.title}
- item={item}
- label={t(item.title)}
- />
+ <React.Fragment key={item.title}>
+ {item.title === 'common:settings' && beforeSettings}
+ <NavMainItemWithAnimatedIcon
+ item={item}
+ label={t(item.title)}
+ />
+ {item.title === 'common:search' && afterSearch}
+ </React.Fragment>
)
}
@@ -226,14 +235,14 @@ export function NavMain() {
>
{item.url ? (
<Link to={item.url}>
- {Icon && <Icon className="text-foreground/70" />}
- <span>{t(item.title)}</span>
+ {Icon && <Icon className="size-4 shrink-0 text-foreground/70" />}
+ <span className="min-w-0 truncate leading-5">{t(item.title)}</span>
{item.shortcut}
</Link>
) : (
<>
- {Icon && <Icon className="text-foreground/70" />}
- <span>{t(item.title)}</span>
+ {Icon && <Icon className="size-4 shrink-0 text-foreground/70" />}
+ <span className="min-w-0 truncate leading-5">{t(item.title)}</span>
{item.shortcut}
</>
)}
diff --git a/web-app/src/components/left-sidebar/NavProjects.tsx b/web-app/src/components/left-sidebar/NavProjects.tsx
index 5c4a8048e..313057020 100644
--- a/web-app/src/components/left-sidebar/NavProjects.tsx
+++ b/web-app/src/components/left-sidebar/NavProjects.tsx
@@ -45,6 +45,7 @@ function ProjectItem({
}) {
const navigate = useNavigate()
+ const { t } = useTranslation()
return (
<SidebarMenuItem>
@@ -53,15 +54,15 @@ function ProjectItem({
to="/project/$projectId"
params={{ projectId: item.id }}
>
- <FolderIcon className="text-foreground/70" size={16} />
- <span>{item.name}</span>
+ <FolderIcon className="size-4 shrink-0 text-foreground/70" size={16} />
+ <span className="min-w-0 truncate leading-5">{item.name}</span>
</Link>
</SidebarMenuButton>
<DropdownMenu>
<DropdownMenuTrigger asChild>
<SidebarMenuAction showOnHover className="hover:bg-sidebar-foreground/8">
<MoreHorizontal />
- <span className="sr-only">More</span>
+ <span className="sr-only">{t('common:sidebar.more')}</span>
</SidebarMenuAction>
</DropdownMenuTrigger>
<DropdownMenuContent
@@ -73,16 +74,16 @@ function ProjectItem({
navigate({ to: '/project/$projectId', params: { projectId: item.id } })
}}>
<FolderOpenIcon className="text-muted-foreground" />
- <span>View Project</span>
+ <span>{t('common:projects.viewProject')}</span>
</DropdownMenuItem>
<DropdownMenuItem onSelect={() => onEdit(item)}>
<FolderEditIcon className="text-muted-foreground" />
- <span>Edit Project</span>
+ <span>{t('common:projects.editProject')}</span>
</DropdownMenuItem>
<DropdownMenuSeparator />
<DropdownMenuItem variant="destructive" onSelect={() => onDelete(item)}>
<Trash2 />
- <span>Delete Project</span>
+ <span>{t('common:projects.deleteProject')}</span>
</DropdownMenuItem>
</DropdownMenuContent>
</DropdownMenu>
@@ -123,7 +124,7 @@ export function NavProjects() {
return (
<>
- <SidebarGroup className="group-data-[collapsible=icon]:hidden">
+ <SidebarGroup className="px-1 group-data-[collapsible=icon]:hidden">
<SidebarGroupLabel>{t('common:projects.title')}</SidebarGroupLabel>
<SidebarMenu>
{folders.map((item) => (
diff --git a/web-app/src/components/left-sidebar/NavTabs.tsx b/web-app/src/components/left-sidebar/NavTabs.tsx
deleted file mode 100644
index a8a57444d..000000000
--- a/web-app/src/components/left-sidebar/NavTabs.tsx
+++ /dev/null
@@ -1,94 +0,0 @@
-import { useRef } from 'react'
-import { Link } from '@tanstack/react-router'
-import { Handshake, HomeIcon, type LucideIcon } from 'lucide-react'
-import { route, isCoworkRoute } from '@/constants/routes'
-import { cn } from '@/lib/utils'
-import { useTranslation } from '@/i18n/react-i18next-compat'
-import { useThreads } from '@/hooks/useThreads'
-import {
- AnimatedLucideIcon,
- type AnimatedLucideIconHandle,
- type AnimatedLucidePreset,
-} from '@/components/animated-icon/animated-lucide'
-
-type TabItem = {
- label: string
- to: string
- icon: LucideIcon
- preset: AnimatedLucidePreset
- isActive: boolean
-}
-
-function NavTab({ tab }: { tab: TabItem }) {
- const iconRef = useRef<AnimatedLucideIconHandle>(null)
-
- return (
- <Link
- to={tab.to}
- aria-current={tab.isActive ? 'page' : undefined}
- className={cn(
- 'flex flex-1 items-center justify-center gap-1.5 rounded-md px-2 py-1 text-sm font-medium transition-colors',
- tab.isActive
- ? 'bg-sidebar text-foreground shadow-sm'
- : 'text-muted-foreground hover:text-foreground'
- )}
- onBlur={() => iconRef.current?.stopAnimation()}
- onFocus={() => iconRef.current?.startAnimation()}
- onMouseEnter={() => iconRef.current?.startAnimation()}
- onMouseLeave={() => iconRef.current?.stopAnimation()}
- >
- <AnimatedLucideIcon
- ref={iconRef}
- icon={tab.icon}
- preset={tab.preset}
- size={15}
- />
- <span>{tab.label}</span>
- </Link>
- )
-}
-
-export function NavTabs({ surfacePath }: { surfacePath: string }) {
- const { t } = useTranslation()
- const lastHomePath = useRef<string>(route.home)
-
- const isCowork = isCoworkRoute(surfacePath)
- // Home owns the chat surfaces (new chat, threads, projects); Cowork owns /cowork.
- const isHome =
- surfacePath === route.home ||
- surfacePath.startsWith('/threads') ||
- surfacePath.startsWith('/project')
- if (isHome) lastHomePath.current = surfacePath
- const homePath = isHome ? surfacePath : lastHomePath.current
- const threadId = homePath.startsWith('/threads/')
- ? homePath.slice('/threads/'.length)
- : undefined
- const threadExists = useThreads(
- (s) => !threadId || Boolean(s.threads[threadId])
- )
-
- const tabs: TabItem[] = [
- {
- label: t('common:home'),
- to: threadExists ? homePath : route.home,
- icon: HomeIcon,
- preset: 'home',
- isActive: isHome,
- },
- {
- label: t('common:cowork'),
- to: route.cowork,
- icon: Handshake,
- preset: 'handshake',
- isActive: isCowork,
- },
- ]
-
- return (
- <div className="mt-1 flex items-center gap-0.5 rounded-lg bg-sidebar-foreground/5 p-0.5">
- {tabs.map((tab) => (
- <NavTab key={tab.to} tab={tab} />
- ))}
- </div>
- )
-}
diff --git a/web-app/src/components/left-sidebar/__tests__/headerLabel.test.tsx b/web-app/src/components/left-sidebar/__tests__/headerLabel.test.tsx
index cc470cdca..b8fa14565 100644
--- a/web-app/src/components/left-sidebar/__tests__/headerLabel.test.tsx
+++ b/web-app/src/components/left-sidebar/__tests__/headerLabel.test.tsx
@@ -6,7 +6,8 @@ import { render, screen } from '@testing-library/react'
const titlebar = vi.hoisted(() => ({ left: [] as string[] }))
vi.mock('@tanstack/react-router', () => ({
- useLocation: () => ({ pathname: '/' }),
+ useLocation: ({ select }: { select?: (l: { pathname: string }) => unknown } = {}) =>
+ select ? select({ pathname: '/' }) : { pathname: '/' },
Link: ({ to, children, ...props }: { to: string; children: ReactNode }) => (
<a {...props} href={to}>
{children}
@@ -27,11 +28,10 @@ vi.mock('@/stores/titlebar-layout-store', () => ({
vi.mock('@/containers/DownloadManegement', () => ({
DownloadManagement: () => null,
}))
-vi.mock('../NavCowork', () => ({ NavCowork: () => null }))
+vi.mock('../NavCoworkTools', () => ({ NavCoworkTools: () => null }))
+vi.mock('../NavHistory', () => ({ NavHistory: () => null }))
vi.mock('../NavMain', () => ({ NavMain: () => null }))
-vi.mock('../NavChats', () => ({ NavChats: () => null }))
vi.mock('../NavProjects', () => ({ NavProjects: () => null }))
-vi.mock('../NavTabs', () => ({ NavTabs: () => null }))
vi.mock('@/components/ui/sidebar', () => {
const Box = ({ children }: { children: ReactNode }) => <div>{children}</div>
return {
@@ -40,6 +40,7 @@ vi.mock('@/components/ui/sidebar', () => {
SidebarHeader: Box,
SidebarTrigger: () => null,
SidebarRail: () => null,
+ useSidebar: () => ({ isMobile: false, setOpenMobile: vi.fn(), closeMobileForNavigation: vi.fn() }),
}
})
diff --git a/web-app/src/components/left-sidebar/__tests__/navCoworkToolsIcons.test.tsx b/web-app/src/components/left-sidebar/__tests__/navCoworkToolsIcons.test.tsx
new file mode 100644
index 000000000..31a8c0c4d
--- /dev/null
+++ b/web-app/src/components/left-sidebar/__tests__/navCoworkToolsIcons.test.tsx
@@ -0,0 +1,30 @@
+import '@testing-library/jest-dom/vitest'
+import type { ComponentProps, ReactNode } from 'react'
+import { expect, it, vi } from 'vitest'
+import { render, screen } from '@testing-library/react'
+
+vi.mock('@tanstack/react-router', () => ({ useNavigate: () => vi.fn() }))
+vi.mock('@/i18n/react-i18next-compat', () => ({
+ useTranslation: () => ({ t: (key: string) => key }),
+}))
+vi.mock('@/containers/dialogs/SkillsManagerDialog', () => ({ default: () => null }))
+vi.mock('@/components/ui/sidebar', () => ({
+ SidebarMenuItem: ({ children }: { children: ReactNode }) => <li>{children}</li>,
+ SidebarMenuButton: (props: ComponentProps<'button'> & { asChild?: boolean }) => {
+ const { asChild, ...rest } = props
+ void asChild
+ return <button {...rest} />
+ },
+}))
+
+import { NavCoworkTools } from '../NavCoworkTools'
+
+// index.css sets `svg.lucide { width: 14px; height: 14px }` globally, which made
+// the Artifacts and Skills icons 14px next to 16px icons in every other row.
+// The wrapper must carry a rule that wins over it.
+it.each(['artifacts', 'customize'] as const)('%s icon opts out of the global 14px lucide size', (section) => {
+ render(<NavCoworkTools section={section} />)
+ const svg = screen.getByTestId(`nav-${section}`).querySelector('svg')!
+ expect(svg).toHaveAttribute('width', '16')
+ expect(svg.closest('div[class*="size-4"]')?.className).toContain('[&_svg]:size-4')
+})
diff --git a/web-app/src/components/left-sidebar/__tests__/navHistory.test.tsx b/web-app/src/components/left-sidebar/__tests__/navHistory.test.tsx
new file mode 100644
index 000000000..9b0f451c1
--- /dev/null
+++ b/web-app/src/components/left-sidebar/__tests__/navHistory.test.tsx
@@ -0,0 +1,326 @@
+import '@testing-library/jest-dom/vitest'
+import type { ComponentProps, ReactNode } from 'react'
+import { beforeEach, describe, expect, it, vi } from 'vitest'
+import { fireEvent, render, screen, within } from '@testing-library/react'
+
+const router = vi.hoisted(() => ({
+ navigate: vi.fn(),
+ sessionId: undefined as string | undefined,
+}))
+
+vi.mock('@tanstack/react-router', () => ({
+ useNavigate: () => router.navigate,
+ useParams: ({ select }: { select?: (p: unknown) => unknown }) => {
+ const params = { sessionId: router.sessionId }
+ return select ? select(params) : params
+ },
+}))
+// A stable `t`: RenameThreadDialog re-seeds its input whenever `t` changes.
+const t = (key: string) => key
+vi.mock('@/i18n/react-i18next-compat', () => ({
+ useTranslation: () => ({ t }),
+}))
+vi.mock('@/lib/backendStorage', () => {
+ const store = {
+ getItem: async () => null,
+ setItem: async () => {},
+ removeItem: async () => {},
+ }
+ return { backendStorage: store, default: store }
+})
+// Not the dev server: the old gate let `isDev()` through, which hid the bug.
+vi.mock('@/lib/utils', async (importOriginal) => ({
+ ...(await importOriginal<typeof import('@/lib/utils')>()),
+ isDev: () => false,
+}))
+vi.mock('@/lib/agentTools', () => ({
+ stopAgentSessionMonitors: vi.fn(),
+ cancelAgentThreadBash: vi.fn(),
+}))
+vi.mock('@/lib/coworkRunner', () => ({ abortRun: vi.fn() }))
+vi.mock('@/lib/coworkMonitor', async (importOriginal) => ({
+ ...(await importOriginal<typeof import('@/lib/coworkMonitor')>()),
+ dropMonitorLane: vi.fn(),
+}))
+vi.mock('@/containers/ThreadList', () => ({
+ ThreadItem: ({ thread }: { thread: { id: string } }) => <li data-testid={`thread-${thread.id}`} />,
+}))
+const projects = vi.hoisted(() => ({
+ folders: [] as { id: string }[],
+ foldersLoaded: true,
+}))
+vi.mock('@/hooks/useThreadManagement', () => ({
+ useThreadManagement: () => projects,
+}))
+vi.mock('sonner', () => ({ toast: { success: vi.fn(), error: vi.fn() } }))
+vi.mock('@/containers/dialogs/DeleteAllThreadsDialog', () => ({
+ DeleteAllThreadsDialog: () => <div data-testid="delete-all" />,
+}))
+vi.mock('@/components/ui/dropdown-menu', () => ({
+ DropdownMenu: ({ children }: { children: ReactNode }) => <div>{children}</div>,
+ DropdownMenuTrigger: ({ children }: { children: ReactNode }) => <>{children}</>,
+ DropdownMenuContent: ({ children }: { children: ReactNode }) => <div>{children}</div>,
+ DropdownMenuItem: ({
+ children,
+ onSelect,
+ }: {
+ children: ReactNode
+ onSelect?: () => void
+ }) => (
+ <button role="menuitem" onClick={() => onSelect?.()}>
+ {children}
+ </button>
+ ),
+}))
+vi.mock('@/components/ui/sidebar', () => {
+ const Box = ({ children }: { children?: ReactNode }) => <div>{children}</div>
+ const Btn = (props: ComponentProps<'button'> & { showOnHover?: boolean; isActive?: boolean }) => {
+ const { showOnHover, isActive, ...rest } = props
+ void showOnHover
+ void isActive
+ return <button {...rest} />
+ }
+ return {
+ SidebarGroup: Box,
+ SidebarGroupLabel: Box,
+ SidebarGroupAction: Btn,
+ SidebarMenu: ({ children }: { children?: ReactNode }) => <ul>{children}</ul>,
+ SidebarMenuItem: ({ children }: { children?: ReactNode }) => <li>{children}</li>,
+ SidebarMenuButton: Btn,
+ SidebarMenuAction: Btn,
+ useSidebar: () => ({ isMobile: false }),
+ }
+})
+
+import { NavHistory } from '../NavHistory'
+import { useCoworkSessions, type CoworkSession } from '@/hooks/useCoworkSessions'
+import { useCoworkRun } from '@/hooks/useCoworkRun'
+import { route } from '@/constants/routes'
+import { useThreads } from '@/hooks/useThreads'
+
+const session = (id: string, title: string): CoworkSession =>
+ ({
+ id,
+ title,
+ folder: null,
+ turns: [{ role: 'user', content: 'hi' }],
+ messages: [],
+ updated: Date.now(),
+ }) as unknown as CoworkSession
+
+const ids = () => useCoworkSessions.getState().sessions.map((s) => s.id)
+
+function deleteRow(id: string) {
+ const row = screen.getByTestId(`history-cowork-${id}`).closest('li') as HTMLElement
+ fireEvent.click(within(row).getByRole('menuitem', { name: 'common:deleteSession' }))
+ fireEvent.click(within(screen.getByRole('dialog')).getByRole('button', { name: 'common:delete' }))
+}
+
+beforeEach(() => {
+ projects.folders = []
+ projects.foldersLoaded = true
+ useThreads.setState({ threads: {} })
+ router.navigate.mockClear()
+ router.sessionId = undefined
+ useCoworkSessions.setState({ sessions: [session('open', 'Open one'), session('other', 'Other one')] })
+})
+
+describe('NavHistory legacy Cowork sessions', () => {
+ // vitest defines VERSION as 'test', i.e. a stable-style build with no channel
+ // suffix: sessions used to be hidden here.
+ it('lists legacy Cowork sessions on every channel, including stable', () => {
+ render(<NavHistory />)
+ expect(screen.getByTestId('history-cowork-open')).toBeInTheDocument()
+ expect(screen.getByTestId('history-cowork-other')).toBeInTheDocument()
+ })
+})
+
+describe('NavHistory delete Cowork session', () => {
+ it('leaves the route and removes the session when the open conversation is deleted', () => {
+ router.sessionId = 'open'
+ render(<NavHistory />)
+ deleteRow('open')
+ expect(router.navigate).toHaveBeenCalledTimes(1)
+ expect(router.navigate).toHaveBeenCalledWith({ to: route.home })
+ expect(route.home).toBe('/')
+ expect(ids()).toEqual(['other'])
+ })
+
+ it('stops the run, its shell and its monitors before removing the session', async () => {
+ const { abortRun } = await import('@/lib/coworkRunner')
+ const { cancelAgentThreadBash, stopAgentSessionMonitors } = await import('@/lib/agentTools')
+ useCoworkRun.setState({ runId: { other: 'run-1' } } as never)
+ render(<NavHistory />)
+ deleteRow('other')
+ expect(abortRun).toHaveBeenCalledWith('other')
+ expect(cancelAgentThreadBash).toHaveBeenCalledWith('other')
+ expect(stopAgentSessionMonitors).toHaveBeenCalledWith('other')
+ expect(ids()).toEqual(['open'])
+ })
+
+ it('keeps rows keyed apart when a chat thread and a collision placeholder share an id', () => {
+ const errors = vi.spyOn(console, 'error').mockImplementation(() => {})
+ useThreads.setState({ threads: { other: { id: 'other', title: 'Chat', updated: 1, messages: [] } as never } })
+ useCoworkSessions.setState({
+ sessions: [session('open', 'Open one'), { ...session('other', 'Other one'), unavailable: 'id-collision' }],
+ })
+ render(<NavHistory />)
+ expect(screen.getByTestId('thread-other')).toBeInTheDocument()
+ expect(screen.getByTestId('history-cowork-other')).toBeInTheDocument()
+ expect(errors.mock.calls.some((c) => String(c[0]).includes('same key'))).toBe(false)
+ errors.mockRestore()
+ })
+
+ it('stays on the current route when a different conversation is deleted', () => {
+ router.sessionId = 'open'
+ render(<NavHistory />)
+ deleteRow('other')
+ expect(router.navigate).not.toHaveBeenCalled()
+ expect(ids()).toEqual(['open'])
+ })
+})
+
+describe('NavHistory rename Cowork session', () => {
+ it('renames a session through the session store', () => {
+ render(<NavHistory />)
+ const row = screen.getByTestId('history-cowork-open').closest('li') as HTMLElement
+ fireEvent.click(within(row).getByRole('menuitem', { name: 'common:rename' }))
+ const input = screen.getByRole('textbox')
+ fireEvent.change(input, { target: { value: ' Renamed one ' } })
+ fireEvent.click(within(screen.getByRole('dialog')).getByRole('button', { name: 'common:rename' }))
+ const renamed = useCoworkSessions.getState().sessions.find((s) => s.id === 'open')
+ expect(renamed?.title).toBe('Renamed one')
+ expect(useCoworkSessions.getState().sessions.find((s) => s.id === 'other')?.title).toBe('Other one')
+ })
+})
+
+describe('NavHistory threads that point at a project', () => {
+ const thread = (id: string, projectId?: string) =>
+ ({ id, title: id, updated: 1, metadata: projectId ? { project: { id: projectId, name: 'P' } } : {} }) as never
+
+ beforeEach(() => {
+ useThreads.setState({
+ threads: {
+ plain: thread('plain'),
+ homed: thread('homed', 'p1'),
+ orphan: thread('orphan', 'missing'),
+ },
+ })
+ })
+
+ it('lists a thread whose project no longer exists, and hides one whose project does', () => {
+ projects.folders = [{ id: 'p1' }]
+ render(<NavHistory />)
+ expect(screen.getByTestId('thread-plain')).toBeInTheDocument()
+ expect(screen.getByTestId('thread-orphan')).toBeInTheDocument()
+ expect(screen.queryByTestId('thread-homed')).not.toBeInTheDocument()
+ })
+
+ it('hides project threads until the project list has loaded', () => {
+ projects.foldersLoaded = false
+ render(<NavHistory />)
+ expect(screen.queryByTestId('thread-orphan')).not.toBeInTheDocument()
+ expect(screen.queryByTestId('thread-homed')).not.toBeInTheDocument()
+ expect(screen.getByTestId('thread-plain')).toBeInTheDocument()
+ })
+})
+
+describe('NavHistory rename availability', () => {
+ it.each(['missing-sidecar', 'unreadable-sidecar', 'id-collision', 'missing-thread'] as const)(
+ 'does not offer Rename for an unavailable session (%s), only Delete',
+ (unavailable) => {
+ useCoworkSessions.setState({
+ sessions: [{ ...session('open', 'Open one'), unavailable }],
+ })
+ render(<NavHistory />)
+ const row = screen.getByTestId('history-cowork-open').closest('li') as HTMLElement
+ expect(within(row).queryByRole('menuitem', { name: 'common:rename' })).toBeNull()
+ expect(within(row).getByRole('menuitem', { name: 'common:deleteSession' })).toBeInTheDocument()
+ }
+ )
+})
+
+describe('NavHistory Delete All is offered only when it would delete something', () => {
+ const t = (id: string, extra: Record<string, unknown> = {}) =>
+ ({ id, title: id, updated: 1, metadata: {}, ...extra }) as never
+ const orphan = (id: string) => t(id, { metadata: { project: { id: 'gone', name: 'P' } } })
+
+ beforeEach(() => useCoworkSessions.setState({ sessions: [] }))
+
+ it('is not offered for orphan-project threads, which Delete All keeps', () => {
+ useThreads.setState({ threads: { a: orphan('a'), b: orphan('b'), c: orphan('c') } })
+ render(<NavHistory />)
+ expect(screen.getByTestId('thread-a')).toBeInTheDocument()
+ expect(screen.queryByTestId('delete-all')).not.toBeInTheDocument()
+ })
+
+ it('is not offered for favorites only', () => {
+ useThreads.setState({ threads: { a: t('a', { isFavorite: true }), b: t('b', { isFavorite: true }) } })
+ render(<NavHistory />)
+ expect(screen.queryByTestId('delete-all')).not.toBeInTheDocument()
+ })
+
+ it('is offered once two deletable chats exist, whatever else is listed', () => {
+ useThreads.setState({ threads: { a: t('a'), b: t('b'), c: orphan('c') } })
+ render(<NavHistory />)
+ expect(screen.getByTestId('delete-all')).toBeInTheDocument()
+ })
+})
+
+describe('NavHistory one row per conversation (write-through mirror)', () => {
+ const mirror = (id: string, title: string) =>
+ ({ id, title, updated: 1, metadata: { mode: 'cowork' } }) as never
+
+ it('lists a session that is also mirrored into the thread list exactly once', () => {
+ useThreads.setState({ threads: { open: mirror('open', 'Open one'), other: mirror('other', 'Other one') } })
+ render(<NavHistory />)
+ expect(screen.getAllByTestId('history-cowork-open')).toHaveLength(1)
+ expect(screen.getAllByTestId('history-cowork-other')).toHaveLength(1)
+ expect(screen.queryByTestId('thread-open')).not.toBeInTheDocument()
+ })
+
+ it('shows the session title for a mirrored row and routes it to the Cowork view', () => {
+ useThreads.setState({ threads: { open: mirror('open', 'Stale mirror title') } })
+ useCoworkSessions.setState({ sessions: [session('open', 'Live title')] })
+ render(<NavHistory />)
+ const row = screen.getByTestId('history-cowork-open')
+ expect(row).toHaveTextContent('Live title')
+ fireEvent.click(row)
+ expect(router.navigate).toHaveBeenCalledWith({ to: route.coworkSession, params: { sessionId: 'open' } })
+ })
+
+ it('lists a mirrored Cowork thread whose session is not in the store', () => {
+ useCoworkSessions.setState({ sessions: [] })
+ useThreads.setState({ threads: { solo: mirror('solo', 'Solo') } })
+ render(<NavHistory />)
+ expect(screen.getByTestId('history-cowork-solo')).toHaveTextContent('Solo')
+ })
+
+ it('deletes a mirrored session through the session store', () => {
+ useThreads.setState({ threads: { open: mirror('open', 'Open one'), other: mirror('other', 'Other one') } })
+ render(<NavHistory />)
+ deleteRow('other')
+ expect(ids()).toEqual(['open'])
+ })
+
+ it('deletes a mirrored thread that has no live session through the thread list', () => {
+ useCoworkSessions.setState({ sessions: [] })
+ const deleteThread = vi.fn()
+ useThreads.setState({ threads: { solo: mirror('solo', 'Solo') }, deleteThread } as never)
+ render(<NavHistory />)
+ deleteRow('solo')
+ expect(deleteThread).toHaveBeenCalledWith('solo')
+ })
+
+ it('removes only the placeholder when a collision row is deleted, leaving the chat', () => {
+ const deleteThread = vi.fn()
+ useThreads.setState({ threads: { other: { id: 'other', title: 'Chat', updated: 1 } as never }, deleteThread } as never)
+ useCoworkSessions.setState({
+ sessions: [{ ...session('other', 'Placeholder'), unavailable: 'id-collision' }],
+ })
+ render(<NavHistory />)
+ deleteRow('other')
+ expect(ids()).toEqual([])
+ expect(deleteThread).not.toHaveBeenCalled()
+ })
+})
diff --git a/web-app/src/components/left-sidebar/__tests__/settingsNavigation.test.tsx b/web-app/src/components/left-sidebar/__tests__/settingsNavigation.test.tsx
deleted file mode 100644
index e04890ea4..000000000
--- a/web-app/src/components/left-sidebar/__tests__/settingsNavigation.test.tsx
+++ /dev/null
@@ -1,99 +0,0 @@
-import '@testing-library/jest-dom/vitest'
-import type { ReactNode } from 'react'
-import { beforeEach, expect, it, vi } from 'vitest'
-import { fireEvent, render, screen } from '@testing-library/react'
-
-const navigation = vi.hoisted(() => ({
- pathname: '/cowork',
- session: 'existing-session',
-}))
-vi.mock('@tanstack/react-router', () => ({
- useLocation: () => ({ pathname: navigation.pathname }),
- Link: ({
- to,
- onClick,
- children,
- ...props
- }: {
- to: string
- onClick?: () => void
- children: ReactNode
- }) => (
- <a
- {...props}
- href={to}
- onClick={(event) => {
- event.preventDefault()
- onClick?.()
- navigation.pathname = to
- }}
- >
- {children}
- </a>
- ),
-}))
-vi.mock('@/i18n/react-i18next-compat', () => ({
- useTranslation: () => ({ t: (key: string) => key }),
-}))
-vi.mock('@/hooks/useLeftPanel', () => ({
- useLeftPanel: () => ({ open: true }),
-}))
-vi.mock('@/stores/titlebar-layout-store', () => ({
- useTitlebarLayout: () => 0,
-}))
-vi.mock('@/containers/DownloadManegement', () => ({
- DownloadManagement: () => null,
-}))
-vi.mock('../NavCowork', () => ({ NavCowork: () => <div>Cowork sessions</div> }))
-vi.mock('../NavMain', () => ({ NavMain: () => <div>Chat navigation</div> }))
-vi.mock('../NavChats', () => ({ NavChats: () => <div>Chat threads</div> }))
-vi.mock('../NavProjects', () => ({ NavProjects: () => null }))
-vi.mock('@/components/ui/sidebar', () => {
- const Box = ({ children }: { children: ReactNode }) => <div>{children}</div>
- return {
- Sidebar: Box,
- SidebarContent: Box,
- SidebarHeader: Box,
- SidebarTrigger: () => null,
- SidebarRail: () => null,
- }
-})
-
-import { LeftSidebar } from '..'
-
-beforeEach(() => {
- navigation.pathname = '/cowork'
- navigation.session = 'existing-session'
-})
-
-it('keeps Cowork navigation across Settings pages and returns without starting a session', () => {
- const view = render(<LeftSidebar />)
- navigation.pathname = '/settings/general'
- view.rerender(<LeftSidebar />)
- expect(screen.getByText('Cowork sessions')).toBeInTheDocument()
- expect(screen.queryByText('Chat threads')).not.toBeInTheDocument()
- expect(screen.getByRole('link', { name: 'common:cowork' })).toHaveAttribute(
- 'aria-current',
- 'page'
- )
- navigation.pathname = '/settings/providers'
- view.rerender(<LeftSidebar />)
- fireEvent.click(screen.getByRole('link', { name: 'common:cowork' }))
- view.rerender(<LeftSidebar />)
- expect(navigation.pathname).toBe('/cowork')
- expect(navigation.session).toBe('existing-session')
-})
-
-it('keeps the current Cowork session when switching from a chat', () => {
- navigation.pathname = '/threads/chat-1'
- const view = render(<LeftSidebar />)
- navigation.pathname = '/settings/general'
- view.rerender(<LeftSidebar />)
- expect(screen.getByText('Chat threads')).toBeInTheDocument()
- expect(screen.getByRole('link', { name: 'common:home' })).toHaveAttribute(
- 'aria-current',
- 'page'
- )
- fireEvent.click(screen.getByRole('link', { name: 'common:cowork' }))
- expect(navigation.session).toBe('existing-session')
-})
diff --git a/web-app/src/components/left-sidebar/__tests__/sidebarNavigation.test.tsx b/web-app/src/components/left-sidebar/__tests__/sidebarNavigation.test.tsx
new file mode 100644
index 000000000..45b929325
--- /dev/null
+++ b/web-app/src/components/left-sidebar/__tests__/sidebarNavigation.test.tsx
@@ -0,0 +1,93 @@
+import '@testing-library/jest-dom/vitest'
+import type { ComponentProps, ReactNode } from 'react'
+import { expect, it, vi } from 'vitest'
+import { fireEvent, render, screen } from '@testing-library/react'
+
+vi.mock('@tanstack/react-router', () => ({
+ useNavigate: () => vi.fn(),
+ Link: ({ to, children }: { to: string; children: ReactNode }) => <a href={to}>{children}</a>,
+ useLocation: ({ select }: { select?: (l: { pathname: string }) => unknown } = {}) =>
+ select ? select({ pathname: '/' }) : { pathname: '/' },
+}))
+vi.mock('@/i18n/react-i18next-compat', () => ({
+ useTranslation: () => ({ t: (key: string) => key }),
+}))
+vi.mock('@/hooks/useLeftPanel', () => ({ useLeftPanel: () => ({ open: true }) }))
+vi.mock('@/stores/titlebar-layout-store', () => ({ useTitlebarLayout: () => 0 }))
+vi.mock('@/containers/DownloadManegement', () => ({ DownloadManagement: () => null }))
+vi.mock('@/containers/dialogs/SkillsManagerDialog', () => ({
+ default: ({ open, onOpenChange }: { open: boolean; onOpenChange: (open: boolean) => void }) =>
+ open ? <div role="dialog"><button onClick={() => onOpenChange(false)}>Close skills</button></div> : null,
+}))
+vi.mock('@/hooks/useThreadManagement', () => ({ useThreadManagement: () => ({ addFolder: vi.fn() }) }))
+vi.mock('@/hooks/useSearchDialog', () => ({ useSearchDialog: () => ({ open: false, setOpen: vi.fn() }) }))
+vi.mock('@/hooks/useProjectDialog', () => ({ useProjectDialog: () => ({ open: false, setOpen: vi.fn() }) }))
+vi.mock('@/containers/dialogs/AddProjectDialog', () => ({ default: () => null }))
+vi.mock('@/containers/dialogs/SearchDialog', () => ({ SearchDialog: () => null }))
+vi.mock('../NavHistory', () => ({ NavHistory: () => <div>Chats and tasks</div> }))
+vi.mock('../NavProjects', () => ({ NavProjects: () => <div>Projects</div> }))
+vi.mock('@/components/ui/sidebar', () => {
+ const Box = ({ children }: { children: ReactNode }) => <div>{children}</div>
+ return {
+ Sidebar: Box,
+ SidebarContent: Box,
+ SidebarHeader: Box,
+ SidebarMenu: ({ children }: { children: ReactNode }) => <ul>{children}</ul>,
+ SidebarMenuItem: ({ children }: { children: ReactNode }) => <li>{children}</li>,
+ SidebarMenuButton: (props: ComponentProps<'button'> & { asChild?: boolean; isActive?: boolean }) => {
+ const { asChild, isActive, ...buttonProps } = props
+ void asChild
+ void isActive
+ return <button {...buttonProps} />
+ },
+ SidebarTrigger: () => null,
+ SidebarRail: () => null,
+ useSidebar: () => ({ isMobile: false, setOpenMobile: vi.fn(), closeMobileForNavigation: vi.fn() }),
+ }
+})
+vi.mock('@/components/animated-icon/animated-lucide', () => ({
+ AnimatedLucideIcon: () => null,
+}))
+
+import { LeftSidebar } from '..'
+
+it('renders one sidebar: navigation, projects and a single history, with no tab switcher', () => {
+ render(<LeftSidebar />)
+ expect(screen.getByText('common:newChat')).toBeInTheDocument()
+ expect(screen.getByText('Projects')).toBeInTheDocument()
+ expect(screen.getByText('Chats and tasks')).toBeInTheDocument()
+ expect(screen.queryByRole('link', { name: 'common:cowork' })).not.toBeInTheDocument()
+ expect(screen.queryByRole('link', { name: 'common:home' })).not.toBeInTheDocument()
+})
+
+it('offers Artifacts and Skills on every build', () => {
+ render(<LeftSidebar />)
+ expect(screen.getByTestId('nav-artifacts')).toBeInTheDocument()
+ expect(screen.getByTestId('nav-customize')).toBeInTheDocument()
+})
+
+it('places Artifacts and Skills without replacing the rest of the navigation', () => {
+ render(<LeftSidebar />)
+ expect(screen.getByTestId('nav-artifacts')).toBeInTheDocument()
+ expect(screen.getByTestId('nav-customize')).toHaveTextContent('common:skills')
+ expect(screen.queryByText('common:customize')).not.toBeInTheDocument()
+ const artifacts = screen.getByTestId('nav-artifacts')
+ expect(screen.getByText('common:search').compareDocumentPosition(artifacts) & Node.DOCUMENT_POSITION_FOLLOWING).toBeTruthy()
+ expect(artifacts.compareDocumentPosition(screen.getByText('common:hub')) & Node.DOCUMENT_POSITION_FOLLOWING).toBeTruthy()
+ expect(screen.getByText('common:newChat')).toBeInTheDocument()
+ expect(screen.getByText('Chats and tasks')).toBeInTheDocument()
+})
+
+it('inserts Skills directly before Settings as a menu row and opens its dialog', () => {
+ render(<LeftSidebar />)
+ const skills = screen.getByRole('button', { name: 'common:skills' })
+ const row = skills.closest('li')!
+ expect(row.nextElementSibling).toHaveTextContent('common:settings')
+ expect(row.parentElement?.tagName).toBe('UL')
+ expect(document.querySelector('ul ul')).not.toBeInTheDocument()
+ expect(screen.queryByRole('dialog')).not.toBeInTheDocument()
+ fireEvent.click(skills)
+ expect(screen.getByRole('dialog')).toBeInTheDocument()
+ fireEvent.click(screen.getByText('Close skills'))
+ expect(screen.queryByRole('dialog')).not.toBeInTheDocument()
+})
diff --git a/web-app/src/components/left-sidebar/__tests__/tabRestoration.test.tsx b/web-app/src/components/left-sidebar/__tests__/tabRestoration.test.tsx
deleted file mode 100644
index 64ed40320..000000000
--- a/web-app/src/components/left-sidebar/__tests__/tabRestoration.test.tsx
+++ /dev/null
@@ -1,158 +0,0 @@
-import '@testing-library/jest-dom/vitest'
-import type { ReactNode } from 'react'
-import { beforeEach, expect, it, vi } from 'vitest'
-import { fireEvent, render, screen } from '@testing-library/react'
-
-const navigation = vi.hoisted(() => ({
- pathname: '/threads/chat-a',
- threads: {} as Record<string, { id: string }>,
- running: {} as Record<string, string>,
-}))
-vi.mock('@tanstack/react-router', () => ({
- useLocation: () => ({ pathname: navigation.pathname }),
- Link: ({
- to,
- onClick,
- children,
- ...props
- }: {
- to: string
- onClick?: () => void
- children: ReactNode
- }) => (
- <a
- {...props}
- href={to}
- onClick={(event) => {
- event.preventDefault()
- onClick?.()
- navigation.pathname = to
- }}
- >
- {children}
- </a>
- ),
-}))
-vi.mock('@/i18n/react-i18next-compat', () => ({
- useTranslation: () => ({ t: (key: string) => key }),
-}))
-vi.mock('@/hooks/useThreads', () => ({
- useThreads: (
- selector: (state: { threads: typeof navigation.threads }) => unknown
- ) => selector({ threads: navigation.threads }),
-}))
-vi.mock('@/hooks/useCoworkRun', () => ({
- useCoworkRun: { getState: () => ({ runId: navigation.running }) },
-}))
-vi.mock('@/lib/backendStorage', () => ({
- backendStorage: {
- getItem: vi.fn().mockResolvedValue(null),
- setItem: vi.fn().mockResolvedValue(undefined),
- removeItem: vi.fn().mockResolvedValue(undefined),
- },
-}))
-
-import { NavTabs } from '../NavTabs'
-import { startNewSession, useCoworkSessions } from '../../../hooks/useCoworkSessions'
-
-beforeEach(() => {
- navigation.pathname = '/threads/chat-a'
- navigation.threads = { 'chat-a': { id: 'chat-a' } }
- navigation.running = {}
- useCoworkSessions.setState({ sessions: [], currentId: null })
-})
-
-function tabs() {
- const view = render(<NavTabs surfacePath={navigation.pathname} />)
- const refresh = () =>
- view.rerender(<NavTabs surfacePath={navigation.pathname} />)
- return {
- visit: (pathname: string) => {
- navigation.pathname = pathname
- refresh()
- },
- click: (tab: 'home' | 'cowork') => {
- fireEvent.click(screen.getByRole('link', { name: `common:${tab}` }))
- refresh()
- },
- }
-}
-
-it('returns to the previously viewed chat and Cowork conversation in both directions', () => {
- const store = useCoworkSessions.getState()
- const session = store.createSession()
- store.commitTurns(
- session,
- [{ role: 'user', content: 'Remember this conversation' }],
- [],
- []
- )
- const view = tabs()
- view.click('cowork')
- expect(useCoworkSessions.getState().currentId).toBe(session)
- view.click('home')
- expect(navigation.pathname).toBe('/threads/chat-a')
- view.click('cowork')
- expect(useCoworkSessions.getState().currentId).toBe(session)
- expect(useCoworkSessions.getState().sessions).toHaveLength(1)
-})
-
-it('restores chat independently of Cowork selection', () => {
- const view = tabs()
- view.click('cowork')
- view.click('home')
- expect(navigation.pathname).toBe('/threads/chat-a')
-})
-
-it('keeps an explicitly opened blank chat instead of restoring an older thread', () => {
- const view = tabs()
- view.visit('/')
- view.click('cowork')
- view.click('home')
- expect(navigation.pathname).toBe('/')
-})
-
-it('falls back to a blank chat if the remembered thread was deleted', () => {
- const view = tabs()
- view.click('cowork')
- navigation.threads = {}
- view.visit('/cowork')
- view.click('home')
- expect(navigation.pathname).toBe('/')
-})
-
-it('opens blank chat when Cowork was the first surface visited', () => {
- navigation.pathname = '/cowork'
- const view = tabs()
- view.click('home')
- expect(navigation.pathname).toBe('/')
-})
-
-it('keeps the first streaming Cowork session when switching or clicking the active tab', () => {
- const session = useCoworkSessions.getState().createSession()
- navigation.running = { [session]: 'active-run' }
- const view = tabs()
- view.click('cowork')
- expect(useCoworkSessions.getState().currentId).toBe(session)
- view.click('cowork')
- expect(useCoworkSessions.getState().currentId).toBe(session)
-})
-
-it('retains an explicit new Cowork session and the existing deletion fallback', () => {
- const store = useCoworkSessions.getState()
- const previous = store.createSession()
- store.commitTurns(
- previous,
- [{ role: 'user', content: 'Existing conversation' }],
- [],
- []
- )
- const fresh = startNewSession([])
- const view = tabs()
- view.click('cowork')
- expect(useCoworkSessions.getState().currentId).toBe(fresh)
- view.click('home')
- store.deleteSession(fresh)
- view.click('cowork')
- expect(useCoworkSessions.getState().currentId).toBe(previous)
-})
diff --git a/web-app/src/components/left-sidebar/index.tsx b/web-app/src/components/left-sidebar/index.tsx
index 3b0018793..b1bd703a3 100644
--- a/web-app/src/components/left-sidebar/index.tsx
+++ b/web-app/src/components/left-sidebar/index.tsx
@@ -1,11 +1,9 @@
-import { useState } from 'react'
import { DownloadManagement } from '@/containers/DownloadManegement'
import { StatusItems } from '@/containers/extensions/StatusItems'
-import { NavChats } from './NavChats'
-import { NavCowork } from './NavCowork'
+import { NavCoworkTools } from './NavCoworkTools'
+import { NavHistory } from './NavHistory'
import { NavMain } from './NavMain'
import { NavProjects } from './NavProjects'
-import { NavTabs } from './NavTabs'
import { useLeftPanel } from '@/hooks/useLeftPanel'
import {
@@ -17,18 +15,9 @@ import {
} from '@/components/ui/sidebar'
import { cn } from '@/lib/utils'
import { useTitlebarLayout } from '@/stores/titlebar-layout-store'
-import { useLocation } from '@tanstack/react-router'
-import { isCoworkRoute, route } from '@/constants/routes'
export function LeftSidebar() {
const { open: isLeftPanelOpen } = useLeftPanel()
- const { pathname } = useLocation()
- const inSettings =
- pathname === route.settings.index || pathname.startsWith('/settings/')
- const [lastSurfacePath, setLastSurfacePath] = useState(pathname)
- if (!inSettings && lastSurfacePath !== pathname) setLastSurfacePath(pathname)
- const surfacePath = inSettings ? lastSurfacePath : pathname
- const isCowork = isCoworkRoute(surfacePath)
// Right-align the header and hide "Jan" when native controls own the top-left
// (macOS, or a Linux DE placing buttons left).
const leftButtons = useTitlebarLayout((s) => s.layout.left.length)
@@ -44,16 +33,14 @@ export function LeftSidebar() {
<SidebarTrigger className="text-muted-foreground rounded-full hover:bg-sidebar-foreground/8! -mt-0.5 relative z-50 ml-0.5" />
</div>
</div>
- <NavTabs surfacePath={surfacePath} />
- {isCowork ? <NavCowork /> : <NavMain />}
+ <NavMain
+ afterSearch={<NavCoworkTools section="artifacts" />}
+ beforeSettings={<NavCoworkTools />}
+ />
</SidebarHeader>
<SidebarContent className="mask-b-from-95% mask-t-from-98%">
- {!isCowork && (
- <>
- <NavProjects />
- <NavChats />
- </>
- )}
+ <NavProjects />
+ <NavHistory />
</SidebarContent>
<StatusItems />
<SidebarRail />
diff --git a/web-app/src/containers/SettingsMenu.tsx b/web-app/src/containers/SettingsMenu.tsx
index 9adad6210..30f86cc2b 100644
--- a/web-app/src/containers/SettingsMenu.tsx
+++ b/web-app/src/containers/SettingsMenu.tsx
@@ -201,7 +201,7 @@ const SettingsMenu = () => {
icon: IconWorldSearch,
},
{
- title: 'common:cowork',
+ title: 'common:agentSettings',
route: route.settings.cowork,
icon: IconFolderCode,
},
diff --git a/web-app/src/containers/ThreadList.tsx b/web-app/src/containers/ThreadList.tsx
index 255b07e05..af9d0a335 100644
--- a/web-app/src/containers/ThreadList.tsx
+++ b/web-app/src/containers/ThreadList.tsx
@@ -1,5 +1,9 @@
import { Folder, Loader2, MoreHorizontal, Pencil, Trash2, X } from 'lucide-react'
import { useThreads } from '@/hooks/useThreads'
+import { useCoworkSessions } from '@/hooks/useCoworkSessions'
+import { hasCoworkSession } from '@/lib/coworkDelete'
+import { isCoworkThread } from '@/lib/threadMode'
+import { updateThreadProject } from '@/lib/threadProject'
import { useIsThreadActive } from '@/hooks/useAppState'
import { useChatSessions } from '@/stores/chat-session-store'
import { useMessages } from '@/hooks/useMessages'
@@ -26,13 +30,30 @@ import {
import { useTranslation } from '@/i18n/react-i18next-compat'
import { memo, useMemo, useState } from 'react'
import { Link, useParams } from '@tanstack/react-router'
+import type { ComponentProps } from 'react'
import { RenameThreadDialog, DeleteThreadDialog } from '@/containers/dialogs'
import { toast } from 'sonner'
import { cn } from '@/lib/utils'
import { ThreadMessage } from '@janhq/core'
import { ContributedMenuItems } from '@/containers/extensions/ContributedMenuItems'
-const ThreadItem = memo(
+/**
+ * A conversation opens in the view that can run it: a Cowork thread in the
+ * Cowork view, anything else as a chat. Both routes put the id in the URL, so
+ * the row is selected from either param.
+ */
+function ThreadLink({
+ thread,
+ ...props
+}: { thread: Thread } & Omit<ComponentProps<'a'>, 'href'>) {
+ return isCoworkThread(thread) ? (
+ <Link to="/cowork/$sessionId" params={{ sessionId: thread.id }} {...props} />
+ ) : (
+ <Link to="/threads/$threadId" params={{ threadId: thread.id }} {...props} />
+ )
+}
+
+export const ThreadItem = memo(
({
thread,
isMobile,
@@ -44,7 +65,6 @@ const ThreadItem = memo(
}) => {
const deleteThread = useThreads((state) => state.deleteThread)
const renameThread = useThreads((state) => state.renameThread)
- const updateThread = useThreads((state) => state.updateThread)
const getFolderById = useThreadManagement().getFolderById
const { folders } = useThreadManagement()
const { t } = useTranslation()
@@ -122,18 +142,12 @@ const ThreadItem = memo(
const assignThreadToProject = (threadId: string, projectId: string) => {
const project = getFolderById(projectId)
- if (project && updateThread) {
- const projectMetadata = {
+ if (project) {
+ // Cowork persists from its session, so the move goes through it.
+ updateThreadProject(threadId, {
id: project.id,
name: project.name,
updated_at: project.updated_at,
- }
-
- updateThread(threadId, {
- metadata: {
- ...thread.metadata,
- project: projectMetadata,
- },
})
toast.success(`Thread assigned to "${project.name}" successfully`)
@@ -148,14 +162,24 @@ const ThreadItem = memo(
const currentThreadId = useParams({
strict: false,
- select: (params) => params.threadId,
+ select: (params) =>
+ (params as { threadId?: string; sessionId?: string }).threadId ??
+ (params as { sessionId?: string }).sessionId,
})
const isSelected = currentThreadId === thread.id
+ const onRename = (threadId: string, title: string) => {
+ // A live Cowork session owns its title; the mirrored thread follows it.
+ if (isCoworkThread(thread) && hasCoworkSession(threadId)) {
+ useCoworkSessions.getState().setTitle(threadId, title)
+ } else {
+ renameThread(threadId, title)
+ }
+ }
return (
<SidebarMenuItem>
{currentProjectId ?
- <Link to="/threads/$threadId" params={{ threadId: thread.id }} data-testid={`thread-row-${thread.id}`} className={cn("bg-card dark:bg-secondary/20 mb-2 px-4 py-4 border hover:dark:bg-secondary/30 rounded-lg block max-w-full overflow-hidden", isSelected && "border-primary")}>
+ <ThreadLink thread={thread} data-testid={`thread-row-${thread.id}`} className={cn("bg-card dark:bg-secondary/20 mb-2 px-4 py-4 border hover:dark:bg-secondary/30 rounded-lg block max-w-full overflow-hidden", isSelected && "border-primary")}>
<div className="flex items-center gap-1.5 min-w-0">
{isActive && (
<Loader2 className="size-3 shrink-0 animate-spin text-muted-foreground" />
@@ -167,15 +191,15 @@ const ThreadItem = memo(
{lastUserMessageText}
</div>
)}
- </Link>
+ </ThreadLink>
:
- <SidebarMenuButton asChild isActive={isSelected}>
- <Link to="/threads/$threadId" params={{ threadId: thread.id }} data-testid={`thread-row-${thread.id}`}>
+ <SidebarMenuButton asChild isActive={isSelected} className="data-[active=true]:bg-sidebar-foreground/10 dark:data-[active=true]:bg-sidebar-accent">
+ <ThreadLink thread={thread} data-testid={`thread-row-${thread.id}`}>
{isActive && (
<Loader2 className="size-3 shrink-0 animate-spin text-muted-foreground" />
)}
<span className={cn("block truncate", isSelected && "font-medium")} title={thread.title || t('common:newThread')}>{thread.title || t('common:newThread')}</span>
- </Link>
+ </ThreadLink>
</SidebarMenuButton>
}
<DropdownMenu>
@@ -186,7 +210,7 @@ const ThreadItem = memo(
className={cn("hover:bg-sidebar-foreground/8", currentProjectId && 'mt-4 mr-2')}
>
<MoreHorizontal />
- <span className="sr-only">More</span>
+ <span className="sr-only">{t('common:sidebar.more')}</span>
</SidebarMenuAction>
</DropdownMenuTrigger>
<DropdownMenuContent
@@ -235,12 +259,7 @@ const ThreadItem = memo(
onClick={(e) => {
e.stopPropagation()
const projectName = thread.metadata?.project?.name
- updateThread(thread.id, {
- metadata: {
- ...thread.metadata,
- project: undefined,
- },
- })
+ updateThreadProject(thread.id, undefined)
toast.success(
`Thread removed from "${projectName}" successfully`
)
@@ -276,7 +295,7 @@ const ThreadItem = memo(
<RenameThreadDialog
thread={thread}
plainTitleForRename={plainTitleForRename}
- onRename={renameThread}
+ onRename={onRename}
open={renameOpen}
onOpenChange={setRenameOpen}
withoutTrigger
diff --git a/web-app/src/containers/__tests__/SettingsMenu.test.tsx b/web-app/src/containers/__tests__/SettingsMenu.test.tsx
index 184d327f7..5a418e72e 100644
--- a/web-app/src/containers/__tests__/SettingsMenu.test.tsx
+++ b/web-app/src/containers/__tests__/SettingsMenu.test.tsx
@@ -111,9 +111,10 @@ describe('SettingsMenu', () => {
expect(screen.getByText('common:privacy')).toBeInTheDocument()
})
- it('lists the Cowork settings entry on every channel', () => {
+ it('lists the Agent settings entry on every channel', () => {
render(<SettingsMenu />)
- expect(screen.getByText('common:cowork')).toBeInTheDocument()
+ expect(screen.getByText('common:agentSettings')).toBeInTheDocument()
+ expect(screen.queryByText('common:cowork')).not.toBeInTheDocument()
})
it('links to the Extensions settings page', () => {
diff --git a/web-app/src/containers/__tests__/ThreadList.test.tsx b/web-app/src/containers/__tests__/ThreadList.test.tsx
index f8ebd1496..6a01fac16 100644
--- a/web-app/src/containers/__tests__/ThreadList.test.tsx
+++ b/web-app/src/containers/__tests__/ThreadList.test.tsx
@@ -4,8 +4,13 @@ import '@testing-library/jest-dom'
import ThreadList from '../ThreadList'
vi.mock('@tanstack/react-router', () => ({
- Link: ({ children, className, title }: any) => (
- <a className={className} title={title}>
+ Link: ({ children, className, title, to, params }: any) => (
+ <a
+ className={className}
+ title={title}
+ data-to={to}
+ data-param={params ? Object.values(params)[0] : undefined}
+ >
{children}
</a>
),
@@ -96,6 +101,25 @@ describe('ThreadList — long-URL overflow guard (#7959)', () => {
expect(titleEl).toHaveAttribute('title', longUrl)
})
+ it('opens a chat thread on /threads and a Cowork thread on /cowork', async () => {
+ render(
+ <ThreadList
+ threads={[
+ makeThread({ id: 'chat-1', title: 'A chat' }),
+ makeThread({ id: 'cw-1', title: 'A task', metadata: { mode: 'cowork' } }),
+ ]}
+ />
+ )
+ await flushEffects()
+
+ const chat = screen.getByText('A chat').closest('a')
+ const task = screen.getByText('A task').closest('a')
+ expect(chat).toHaveAttribute('data-to', '/threads/$threadId')
+ expect(chat).toHaveAttribute('data-param', 'chat-1')
+ expect(task).toHaveAttribute('data-to', '/cowork/$sessionId')
+ expect(task).toHaveAttribute('data-param', 'cw-1')
+ })
+
it('applies overflow guard on the project-view thread link wrapper', async () => {
render(
<ThreadList
diff --git a/web-app/src/containers/dialogs/DeleteAllThreadsDialog.tsx b/web-app/src/containers/dialogs/DeleteAllThreadsDialog.tsx
index 55ff4ad7f..41d271307 100644
--- a/web-app/src/containers/dialogs/DeleteAllThreadsDialog.tsx
+++ b/web-app/src/containers/dialogs/DeleteAllThreadsDialog.tsx
@@ -42,9 +42,9 @@ export function DeleteAllThreadsDialog({
onDeleteAll()
setIsOpen(false)
if (onDropdownClose) onDropdownClose()
- toast.success(t('common:toast.deleteAllThreads.title'), {
+ toast.success(t('common:toast.deleteAllChats.title'), {
id: 'delete-all-threads',
- description: t('common:toast.deleteAllThreads.description'),
+ description: t('common:toast.deleteAllChats.description'),
})
setTimeout(() => {
navigate({ to: route.home })
@@ -73,10 +73,10 @@ export function DeleteAllThreadsDialog({
>
<DialogHeader>
<DialogTitle>
- {t('common:dialogs.deleteAllThreads.title')}
+ {t('common:dialogs.deleteAllChats.title')}
</DialogTitle>
<DialogDescription>
- {t('common:dialogs.deleteAllThreads.description')}
+ {t('common:dialogs.deleteAllChats.description')}
</DialogDescription>
<DialogFooter className="flex flex-col-reverse sm:flex-row sm:justify-end gap-2">
<DialogClose asChild>
diff --git a/web-app/src/containers/dialogs/DeleteAllThreadsInProjectDialog.tsx b/web-app/src/containers/dialogs/DeleteAllThreadsInProjectDialog.tsx
index f51e26c9f..c194673e1 100644
--- a/web-app/src/containers/dialogs/DeleteAllThreadsInProjectDialog.tsx
+++ b/web-app/src/containers/dialogs/DeleteAllThreadsInProjectDialog.tsx
@@ -18,7 +18,7 @@ import { toast } from 'sonner'
interface DeleteAllThreadsInProjectDialogProps {
projectName: string
threadCount: number
- onDeleteAll: () => void
+ onDeleteAll: () => void | Promise<void>
onDropdownClose?: () => void
}
@@ -30,6 +30,7 @@ export function DeleteAllThreadsInProjectDialog({
}: DeleteAllThreadsInProjectDialogProps) {
const { t } = useTranslation()
const [isOpen, setIsOpen] = useState(false)
+ const [deleting, setDeleting] = useState(false)
const deleteButtonRef = useRef<HTMLButtonElement>(null)
const handleOpenChange = (open: boolean) => {
@@ -39,19 +40,22 @@ export function DeleteAllThreadsInProjectDialog({
}
}
- const handleDeleteAll = () => {
- onDeleteAll()
- setIsOpen(false)
- if (onDropdownClose) onDropdownClose()
- toast.success(t('common:toast.deleteAllThreads.title'), {
- id: 'delete-all-threads-in-project',
- description: t('common:toast.deleteAllThreads.description'),
- })
- }
-
- const handleKeyDown = (e: React.KeyboardEvent) => {
- if (e.key === 'Enter') {
- handleDeleteAll()
+ const handleDeleteAll = async () => {
+ if (deleting) return
+ setDeleting(true)
+ try {
+ await onDeleteAll()
+ setIsOpen(false)
+ onDropdownClose?.()
+ toast.success(t('common:toast.deleteAllThreads.title'), {
+ id: 'delete-all-threads-in-project',
+ description: t('common:toast.deleteAllThreads.description'),
+ })
+ } catch (error) {
+ console.warn('Could not delete project conversations:', error)
+ toast.error(t('common:error'))
+ } finally {
+ setDeleting(false)
}
}
@@ -86,7 +90,7 @@ export function DeleteAllThreadsInProjectDialog({
ref={deleteButtonRef}
variant="destructive"
onClick={handleDeleteAll}
- onKeyDown={handleKeyDown}
+ disabled={deleting}
size="sm"
className="w-full sm:w-auto"
aria-label={t('common:deleteAll')}
diff --git a/web-app/src/containers/dialogs/DeleteProjectDialog.tsx b/web-app/src/containers/dialogs/DeleteProjectDialog.tsx
index 8bee31d14..2745cb443 100644
--- a/web-app/src/containers/dialogs/DeleteProjectDialog.tsx
+++ b/web-app/src/containers/dialogs/DeleteProjectDialog.tsx
@@ -1,4 +1,4 @@
-import { useRef, useMemo } from 'react'
+import { useRef } from 'react'
import {
Dialog,
DialogContent,
@@ -9,8 +9,9 @@ import {
} from '@/components/ui/dialog'
import { Button } from '@/components/ui/button'
import { toast } from 'sonner'
+import { useNavigate, useRouter } from '@tanstack/react-router'
+import { route } from '@/constants/routes'
import { useTranslation } from '@/i18n/react-i18next-compat'
-import { useThreads } from '@/hooks/useThreads'
import { useThreadManagement } from '@/hooks/useThreadManagement'
interface DeleteProjectDialogProps {
@@ -28,16 +29,9 @@ export function DeleteProjectDialog({
}: DeleteProjectDialogProps) {
const { t } = useTranslation()
const deleteButtonRef = useRef<HTMLButtonElement>(null)
- const threads = useThreads((state) => state.threads)
const { deleteFolderWithThreads } = useThreadManagement()
-
- const threadCount = useMemo(() => {
- if (!projectId) return 0
-
- return Object.values(threads).filter(
- (thread) => thread.metadata?.project?.id === projectId
- ).length
- }, [projectId, threads])
+ const navigate = useNavigate()
+ const router = useRouter()
const handleConfirm = async () => {
if (!projectId) return
@@ -50,6 +44,14 @@ export function DeleteProjectDialog({
: t('projects.deleteProjectDialog.successWithoutName')
)
onOpenChange(false)
+ // Deleting the project on screen must leave its route, or the page is
+ // left on "Project Not Found". Read the location now, not when the
+ // dialog opened: the user may have navigated while the delete ran, and
+ // deleting from the sidebar while elsewhere must stay where they are.
+ const { pathname } = router.state.location
+ if (pathname.replace(/\/+$/, '') === `/project/${projectId}`) {
+ navigate({ to: route.home })
+ }
} catch (error) {
toast.error(t('projects.deleteProjectDialog.error'))
console.error('Delete project error:', error)
@@ -62,8 +64,6 @@ export function DeleteProjectDialog({
}
}
- const hasThreads = threadCount > 0
-
return (
<Dialog open={open} onOpenChange={onOpenChange}>
<DialogContent
@@ -75,11 +75,9 @@ export function DeleteProjectDialog({
<DialogHeader>
<DialogTitle>{t('projects.deleteProjectDialog.title')}</DialogTitle>
<DialogDescription>
- {hasThreads
- ? t('projects.deleteProjectDialog.permanentDelete')
- : t('projects.deleteProjectDialog.deleteEmptyProject', {
- projectName,
- })}
+ {t('projects.deleteProjectDialog.permanentDelete', {
+ projectName: projectName ?? '',
+ })}
</DialogDescription>
</DialogHeader>
<DialogFooter>
diff --git a/web-app/src/containers/dialogs/SearchDialog.tsx b/web-app/src/containers/dialogs/SearchDialog.tsx
index ce0a21ec6..63f18813d 100644
--- a/web-app/src/containers/dialogs/SearchDialog.tsx
+++ b/web-app/src/containers/dialogs/SearchDialog.tsx
@@ -120,6 +120,8 @@ export function SearchDialog({ open, onOpenChange }: SearchDialogProps) {
const searchResults = useMemo(() => {
if (!searchQuery) return { withProject: [], withoutProject: [] }
+ // Chat and Cowork conversations are searched together; a Cowork hit opens
+ // its own view through the /threads/$threadId redirect.
const filteredThreads = getFilteredThreads(searchQuery)
const withProject: Array<{
thread: Thread
diff --git a/web-app/src/containers/dialogs/__tests__/DeleteAllThreadsDialog.test.tsx b/web-app/src/containers/dialogs/__tests__/DeleteAllThreadsDialog.test.tsx
new file mode 100644
index 000000000..fe9fd3966
--- /dev/null
+++ b/web-app/src/containers/dialogs/__tests__/DeleteAllThreadsDialog.test.tsx
@@ -0,0 +1,42 @@
+import '@testing-library/jest-dom/vitest'
+import { describe, expect, it, vi } from 'vitest'
+import { fireEvent, render, screen, within } from '@testing-library/react'
+import en from '@/locales/en/common.json'
+
+const h = vi.hoisted(() => ({ toastSuccess: vi.fn() }))
+
+vi.mock('@tanstack/react-router', () => ({ useNavigate: () => vi.fn() }))
+vi.mock('sonner', () => ({ toast: { success: h.toastSuccess, error: vi.fn() } }))
+vi.mock('@/components/ui/dropdown-menu', () => ({
+ DropdownMenuItem: ({ children, onSelect, ...props }: { children: React.ReactNode; onSelect?: unknown }) => {
+ void onSelect
+ return <button {...props}>{children}</button>
+ },
+}))
+// Resolve keys against the real English bundle, so the copy itself is under test.
+const t = (key: string) =>
+ key
+ .replace(/^common:/, '')
+ .split('.')
+ .reduce<unknown>((node, part) => (node as Record<string, unknown> | undefined)?.[part], en) as string
+vi.mock('@/i18n/react-i18next-compat', () => ({ useTranslation: () => ({ t }) }))
+
+import { DeleteAllThreadsDialog } from '../DeleteAllThreadsDialog'
+
+describe('DeleteAllThreadsDialog copy', () => {
+ it('says conversations outside projects are deleted and project conversations and tasks are kept', () => {
+ const onDeleteAll = vi.fn()
+ render(<DeleteAllThreadsDialog onDeleteAll={onDeleteAll} />)
+ fireEvent.click(screen.getByText('Delete All'))
+ const dialog = screen.getByRole('dialog')
+ expect(dialog).toHaveTextContent(/outside projects/i)
+ expect(dialog).toHaveTextContent(/project conversations.*tasks are kept/i)
+ expect(dialog).not.toHaveTextContent(/all threads will be deleted/i)
+
+ fireEvent.click(within(dialog).getByRole('button', { name: 'Delete All' }))
+ expect(onDeleteAll).toHaveBeenCalled()
+ const [title, options] = h.toastSuccess.mock.calls[0]
+ expect(title).toBe('Conversations deleted')
+ expect(options.description).toMatch(/outside projects.*kept/i)
+ })
+})
diff --git a/web-app/src/containers/dialogs/__tests__/DeleteProjectDialog.test.tsx b/web-app/src/containers/dialogs/__tests__/DeleteProjectDialog.test.tsx
new file mode 100644
index 000000000..6e9bd9423
--- /dev/null
+++ b/web-app/src/containers/dialogs/__tests__/DeleteProjectDialog.test.tsx
@@ -0,0 +1,123 @@
+import '@testing-library/jest-dom/vitest'
+import { beforeEach, describe, expect, it, vi } from 'vitest'
+import { fireEvent, render, screen, waitFor } from '@testing-library/react'
+import en from '@/locales/en/common.json'
+
+const h = vi.hoisted(() => ({
+ navigate: vi.fn(),
+ pathname: '/',
+ deleteFolderWithThreads: vi.fn(),
+}))
+
+vi.mock('@tanstack/react-router', () => ({
+ useNavigate: () => h.navigate,
+ useRouter: () => ({ state: { get location() { return { pathname: h.pathname } } } }),
+}))
+// Resolve against the real English bundle (with count plurals) so the copy is under test.
+const t = (key: string, opts: { projectName?: string } = {}) => {
+ const dialog = en.projects.deleteProjectDialog as Record<string, string>
+ const raw = dialog[key.replace('projects.deleteProjectDialog.', '')] ?? key
+ return raw.replace(/\{\{(\w+)\}\}/g, (_, k) => String((opts as Record<string, unknown>)[k] ?? ''))
+}
+vi.mock('@/i18n/react-i18next-compat', () => ({ useTranslation: () => ({ t }) }))
+vi.mock('sonner', () => ({ toast: { success: vi.fn(), error: vi.fn() } }))
+vi.mock('@/hooks/useThreadManagement', () => ({
+ useThreadManagement: () => ({ deleteFolderWithThreads: h.deleteFolderWithThreads }),
+}))
+
+import { DeleteProjectDialog } from '../DeleteProjectDialog'
+
+const confirm = async (projectId = 'p1') => {
+ const onOpenChange = vi.fn()
+ render(
+ <DeleteProjectDialog
+ open
+ onOpenChange={onOpenChange}
+ projectId={projectId}
+ projectName="Alpha"
+ />
+ )
+ fireEvent.click(screen.getByRole('button', { name: 'Delete Alpha' }))
+ await waitFor(() => expect(onOpenChange).toHaveBeenCalledWith(false))
+}
+
+beforeEach(() => {
+ h.navigate.mockClear()
+ h.deleteFolderWithThreads.mockReset().mockResolvedValue(undefined)
+ h.pathname = '/'
+})
+
+describe('DeleteProjectDialog navigation', () => {
+ it('leaves the project page when the viewed project is deleted', async () => {
+ h.pathname = '/project/p1'
+ await confirm('p1')
+ expect(h.deleteFolderWithThreads).toHaveBeenCalledWith('p1')
+ expect(h.navigate).toHaveBeenCalledTimes(1)
+ expect(h.navigate).toHaveBeenCalledWith({ to: '/' })
+ })
+
+ it('stays put when a project is deleted from the sidebar on another page', async () => {
+ h.pathname = '/threads/t1'
+ await confirm('p1')
+ expect(h.navigate).not.toHaveBeenCalled()
+ })
+
+ it('stays put when another project page is open', async () => {
+ h.pathname = '/project/p2'
+ await confirm('p1')
+ expect(h.navigate).not.toHaveBeenCalled()
+ })
+
+ it('does not navigate when the delete fails', async () => {
+ h.pathname = '/project/p1'
+ h.deleteFolderWithThreads.mockRejectedValue(new Error('boom'))
+ const onOpenChange = vi.fn()
+ render(<DeleteProjectDialog open onOpenChange={onOpenChange} projectId="p1" projectName="Alpha" />)
+ fireEvent.click(screen.getByRole('button', { name: 'Delete Alpha' }))
+ await waitFor(() => expect(h.deleteFolderWithThreads).toHaveBeenCalled())
+ await Promise.resolve()
+ expect(h.navigate).not.toHaveBeenCalled()
+ })
+})
+
+describe('DeleteProjectDialog route read after the delete', () => {
+ const deferred = () => {
+ let resolve!: () => void
+ const promise = new Promise<void>((r) => (resolve = r))
+ return { promise, resolve }
+ }
+
+ it('does not navigate Home when the user left the deleted project while it ran', async () => {
+ h.pathname = '/project/p1'
+ const d = deferred()
+ h.deleteFolderWithThreads.mockReturnValue(d.promise)
+ const onOpenChange = vi.fn()
+ render(<DeleteProjectDialog open onOpenChange={onOpenChange} projectId="p1" projectName="Alpha" />)
+ fireEvent.click(screen.getByRole('button', { name: 'Delete Alpha' }))
+ h.pathname = '/settings/general'
+ d.resolve()
+ await waitFor(() => expect(onOpenChange).toHaveBeenCalledWith(false))
+ expect(h.navigate).not.toHaveBeenCalled()
+ })
+
+ it('navigates Home when the user opened the deleted project while it ran', async () => {
+ h.pathname = '/threads/t1'
+ const d = deferred()
+ h.deleteFolderWithThreads.mockReturnValue(d.promise)
+ const onOpenChange = vi.fn()
+ render(<DeleteProjectDialog open onOpenChange={onOpenChange} projectId="p1" projectName="Alpha" />)
+ fireEvent.click(screen.getByRole('button', { name: 'Delete Alpha' }))
+ h.pathname = '/project/p1'
+ d.resolve()
+ await waitFor(() => expect(h.navigate).toHaveBeenCalledWith({ to: '/' }))
+ })
+})
+
+describe('DeleteProjectDialog copy', () => {
+ it('names the project and no conversation count', () => {
+ render(<DeleteProjectDialog open onOpenChange={vi.fn()} projectId="p1" projectName="Alpha" />)
+ const text = screen.getByRole('dialog').textContent ?? ''
+ expect(text).toContain('permanently delete "Alpha" and all of its conversations')
+ expect(text).not.toMatch(/\d+ conversation/)
+ })
+})
diff --git a/web-app/src/hooks/__tests__/useThreadManagement.test.ts b/web-app/src/hooks/__tests__/useThreadManagement.test.ts
index b15fa6123..5d14de3ec 100644
--- a/web-app/src/hooks/__tests__/useThreadManagement.test.ts
+++ b/web-app/src/hooks/__tests__/useThreadManagement.test.ts
@@ -41,7 +41,13 @@ vi.mock('@/hooks/useThreads', () => ({
},
}))
+const mockDeleteCowork = vi.fn()
+const mockFlushCoworkDeletes = vi.fn()
+vi.mock('@/lib/coworkDelete', () => ({ deleteCoworkConversation: (id: string) => mockDeleteCowork(id) }))
+vi.mock('@/lib/coworkSync', () => ({ flushCoworkDeletes: () => mockFlushCoworkDeletes() }))
+
import { useThreadManagement } from '../useThreadManagement'
+import { useCoworkSessions } from '../useCoworkSessions'
// We need to get the underlying store for direct testing
// The hook wraps a zustand store with useEffect, so we test both
@@ -147,6 +153,49 @@ describe('useThreadManagement', () => {
expect(mockDeleteProject).toHaveBeenCalledWith('p1')
})
+ describe('Cowork conversations in a project', () => {
+ const project = { id: 'p1', name: 'P', updated_at: 1 }
+ const live = (id: string, extra = {}) =>
+ ({ id, title: id, folder: null, turns: [], messages: [], updated: 1, project, ...extra }) as never
+
+ beforeEach(() => {
+ mockDeleteProject.mockResolvedValue(undefined)
+ mockDeleteThread.mockResolvedValue(undefined)
+ mockFlushCoworkDeletes.mockResolvedValue(undefined)
+ useCoworkSessions.setState({ sessions: [] })
+ })
+
+ it('deletes a not-yet-mirrored session through the session store before the project', async () => {
+ useCoworkSessions.setState({ sessions: [live('c1')] })
+ const { result } = renderHook(() => useThreadManagement())
+ await act(async () => {
+ await result.current.deleteFolderWithThreads('p1')
+ })
+ expect(mockDeleteCowork).toHaveBeenCalledWith('c1')
+ expect(mockFlushCoworkDeletes).toHaveBeenCalled()
+ expect(mockDeleteProject).toHaveBeenCalledWith('p1')
+ })
+
+ it('never deletes an unavailable session it cannot write', async () => {
+ useCoworkSessions.setState({ sessions: [live('c1', { unavailable: 'missing-thread' })] })
+ const { result } = renderHook(() => useThreadManagement())
+ await act(async () => {
+ await result.current.deleteFolderWithThreads('p1')
+ })
+ expect(mockDeleteCowork).not.toHaveBeenCalled()
+ })
+
+ it('keeps the project when a Cowork delete fails to flush', async () => {
+ useCoworkSessions.setState({ sessions: [live('c1')] })
+ mockFlushCoworkDeletes.mockRejectedValueOnce(new Error('flush failed'))
+ const { result } = renderHook(() => useThreadManagement())
+ await act(async () => {
+ await expect(result.current.deleteFolderWithThreads('p1')).rejects.toThrow('flush failed')
+ })
+ expect(mockDeleteProject).not.toHaveBeenCalled()
+ })
+ })
+
it('should get folder by id', async () => {
const folders = [
{ id: 'p1', name: 'Project 1' },
diff --git a/web-app/src/hooks/useThreadManagement.ts b/web-app/src/hooks/useThreadManagement.ts
index 04978e9a7..a7b32bebf 100644
--- a/web-app/src/hooks/useThreadManagement.ts
+++ b/web-app/src/hooks/useThreadManagement.ts
@@ -1,11 +1,17 @@
import { create } from 'zustand'
import { getServiceHub } from '@/hooks/useServiceHub'
import { useThreads } from '@/hooks/useThreads'
+import { useCoworkSessions } from '@/hooks/useCoworkSessions'
+import { updateThreadProject } from '@/lib/threadProject'
+import { isCoworkThread } from '@/lib/threadMode'
+import { deleteCoworkConversation } from '@/lib/coworkDelete'
import type { ThreadFolder } from '@/services/projects/types'
import { useEffect } from 'react'
type ThreadManagementState = {
folders: ThreadFolder[]
+ /** True once the project list has been read; `folders` is not authoritative before that. */
+ foldersLoaded: boolean
setFolders: (folders: ThreadFolder[]) => void
addFolder: (name: string, assistantId?: string) => Promise<ThreadFolder>
updateFolder: (id: string, name: string, assistantId?: string) => Promise<void>
@@ -17,9 +23,10 @@ type ThreadManagementState = {
const useThreadManagementStore = create<ThreadManagementState>()((set, get) => ({
folders: [],
+ foldersLoaded: false,
setFolders: (folders) => {
- set({ folders })
+ set({ folders, foldersLoaded: true })
},
addFolder: async (name, assistantId) => {
@@ -38,20 +45,25 @@ const useThreadManagementStore = create<ThreadManagementState>()((set, get) => (
},
deleteFolder: async (id) => {
- // Remove project metadata from all threads that belong to this project
- const threadsState = useThreads.getState()
- const threadsToUpdate = Object.values(threadsState.threads).filter(
- (thread) => thread.metadata?.project?.id === id
+ // Sessions are authoritative, including while their mirrors lag persistence.
+ const threads = Object.values(useThreads.getState().threads)
+ const sessions = useCoworkSessions.getState().sessions
+ const sessionsById = new Map(sessions.map((session) => [session.id, session]))
+ const ids = new Set(
+ threads
+ .filter(
+ (thread) =>
+ (isCoworkThread(thread)
+ ? sessionsById.get(thread.id)?.project?.id
+ : thread.metadata?.project?.id) === id
+ )
+ .map((thread) => thread.id)
)
-
- threadsToUpdate.forEach((thread) => {
- threadsState.updateThread(thread.id, {
- metadata: {
- ...thread.metadata,
- project: undefined,
- },
- })
- })
+ for (const session of sessions) {
+ if (session.project?.id === id && !session.unavailable) ids.add(session.id)
+ }
+ // Remove the project from every conversation that belongs to it.
+ ids.forEach((threadId) => updateThreadProject(threadId, undefined))
const projectsService = getServiceHub().projects()
await projectsService.deleteProject(id)
@@ -60,21 +72,52 @@ const useThreadManagementStore = create<ThreadManagementState>()((set, get) => (
},
deleteFolderWithThreads: async (id) => {
- // Get all threads that belong to this project
const threadsState = useThreads.getState()
- const projectThreads = Object.values(threadsState.threads).filter(
- (thread) => thread.metadata?.project?.id === id
+ const sessions = useCoworkSessions.getState().sessions
+ const sessionsById = new Map(sessions.map((session) => [session.id, session]))
+ // The session is authoritative for a Cowork conversation, including while
+ // its mirrored thread lags persistence.
+ const inProject = (threadId: string, thread?: Thread) =>
+ (isCoworkThread(thread) && sessionsById.has(threadId)
+ ? sessionsById.get(threadId)?.project?.id
+ : thread?.metadata?.project?.id) === id
+ const projectThreads = Object.values(threadsState.threads).filter((thread) =>
+ inProject(thread.id, thread)
+ )
+ // A session can exist before its first write has mirrored it into threads.
+ const unmirrored = sessions.filter(
+ (session) =>
+ session.project?.id === id &&
+ !session.unavailable &&
+ !threadsState.threads[session.id]
)
- // Delete threads from backend first
const serviceHub = getServiceHub()
+ let coworkRemoved = false
for (const thread of projectThreads) {
- await serviceHub.threads().deleteThread(thread.id)
+ if (isCoworkThread(thread) && sessionsById.has(thread.id)) {
+ // Cowork deletes through its session store (journal, thread record and
+ // sandbox); a direct record delete would race the write-through sync.
+ threadsState.deleteThread(thread.id)
+ coworkRemoved = true
+ } else {
+ // Delete from the backend first so a failure keeps the project.
+ await serviceHub.threads().deleteThread(thread.id)
+ }
}
-
- // Delete threads from frontend state
+ for (const session of unmirrored) {
+ deleteCoworkConversation(session.id)
+ coworkRemoved = true
+ }
+ if (coworkRemoved) {
+ const sync = await import('@/lib/coworkSync')
+ await sync.flushCoworkDeletes()
+ }
+ // Then the frontend state of the plain chats.
for (const thread of projectThreads) {
- threadsState.deleteThread(thread.id)
+ if (!(isCoworkThread(thread) && sessionsById.has(thread.id))) {
+ threadsState.deleteThread(thread.id)
+ }
}
// Delete the project from storage
@@ -104,7 +147,7 @@ export const useThreadManagement = () => {
try {
const projectsService = getServiceHub().projects()
const projects = await projectsService.getProjects()
- useThreadManagementStore.setState({ folders: projects })
+ useThreadManagementStore.setState({ folders: projects, foldersLoaded: true })
} catch (error) {
console.error('Error syncing projects:', error)
}
diff --git a/web-app/src/lib/__tests__/mergeHistory.test.ts b/web-app/src/lib/__tests__/mergeHistory.test.ts
new file mode 100644
index 000000000..92f1f07a7
--- /dev/null
+++ b/web-app/src/lib/__tests__/mergeHistory.test.ts
@@ -0,0 +1,154 @@
+import { describe, it, expect } from 'vitest'
+import { mergeHistory } from '@/lib/mergeHistory'
+
+const thread = (id: string, updated: number, metadata: Record<string, unknown> = {}) =>
+ ({ id, title: id, updated, metadata }) as unknown as Thread
+const cowork = (id: string, updated: number, metadata: Record<string, unknown> = {}) =>
+ thread(id, updated, { mode: 'cowork', ...metadata })
+const session = (id: string, updated: number, turns = 1, extra = {}) =>
+ ({
+ id,
+ title: id,
+ folder: null,
+ turns: Array.from({ length: turns }, () => ({ role: 'user', content: 'x' })),
+ messages: [],
+ updated,
+ ...extra,
+ }) as never
+
+const project = { id: 'p', name: 'p', updated_at: 1 }
+
+describe('mergeHistory', () => {
+ it('lists chat and Cowork threads together, newest first', () => {
+ const rows = mergeHistory(
+ [thread('chat-old', 1_700_000_000), cowork('cw-mid', 1_700_000_200), thread('chat-new', 1_700_000_300)],
+ [],
+ {}
+ )
+ expect(rows.map((r) => r.id)).toEqual(['chat-new', 'cw-mid', 'chat-old'])
+ expect(rows.every((r) => r.kind === 'thread')).toBe(true)
+ })
+
+ it('renders a persisted Cowork session once, from its mirror thread', () => {
+ const rows = mergeHistory(
+ [cowork('cw', 1_700_000_200)],
+ [session('cw', 1_700_000_200_000)],
+ {}
+ )
+ expect(rows).toHaveLength(1)
+ expect(rows[0].kind).toBe('thread')
+ expect(rows[0].id).toBe('cw')
+ })
+
+ it('still renders each id once while the session is running and mirrored', () => {
+ const rows = mergeHistory([cowork('cw', 1_700_000_200)], [session('cw', 1_700_000_200_000, 0)], { cw: 'run' })
+ expect(rows.map((r) => `${r.kind}:${r.id}`)).toEqual(['thread:cw'])
+ })
+
+ it('adds a store-only row for a running first turn that is not persisted yet', () => {
+ const rows = mergeHistory([thread('chat', 1_700_000_000)], [session('fresh', 1_700_000_100_000, 0)], { fresh: 'run' })
+ expect(rows.map((r) => `${r.kind}:${r.id}`)).toEqual(['session:fresh', 'thread:chat'])
+ })
+
+ it('adds a store-only row for committed turns that are not mirrored yet', () => {
+ const rows = mergeHistory([], [session('unsynced', 1_700_000_100_000)], {})
+ expect(rows.map((r) => `${r.kind}:${r.id}`)).toEqual(['session:unsynced'])
+ })
+
+ it('sorts across seconds (threads) and milliseconds (sessions)', () => {
+ const rows = mergeHistory(
+ [thread('chat-old', 1_700_000_000), thread('chat-new', 1_700_000_300)],
+ [session('cw-mid', 1_700_000_200_000)],
+ {}
+ )
+ expect(rows.map((r) => r.id)).toEqual(['chat-new', 'cw-mid', 'chat-old'])
+ })
+
+ it('does not list an empty, never-used session', () => {
+ expect(mergeHistory([], [session('blank', 3_000_000_000_000, 0)], {})).toEqual([])
+ })
+
+ it('lists a cleared session (used, then emptied) that has no mirror yet', () => {
+ const rows = mergeHistory([], [session('cleared', 2_000_000_000_000, 0, { cleared: true })], {})
+ expect(rows.map((r) => r.id)).toEqual(['cleared'])
+ })
+
+ it('keeps an unavailable session visible so a failed load never hides it', () => {
+ const rows = mergeHistory([], [session('broken', 1, 0, { unavailable: 'unreadable-sidecar' })], {})
+ expect(rows.map((r) => r.id)).toEqual(['broken'])
+ })
+
+ it('leaves out threads that belong to an existing project, Cowork or not', () => {
+ const rows = mergeHistory(
+ [
+ thread('in-project', 5, { project }),
+ cowork('cw-in-project', 6, { project }),
+ thread('plain', 7),
+ ],
+ [],
+ {},
+ new Set(['p'])
+ )
+ expect(rows.map((r) => r.id)).toEqual(['plain'])
+ })
+
+ it('lists a thread whose project does not exist, and hides one whose project does', () => {
+ const threads = [
+ thread('orphan', 5, { project: { id: 'gone' } }),
+ cowork('orphan-cw', 6, { project: { id: 'gone' } }),
+ thread('homed', 6, { project }),
+ thread('plain', 8),
+ ]
+ expect(mergeHistory(threads, [], {}, new Set(['p'])).map((r) => r.id)).toEqual([
+ 'plain',
+ 'orphan-cw',
+ 'orphan',
+ ])
+ })
+
+ it('hides every project thread until the project list has loaded', () => {
+ const threads = [thread('orphan', 5, { project: { id: 'gone' } }), thread('plain', 7)]
+ expect(mergeHistory(threads, [], {}, null).map((r) => r.id)).toEqual(['plain'])
+ })
+
+ it('does not list a store-only session twice when its mirror lives under a project', () => {
+ const rows = mergeHistory(
+ [cowork('cw', 5, { project })],
+ [session('cw', 5_000, 1, { project })],
+ {},
+ new Set(['p'])
+ )
+ expect(rows).toEqual([])
+ })
+
+ describe('a session sharing its id with a chat thread (id-collision placeholder)', () => {
+ it('is a separate row, keyed apart from the chat', () => {
+ const rows = mergeHistory(
+ [thread('same', 1_700_000_000)],
+ [session('same', 1_700_000_100_000, 1, { unavailable: 'id-collision' })],
+ {}
+ )
+ expect(rows.map((r) => `${r.kind}:${r.id}`)).toEqual(['session:same', 'thread:same'])
+ })
+
+ it('is hidden when the chat it collides with sits under an existing project', () => {
+ const rows = mergeHistory(
+ [thread('same', 1, { project })],
+ [session('same', 1_000, 1, { unavailable: 'id-collision', project })],
+ {},
+ new Set(['p'])
+ )
+ expect(rows).toEqual([])
+ })
+ })
+
+ it('lists a project session whose mirror thread is gone: history is the only way to delete it', () => {
+ const rows = mergeHistory(
+ [],
+ [session('gone', 1_000_000_000_000, 1, { project, unavailable: 'missing-thread' })],
+ {},
+ new Set(['p'])
+ )
+ expect(rows.map((r) => r.id)).toEqual(['gone'])
+ })
+})
diff --git a/web-app/src/lib/__tests__/threadProject.test.ts b/web-app/src/lib/__tests__/threadProject.test.ts
new file mode 100644
index 000000000..b51e1cf86
--- /dev/null
+++ b/web-app/src/lib/__tests__/threadProject.test.ts
@@ -0,0 +1,63 @@
+import { beforeEach, describe, expect, it, vi } from 'vitest'
+
+const updateThread = vi.fn()
+const setThreads = vi.fn()
+const state = vi.hoisted(() => ({ threads: {} as Record<string, unknown> }))
+vi.mock('@/hooks/useThreads', () => ({
+ useThreads: {
+ getState: () => ({ threads: state.threads, updateThread, setThreads }),
+ },
+}))
+
+import { updateThreadProject } from '../threadProject'
+import { useCoworkSessions } from '@/hooks/useCoworkSessions'
+
+const project = { id: 'p', name: 'P', updated_at: 1 }
+const session = (id: string, extra = {}) =>
+ ({ id, title: id, folder: null, turns: [], messages: [], updated: 1, ...extra }) as never
+
+describe('updateThreadProject', () => {
+ beforeEach(() => {
+ vi.clearAllMocks()
+ state.threads = {}
+ useCoworkSessions.setState({ sessions: [] })
+ })
+
+ it('updates a chat thread through the thread list', () => {
+ state.threads = { t: { id: 't', metadata: { a: 1 } } }
+ updateThreadProject('t', project)
+ expect(updateThread).toHaveBeenCalledWith('t', { metadata: { a: 1, project } })
+ })
+
+ it('persists a Cowork conversation from its session and updates the mirror', () => {
+ state.threads = { c: { id: 'c', metadata: { mode: 'cowork' } } }
+ useCoworkSessions.setState({ sessions: [session('c')] })
+ updateThreadProject('c', project)
+ expect(useCoworkSessions.getState().sessions[0].project).toEqual(project)
+ expect(updateThread).not.toHaveBeenCalled()
+ expect(setThreads).toHaveBeenCalled()
+ })
+
+ it('removes the project from a Cowork session with an explicit clear', () => {
+ state.threads = { c: { id: 'c', metadata: { mode: 'cowork', project } } }
+ useCoworkSessions.setState({ sessions: [session('c', { project })] })
+ updateThreadProject('c', undefined)
+ const s = useCoworkSessions.getState().sessions[0]
+ expect('project' in s).toBe(true)
+ expect(s.project).toBeUndefined()
+ })
+
+ it('refuses an unavailable session: its assignment would be undone by persistence', () => {
+ state.threads = { c: { id: 'c', metadata: { mode: 'cowork' } } }
+ useCoworkSessions.setState({ sessions: [session('c', { unavailable: 'missing-thread' })] })
+ updateThreadProject('c', project)
+ expect(useCoworkSessions.getState().sessions[0].project).toBeUndefined()
+ expect(updateThread).not.toHaveBeenCalled()
+ })
+
+ it('does nothing for an unknown id', () => {
+ updateThreadProject('nope', project)
+ expect(updateThread).not.toHaveBeenCalled()
+ expect(setThreads).not.toHaveBeenCalled()
+ })
+})
diff --git a/web-app/src/lib/mergeHistory.ts b/web-app/src/lib/mergeHistory.ts
new file mode 100644
index 000000000..39b2e8193
--- /dev/null
+++ b/web-app/src/lib/mergeHistory.ts
@@ -0,0 +1,81 @@
+import type { CoworkSession } from '@/hooks/useCoworkSessions'
+
+/**
+ * One history for every conversation, newest first.
+ *
+ * Chat and Cowork conversations are both threads: a Cowork session is written
+ * through to a thread (see coworkSync) and mirrored into the shared thread
+ * list, so every persisted conversation is listed ONCE, from `threads`. The
+ * session store only contributes a row for what has no thread yet (a first run
+ * that is still streaming, turns not yet mirrored) or whose thread is gone
+ * (an unavailable session, which history is the only way to reach and delete).
+ */
+
+export type HistoryRow =
+ | { kind: 'thread'; id: string; updated: number; thread: Thread }
+ | { kind: 'session'; id: string; updated: number; session: CoworkSession }
+
+// Threads store seconds, Cowork sessions milliseconds. Sort on one unit.
+const toSeconds = (n: number) => (n > 1e12 ? n / 1000 : n)
+
+export function mergeHistory(
+ threads: Thread[],
+ sessions: CoworkSession[],
+ runIds: Record<string, unknown>,
+ // Ids of the projects that exist. A thread is left out of the history only
+ // when its project is real (it is listed under that project instead); one
+ // pointing at a missing project would otherwise be unreachable from the
+ // sidebar. `null` means the project list has not loaded yet, so every
+ // project thread stays hidden rather than flashing in and out.
+ projectIds: ReadonlySet<string> | null = null
+): HistoryRow[] {
+ const inProject = (project: { id: string } | undefined) =>
+ Boolean(project) && (projectIds === null || projectIds.has((project as { id: string }).id))
+
+ const threadIds = new Set<string>()
+ const rows: HistoryRow[] = []
+ for (const thread of threads) {
+ threadIds.add(thread.id)
+ if (inProject(thread.metadata?.project)) continue
+ rows.push({
+ kind: 'thread',
+ id: thread.id,
+ updated: toSeconds(thread.updated || 0),
+ thread,
+ })
+ }
+
+ for (const session of sessions) {
+ // Dedupe by id: a session that already has its thread is that thread's row.
+ // The one exception is an `id-collision` placeholder, which shares its id
+ // with an unrelated chat thread and is a conversation of its own.
+ if (threadIds.has(session.id) && session.unavailable !== 'id-collision') continue
+ // Same rule as thread rows: a session in a real project is listed under
+ // that project (through its mirror thread), not here. The exception is a
+ // session whose mirror thread is gone ('missing-thread'): nothing lists it
+ // under the project, so history is its only way in.
+ if (
+ session.unavailable !== 'missing-thread' &&
+ inProject(session.project)
+ ) {
+ continue
+ }
+ // A session earns a row once it has messages. A first run's turns are
+ // transient until committed, so a streaming session stays listed too.
+ if (
+ session.turns.length === 0 &&
+ runIds[session.id] == null &&
+ !session.unavailable &&
+ !session.cleared
+ ) {
+ continue
+ }
+ rows.push({
+ kind: 'session',
+ id: session.id,
+ updated: toSeconds(session.updated || 0),
+ session,
+ })
+ }
+ return rows.sort((a, b) => b.updated - a.updated)
+}
diff --git a/web-app/src/lib/threadProject.ts b/web-app/src/lib/threadProject.ts
new file mode 100644
index 000000000..69acc61a8
--- /dev/null
+++ b/web-app/src/lib/threadProject.ts
@@ -0,0 +1,32 @@
+import { useCoworkSessions, type CoworkSession } from '@/hooks/useCoworkSessions'
+import { useThreads } from '@/hooks/useThreads'
+import { isCoworkThread } from '@/lib/threadMode'
+
+/** Cowork persists from its session, never from the sidebar's thread mirror. */
+export function updateThreadProject(
+ id: string,
+ project: CoworkSession['project']
+): void {
+ const thread = useThreads.getState().threads[id]
+ const session = useCoworkSessions.getState().sessions.find((s) => s.id === id)
+ if (isCoworkThread(thread) || (!thread && session)) {
+ // Missing/unavailable sessions must not acquire a mirror-only assignment
+ // that a later persistence pass would silently undo.
+ if (!session || session.unavailable) return
+ useCoworkSessions.getState().setProject(id, project)
+ const state = useThreads.getState()
+ const mirror = state.threads[id]
+ if (mirror) {
+ state.setThreads(Object.values({
+ ...state.threads,
+ [id]: { ...mirror, metadata: { ...mirror.metadata, project } },
+ }))
+ }
+ return
+ }
+ if (thread) {
+ useThreads.getState().updateThread(id, {
+ metadata: { ...thread.metadata, project },
+ })
+ }
+}
diff --git a/web-app/src/locales/ca/common.json b/web-app/src/locales/ca/common.json
index e61db0e25..0e4c83c47 100644
--- a/web-app/src/locales/ca/common.json
+++ b/web-app/src/locales/ca/common.json
@@ -229,10 +229,6 @@
"cancel": "Cancel·la",
"changeLocation": "Canvia la ubicació"
},
- "deleteAllThreads": {
- "title": "Suprimeix tots els fils",
- "description": "Se suprimiran tots els fils. Aquesta acció no es pot desfer."
- },
"deleteThread": {
"description": "Segur que vols suprimir aquest fil? Aquesta acció no es pot desfer."
},
@@ -260,7 +256,6 @@
"projectNotFoundDesc": "El projecte que busques no existeix o s’ha suprimit.",
"deleteProjectDialog": {
"title": "Suprimeix el projecte",
- "permanentDelete": "Això suprimirà definitivament tots els fils.",
"permanentDeleteWarning": "Aquesta acció suprimirà TOTS els fils del projecte!",
"deleteEmptyProject": "Aquesta acció suprimirà el projecte \"{{projectName}}\".",
"saveThreadsAdvice": "Per conservar els fils, mou-los a la llista de fils o a un altre projecte abans de suprimir-lo.",
@@ -283,7 +278,6 @@
"renameSuccess": "Projecte reanomenat de \"{{oldName}}\" a \"{{newName}}\""
},
"noConversationsIn": "No hi ha converses a {{projectName}}",
- "startNewConversation": "Inicia una conversa nova amb {{projectName}} a continuació",
"conversationsIn": "Converses a {{projectName}}",
"conversationsDescription": "Fes clic a qualsevol conversa per continuar parlant o inicia’n una de nova a continuació.",
"thread": "fil",
@@ -296,7 +290,8 @@
"noProjectsFound": "No s’han trobat projectes",
"tryDifferentSearch": "Prova amb un terme de cerca diferent",
"uploadingFiles": "S’estan processant els fitxers…",
- "processButton": "Afegeix"
+ "processButton": "Afegeix",
+ "viewProject": "Mostra el projecte"
},
"attachmentsIngestion": {
"title": "Tria com ingerir els adjunts",
@@ -408,5 +403,14 @@
"forceQuit": "Force quit",
"forcing": "Force quitting…",
"shuttingDown": "Shutting down…"
+ },
+ "chatsAndTasks": "Xats i tasques",
+ "artifacts": "Artefactes",
+ "skills": "Habilitats",
+ "deleteSession": "Suprimeix la sessió",
+ "deleteSessionTitle": "Vols suprimir la sessió?",
+ "deleteSessionBody": "«{{title}}» i la seva transcripció se suprimiran de manera permanent. Aquesta acció no es pot desfer.",
+ "sidebar": {
+ "more": "Més"
}
}
diff --git a/web-app/src/locales/cs/common.json b/web-app/src/locales/cs/common.json
index 02a36c8a6..8b08645be 100644
--- a/web-app/src/locales/cs/common.json
+++ b/web-app/src/locales/cs/common.json
@@ -236,10 +236,6 @@
"cancel": "Zrušit",
"changeLocation": "Změnit umístění"
},
- "deleteAllThreads": {
- "title": "Smazat všechna vlákna",
- "description": "Všechna vlákna budou smazána. Tuto akci nelze vrátit zpět."
- },
"deleteThread": {
"description": "Opravdu chcete smazat toto vlákno? Tuto akci nelze vrátit zpět."
},
@@ -268,7 +264,6 @@
"projectNotFoundDesc": "Projekt, který hledáte, neexistuje nebo byl smazán.",
"deleteProjectDialog": {
"title": "Smazat projekt",
- "permanentDelete": "Tímto trvale smažete všechna vlákna.",
"permanentDeleteWarning": "Tato akce trvale smaže VŠECHNA vlákna v rámci projektu!",
"deleteEmptyProject": "Tato akce smaže projekt \"{{projectName}}\".",
"saveThreadsAdvice": "Chcete-li uložit vlákna, přesuňte je do seznamu vláken nebo jiného projektu před smazáním.",
@@ -291,7 +286,6 @@
"renameSuccess": "Projekt byl přejmenován z \"{{oldName}}\" na \"{{newName}}\""
},
"noConversationsIn": "Žádné konverzace v {{projectName}}",
- "startNewConversation": "Začněte novou konverzaci s {{projectName}} níže",
"conversationsIn": "Konverzace v {{projectName}}",
"conversationsDescription": "Kliknutím na kteroukoli konverzaci pokračujte v chatování nebo začněte novou níže.",
"thread": "vlákno",
@@ -304,7 +298,8 @@
"noProjectsFound": "Nebyly nalezeny žádné projekty",
"tryDifferentSearch": "Zkuste jiný vyhledávací výraz",
"uploadingFiles": "Zpracování souborů…",
- "processButton": "Přidat"
+ "processButton": "Přidat",
+ "viewProject": "Zobrazit projekt"
},
"errorDialog": {
"titleFallback": "Něco se pokazilo",
@@ -406,5 +401,14 @@
"forceQuit": "Force quit",
"forcing": "Force quitting…",
"shuttingDown": "Shutting down…"
+ },
+ "chatsAndTasks": "Chaty a úlohy",
+ "artifacts": "Artefakty",
+ "skills": "Dovednosti",
+ "deleteSession": "Smazat relaci",
+ "deleteSessionTitle": "Smazat relaci?",
+ "deleteSessionBody": "„{{title}}“ a její přepis budou trvale smazány. Tuto akci nelze vrátit zpět.",
+ "sidebar": {
+ "more": "Více"
}
}
diff --git a/web-app/src/locales/de-DE/common.json b/web-app/src/locales/de-DE/common.json
index 52e7502d2..b3552e02e 100644
--- a/web-app/src/locales/de-DE/common.json
+++ b/web-app/src/locales/de-DE/common.json
@@ -235,10 +235,6 @@
"cancel": "Abbrechen",
"changeLocation": "Speicherort ändern"
},
- "deleteAllThreads": {
- "title": "Alle Threads löschen",
- "description": "Alle Threads werden gelöscht. Diese Aktion kann nicht rückgängig gemacht werden."
- },
"deleteThread": {
"description": "Bist Du sicher, daß Du diesen Thread löschen möchtest? Diese Aktion kann nicht rückgängig gemacht werden."
},
@@ -247,6 +243,10 @@
},
"messageMetadata": {
"title": "Nachricht Metadaten"
+ },
+ "deleteAllChats": {
+ "title": "Unterhaltungen außerhalb von Projekten löschen",
+ "description": "Dadurch werden Unterhaltungen gelöscht, die nicht in einem Projekt liegen. Projektunterhaltungen, markierte Unterhaltungen und Aufgaben bleiben erhalten. Diese Aktion kann nicht rückgängig gemacht werden."
}
},
"projects": {
@@ -267,7 +267,7 @@
"projectNotFoundDesc": "Das gesuchte Projekt existiert nicht oder wurde gelöscht.",
"deleteProjectDialog": {
"title": "Projekt löschen",
- "permanentDelete": "Dies wird alle Threads permanent löschen.",
+ "permanentDelete": "Dadurch werden \"{{projectName}}\" und alle zugehörigen Unterhaltungen dauerhaft gelöscht. Diese Aktion kann nicht rückgängig gemacht werden.",
"permanentDeleteWarning": "Diese Aktion wird ALLE Threads innerhalb des Projekts permanent löschen!",
"deleteEmptyProject": "Diese Aktion wird das Projekt \"{{projectName}}\" löschen.",
"saveThreadsAdvice": "Um Threads zu speichern, verschiebe sie zu deiner Threadliste oder zu einem anderen Projekt, bevor du löschst.",
@@ -291,7 +291,6 @@
"renameSuccess": "Projekt von \"{{oldName}}\" zu \"{{newName}}\" umbenannt"
},
"noConversationsIn": "Keine Gespräche in {{projectName}}",
- "startNewConversation": "Starten Sie ein neues Gespräch mit {{projectName}} unten",
"conversationsIn": "Gespräche in {{projectName}}",
"conversationsDescription": "Klicken Sie auf ein Gespräch, um weiterzuchatten, oder starten Sie unten ein neues.",
"thread": "Thread",
@@ -304,7 +303,9 @@
"noProjectsFound": "Keine Projekte gefunden",
"tryDifferentSearch": "Versuchen Sie einen anderen Suchbegriff",
"uploadingFiles": "Dateien werden verarbeitet…",
- "processButton": "Hinzufügen"
+ "processButton": "Hinzufügen",
+ "viewProject": "Projekt ansehen",
+ "sendMessageToStart": "Sende oben eine Nachricht, um eine zu beginnen."
},
"errorDialog": {
"titleFallback": "Etwas ist schiefgelaufen",
@@ -398,6 +399,10 @@
"downloadAndVerificationComplete": {
"title": "Download abgeschlossen",
"description": "Modell \"{{item}}\" erfolgreich heruntergeladen und verifiziert"
+ },
+ "deleteAllChats": {
+ "title": "Unterhaltungen gelöscht",
+ "description": "Unterhaltungen außerhalb von Projekten wurden gelöscht. Projektunterhaltungen und Aufgaben wurden behalten."
}
},
"llamacppBusyOnExit": {
@@ -419,5 +424,15 @@
"notReadyTitle": "Diese Unterhaltung ist noch nicht bereit",
"notReadyDescription": "Jan konnte nicht bestätigen, ob diese Unterhaltung ein Chat oder eine Cowork-Aufgabe ist. Versuche es erneut; falls das Problem bestehen bleibt, starte die App neu.",
"retry": "Erneut versuchen"
+ },
+ "agentSettings": "Agent",
+ "chatsAndTasks": "Chats und Aufgaben",
+ "artifacts": "Artefakte",
+ "skills": "Skills",
+ "deleteSession": "Sitzung löschen",
+ "deleteSessionTitle": "Sitzung löschen?",
+ "deleteSessionBody": "„{{title}}“ und das zugehörige Protokoll werden endgültig gelöscht. Das lässt sich nicht rückgängig machen.",
+ "sidebar": {
+ "more": "Mehr"
}
}
diff --git a/web-app/src/locales/en/common.json b/web-app/src/locales/en/common.json
index b853fe69b..6a810f324 100644
--- a/web-app/src/locales/en/common.json
+++ b/web-app/src/locales/en/common.json
@@ -383,10 +383,6 @@
"cancel": "Cancel",
"changeLocation": "Change Location"
},
- "deleteAllThreads": {
- "title": "Delete All Threads",
- "description": "All threads will be deleted. This action cannot be undone."
- },
"deleteAllThreadsInProject": {
"title": "Delete All Conversations",
"description": "{{count}} conversations in \"{{projectName}}\" will be deleted. This action cannot be undone."
@@ -399,6 +395,10 @@
},
"messageMetadata": {
"title": "Message Metadata"
+ },
+ "deleteAllChats": {
+ "title": "Delete Conversations Outside Projects",
+ "description": "This deletes conversations that are not in a project. Project conversations, starred conversations and tasks are kept. This action cannot be undone."
}
},
"errorDialog": {
@@ -438,7 +438,7 @@
"processButton": "Add",
"deleteProjectDialog": {
"title": "Delete Project",
- "permanentDelete": "This will permanently delete all threads.",
+ "permanentDelete": "This will permanently delete \"{{projectName}}\" and all of its conversations. This action cannot be undone.",
"permanentDeleteWarning": "This action will permanently delete ALL threads within the project!",
"deleteEmptyProject": "This action will delete project \"{{projectName}}\".",
"saveThreadsAdvice": "To save threads, move them to your thread list or another project before deleting.",
@@ -465,7 +465,6 @@
"updateSuccess": "Project \"{{projectName}}\" updated successfully"
},
"noConversationsIn": "No Conversations in {{projectName}}",
- "startNewConversation": "Start a new conversation with {{projectName}} below",
"conversationsIn": "Conversations in {{projectName}}",
"conversationsDescription": "Click on any conversation to continue chatting, or start a new one below.",
"conversation": "Conversation",
@@ -481,7 +480,9 @@
"update": "Update",
"searchProjects": "Search projects...",
"noProjectsFound": "No projects found",
- "tryDifferentSearch": "Try a different search term"
+ "tryDifferentSearch": "Try a different search term",
+ "viewProject": "View Project",
+ "sendMessageToStart": "Send a message above to start one."
},
"attachmentsIngestion": {
"title": "Choose how to ingest attachments",
@@ -643,6 +644,10 @@
"attachmentsDisabledInfo": {
"title": "Attachments Disabled",
"description": "Attachments are disabled in Settings"
+ },
+ "deleteAllChats": {
+ "title": "Conversations deleted",
+ "description": "Conversations outside projects were deleted. Project conversations and tasks were kept."
}
},
"errors": {
@@ -802,5 +807,10 @@
"notReadyTitle": "This conversation isn't ready yet",
"notReadyDescription": "Jan could not confirm whether this conversation is a chat or a Cowork task. Retry; if this persists, restart the app.",
"retry": "Retry"
+ },
+ "agentSettings": "Agent",
+ "chatsAndTasks": "Chats and tasks",
+ "sidebar": {
+ "more": "More"
}
}
diff --git a/web-app/src/locales/es/common.json b/web-app/src/locales/es/common.json
index cdaf76977..062d71a53 100644
--- a/web-app/src/locales/es/common.json
+++ b/web-app/src/locales/es/common.json
@@ -248,10 +248,6 @@
"cancel": "Cancelar",
"changeLocation": "Cambiar ubicación"
},
- "deleteAllThreads": {
- "title": "Eliminar todos los hilos",
- "description": "Todos los hilos serán eliminados. Esta acción no se puede deshacer."
- },
"deleteAllThreadsInProject": {
"title": "Eliminar todas las conversaciones",
"description": "Se eliminarán {{count}} conversaciones en \"{{projectName}}\". Esta acción no se puede deshacer."
@@ -290,7 +286,6 @@
"processButton": "Añadir",
"deleteProjectDialog": {
"title": "Eliminar proyecto",
- "permanentDelete": "Esto eliminará permanentemente todos los hilos.",
"permanentDeleteWarning": "¡Esta acción eliminará permanentemente TODOS los hilos dentro del proyecto!",
"deleteEmptyProject": "Esta acción eliminará el proyecto \"{{projectName}}\".",
"saveThreadsAdvice": "Para guardar hilos, muévelos a tu lista de hilos o a otro proyecto antes de eliminar.",
@@ -317,7 +312,6 @@
"updateSuccess": "Proyecto \"{{projectName}}\" actualizado correctamente"
},
"noConversationsIn": "No hay conversaciones en {{projectName}}",
- "startNewConversation": "Inicia una nueva conversación con {{projectName}} a continuación",
"conversationsIn": "Conversaciones en {{projectName}}",
"conversationsDescription": "Haz clic en cualquier conversación para continuar chateando, o inicia una nueva a continuación.",
"conversation": "Conversación",
@@ -333,7 +327,8 @@
"update": "Actualizar",
"searchProjects": "Buscar proyectos...",
"noProjectsFound": "No se encontraron proyectos",
- "tryDifferentSearch": "Prueba con un término de búsqueda diferente"
+ "tryDifferentSearch": "Prueba con un término de búsqueda diferente",
+ "viewProject": "Ver proyecto"
},
"attachmentsIngestion": {
"title": "Elige cómo procesar los adjuntos",
@@ -476,5 +471,14 @@
"forceQuit": "Force quit",
"forcing": "Force quitting…",
"shuttingDown": "Shutting down…"
+ },
+ "chatsAndTasks": "Chats y tareas",
+ "artifacts": "Artefactos",
+ "skills": "Habilidades",
+ "deleteSession": "Eliminar sesión",
+ "deleteSessionTitle": "¿Eliminar la sesión?",
+ "deleteSessionBody": "«{{title}}» y su transcripción se eliminarán de forma permanente. Esta acción no se puede deshacer.",
+ "sidebar": {
+ "more": "Más"
}
}
diff --git a/web-app/src/locales/fr/common.json b/web-app/src/locales/fr/common.json
index ae3b75f31..59dc3ffab 100644
--- a/web-app/src/locales/fr/common.json
+++ b/web-app/src/locales/fr/common.json
@@ -235,10 +235,6 @@
"cancel": "Annuler",
"changeLocation": "Changer l'emplacement"
},
- "deleteAllThreads": {
- "title": "Supprimer toutes les discussions",
- "description": "Toutes les discussions seront supprimées. Cette action ne peut pas être annulée."
- },
"deleteThread": {
"description": "Êtes-vous sûr de vouloir supprimer cette discussion ? Cette action ne peut pas être annulée."
},
@@ -247,6 +243,10 @@
},
"messageMetadata": {
"title": "Métadonnées du message"
+ },
+ "deleteAllChats": {
+ "title": "Supprimer les conversations hors projets",
+ "description": "Cela supprime les conversations qui ne sont pas dans un projet. Les conversations de projet, les conversations favorites et les tâches sont conservées. Cette action est irréversible."
}
},
"projects": {
@@ -267,7 +267,7 @@
"projectNotFoundDesc": "Le projet que vous recherchez n'existe pas ou a été supprimé.",
"deleteProjectDialog": {
"title": "Supprimer le projet",
- "permanentDelete": "Cela supprimera définitivement toutes les discussions.",
+ "permanentDelete": "Cela supprimera définitivement « {{projectName}} » et toutes ses conversations. Cette action est irréversible.",
"permanentDeleteWarning": "Cette action supprimera définitivement TOUTES les discussions au sein du projet !",
"deleteEmptyProject": "Cette action supprimera le projet \"{{projectName}}\".",
"saveThreadsAdvice": "Pour sauvegarder les discussions, déplacez-les vers votre liste de discussions ou un autre projet avant de les supprimer.",
@@ -290,7 +290,6 @@
"renameSuccess": "Projet renommé de \"{{oldName}}\" en \"{{newName}}\""
},
"noConversationsIn": "Aucune conversation dans {{projectName}}",
- "startNewConversation": "Commencez une nouvelle conversation avec {{projectName}} ci-dessous",
"conversationsIn": "Conversations dans {{projectName}}",
"conversationsDescription": "Cliquez sur n'importe quelle conversation pour continuer à discuter, ou commencez-en une nouvelle ci-dessous.",
"thread": "discussion",
@@ -303,7 +302,9 @@
"noProjectsFound": "Aucun projet trouvé",
"tryDifferentSearch": "Essayez un autre terme de recherche",
"uploadingFiles": "Traitement des fichiers…",
- "processButton": "Ajouter"
+ "processButton": "Ajouter",
+ "viewProject": "Afficher le projet",
+ "sendMessageToStart": "Envoyez un message ci-dessus pour en démarrer une."
},
"errorDialog": {
"titleFallback": "Une erreur s'est produite",
@@ -397,6 +398,10 @@
"threadRemovedFromProject": {
"title": "Discussion retirée",
"description": "Discussion retirée de \"{{projectName}}\" avec succès"
+ },
+ "deleteAllChats": {
+ "title": "Conversations supprimées",
+ "description": "Les conversations hors projets ont été supprimées. Les conversations de projet et les tâches ont été conservées."
}
},
"attachmentInjectedIndicator": "Injecté dans la discussion",
@@ -422,5 +427,15 @@
"notReadyTitle": "Cette conversation n'est pas encore prête",
"notReadyDescription": "Jan n'a pas pu confirmer si cette conversation est un chat ou une tâche Cowork. Réessayez ; si le problème persiste, redémarrez l'application.",
"retry": "Réessayer"
+ },
+ "agentSettings": "Agent",
+ "chatsAndTasks": "Discussions et tâches",
+ "artifacts": "Artefacts",
+ "skills": "Compétences",
+ "deleteSession": "Supprimer la session",
+ "deleteSessionTitle": "Supprimer la session ?",
+ "deleteSessionBody": "« {{title}} » et sa transcription seront supprimées définitivement. Cette action est irréversible.",
+ "sidebar": {
+ "more": "Plus"
}
}
diff --git a/web-app/src/locales/hi/common.json b/web-app/src/locales/hi/common.json
index 3a56c4996..8bb08b82b 100644
--- a/web-app/src/locales/hi/common.json
+++ b/web-app/src/locales/hi/common.json
@@ -248,10 +248,6 @@
"cancel": "रद्द करें",
"changeLocation": "स्थान बदलें"
},
- "deleteAllThreads": {
- "title": "सभी थ्रेड हटाएं",
- "description": "सभी थ्रेड हटा दिए जाएंगे। यह कार्रवाई वापस नहीं ली जा सकती।"
- },
"deleteAllThreadsInProject": {
"title": "सभी वार्तालाप हटाएं",
"description": "\"{{projectName}}\" में {{count}} वार्तालाप हटा दिए जाएंगे। यह कार्रवाई वापस नहीं ली जा सकती।"
@@ -290,7 +286,6 @@
"processButton": "जोड़ें",
"deleteProjectDialog": {
"title": "प्रोजेक्ट हटाएं",
- "permanentDelete": "यह सभी थ्रेड्स को स्थायी रूप से हटा देगा।",
"permanentDeleteWarning": "यह कार्रवाई प्रोजेक्ट के भीतर सभी थ्रेड्स को स्थायी रूप से हटा देगी!",
"deleteEmptyProject": "यह कार्रवाई \"{{projectName}}\" प्रोजेक्ट को हटा देगी।",
"saveThreadsAdvice": "थ्रेड्स को सुरक्षित रखने के लिए, हटाने से पहले उन्हें अपनी थ्रेड सूची या किसी अन्य प्रोजेक्ट में स्थानांतरित करें।",
@@ -317,7 +312,6 @@
"updateSuccess": "प्रोजेक्ट \"{{projectName}}\" सफलतापूर्वक अपडेट किया गया"
},
"noConversationsIn": "{{projectName}} में कोई वार्तालाप नहीं है",
- "startNewConversation": "{{projectName}} के साथ नीचे एक नई वार्तालाप शुरू करें",
"conversationsIn": "{{projectName}} में वार्तालाप",
"conversationsDescription": "चैट जारी रखने के लिए किसी भी वार्तालाप पर क्लिक करें, या नीचे एक नई शुरू करें।",
"conversation": "वार्तालाप",
@@ -333,7 +327,8 @@
"update": "अपडेट करें",
"searchProjects": "प्रोजेक्ट खोजें...",
"noProjectsFound": "कोई प्रोजेक्ट नहीं मिला",
- "tryDifferentSearch": "कोई अलग खोज शब्द आज़माएं"
+ "tryDifferentSearch": "कोई अलग खोज शब्द आज़माएं",
+ "viewProject": "प्रोजेक्ट देखें"
},
"attachmentsIngestion": {
"title": "संलग्नकों को कैसे प्रोसेस करना है चुनें",
@@ -476,5 +471,14 @@
"forceQuit": "Force quit",
"forcing": "Force quitting…",
"shuttingDown": "Shutting down…"
+ },
+ "chatsAndTasks": "चैट और कार्य",
+ "artifacts": "आर्टिफ़ैक्ट",
+ "skills": "स्किल",
+ "deleteSession": "सत्र हटाएँ",
+ "deleteSessionTitle": "सत्र हटाएँ?",
+ "deleteSessionBody": "\"{{title}}\" और उसका ट्रांसक्रिप्ट स्थायी रूप से हटा दिया जाएगा। इसे वापस नहीं किया जा सकता।",
+ "sidebar": {
+ "more": "और"
}
}
diff --git a/web-app/src/locales/id/common.json b/web-app/src/locales/id/common.json
index 55e53bb96..bebe3a8e6 100644
--- a/web-app/src/locales/id/common.json
+++ b/web-app/src/locales/id/common.json
@@ -235,10 +235,6 @@
"cancel": "Batal",
"changeLocation": "Ubah Lokasi"
},
- "deleteAllThreads": {
- "title": "Hapus Semua Utas",
- "description": "Semua utas akan dihapus. Tindakan ini tidak dapat dibatalkan."
- },
"deleteThread": {
"description": "Apakah Anda yakin ingin menghapus thread ini? Tindakan ini tidak dapat dibatalkan."
},
@@ -361,7 +357,6 @@
"projectNotFoundDesc": "Proyek yang Anda cari tidak ada atau telah dihapus.",
"deleteProjectDialog": {
"title": "Hapus Proyek",
- "permanentDelete": "Ini akan menghapus semua utas secara permanen.",
"permanentDeleteWarning": "Tindakan ini akan menghapus SEMUA utas dalam proyek secara permanen!",
"deleteEmptyProject": "Tindakan ini akan menghapus proyek \"{{projectName}}\".",
"saveThreadsAdvice": "Untuk menyimpan utas, pindahkan ke daftar utas Anda atau proyek lain sebelum menghapus.",
@@ -385,7 +380,6 @@
"renameSuccess": "Proyek diubah dari \"{{oldName}}\" menjadi \"{{newName}}\""
},
"noConversationsIn": "Tidak Ada Percakapan di {{projectName}}",
- "startNewConversation": "Mulai percakapan baru dengan {{projectName}} di bawah",
"conversationsIn": "Percakapan di {{projectName}}",
"conversationsDescription": "Klik percakapan mana pun untuk melanjutkan chatting, atau mulai yang baru di bawah.",
"thread": "utas",
@@ -398,7 +392,8 @@
"noProjectsFound": "Tidak ada proyek ditemukan",
"tryDifferentSearch": "Coba kata kunci pencarian lain",
"uploadingFiles": "Memproses file…",
- "processButton": "Tambah"
+ "processButton": "Tambah",
+ "viewProject": "Lihat Proyek"
},
"llamacppBusyOnExit": {
"title": "llama.cpp is still busy",
@@ -406,5 +401,14 @@
"forceQuit": "Force quit",
"forcing": "Force quitting…",
"shuttingDown": "Shutting down…"
+ },
+ "chatsAndTasks": "Obrolan dan tugas",
+ "artifacts": "Artefak",
+ "skills": "Keahlian",
+ "deleteSession": "Hapus sesi",
+ "deleteSessionTitle": "Hapus sesi?",
+ "deleteSessionBody": "\"{{title}}\" dan transkripnya akan dihapus secara permanen. Tindakan ini tidak dapat dibatalkan.",
+ "sidebar": {
+ "more": "Lainnya"
}
}
diff --git a/web-app/src/locales/it/common.json b/web-app/src/locales/it/common.json
index 3158a63b7..6525dc4a6 100644
--- a/web-app/src/locales/it/common.json
+++ b/web-app/src/locales/it/common.json
@@ -230,7 +230,7 @@
"title": "Elimina fornitore",
"description": "Elimina questo fornitore e tutti i suoi modelli. Questa azione non può essere annullata.",
"success": "Il fornitore {{provider}} è stato eliminato definitivamente.",
- "confirmTitle": "Elimina fornitore: {{provider}}",
+ "confirmTitle": "Elimina fornitore: {{provider}}",
"confirmDescription": "Sei sicuro di voler eliminare questo fornitore? Questa azione non può essere annullata.",
"cancel": "Annulla",
"delete": "Elimina"
@@ -261,10 +261,6 @@
"cancel": "Annulla",
"changeLocation": "Modifica posizione"
},
- "deleteAllThreads": {
- "title": "Elimina tutte le conversazioni",
- "description": "Tutte le conversazioni saranno eliminate. Questa azione non può essere annullata."
- },
"deleteAllThreadsInProject": {
"title": "Elimina tutte le conversazioni",
"description": "{{count}} conversazioni in \"{{projectName}}\" saranno eliminate. Questa azione non può essere annullata."
@@ -315,7 +311,6 @@
"uploadingFiles": "Caricamento file in corso…",
"deleteProjectDialog": {
"title": "Elimina progetto",
- "permanentDelete": "Questo eliminerà definitivamente tutte le conversazioni.",
"permanentDeleteWarning": "Questa azione eliminerà definitivamente TUTTE le conversazioni all'interno del progetto!",
"deleteEmptyProject": "Questa azione eliminerà il progetto \"{{projectName}}\".",
"saveThreadsAdvice": "Per salvare le conversazioni, spostale nell'elenco delle conversazioni o in un altro progetto prima di procedere con l'eliminazione.",
@@ -342,7 +337,6 @@
"updateSuccess": "Progetto \"{{projectName}}\" aggiornato con successo"
},
"noConversationsIn": "Nessuna conversazione in {{projectName}}",
- "startNewConversation": "Avvia una nuova conversazione con {{projectName}} qui sotto",
"conversationsIn": "Conversazioni in {{projectName}}",
"conversationsDescription": "Fai clic su una conversazione per continuare a chattare, oppure avviane una nuova qui sotto.",
"conversation": "Conversazione",
@@ -358,7 +352,8 @@
"update": "Aggiorna",
"searchProjects": "Cerca progetti...",
"noProjectsFound": "Nessun progetto trovato",
- "tryDifferentSearch": "Prova con un termine di ricerca diverso"
+ "tryDifferentSearch": "Prova con un termine di ricerca diverso",
+ "viewProject": "Visualizza progetto"
},
"attachmentsIngestion": {
"title": "Scegli come elaborare gli allegati",
@@ -501,5 +496,14 @@
"forceQuit": "Uscita forzata",
"forcing": "Chiusura forzata in corso…",
"shuttingDown": "Arresto in corso…"
+ },
+ "chatsAndTasks": "Chat e attività",
+ "artifacts": "Artefatti",
+ "skills": "Competenze",
+ "deleteSession": "Elimina sessione",
+ "deleteSessionTitle": "Eliminare la sessione?",
+ "deleteSessionBody": "«{{title}}» e la sua trascrizione verranno eliminate definitivamente. L'operazione non può essere annullata.",
+ "sidebar": {
+ "more": "Altro"
}
}
diff --git a/web-app/src/locales/ja/common.json b/web-app/src/locales/ja/common.json
index ac3c58099..2b75b4105 100644
--- a/web-app/src/locales/ja/common.json
+++ b/web-app/src/locales/ja/common.json
@@ -272,10 +272,6 @@
"cancel": "キャンセル",
"changeLocation": "場所を変更"
},
- "deleteAllThreads": {
- "title": "すべてのスレッドを削除",
- "description": "すべてのスレッドが削除されます。この操作は元に戻せません。"
- },
"deleteAllThreadsInProject": {
"title": "すべての会話を削除",
"description": "「{{projectName}}」内の{{count}}件の会話が削除されます。この操作は元に戻せません。"
@@ -288,6 +284,10 @@
},
"messageMetadata": {
"title": "メッセージメタデータ"
+ },
+ "deleteAllChats": {
+ "title": "プロジェクト外の会話を削除",
+ "description": "プロジェクトに属していない会話を削除します。プロジェクト内の会話、スター付きの会話、タスクは残ります。この操作は元に戻せません。"
}
},
"errorDialog": {
@@ -327,7 +327,7 @@
"processButton": "追加",
"deleteProjectDialog": {
"title": "プロジェクトを削除",
- "permanentDelete": "これにより、すべてのスレッドが完全に削除されます。",
+ "permanentDelete": "「{{projectName}}」とそのすべての会話が完全に削除されます。この操作は元に戻せません。",
"permanentDeleteWarning": "この操作は、プロジェクト内のすべてのスレッドを完全に削除します!",
"deleteEmptyProject": "この操作は、プロジェクト「{{projectName}}」を削除します。",
"saveThreadsAdvice": "スレッドを残すには、削除する前にスレッドリストまたは別のプロジェクトに移動してください。",
@@ -354,7 +354,6 @@
"updateSuccess": "プロジェクト「{{projectName}}」を正常に更新しました"
},
"noConversationsIn": "{{projectName}}には会話がありません",
- "startNewConversation": "以下で{{projectName}}との新しい会話を開始します",
"conversationsIn": "{{projectName}}での会話",
"conversationsDescription": "会話をクリックしてチャットを続けるか、以下で新しい会話を開始してください。",
"conversation": "会話",
@@ -370,7 +369,9 @@
"update": "更新",
"searchProjects": "プロジェクトを検索...",
"noProjectsFound": "プロジェクトが見つかりません",
- "tryDifferentSearch": "別の検索語をお試しください"
+ "tryDifferentSearch": "別の検索語をお試しください",
+ "viewProject": "プロジェクトを表示",
+ "sendMessageToStart": "上でメッセージを送信すると会話を始められます。"
},
"attachmentsIngestion": {
"title": "添付ファイルの取り込み方法を選択",
@@ -508,6 +509,10 @@
"attachmentsDisabledInfo": {
"title": "添付ファイルが無効です",
"description": "添付ファイルは設定で無効になっています"
+ },
+ "deleteAllChats": {
+ "title": "会話を削除しました",
+ "description": "プロジェクト外の会話を削除しました。プロジェクト内の会話とタスクは残しています。"
}
},
"errors": {
@@ -536,5 +541,15 @@
"notReadyTitle": "この会話はまだ準備できていません",
"notReadyDescription": "この会話がチャットかCoworkタスクかをJanが確認できませんでした。再試行してください。解決しない場合はアプリを再起動してください。",
"retry": "再試行"
+ },
+ "agentSettings": "エージェント",
+ "chatsAndTasks": "チャットとタスク",
+ "artifacts": "アーティファクト",
+ "skills": "スキル",
+ "deleteSession": "セッションを削除",
+ "deleteSessionTitle": "セッションを削除しますか?",
+ "deleteSessionBody": "「{{title}}」とそのトランスクリプトは完全に削除されます。この操作は元に戻せません。",
+ "sidebar": {
+ "more": "その他"
}
}
diff --git a/web-app/src/locales/ko/common.json b/web-app/src/locales/ko/common.json
index c397ce984..a713b5214 100644
--- a/web-app/src/locales/ko/common.json
+++ b/web-app/src/locales/ko/common.json
@@ -247,10 +247,6 @@
"cancel": "취소",
"changeLocation": "위치 변경"
},
- "deleteAllThreads": {
- "title": "모든 스레드 삭제",
- "description": "모든 스레드가 삭제됩니다. 이 작업은 되돌릴 수 없습니다."
- },
"deleteAllThreadsInProject": {
"title": "모든 대화 삭제",
"description": "\"{{projectName}}\"의 대화 {{count}}개가 삭제됩니다. 이 작업은 되돌릴 수 없습니다."
@@ -289,7 +285,6 @@
"processButton": "추가",
"deleteProjectDialog": {
"title": "프로젝트 삭제",
- "permanentDelete": "모든 스레드가 영구적으로 삭제됩니다.",
"permanentDeleteWarning": "이 작업은 프로젝트 내의 모든 스레드를 영구적으로 삭제합니다!",
"deleteEmptyProject": "이 작업은 \"{{projectName}}\" 프로젝트를 삭제합니다.",
"saveThreadsAdvice": "스레드를 저장하려면 삭제하기 전에 스레드 목록이나 다른 프로젝트로 이동하세요.",
@@ -316,7 +311,6 @@
"updateSuccess": "\"{{projectName}}\" 프로젝트가 성공적으로 업데이트되었습니다"
},
"noConversationsIn": "{{projectName}}에 대화가 없습니다",
- "startNewConversation": "아래에서 {{projectName}}와(과) 새 대화를 시작하세요",
"conversationsIn": "{{projectName}}의 대화",
"conversationsDescription": "대화를 클릭하여 채팅을 계속하거나 아래에서 새 대화를 시작하세요.",
"conversation": "대화",
@@ -332,7 +326,8 @@
"update": "업데이트",
"searchProjects": "프로젝트 검색...",
"noProjectsFound": "프로젝트를 찾을 수 없습니다",
- "tryDifferentSearch": "다른 검색어를 시도해 보세요"
+ "tryDifferentSearch": "다른 검색어를 시도해 보세요",
+ "viewProject": "프로젝트 보기"
},
"attachmentsIngestion": {
"title": "첨부 파일 수집 방식 선택",
@@ -475,5 +470,14 @@
"forceQuit": "Force quit",
"forcing": "Force quitting…",
"shuttingDown": "Shutting down…"
+ },
+ "chatsAndTasks": "채팅 및 작업",
+ "artifacts": "아티팩트",
+ "skills": "스킬",
+ "deleteSession": "세션 삭제",
+ "deleteSessionTitle": "세션을 삭제할까요?",
+ "deleteSessionBody": "“{{title}}”과(와) 해당 기록이 영구적으로 삭제됩니다. 이 작업은 되돌릴 수 없습니다.",
+ "sidebar": {
+ "more": "더 보기"
}
}
diff --git a/web-app/src/locales/pl/common.json b/web-app/src/locales/pl/common.json
index 37648f975..5f56c917d 100644
--- a/web-app/src/locales/pl/common.json
+++ b/web-app/src/locales/pl/common.json
@@ -229,10 +229,6 @@
"cancel": "Anuluj",
"changeLocation": "Zmień Położenie"
},
- "deleteAllThreads": {
- "title": "Usuń Wszystkie Wątki",
- "description": "Wszystkie wątki zostaną usunięte. Tej operacji nie można cofnąć."
- },
"deleteThread": {
"description": "Na pewno chcesz usunąć ten wątek? Tej operacji nie można cofnąć."
},
@@ -262,7 +258,6 @@
"deleteProjectDialog": {
"title": "Usuń Projekt",
"description": "Na pewno chcesz usunąć ten projekt? Tej operacji nie można cofnąć.",
- "permanentDelete": "To spowoduje trwałe usunięcie wszystkich wątków.",
"permanentDeleteWarning": "Ta operacja spowoduje trwałe usunięcie WSZYSTKICH wątków w projekcie!",
"deleteEmptyProject": "Ta operacja usunie projekt \"{{projectName}}\".",
"saveThreadsAdvice": "Aby zapisać wątki, przenieś je do listy wątków lub innego projektu przed usunięciem.",
@@ -285,7 +280,6 @@
"renameSuccess": "Projekt zmieniono z \"{{oldName}}\" na \"{{newName}}\""
},
"noConversationsIn": "Brak Rozmów w {{projectName}}",
- "startNewConversation": "Rozpocznij nową rozmowę z {{projectName}} poniżej",
"conversationsIn": "Rozmowy w {{projectName}}",
"conversationsDescription": "Kliknij na dowolną rozmowę aby kontynuować czat, lub rozpocznij nową poniżej.",
"thread": "wątek",
@@ -298,7 +292,8 @@
"noProjectsFound": "Nie znaleziono projektów",
"tryDifferentSearch": "Spróbuj innego wyszukiwania",
"uploadingFiles": "Przetwarzanie plików…",
- "processButton": "Dodaj"
+ "processButton": "Dodaj",
+ "viewProject": "Wyświetl projekt"
},
"errorDialog": {
"titleFallback": "Coś poszło nie tak",
@@ -406,5 +401,14 @@
"forceQuit": "Force quit",
"forcing": "Force quitting…",
"shuttingDown": "Shutting down…"
+ },
+ "chatsAndTasks": "Czaty i zadania",
+ "artifacts": "Artefakty",
+ "skills": "Umiejętności",
+ "deleteSession": "Usuń sesję",
+ "deleteSessionTitle": "Usunąć sesję?",
+ "deleteSessionBody": "„{{title}}” i jej transkrypcja zostaną trwale usunięte. Tej operacji nie można cofnąć.",
+ "sidebar": {
+ "more": "Więcej"
}
}
diff --git a/web-app/src/locales/pt-BR/common.json b/web-app/src/locales/pt-BR/common.json
index e11a5b691..82e69294d 100644
--- a/web-app/src/locales/pt-BR/common.json
+++ b/web-app/src/locales/pt-BR/common.json
@@ -233,10 +233,6 @@
"cancel": "Cancelar",
"changeLocation": "Alterar Localização"
},
- "deleteAllThreads": {
- "title": "Remover Todas as Conversas",
- "description": "Todas as conversas serão removidas. Esta ação não pode ser desfeita."
- },
"deleteThread": {
"description": "Tem certeza de que deseja remover esta conversa? Esta ação não pode ser desfeita."
},
@@ -265,7 +261,6 @@
"projectNotFoundDesc": "O projeto que você está procurando não existe ou foi removido.",
"deleteProjectDialog": {
"title": "Remover Projeto",
- "permanentDelete": "ThiIsso removerá permanentemente todas as conversas.",
"permanentDeleteWarning": "Esta ação removerá permanentemente TODAS as conversas dentro do projeto!",
"deleteEmptyProject": "Esta ação removerá o projeto \"{{projectName}}\".",
"saveThreadsAdvice": "Para salvar conversas, mova-as para sua lista de conversas ou outro projeto antes de remover.",
@@ -288,7 +283,6 @@
"renameSuccess": "Projeto renomeado de \"{{oldName}}\" para \"{{newName}}\""
},
"noConversationsIn": "Nenhuma Conversa em {{projectName}}",
- "startNewConversation": "Inicie uma nova conversa com {{projectName}} abaixo",
"conversationsIn": "Conversas em {{projectName}}",
"conversationsDescription": "Clique em qualquer conversa para continuar o chat, ou inicie uma nova abaixo.",
"thread": "conversa",
@@ -301,7 +295,8 @@
"noProjectsFound": "Nenhum projeto encontrado",
"tryDifferentSearch": "Tente um termo de busca diferente",
"uploadingFiles": "Processando arquivos…",
- "processButton": "Adicionar"
+ "processButton": "Adicionar",
+ "viewProject": "Ver projeto"
},
"errorDialog": {
"titleFallback": "Algo deu errado",
@@ -407,5 +402,14 @@
"forceQuit": "Force quit",
"forcing": "Force quitting…",
"shuttingDown": "Shutting down…"
+ },
+ "chatsAndTasks": "Conversas e tarefas",
+ "artifacts": "Artefatos",
+ "skills": "Habilidades",
+ "deleteSession": "Excluir sessão",
+ "deleteSessionTitle": "Excluir sessão?",
+ "deleteSessionBody": "“{{title}}” e a transcrição dela serão excluídas permanentemente. Esta ação não pode ser desfeita.",
+ "sidebar": {
+ "more": "Mais"
}
}
diff --git a/web-app/src/locales/ru/common.json b/web-app/src/locales/ru/common.json
index f083c04ab..146ea520e 100644
--- a/web-app/src/locales/ru/common.json
+++ b/web-app/src/locales/ru/common.json
@@ -236,10 +236,6 @@
"cancel": "Отмена",
"changeLocation": "Изменить расположение"
},
- "deleteAllThreads": {
- "title": "Удаление всех обсуждений",
- "description": "Все обсуждения будут удалены. Это действие нельзя отменить."
- },
"deleteThread": {
"description": "Вы уверены, что хотите удалить это обсуждение? Это действие нельзя отменить."
},
@@ -268,7 +264,6 @@
"projectNotFoundDesc": "Проект, который вы ищете, не существует или был удалён.",
"deleteProjectDialog": {
"title": "Удалить проект",
- "permanentDelete": "Это навсегда удалит все обсуждения.",
"permanentDeleteWarning": "Это действие навсегда удалит ВСЕ обсуждения в проекте!",
"deleteEmptyProject": "Это действие удалит проект \"{{projectName}}\".",
"saveThreadsAdvice": "Чтобы сохранить обсуждения, переместите их в общий список или в другой проект перед удалением.",
@@ -291,7 +286,6 @@
"renameSuccess": "Проект переименован с \"{{oldName}}\" на \"{{newName}}\""
},
"noConversationsIn": "В проекте {{projectName}} нет диалогов",
- "startNewConversation": "Начните новый диалог с {{projectName}} ниже",
"conversationsIn": "Диалоги в {{projectName}}",
"conversationsDescription": "Нажмите на любой диалог, чтобы продолжить общение, или начните новый ниже.",
"thread": "обсуждение",
@@ -304,7 +298,8 @@
"noProjectsFound": "Проекты не найдены",
"tryDifferentSearch": "Попробуйте другой поисковый запрос",
"uploadingFiles": "Обработка файлов…",
- "processButton": "Добавить"
+ "processButton": "Добавить",
+ "viewProject": "Открыть проект"
},
"attachmentsIngestion": {
"title": "Выберите способ обработки вложений",
@@ -416,5 +411,14 @@
"forceQuit": "Force quit",
"forcing": "Force quitting…",
"shuttingDown": "Shutting down…"
+ },
+ "chatsAndTasks": "Чаты и задачи",
+ "artifacts": "Артефакты",
+ "skills": "Навыки",
+ "deleteSession": "Удалить сеанс",
+ "deleteSessionTitle": "Удалить сеанс?",
+ "deleteSessionBody": "«{{title}}» и его стенограмма будут удалены безвозвратно. Это действие нельзя отменить.",
+ "sidebar": {
+ "more": "Ещё"
}
}
diff --git a/web-app/src/locales/vn/common.json b/web-app/src/locales/vn/common.json
index 543b72a55..817a905e2 100644
--- a/web-app/src/locales/vn/common.json
+++ b/web-app/src/locales/vn/common.json
@@ -243,7 +243,6 @@
"addToProject": "Thêm vào dự án",
"removeFromProject": "Xóa khỏi dự án",
"noConversationsIn": "Chưa có cuộc trò chuyện nào trong {{projectName}}",
- "startNewConversation": "Bắt đầu một cuộc trò chuyện mới với {{projectName}} bên dưới",
"conversationsIn": "Cuộc trò chuyện trong {{projectName}}",
"conversationsDescription": "Nhấp vào bất kỳ cuộc trò chuyện nào để tiếp tục trò chuyện hoặc bắt đầu một cuộc trò chuyện mới bên dưới.",
"thread": "chủ đề",
@@ -260,7 +259,6 @@
"processButton": "Thêm",
"deleteProjectDialog": {
"title": "Xóa dự án",
- "permanentDelete": "Điều này sẽ xóa vĩnh viễn tất cả các chủ đề.",
"permanentDeleteWarning": "Hành động này sẽ xóa vĩnh viễn TẤT CẢ các chủ đề trong dự án!",
"deleteEmptyProject": "Hành động này sẽ xóa dự án \"{{projectName}}\".",
"saveThreadsAdvice": "Để lưu các chủ đề, hãy di chuyển chúng vào danh sách chủ đề của bạn hoặc dự án khác trước khi xóa.",
@@ -281,7 +279,8 @@
"alreadyExists": "Dự án \"{{projectName}}\" đã tồn tại",
"createSuccess": "Dự án \"{{projectName}}\" đã được tạo thành công",
"renameSuccess": "Dự án đã được đổi tên từ \"{{oldName}}\" thành \"{{newName}}\""
- }
+ },
+ "viewProject": "Xem dự án"
},
"dialogs": {
"changeDataFolder": {
@@ -292,10 +291,6 @@
"cancel": "Hủy",
"changeLocation": "Thay đổi vị trí"
},
- "deleteAllThreads": {
- "title": "Xóa tất cả các chủ đề",
- "description": "Tất cả các chủ đề sẽ bị xóa. Hành động này không thể hoàn tác."
- },
"deleteThread": {
"description": "Bạn có chắc chắn muốn xóa cuộc trò chuyện này không? Hành động này không thể hoàn tác."
},
@@ -406,5 +401,15 @@
"forceQuit": "Force quit",
"forcing": "Force quitting…",
"shuttingDown": "Shutting down…"
+ },
+ "agentSettings": "Tác nhân",
+ "chatsAndTasks": "Trò chuyện và tác vụ",
+ "artifacts": "Tạo phẩm",
+ "skills": "Kỹ năng",
+ "deleteSession": "Xóa phiên",
+ "deleteSessionTitle": "Xóa phiên?",
+ "deleteSessionBody": "“{{title}}” và bản ghi của phiên sẽ bị xóa vĩnh viễn. Không thể hoàn tác thao tác này.",
+ "sidebar": {
+ "more": "Thêm"
}
}
diff --git a/web-app/src/locales/zh-CN/common.json b/web-app/src/locales/zh-CN/common.json
index e5faa9946..b9853fbda 100644
--- a/web-app/src/locales/zh-CN/common.json
+++ b/web-app/src/locales/zh-CN/common.json
@@ -297,7 +297,6 @@
"addToProject": "移动到项目",
"removeFromProject": "从项目中删除",
"noConversationsIn": "{{projectName}} 中还没有对话",
- "startNewConversation": "在下方开始与 {{projectName}} 的新对话",
"conversationsIn": "{{projectName}} 中的对话",
"conversationsDescription": "点击任何对话以继续聊天,或在下方开始新的对话。",
"thread": "对话",
@@ -315,7 +314,7 @@
"createNewProject": "创建新项目",
"deleteProjectDialog": {
"title": "删除项目",
- "permanentDelete": "这将永久删除所有对话。",
+ "permanentDelete": "这将永久删除“{{projectName}}”及其所有对话。此操作无法撤销。",
"permanentDeleteWarning": "此操作将永久删除项目内的所有对话!",
"deleteEmptyProject": "此操作将删除项目\"{{projectName}}\"。",
"saveThreadsAdvice": "要保存对话,请在删除前将它们移动到您的对话列表或另一个项目中。",
@@ -336,7 +335,9 @@
"alreadyExists": "项目\"{{projectName}}\"已存在",
"createSuccess": "项目\"{{projectName}}\"创建成功",
"renameSuccess": "项目从\"{{oldName}}\"重命名为\"{{newName}}\""
- }
+ },
+ "viewProject": "查看项目",
+ "sendMessageToStart": "在上方发送消息即可开始。"
},
"dialogs": {
"changeDataFolder": {
@@ -347,10 +348,6 @@
"cancel": "取消",
"changeLocation": "更改位置"
},
- "deleteAllThreads": {
- "title": "删除所有会话",
- "description": "所有会话将被删除。此操作无法撤销。"
- },
"deleteThread": {
"description": "确定删除此对话?此操作无法撤销。"
},
@@ -359,6 +356,10 @@
},
"messageMetadata": {
"title": "消息元数据"
+ },
+ "deleteAllChats": {
+ "title": "删除项目外的对话",
+ "description": "这将删除不在任何项目中的对话。项目中的对话、已加星标的对话和任务将被保留。此操作无法撤销。"
}
},
"errorDialog": {
@@ -453,6 +454,10 @@
"threadRemovedFromProject": {
"title": "对话已移除",
"description": "对话已成功从\"{{projectName}}\"中移除"
+ },
+ "deleteAllChats": {
+ "title": "对话已删除",
+ "description": "已删除项目外的对话,项目中的对话和任务已保留。"
}
},
"llamacppBusyOnExit": {
@@ -598,5 +603,15 @@
"notReadyTitle": "此对话尚未就绪",
"notReadyDescription": "Jan 无法确认此对话是聊天还是 Cowork 任务。请重试;如果问题仍然存在,请重启应用。",
"retry": "重试"
+ },
+ "agentSettings": "智能体",
+ "chatsAndTasks": "聊天和任务",
+ "artifacts": "产物",
+ "skills": "技能",
+ "deleteSession": "删除会话",
+ "deleteSessionTitle": "删除会话?",
+ "deleteSessionBody": "“{{title}}”及其记录将被永久删除,此操作无法撤销。",
+ "sidebar": {
+ "more": "更多"
}
}
diff --git a/web-app/src/locales/zh-TW/common.json b/web-app/src/locales/zh-TW/common.json
index 53ac83cf0..e8a274ab6 100644
--- a/web-app/src/locales/zh-TW/common.json
+++ b/web-app/src/locales/zh-TW/common.json
@@ -242,7 +242,6 @@
"addToProject": "加入專案",
"removeFromProject": "從專案中移除",
"noConversationsIn": "{{projectName}} 中尚無對話",
- "startNewConversation": "在下方開始與 {{projectName}} 的新對話",
"conversationsIn": "{{projectName}} 中的對話",
"conversationsDescription": "點擊任何對話以繼續聊天,或在下方開始新的對話。",
"thread": "執行緒",
@@ -260,7 +259,6 @@
"createNewProject": "建立新專案",
"deleteProjectDialog": {
"title": "刪除專案",
- "permanentDelete": "這將永久刪除所有執行緒。",
"permanentDeleteWarning": "此操作將永久刪除專案內的所有執行緒!",
"deleteEmptyProject": "此操作將刪除專案「{{projectName}}」。",
"saveThreadsAdvice": "要儲存執行緒,請在刪除前將它們移至您的執行緒清單或另一個專案。",
@@ -281,7 +279,8 @@
"alreadyExists": "專案「{{projectName}}」已存在",
"createSuccess": "專案「{{projectName}}」已成功建立",
"renameSuccess": "專案已從「{{oldName}}」重新命名為「{{newName}}」"
- }
+ },
+ "viewProject": "檢視專案"
},
"dialogs": {
"changeDataFolder": {
@@ -292,10 +291,6 @@
"cancel": "取消",
"changeLocation": "變更位置"
},
- "deleteAllThreads": {
- "title": "刪除所有對話",
- "description": "所有對話將被刪除。此操作無法復原。"
- },
"deleteThread": {
"description": "您確定要刪除此對話嗎?此操作無法復原。"
},
@@ -406,5 +401,14 @@
"forceQuit": "Force quit",
"forcing": "Force quitting…",
"shuttingDown": "Shutting down…"
+ },
+ "chatsAndTasks": "聊天與任務",
+ "artifacts": "成品",
+ "skills": "技能",
+ "deleteSession": "刪除工作階段",
+ "deleteSessionTitle": "要刪除工作階段嗎?",
+ "deleteSessionBody": "「{{title}}」及其紀錄將被永久刪除,此操作無法復原。",
+ "sidebar": {
+ "more": "更多"
}
}
diff --git a/web-app/src/routes/project/$projectId.tsx b/web-app/src/routes/project/$projectId.tsx
index b22f52639..61e1fad26 100644
--- a/web-app/src/routes/project/$projectId.tsx
+++ b/web-app/src/routes/project/$projectId.tsx
@@ -175,7 +175,7 @@ function ProjectPageContent() {
{t('projects.noConversationsIn', { projectName: project.name })}
</h3>
<p className="text-sm text-muted-foreground">
- {t('projects.startNewConversation', { projectName: project.name })}
+ {t('projects.sendMessageToStart')}
</p>
</div>
)}