The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
feat(conversations): add thread workspace chip
Steven Enamakelceea3e001bb4
diff --git a/app/src/features/conversations/aui/ThreadWorkspaceChip.tsx b/app/src/features/conversations/aui/ThreadWorkspaceChip.tsxnew file mode 100644index 0000000000..7e4088221d--- /dev/null+++ b/app/src/features/conversations/aui/ThreadWorkspaceChip.tsx@@ -0,0 +1,89 @@+/**+ * Store-connected {@link WorkspacePicker} for one thread. Renders only while+ * the thread has no messages — the core refuses to move a started thread —+ * and binds the choice through `updateThreadWorkingDir`.+ */+import debugFactory from 'debug';+import { useEffect, useMemo, useState } from 'react';++import { useT } from '../../../lib/i18n/I18nContext';+import { useAppDispatch, useAppSelector } from '../../../store/hooks';+import { updateThreadWorkingDir } from '../../../store/threadSlice';+import { openhumanGetAgentPaths } from '../../../utils/tauriCommands/config';+import { pickDirectoryNatively } from '../../../utils/tauriCommands/directoryPicker';+import { isTauri } from '../../../utils/tauriCommands/common';+import { recentWorkingFolders, WorkspacePicker } from './WorkspacePicker';++const debug = debugFactory('conversations:workspace');++export function ThreadWorkspaceChip({ threadId }: { threadId: string | null }) {+ const { t } = useT();+ const dispatch = useAppDispatch();+ const threads = useAppSelector(state => state.thread.threads);+ const thread = threadId ? threads.find(candidate => candidate.id === threadId) : undefined;+ const [defaultDir, setDefaultDir] = useState<string | null>(null);+ const [saving, setSaving] = useState(false);+ const [error, setError] = useState<string | null>(null);++ useEffect(() => {+ let cancelled = false;+ void openhumanGetAgentPaths()+ .then(res => {+ if (!cancelled) setDefaultDir(res.result?.action_dir ?? null);+ })+ .catch((err: unknown) => {+ debug('agent paths unavailable: %s', err instanceof Error ? err.message : String(err));+ });+ return () => {+ cancelled = true;+ };+ }, []);++ // A new thread starts with no error from the previous one.+ useEffect(() => setError(null), [threadId]);++ const value = thread?.actionDir ?? null;+ const recent = useMemo(+ () => recentWorkingFolders(threads, [value, defaultDir]),+ [threads, value, defaultDir]+ );++ if (!thread || thread.messageCount > 0) return null;++ const bind = (dir: string | null) => {+ if (dir === value) return;+ setSaving(true);+ setError(null);+ debug('[chat][workspace] bind thread=%s default=%s', thread.id, dir === null);+ void dispatch(updateThreadWorkingDir({ threadId: thread.id, actionDir: dir }))+ .unwrap()+ .catch((err: unknown) => {+ debug('[chat][workspace] bind failed thread=%s', thread.id);+ setError(typeof err === 'string' && err ? err : t('composer.workspace.error'));+ })+ .finally(() => setSaving(false));+ };++ const chooseFolder = async () => {+ const picked = await pickDirectoryNatively();+ if (picked.ok) {+ bind(picked.path);+ } else if (picked.reason === 'failed') {+ setError(t('composer.workspace.error'));+ }+ };++ return (+ <WorkspacePicker+ value={value}+ defaultDir={defaultDir}+ recent={recent}+ onChange={bind}+ onChooseFolder={isTauri() ? () => void chooseFolder() : undefined}+ disabled={saving}+ error={error}+ />+ );+}++export default ThreadWorkspaceChip;