Skip to content

armgit / avibe

Public Imported from GitHub
0

Make your computer a home for your AI partner. Avibe is the local-first Agent OS: Vibey, its built-in AI partner, works out of the box, and Claude Code, Codex & OpenCode run unchanged beside it — reach them from your browser, phone, or any chat app.

fix(workbench): chat layout + folder picker polish from feedback

cyhe19f13fadd1f
diff --git a/ui/src/components/ui/directory-browser.tsx b/ui/src/components/ui/directory-browser.tsx
index 5e90d7d20..d811ec8dd 100644
--- a/ui/src/components/ui/directory-browser.tsx
+++ b/ui/src/components/ui/directory-browser.tsx
@@ -11,6 +11,7 @@ import {
FolderOpen,
FolderPlus,
Home,
+ Keyboard,
Monitor,
RefreshCw,
X,
@@ -61,6 +62,19 @@ export const DirectoryBrowser: React.FC<DirectoryBrowserProps> = ({
const [createError, setCreateError] = useState<string | null>(null);
const newFolderInputRef = useRef<HTMLInputElement | null>(null);
+ // Manual-path mode — flips the breadcrumb into an editable text input
+ // (mirrors Finder's Cmd+Shift+G behavior) so users can paste an
+ // arbitrary path and navigate to it directly.
+ const [pathEditing, setPathEditing] = useState(false);
+ const [pathInput, setPathInput] = useState('');
+ const [pathError, setPathError] = useState<string | null>(null);
+ const pathInputRef = useRef<HTMLInputElement | null>(null);
+
+ // Which favorites actually resolve on this filesystem. On Linux the
+ // Desktop/Documents/Downloads shortcuts often don't exist, so we hide
+ // them rather than handing the user a row that always 404s.
+ const [favoriteExists, setFavoriteExists] = useState<Record<string, boolean>>({});
+
const mountedRef = useRef(true);
const reqIdRef = useRef(0);
@@ -178,6 +192,55 @@ export const DirectoryBrowser: React.FC<DirectoryBrowserProps> = ({
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
+ // Probe each non-home favorite once on open. We hit the backend with a
+ // single browse call per favorite — fast enough since it's only three
+ // shortcuts — and drop the ones that come back !ok. Home is always
+ // shown because every user has one.
+ useEffect(() => {
+ let cancelled = false;
+ const targets = ['~/Desktop', '~/Documents', '~/Downloads'];
+ Promise.all(
+ targets.map((path) =>
+ api
+ .browseDirectory(path, false)
+ .then((res) => ({ path, exists: !!res.ok }))
+ .catch(() => ({ path, exists: false })),
+ ),
+ ).then((results) => {
+ if (cancelled) return;
+ setFavoriteExists(Object.fromEntries(results.map((r) => [r.path, r.exists])));
+ });
+ return () => {
+ cancelled = true;
+ };
+ }, [api]);
+
+ useEffect(() => {
+ if (pathEditing) {
+ // Pre-fill with the current path so the user can edit it instead
+ // of typing from scratch — that's the common case.
+ setPathInput(currentPath);
+ setPathError(null);
+ pathInputRef.current?.focus();
+ pathInputRef.current?.select();
+ }
+ }, [pathEditing, currentPath]);
+
+ const submitManualPath = async () => {
+ const target = pathInput.trim();
+ if (!target) return;
+ setPathError(null);
+ const resolved = await fetchPath(target);
+ if (resolved) {
+ // Mirror `navigate` history bookkeeping so the back arrow works.
+ setHistory((prev) => [...prev.slice(0, historyIndex + 1), resolved]);
+ setHistoryIndex((prev) => prev + 1);
+ setPathEditing(false);
+ } else {
+ setPathError(t('directoryBrowser.pathNotFound'));
+ }
+ };
+
const toggleHidden = () => {
const next = !showHidden;
setShowHidden(next);
@@ -234,13 +297,17 @@ export const DirectoryBrowser: React.FC<DirectoryBrowserProps> = ({
// Static shortcuts mirroring Finder's Favorites column. We just hand
// these to the existing `browseDirectory` endpoint — the backend
- // expands ``~`` so we don't need to resolve them client-side.
- const favorites: { i18nKey: string; path: string; icon: React.ReactNode }[] = [
- { i18nKey: 'directoryBrowser.favoritesHome', path: '~', icon: <Home className="size-3.5" /> },
+ // expands ``~`` so we don't need to resolve them client-side. Home is
+ // always shown; the other three are gated by ``favoriteExists`` so
+ // Linux installations without Desktop/Documents/Downloads don't see
+ // dead rows.
+ const allFavorites: { i18nKey: string; path: string; icon: React.ReactNode; always?: boolean }[] = [
+ { i18nKey: 'directoryBrowser.favoritesHome', path: '~', icon: <Home className="size-3.5" />, always: true },
{ i18nKey: 'directoryBrowser.favoritesDesktop', path: '~/Desktop', icon: <Monitor className="size-3.5" /> },
{ i18nKey: 'directoryBrowser.favoritesDocuments', path: '~/Documents', icon: <FileText className="size-3.5" /> },
{ i18nKey: 'directoryBrowser.favoritesDownloads', path: '~/Downloads', icon: <Download className="size-3.5" /> },
];
+ const favorites = allFavorites.filter((fav) => fav.always || favoriteExists[fav.path]);
return (
<div
@@ -251,7 +318,7 @@ export const DirectoryBrowser: React.FC<DirectoryBrowserProps> = ({
onClick={onClose}
>
<div
- className="flex max-h-[80vh] w-full max-w-3xl flex-col overflow-hidden rounded-2xl border border-border-strong bg-surface shadow-[0_24px_64px_-12px_rgba(0,0,0,0.6)]"
+ className="flex h-[80vh] max-h-[720px] min-h-[560px] w-full max-w-3xl flex-col overflow-hidden rounded-2xl border border-border-strong bg-surface shadow-[0_24px_64px_-12px_rgba(0,0,0,0.6)]"
onClick={(e) => e.stopPropagation()}
>
{/* Traffic-light header */}
@@ -307,24 +374,74 @@ export const DirectoryBrowser: React.FC<DirectoryBrowserProps> = ({
<ChevronRight className="size-3.5" />
</button>
- <div className="flex min-w-0 flex-1 items-center gap-1 overflow-x-auto rounded-md border border-border-strong bg-surface-2 px-2 py-1 font-mono text-[11px]">
- {breadcrumbs.map((crumb, i) => (
- <React.Fragment key={`${crumb.path}-${i}`}>
- {i > 0 && <ChevronRight className="size-3 shrink-0 text-muted" />}
+ {pathEditing ? (
+ // Manual path input — replaces the breadcrumb for free-form
+ // entry (paste a long path, use an absolute target outside
+ // the usual breadcrumb chain, etc.). Esc reverts to the
+ // breadcrumb without navigating.
+ <div className="flex min-w-0 flex-1 flex-col gap-1">
+ <div className="flex items-center gap-1.5 rounded-md border border-cyan/40 bg-cyan/[0.06] px-2 py-1">
+ <input
+ ref={pathInputRef}
+ type="text"
+ value={pathInput}
+ onChange={(e) => setPathInput(e.target.value)}
+ onKeyDown={(e) => {
+ if (e.key === 'Enter') {
+ e.preventDefault();
+ submitManualPath();
+ } else if (e.key === 'Escape') {
+ setPathEditing(false);
+ }
+ }}
+ placeholder={t('directoryBrowser.editPathPlaceholder')}
+ className="flex-1 bg-transparent font-mono text-[11px] text-foreground outline-none placeholder:text-muted"
+ />
<button
type="button"
- onClick={() => navigate(crumb.path)}
- className={clsx(
- 'shrink-0 rounded px-1 py-0.5 transition hover:bg-foreground/[0.04]',
- i === breadcrumbs.length - 1 ? 'font-semibold text-cyan' : 'text-muted',
- )}
+ onClick={submitManualPath}
+ className="rounded px-2 py-0.5 text-[10px] font-semibold text-cyan hover:bg-foreground/[0.04]"
>
- {crumb.label}
+ {t('directoryBrowser.editPathDone')}
</button>
- </React.Fragment>
- ))}
- {loading && <RefreshCw className="ml-auto size-3 shrink-0 animate-spin text-muted" />}
- </div>
+ </div>
+ {pathError && <div className="px-1 text-[10.5px] text-destructive">{pathError}</div>}
+ </div>
+ ) : (
+ <div className="flex min-w-0 flex-1 items-center gap-1 overflow-x-auto rounded-md border border-border-strong bg-surface-2 px-2 py-1 font-mono text-[11px]">
+ {breadcrumbs.map((crumb, i) => (
+ <React.Fragment key={`${crumb.path}-${i}`}>
+ {i > 0 && <ChevronRight className="size-3 shrink-0 text-muted" />}
+ <button
+ type="button"
+ onClick={() => navigate(crumb.path)}
+ className={clsx(
+ 'shrink-0 rounded px-1 py-0.5 transition hover:bg-foreground/[0.04]',
+ i === breadcrumbs.length - 1 ? 'font-semibold text-cyan' : 'text-muted',
+ )}
+ >
+ {crumb.label}
+ </button>
+ </React.Fragment>
+ ))}
+ {loading && <RefreshCw className="ml-auto size-3 shrink-0 animate-spin text-muted" />}
+ </div>
+ )}
+
+ <button
+ type="button"
+ onClick={() => setPathEditing((prev) => !prev)}
+ aria-label={t('directoryBrowser.editPath')}
+ title={t('directoryBrowser.editPath')}
+ className={clsx(
+ 'flex size-7 items-center justify-center rounded-md border transition',
+ pathEditing
+ ? 'border-cyan/40 bg-cyan/[0.08] text-cyan'
+ : 'border-border-strong text-muted hover:text-foreground',
+ )}
+ >
+ <Keyboard className="size-3.5" />
+ </button>
<button
type="button"
diff --git a/ui/src/components/workbench/ChatPage.tsx b/ui/src/components/workbench/ChatPage.tsx
index 48140742c..dfb6b600d 100644
--- a/ui/src/components/workbench/ChatPage.tsx
+++ b/ui/src/components/workbench/ChatPage.tsx
@@ -210,20 +210,15 @@ export const ChatPage: React.FC = () => {
}
return (
- <div className="mx-auto flex w-full max-w-[1080px] flex-col gap-4 py-2">
- <button
- type="button"
- onClick={() => navigate('/inbox')}
- className="inline-flex items-center gap-1.5 self-start text-[12px] text-muted hover:text-foreground"
- >
- <ArrowLeft className="size-3.5" />
- {t('chat.backToInbox')}
- </button>
-
- <ChatHeaderBar session={session} agents={agents} onPatch={patch} />
+ // Fill the viewport so the transcript is the only scrolling region and
+ // the compose bar genuinely anchors to the bottom. The outer AppShell
+ // wraps every route in py-5 (mobile) / py-8 (desktop), so we subtract
+ // that here to avoid double-padding.
+ <div className="-my-5 flex h-[calc(100dvh-2.5rem)] flex-col md:-my-8 md:h-[calc(100dvh-4rem)]">
+ <ChatHeaderBar session={session} agents={agents} onPatch={patch} onBack={() => navigate(-1)} />
{error && (
- <div className="rounded-md border border-destructive/40 bg-destructive/[0.06] px-3 py-2 text-[12px] text-destructive">
+ <div className="mx-auto mt-3 w-full max-w-[1080px] rounded-md border border-destructive/40 bg-destructive/[0.06] px-3 py-2 text-[12px] text-destructive">
{error}
</div>
)}
@@ -254,50 +249,54 @@ const Compose: React.FC<ComposeProps> = ({ onSend, onStop, composing }) => {
setValue('');
};
+ // shrink-0 keeps the compose bar pinned at the bottom of the
+ // fixed-height chat container; the transcript above scrolls instead.
return (
- <div className="sticky bottom-0 z-10 mt-2 flex flex-col gap-2 rounded-2xl border border-border bg-surface-2/95 p-3 backdrop-blur">
- <textarea
- ref={textareaRef}
- value={value}
- onChange={(e) => setValue(e.target.value)}
- onKeyDown={(e) => {
- // Cmd/Ctrl+Enter sends; bare Enter still inserts a newline so
- // multi-line drafting works without a separate "expand" toggle.
- if (e.key === 'Enter' && (e.metaKey || e.ctrlKey)) {
- e.preventDefault();
- submit();
- }
- }}
- rows={3}
- placeholder={t('chat.compose.placeholder')}
- disabled={composing}
- className="resize-none rounded-md border border-border-strong bg-surface-2 px-3 py-2 text-[13px] text-foreground outline-none focus:border-cyan disabled:opacity-60"
- />
- <div className="flex items-center justify-between text-[11px] text-muted">
- <span>{t('chat.compose.hint')}</span>
- <div className="flex items-center gap-2">
- {composing && (
+ <div className="shrink-0 border-t border-border bg-surface/95 px-4 py-3 backdrop-blur md:px-8">
+ <div className="mx-auto flex w-full max-w-[1080px] flex-col gap-2 rounded-2xl border border-border-strong bg-surface-2 p-3 shadow-[0_-4px_24px_-12px_rgba(0,0,0,0.5)]">
+ <textarea
+ ref={textareaRef}
+ value={value}
+ onChange={(e) => setValue(e.target.value)}
+ onKeyDown={(e) => {
+ // Cmd/Ctrl+Enter sends; bare Enter still inserts a newline so
+ // multi-line drafting works without a separate "expand" toggle.
+ if (e.key === 'Enter' && (e.metaKey || e.ctrlKey)) {
+ e.preventDefault();
+ submit();
+ }
+ }}
+ rows={3}
+ placeholder={t('chat.compose.placeholder')}
+ disabled={composing}
+ className="resize-none rounded-md border border-border bg-surface-3 px-3 py-2 text-[13px] text-foreground outline-none focus:border-cyan disabled:opacity-60"
+ />
+ <div className="flex items-center justify-between text-[11px] text-muted">
+ <span>{t('chat.compose.hint')}</span>
+ <div className="flex items-center gap-2">
+ {composing && (
+ <Button
+ type="button"
+ variant="outline"
+ size="xs"
+ onClick={onStop}
+ className="border-pink/40 bg-pink/[0.08] text-pink hover:bg-pink/[0.14]"
+ >
+ <StopCircle />
+ {t('chat.compose.stop')}
+ </Button>
+ )}
<Button
type="button"
- variant="outline"
+ variant="brand"
size="xs"
- onClick={onStop}
- className="border-pink/40 bg-pink/[0.08] text-pink hover:bg-pink/[0.14]"
+ onClick={submit}
+ disabled={!canSend}
>
- <StopCircle />
- {t('chat.compose.stop')}
+ {composing ? <Loader2 className="animate-spin" /> : <Send />}
+ {composing ? t('chat.compose.sending') : t('chat.compose.send')}
</Button>
- )}
- <Button
- type="button"
- variant="brand"
- size="xs"
- onClick={submit}
- disabled={!canSend}
- >
- {composing ? <Loader2 className="animate-spin" /> : <Send />}
- {composing ? t('chat.compose.sending') : t('chat.compose.send')}
- </Button>
+ </div>
</div>
</div>
</div>
@@ -308,21 +307,35 @@ interface ChatHeaderBarProps {
session: WorkbenchSession;
agents: VibeAgentBrief[];
onPatch: (changes: Partial<WorkbenchSession>) => Promise<void>;
+ onBack: () => void;
}
-const ChatHeaderBar: React.FC<ChatHeaderBarProps> = ({ session, agents, onPatch }) => {
+const ChatHeaderBar: React.FC<ChatHeaderBarProps> = ({ session, agents, onPatch, onBack }) => {
const { t } = useTranslation();
return (
- <div className="flex flex-col gap-3.5 rounded-2xl border border-border bg-surface px-5 py-3.5">
- <div className="flex items-center gap-3">
- <ProjectPill projectId={session.project_id} />
- <TitleField key={session.id} title={session.title} onCommit={(title) => onPatch({ title })} />
- </div>
- <div className="flex items-center gap-2">
- <AgentPicker session={session} agents={agents} onPatch={onPatch} />
- <ModelField key={`model-${session.id}`} model={session.model} onCommit={(model) => onPatch({ model })} />
- <EffortPicker effort={session.reasoning_effort} onPick={(value) => onPatch({ reasoning_effort: value })} />
- <span className="ml-auto font-mono text-[10px] text-muted">{t('chat.changesPersist')}</span>
+ // shrink-0 keeps the header full-height; bottom border separates it
+ // from the scrolling transcript without a floating-card look that
+ // would compete with messages for attention.
+ <div className="shrink-0 border-b border-border bg-surface/95 px-5 py-3.5 backdrop-blur md:px-8">
+ <div className="mx-auto flex w-full max-w-[1080px] flex-col gap-3">
+ <div className="flex items-center gap-3">
+ <button
+ type="button"
+ onClick={onBack}
+ aria-label={t('chat.backToInbox')}
+ className="flex size-7 shrink-0 items-center justify-center rounded-md border border-border-strong text-muted transition hover:bg-foreground/[0.04] hover:text-foreground"
+ >
+ <ArrowLeft className="size-3.5" />
+ </button>
+ <ProjectPill projectId={session.project_id} />
+ <TitleField key={session.id} title={session.title} onCommit={(title) => onPatch({ title })} />
+ </div>
+ <div className="flex flex-wrap items-center gap-2">
+ <AgentPicker session={session} agents={agents} onPatch={onPatch} />
+ <ModelField key={`model-${session.id}`} model={session.model} onCommit={(model) => onPatch({ model })} />
+ <EffortPicker effort={session.reasoning_effort} onPick={(value) => onPatch({ reasoning_effort: value })} />
+ <span className="ml-auto font-mono text-[10px] text-muted">{t('chat.changesPersist')}</span>
+ </div>
</div>
</div>
);
@@ -523,21 +536,31 @@ interface TranscriptProps {
const Transcript: React.FC<TranscriptProps> = ({ messages, session, streamChunks }) => {
const { t } = useTranslation();
+ const bottomRef = useRef<HTMLDivElement | null>(null);
+ // Auto-scroll to the bottom whenever a new message arrives or the
+ // current stream emits another chunk — mirrors how every other chat
+ // client behaves and saves the user from chasing the latest reply.
+ useEffect(() => {
+ bottomRef.current?.scrollIntoView({ behavior: 'smooth', block: 'end' });
+ }, [messages.length, streamChunks.length]);
+
if (messages.length === 0 && streamChunks.length === 0) {
return (
- <div className="flex flex-col items-center gap-3 rounded-xl border border-dashed border-border bg-surface px-6 py-16 text-center">
- <MessageSquare className="size-8 text-muted" />
- <div className="text-[14px] font-semibold text-foreground">{t('chat.transcriptEmpty')}</div>
- <div className="max-w-md text-[12px] text-muted">{t('chat.transcriptEmptyHint')}</div>
+ <div className="flex flex-1 flex-col items-center justify-center gap-3 px-6 text-center text-muted">
+ <MessageSquare className="size-8 opacity-60" />
+ <div className="text-[13px]">{t('chat.transcriptEmpty')}</div>
</div>
);
}
return (
- <div className="flex flex-col gap-3">
- {messages.map((message) => (
- <MessageRow key={message.id} message={message} session={session} />
- ))}
- {streamChunks.length > 0 && <StreamingChunks chunks={streamChunks} session={session} />}
+ <div className="flex-1 overflow-y-auto px-4 py-5 md:px-8">
+ <div className="mx-auto flex w-full max-w-[1080px] flex-col gap-3">
+ {messages.map((message) => (
+ <MessageRow key={message.id} message={message} session={session} />
+ ))}
+ {streamChunks.length > 0 && <StreamingChunks chunks={streamChunks} session={session} />}
+ <div ref={bottomRef} />
+ </div>
</div>
);
};
diff --git a/ui/src/i18n/en.json b/ui/src/i18n/en.json
index c99b514fa..e32016ca7 100644
--- a/ui/src/i18n/en.json
+++ b/ui/src/i18n/en.json
@@ -1133,7 +1133,11 @@
"favoritesDownloads": "Downloads",
"back": "Back",
"forward": "Forward",
- "newFolderExists": "A folder with that name already exists."
+ "newFolderExists": "A folder with that name already exists.",
+ "editPath": "Type a path",
+ "editPathPlaceholder": "Absolute path, press Enter to go",
+ "editPathDone": "Done",
+ "pathNotFound": "Path doesn't exist or isn't readable."
},
"wechat": {
"userBound": "Your WeChat account is automatically configured as the bot owner.",
@@ -1318,8 +1322,7 @@
"changesPersist": "changes apply on the next reply",
"notFound": "Session not found.",
"missingSessionId": "Missing session id in the URL.",
- "transcriptEmpty": "No messages yet",
- "transcriptEmptyHint": "Type a message below, or send one from an IM platform — Slack, Discord, Telegram, Lark, or WeChat — and it will appear here.",
+ "transcriptEmpty": "Type a message below to start the conversation",
"streaming": "Streaming",
"compose": {
"placeholder": "Type a message…",
diff --git a/ui/src/i18n/zh.json b/ui/src/i18n/zh.json
index c5c6d5a74..20ca71821 100644
--- a/ui/src/i18n/zh.json
+++ b/ui/src/i18n/zh.json
@@ -1133,7 +1133,11 @@
"favoritesDownloads": "下载",
"back": "后退",
"forward": "前进",
- "newFolderExists": "已存在同名文件夹。"
+ "newFolderExists": "已存在同名文件夹。",
+ "editPath": "手动输入路径",
+ "editPathPlaceholder": "输入绝对路径,Enter 跳转",
+ "editPathDone": "完成",
+ "pathNotFound": "路径不存在或不可访问。"
},
"wechat": {
"userBound": "您的微信账号已自动配置为机器人所有者。",
@@ -1318,8 +1322,7 @@
"changesPersist": "下次回复时生效",
"notFound": "未找到该会话。",
"missingSessionId": "URL 缺少 session id。",
- "transcriptEmpty": "暂无消息",
- "transcriptEmptyHint": "在下方输入消息,或者从 Slack/Discord/Telegram/Lark/WeChat 任一平台发,都会出现在这里。",
+ "transcriptEmpty": "在下方输入消息开始对话",
"streaming": "实时输出中",
"compose": {
"placeholder": "输入消息…",