The all-in-one local AI studio for your desktop: chat, image and video generation and a coding agent in one free, open source app. Windows and Linux. No Docker, no terminal, no cloud required.
TypeScript agentai-chatai-studioall-in-onecoding-agentdesktop-appfluximage-generationlinuxllmlocal-ailocal-llmopen-sourceprivacyself-hostedstable-diffusionuncensoreduncensored-aivideo-generationwindows
fix(agent): das x auf der Pille verlaesst auch den Vorgabeordner
purple4060f36842ab
diff --git a/src/components/chat/AgentWorkspaceBadge.tsx b/src/components/chat/AgentWorkspaceBadge.tsxindex f677d020..8f8e6448 100644--- a/src/components/chat/AgentWorkspaceBadge.tsx+++ b/src/components/chat/AgentWorkspaceBadge.tsx@@ -2,6 +2,7 @@ import { useState } from 'react'import { Folder, Shield, X } from 'lucide-react'import { useAgentModeStore } from '../../stores/agentModeStore'import { useChatStore } from '../../stores/chatStore'+import { useSettingsStore } from '../../stores/settingsStore'import { AgentWorkspaceDialog } from './AgentWorkspaceDialog'import type { AgentWorkspace } from '../../types/agent-workspace'@@ -16,6 +17,11 @@ import type { AgentWorkspace } from '../../types/agent-workspace'*/export function AgentWorkspaceBadge() {const [dialogOpen, setDialogOpen] = useState(false)+ // Gesetzt, nachdem das x den Eintrag je Chat geloescht hat und ein+ // Vorgabeordner nachruecken wuerde. Eigener Zustand, weil die Pille in+ // diesem Moment schon verschwunden ist und der Dialog trotzdem stehen+ // bleiben muss.+ const [leftInto, setLeftInto] = useState<AgentWorkspace | null>(null)const activeId = useChatStore((s) => s.activeConversationId)const isActive = useAgentModeStore((s) =>activeId ? s.agentModeActive[activeId] ?? false : false,@@ -23,27 +29,14 @@ export function AgentWorkspaceBadge() {const workspace = useAgentModeStore((s) =>activeId ? s.workspaces[activeId] : undefined,)+ const defaultWorkspace = useSettingsStore((s) => s.settings.defaultWorkspace)- if (!activeId || !isActive || !workspace) return null-- const extras = workspace.kind === 'folder' ? workspace.extraPaths ?? [] : []- const label =- workspace.kind === 'folder'- ? extras.length > 0- ? `${basename(workspace.path)} +${extras.length}`- : basename(workspace.path)- : 'Sandbox'- const Icon = workspace.kind === 'folder' ? Folder : Shield- const tone =- workspace.kind === 'folder'- // Picked folder = neutral / no colour (David 2026-06-06) — the amber read- // as an alert. Text + Folder icon inherit this gray. Sandbox stays green.- ? 'text-gray-500 dark:text-gray-400 border-gray-200 dark:border-white/10'- : 'text-emerald-500 border-emerald-500/30'+ if (!activeId) return nullconst handleChoose = (next: AgentWorkspace) => {useAgentModeStore.getState().setWorkspace(activeId, next)setDialogOpen(false)+ setLeftInto(null)}// helpslowlydying, 01.09.2026: der Agent stand in einem riesigen Baum, in dem@@ -51,11 +44,49 @@ export function AgentWorkspaceBadge() {// konnte den Ordner wechseln, nicht ihn verlassen; clearWorkspace gab es im// Speicher, nur hat es niemand aufgerufen. Jetzt liegt es hier, direkt an der// Stelle, an der der Nutzer den Ordner sieht.+ //+ // R2-1: der Eintrag je Chat war nur die obere Haelfte. `resolveWorkspace`+ // faellt danach auf `settings.defaultWorkspace` zurueck, und der Umschalter+ // ueberspringt bei gesetztem Vorgabeordner den Dialog. Der Agent behielt also+ // Schreib- und Shellzugriff auf genau den Baum, den der Nutzer eben verlassen+ // hat. Steht ein Vorgabeordner, geht deshalb der Dialog auf: er ist die+ // einzige Stelle mit "Forget it". Ohne Vorgabeordner bleibt es beim+ // bisherigen Verhalten, die Pille geht weg und der Agent fragt neu.const handleLeave = () => {useAgentModeStore.getState().clearWorkspace(activeId)setDialogOpen(false)+ if (defaultWorkspace) setLeftInto(defaultWorkspace)+ }++ if (leftInto) {+ return (+ <AgentWorkspaceDialog+ open={true}+ conversationId={activeId}+ initialWorkspace={leftInto}+ onChoose={handleChoose}+ onClose={() => setLeftInto(null)}+ />+ )}+ if (!isActive || !workspace) return null++ const extras = workspace.kind === 'folder' ? workspace.extraPaths ?? [] : []+ const label =+ workspace.kind === 'folder'+ ? extras.length > 0+ ? `${basename(workspace.path)} +${extras.length}`+ : basename(workspace.path)+ : 'Sandbox'+ const Icon = workspace.kind === 'folder' ? Folder : Shield+ const tone =+ workspace.kind === 'folder'+ // Picked folder = neutral / no colour (David 2026-06-06) — the amber read+ // as an alert. Text + Folder icon inherit this gray. Sandbox stays green.+ ? 'text-gray-500 dark:text-gray-400 border-gray-200 dark:border-white/10'+ : 'text-emerald-500 border-emerald-500/30'+return (<><span className={`flex items-center rounded border transition-colors text-[0.55rem] ${tone}`}>diff --git a/src/components/chat/__tests__/agent-workspace-leave.test.tsx b/src/components/chat/__tests__/agent-workspace-leave.test.tsxindex a69469dd..62ad4a4a 100644--- a/src/components/chat/__tests__/agent-workspace-leave.test.tsx+++ b/src/components/chat/__tests__/agent-workspace-leave.test.tsx@@ -14,6 +14,7 @@ import { AgentWorkspaceBadge } from '../AgentWorkspaceBadge'import { useAgentModeStore } from '../../../stores/agentModeStore'import { useChatStore } from '../../../stores/chatStore'import { useSettingsStore } from '../../../stores/settingsStore'+import { resolveWorkspace } from '../../../api/agents/workspace-resolve'const CONV = 'conv-e'@@ -24,8 +25,17 @@ beforeEach(() => {agentModeActive: { [CONV]: true },workspaces: { [CONV]: { kind: 'folder', path: '/Users/x/enormous-monorepo' } },})+ useSettingsStore.getState().updateSettings({ defaultWorkspace: null })})+/** Was der Agent nach dem Klick wirklich sieht, beide Schichten zusammen. */+function effectiveWorkspace() {+ return resolveWorkspace({+ perChat: useAgentModeStore.getState().workspaces[CONV],+ defaultWorkspace: useSettingsStore.getState().settings.defaultWorkspace,+ })+}+describe('leaving a workspace', () => {it('shows the folder and an explicit way out', () => {render(<AgentWorkspaceBadge />)@@ -56,6 +66,44 @@ describe('leaving a workspace', () => {})})+/**+ * R2-1: das x loeschte nur den Eintrag je Chat. workspace-resolve.ts faellt+ * danach sofort auf settings.defaultWorkspace zurueck, und AgentModeToggle+ * steigt bei gesetztem Vorgabeordner ohne Dialog aus. Der Agent behielt damit+ * Schreib- und Shellzugriff auf einen Baum, den der Nutzer gerade verlassen+ * hatte, und der einzige Knopf dagegen lag hinter einem Dialog, den niemand+ * mehr oeffnen konnte.+ */+describe('leaving while a default workspace is remembered', () => {+ it('opens the dialog that owns Forget it, and forgetting really empties both layers', () => {+ useSettingsStore.getState().updateSettings({+ defaultWorkspace: { kind: 'folder', path: '/Users/x/enormous-monorepo' },+ })+ render(<AgentWorkspaceBadge />)+ fireEvent.click(screen.getByTestId('agent-workspace-leave'))++ // Der Eintrag je Chat ist weg, der Vorgabeordner wuerde aber nachruecken.+ expect(useAgentModeStore.getState().workspaces[CONV]).toBeUndefined()+ expect(effectiveWorkspace()).toEqual({ kind: 'folder', path: '/Users/x/enormous-monorepo' })++ expect(screen.getByTestId('agent-workspace-default-note').textContent)+ .toContain('/Users/x/enormous-monorepo')+ fireEvent.click(screen.getByTestId('agent-workspace-forget-default'))++ expect(useSettingsStore.getState().settings.defaultWorkspace).toBeNull()+ expect(effectiveWorkspace()).toBeNull()+ })++ it('stays quiet without a remembered default, and the agent is nowhere', () => {+ render(<AgentWorkspaceBadge />)+ fireEvent.click(screen.getByTestId('agent-workspace-leave'))++ expect(screen.queryByTestId('agent-workspace-default-note')).toBeNull()+ expect(screen.queryByTestId('agent-workspace-options')).toBeNull()+ expect(effectiveWorkspace()).toBeNull()+ })+})+describe('the remembered default', () => {it('can be forgotten, so a new agent chat asks again', async () => {useSettingsStore.getState().updateSettings({