import { IconChevronDown, IconLoader2 } from '@tabler/icons-react' import { useLocation } from 'wouter' import { useAppConfig } from '@/client/api/app-config' import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, AlertDialogTrigger } from '@/client/components/ui/alert-dialog' import { Button } from '@/client/components/ui/button' import { Input } from '@/client/components/ui/input' import { useRemoveWorkspace } from '@/client/features/home/api' import { useWorkspaceLayoutCtx } from '@/client/features/workspace/workspace-layout-context' import { harnessIcon, harnessLabel } from '@/client/features/harness/harness-presentation' import { DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuRadioGroup, DropdownMenuRadioItem } from '@/client/components/ui/dropdown-menu' import { Tooltip, TooltipTrigger, TooltipContent } from '@/client/components/ui/tooltip' import { useLive } from '@/client/features/chat/chat-store' import { useChangeWorkspaceHarness } from '@/client/features/workspace/api' import { SettingsPage, SettingsRow, SettingsSection } from './settings-layout' export function GeneralSettings() { const { demo, environment } = useAppConfig() const { name, cwd, workspaceId } = useWorkspaceLayoutCtx() const [, navigate] = useLocation() const removeWorkspace = useRemoveWorkspace() const label = name ?? cwd ?? 'this space' const remove = () => { removeWorkspace.mutate(workspaceId, { onSuccess: () => navigate('/') }) } return ( {environment === 'local' && ( } /> )} {!demo && ( } disabled={removeWorkspace.isPending} > Remove Remove “{label}” from your workspaces? This only removes it from your list. The folder and its sessions stay on disk. You can add it back any time. {removeWorkspace.isError && (

{removeWorkspace.error.message}

)} Cancel {removeWorkspace.isPending && ( )} Remove
} />
)}
) } function WorkspaceHarnessSetting() { const { demo } = useAppConfig() const { workspaceId, provider } = useWorkspaceLayoutCtx() const type = provider ?? 'claude-code' const change = useChangeWorkspaceHarness(workspaceId) const active = useLive(state => Object.entries(state.activity).some( ([key, activity]) => key.startsWith(`${workspaceId}:`) && activity !== 'idle' ) ) const reason = demo ? 'Changing agents is unavailable in the demo' : type === 'hermes' || type === 'openclaw' ? 'This workspace belongs to its agent and cannot use another agent' : active ? 'Wait for the agent to finish before changing it' : undefined return ( <> }> } disabled={Boolean(reason) || change.isPending} aria-label="Agent" > {harnessLabel[type]} change.mutate(value)} > {(['claude-code', 'codex'] as const).map(option => ( {harnessLabel[option]} ))} {reason} } /> {change.error && (

{change.error.message}

)} ) }