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
v2.5.0 W1+W2: wire AgentWorkspace dialog + badge into chat UI
purple319f7f42c954
diff --git a/src/components/chat/AgentModeToggle.tsx b/src/components/chat/AgentModeToggle.tsxindex e3e2079d..d694d54d 100644--- a/src/components/chat/AgentModeToggle.tsx+++ b/src/components/chat/AgentModeToggle.tsx@@ -10,11 +10,19 @@ import { useSettingsStore } from '../../stores/settingsStore'import { isAgentCompatible } from '../../lib/model-compatibility'import { FEATURE_FLAGS } from '../../lib/constants'import { AgentTutorial } from './AgentTutorial'+import { AgentWorkspaceDialog } from './AgentWorkspaceDialog'+import type { AgentWorkspace } from '../../types/agent-workspace'export function AgentModeToggle() {const [showTutorial, setShowTutorial] = useState(false)const [showNewChatModal, setShowNewChatModal] = useState(false)const [neverShowChecked, setNeverShowChecked] = useState(false)+ // Workspace picker — opens after a fresh agent-mode activation when+ // the conversation doesn't yet have a workspace assigned. Cancelable+ // (the bridge falls back to its per-chat sandbox), but offered so+ // power users can point the agent at a real folder up front.+ const [showWorkspaceDialog, setShowWorkspaceDialog] = useState(false)+ const [workspaceDialogConvId, setWorkspaceDialogConvId] = useState<string | null>(null)const activeConversationId = useChatStore((s) => s.activeConversationId)const conversations = useChatStore((s) => s.conversations)const createConversation = useChatStore((s) => s.createConversation)@@ -29,6 +37,21 @@ export function AgentModeToggle() {const conversation = conversations.find((c) => c.id === activeConversationId)const hasMessages = (conversation?.messages?.length ?? 0) > 0+ /**+ * After an agent-mode activate, if the conversation hasn't picked a+ * workspace yet, open AgentWorkspaceDialog so the user can choose+ * between sandbox and a real folder. Skipped when a workspace is+ * already set (toggling back on after a deactivate) or when the user+ * has a `settings.defaultWorkspace` configured.+ */+ const maybeOpenWorkspaceDialog = (convId: string) => {+ const hasPerChat = !!useAgentModeStore.getState().workspaces[convId]+ const hasDefault = !!useSettingsStore.getState().settings.defaultWorkspace+ if (hasPerChat || hasDefault) return+ setWorkspaceDialogConvId(convId)+ setShowWorkspaceDialog(true)+ }+const createNewAgentChat = () => {if (!activeModel) returnconst persona = useSettingsStore.getState().getActivePersona()@@ -37,6 +60,7 @@ export function AgentModeToggle() {useAgentModeStore.getState().setTutorialCompleted()}useAgentModeStore.getState().toggleAgentMode(newId)+ maybeOpenWorkspaceDialog(newId)}const handleToggle = () => {@@ -60,12 +84,16 @@ export function AgentModeToggle() {}toggleAgentMode(activeConversationId)+ // If the user just turned agent ON (was inactive, now active) and+ // hasn't picked a workspace for this conversation, prompt for one.+ if (!isActive) maybeOpenWorkspaceDialog(activeConversationId)}const handleTutorialComplete = () => {setShowTutorial(false)useAgentModeStore.getState().setTutorialCompleted()toggleAgentMode(activeConversationId)+ maybeOpenWorkspaceDialog(activeConversationId)}const handleNewAgentChat = () => {@@ -77,6 +105,20 @@ export function AgentModeToggle() {setNeverShowChecked(false)}+ const handleWorkspaceChoose = (workspace: AgentWorkspace) => {+ if (workspaceDialogConvId) {+ useAgentModeStore.getState().setWorkspace(workspaceDialogConvId, workspace)+ }+ setShowWorkspaceDialog(false)+ setWorkspaceDialogConvId(null)+ }++ const handleWorkspaceClose = () => {+ // Cancel just dismisses — bridge will fall back to per-chat sandbox.+ setShowWorkspaceDialog(false)+ setWorkspaceDialogConvId(null)+ }+return (<><ToggleSwitch@@ -148,6 +190,15 @@ export function AgentModeToggle() {onComplete={handleTutorialComplete}/>)}++ {showWorkspaceDialog && workspaceDialogConvId && (+ <AgentWorkspaceDialog+ open={showWorkspaceDialog}+ conversationId={workspaceDialogConvId}+ onChoose={handleWorkspaceChoose}+ onClose={handleWorkspaceClose}+ />+ )}</>)}diff --git a/src/components/chat/ChatView.tsx b/src/components/chat/ChatView.tsxindex 2205a598..5e336d93 100644--- a/src/components/chat/ChatView.tsx+++ b/src/components/chat/ChatView.tsx@@ -9,6 +9,7 @@ import { MessageList } from './MessageList'import { ChatInput } from './ChatInput'import { RAGPanel } from './RAGPanel'import { AgentModeToggle } from './AgentModeToggle'+import { AgentWorkspaceBadge } from './AgentWorkspaceBadge'import { ErrorBoundary } from '../ui/ErrorBoundary'import { useSettingsStore } from '../../stores/settingsStore'import { FEATURE_FLAGS } from '../../lib/constants'@@ -276,6 +277,10 @@ export function ChatView() {<Bot size={10} /><span>Agent</span><AgentModeToggle />+ {/* Workspace badge — only renders when agent mode is+ on AND a workspace has been chosen. Click pops+ AgentWorkspaceDialog so the user can swap mid-chat. */}+ <AgentWorkspaceBadge /></div>)}</div>diff --git a/src/stores/agentModeStore.ts b/src/stores/agentModeStore.tsindex b1856d5a..f7973c3e 100644--- a/src/stores/agentModeStore.ts+++ b/src/stores/agentModeStore.ts@@ -1,11 +1,24 @@import { create } from 'zustand'import { persist } from 'zustand/middleware'import type { SandboxLevel } from '../types/agent-mode'+import type { AgentWorkspace } from '../types/agent-workspace'interface AgentModeState {// Per-conversation agent mode toggleagentModeActive: Record<string, boolean>+ // Per-conversation workspace pick (Sprint C #8 — Multi-Repo Agent).+ // Map keyed by conversation id; missing entry → no workspace chosen+ // yet. AgentWorkspaceDialog reads this on activate-time to know whether+ // it should pop up.+ workspaces: Record<string, AgentWorkspace>++ // Last folder the user picked from the "Use last folder" shortcut in+ // AgentWorkspaceDialog. Carries over across chats so the user doesn't+ // have to re-browse to the same repo every time. Updated by+ // setWorkspace() whenever a folder-kind workspace is saved.+ lastFolder: string | undefined+// SettingssandboxLevel: SandboxLeveltutorialCompleted: boolean@@ -14,6 +27,8 @@ interface AgentModeState {// ActionstoggleAgentMode: (conversationId: string) => voidsetAgentModeActive: (conversationId: string, active: boolean) => void+ setWorkspace: (conversationId: string, workspace: AgentWorkspace) => void+ clearWorkspace: (conversationId: string) => voidsetSandboxLevel: (level: SandboxLevel) => voidsetTutorialCompleted: () => voidresetTutorial: () => void@@ -25,6 +40,8 @@ export const useAgentModeStore = create<AgentModeState>()(persist((set, get) => ({agentModeActive: {},+ workspaces: {},+ lastFolder: undefined,sandboxLevel: 'restricted',tutorialCompleted: false,newChatHintDismissed: false,@@ -45,6 +62,28 @@ export const useAgentModeStore = create<AgentModeState>()(},})),+ setWorkspace: (conversationId, workspace) =>+ set((state) => ({+ workspaces: {+ ...state.workspaces,+ [conversationId]: workspace,+ },+ // Folder-kind picks update the "last folder" shortcut so the+ // next AgentWorkspaceDialog can offer it. Sandbox picks don't+ // change the shortcut — that would erase a useful default.+ lastFolder:+ workspace.kind === 'folder' && workspace.path+ ? workspace.path+ : state.lastFolder,+ })),++ clearWorkspace: (conversationId) =>+ set((state) => {+ const next = { ...state.workspaces }+ delete next[conversationId]+ return { workspaces: next }+ }),+setSandboxLevel: (level) => set({ sandboxLevel: level }),setTutorialCompleted: () => set({ tutorialCompleted: true }),