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.

feat(workbench): rebuild root canvas to match design.pen DnkGJ

cyhd80b8399b657
diff --git a/ui/src/components/Workbench.tsx b/ui/src/components/Workbench.tsx
index ebda0d9cb..d79c21dad 100644
--- a/ui/src/components/Workbench.tsx
+++ b/ui/src/components/Workbench.tsx
@@ -1,29 +1,199 @@
+import { useCallback, useEffect, useRef, useState } from 'react';
import { useTranslation } from 'react-i18next';
-import { Link } from 'react-router-dom';
-import { ArrowRight, SlidersHorizontal } from 'lucide-react';
+import { useNavigate } from 'react-router-dom';
+import { Activity, ArrowUp, Bot, FolderPlus, Loader2, Plus, Sparkles } from 'lucide-react';
+import { useApi } from '../context/ApiContext';
+import type { WorkbenchProject } from '../context/ApiContext';
+import { Badge } from './ui/badge';
import { Button } from './ui/button';
+import { NewProjectDialog } from './workbench/NewProjectDialog';
-// Commit 01 placeholder: the full Workbench shell (capability modules,
-// projects, inbox, canvas) is built in later commits. This stub keeps `/`
-// routable while the new shell is staged in.
+// Mirrors design.pen DnkGJ "Workbench" canvas. Hero card on a surface-2
+// rounded backdrop + suggestion chips + bottom InputBar. The InputBar
+// is wired to create a new session under the most-recently-active
+// project using the default backend, then routes to /chat/<id> with the
+// typed message pre-seeded. No project? The button surfaces the
+// NewProjectDialog so the user gets unstuck without bouncing pages.
export const Workbench: React.FC = () => {
const { t } = useTranslation();
+ const navigate = useNavigate();
+ const api = useApi();
+ const [projects, setProjects] = useState<WorkbenchProject[] | null>(null);
+ const [draft, setDraft] = useState('');
+ const [sending, setSending] = useState(false);
+ const [error, setError] = useState<string | null>(null);
+ const [newProjectOpen, setNewProjectOpen] = useState(false);
+ const textareaRef = useRef<HTMLTextAreaElement | null>(null);
+
+ // Load projects so we know whether the InputBar can fire directly or
+ // needs to nudge the user to create one first.
+ useEffect(() => {
+ let cancelled = false;
+ api
+ .listProjects()
+ .then((result) => {
+ if (!cancelled) setProjects(result.projects);
+ })
+ .catch(() => {
+ if (!cancelled) setProjects([]);
+ });
+ return () => {
+ cancelled = true;
+ };
+ }, [api]);
+
+ const sortedProjects = (projects ?? []).slice().sort((a, b) => {
+ const aTs = a.last_active_at || a.created_at;
+ const bTs = b.last_active_at || b.created_at;
+ return bTs.localeCompare(aTs);
+ });
+ const targetProject = sortedProjects[0] || null;
+ const hasProjects = !!targetProject;
+
+ const send = useCallback(async () => {
+ const text = draft.trim();
+ if (!text || sending) return;
+ if (!targetProject) {
+ setNewProjectOpen(true);
+ return;
+ }
+ setSending(true);
+ setError(null);
+ try {
+ const session = await api.createSession({
+ project_id: targetProject.id,
+ agent_backend: 'claude',
+ });
+ // Seed the chat with the user's initial message; the agent picks
+ // it up via the same dispatch path as the Chat-page compose.
+ try {
+ await api.sendSessionMessage(session.id, { text });
+ } catch (err) {
+ console.error('[workbench-canvas] seed message failed', err);
+ }
+ navigate(`/chat/${encodeURIComponent(session.id)}`);
+ } catch (err: any) {
+ setError(err?.message ?? String(err));
+ setSending(false);
+ }
+ }, [api, draft, navigate, sending, targetProject]);
+
+ // Quick chips at the bottom of the canvas — three of the most common
+ // first moves. Click routes to the existing surface for that flow.
+ const suggestions = [
+ {
+ key: 'newProject',
+ icon: FolderPlus,
+ onClick: () => setNewProjectOpen(true),
+ },
+ {
+ key: 'openAgents',
+ icon: Bot,
+ onClick: () => navigate('/agents'),
+ },
+ {
+ key: 'openHarness',
+ icon: Activity,
+ onClick: () => navigate('/harness'),
+ },
+ ] as const;
return (
- <div className="mx-auto flex min-h-[calc(100vh-200px)] max-w-2xl flex-col items-center justify-center gap-5 text-center">
- <div className="font-mono text-[10px] font-bold uppercase tracking-[0.18em] text-mint">
- {t('workbench.eyebrow')}
+ <div className="-my-5 flex h-[calc(100dvh-2.5rem)] flex-col gap-4 md:-my-8 md:h-[calc(100dvh-4rem)]">
+ {/* Canvas card — flex-1 so it eats all the space between the
+ (absent for now) breadcrumb and the InputBar. */}
+ <div className="flex flex-1 flex-col items-center justify-center gap-6 overflow-hidden rounded-2xl border border-border bg-surface-2 px-6 py-10">
+ <div className="flex size-14 items-center justify-center rounded-2xl border border-mint/40 bg-mint-soft text-mint shadow-[0_0_24px_-6px_rgba(91,255,160,0.6)]">
+ <Sparkles className="size-6" />
+ </div>
+ <div className="flex max-w-[560px] flex-col items-center gap-3 text-center">
+ <h1 className="text-[22px] font-semibold text-foreground">
+ {t('workbench.canvas.heroTitle')}
+ </h1>
+ <p className="text-[13px] leading-[1.55] text-muted">
+ {t('workbench.canvas.heroBody')}
+ </p>
+ <Badge variant="warning" className="font-mono text-[10px]">
+ {t('workbench.canvas.v1Hint')}
+ </Badge>
+ </div>
+ <div className="flex flex-wrap items-center justify-center gap-2">
+ {suggestions.map(({ key, icon: Icon, onClick }) => (
+ <button
+ key={key}
+ type="button"
+ onClick={onClick}
+ className="group flex items-center gap-2 rounded-full border border-border-strong bg-surface px-3 py-2 text-[12px] text-foreground transition hover:border-mint/40 hover:bg-mint-soft hover:text-mint"
+ >
+ <Icon className="size-3.5 text-muted group-hover:text-mint" />
+ <span>{t(`workbench.canvas.suggestions.${key}`)}</span>
+ </button>
+ ))}
+ </div>
</div>
- <h1 className="text-3xl font-bold text-foreground">{t('workbench.placeholderTitle')}</h1>
- <p className="text-sm leading-relaxed text-muted">{t('workbench.placeholderBody')}</p>
- <Button asChild variant="outline" size="sm">
- <Link to="/admin/dashboard" className="inline-flex items-center gap-2">
- <SlidersHorizontal className="size-3.5" />
- {t('workbench.openControlPanel')}
- <ArrowRight className="size-3.5" />
- </Link>
- </Button>
+
+ {/* InputBar — design.pen s6tin3. Plus icon (+ new project shortcut),
+ textarea-sized input, mint Send button. Enter sends; Shift+Enter
+ inserts a newline. */}
+ <div className="flex flex-col gap-1">
+ <div className="flex items-end gap-2 rounded-2xl border border-border-strong bg-surface-2 p-3">
+ <button
+ type="button"
+ onClick={() => setNewProjectOpen(true)}
+ aria-label={t('workbench.canvas.suggestions.newProject')}
+ className="flex size-9 shrink-0 items-center justify-center rounded-md text-muted transition hover:bg-foreground/[0.04] hover:text-foreground"
+ >
+ <Plus className="size-4" />
+ </button>
+ <textarea
+ ref={textareaRef}
+ value={draft}
+ onChange={(e) => setDraft(e.target.value)}
+ onKeyDown={(e) => {
+ if (e.key === 'Enter' && !e.shiftKey && !e.nativeEvent.isComposing) {
+ e.preventDefault();
+ send();
+ }
+ }}
+ placeholder={t('workbench.canvas.inputPlaceholder')}
+ rows={1}
+ className="flex-1 resize-none bg-transparent py-2 text-[13px] text-foreground outline-none placeholder:text-muted"
+ />
+ <Button
+ type="button"
+ variant="brand"
+ size="xs"
+ onClick={send}
+ disabled={!draft.trim() || sending}
+ className="shrink-0"
+ >
+ {sending ? <Loader2 className="size-3.5 animate-spin" /> : <ArrowUp className="size-3.5" />}
+ {t('workbench.canvas.send')}
+ </Button>
+ </div>
+ <div className="flex items-center justify-between px-2 text-[10.5px] text-muted">
+ <span>{t('workbench.canvas.inputHint')}</span>
+ {projects !== null && !hasProjects && (
+ <span className="text-gold">{t('workbench.canvas.noProjectForChat')}</span>
+ )}
+ </div>
+ {error && (
+ <div className="mt-1 rounded-md border border-destructive/40 bg-destructive/[0.06] px-3 py-2 text-[12px] text-destructive">
+ {error}
+ </div>
+ )}
+ </div>
+
+ {newProjectOpen && (
+ <NewProjectDialog
+ onClose={() => setNewProjectOpen(false)}
+ onCreated={(project) => {
+ setNewProjectOpen(false);
+ setProjects((prev) => (prev ? [project, ...prev] : [project]));
+ }}
+ />
+ )}
</div>
);
};
diff --git a/ui/src/i18n/en.json b/ui/src/i18n/en.json
index 19b5098a4..d0e3c459b 100644
--- a/ui/src/i18n/en.json
+++ b/ui/src/i18n/en.json
@@ -404,6 +404,23 @@
"eyebrow": "Workbench",
"placeholderTitle": "Your AI workbench is coming together",
"placeholderBody": "Agents, Skills, Harness, and Vaults will live here. For now, jump into the control panel to configure platforms and backends.",
+ "canvas": {
+ "heroTitle": "What should we build today?",
+ "heroBody": "Describe what you want and an agent will run it. Or start with one of the suggestions below.",
+ "v1Hint": "v1 placeholder · canvas-anchored iteration lands next",
+ "suggestions": {
+ "newProject": "New project",
+ "newProjectHint": "Pick a folder; sessions default to it",
+ "openAgents": "Manage agents",
+ "openAgentsHint": "Add or tweak available agents",
+ "openHarness": "Schedule background work",
+ "openHarnessHint": "Have an agent write the cron / watch"
+ },
+ "inputPlaceholder": "Tell the agent what you want…",
+ "inputHint": "Enter to send",
+ "send": "Send",
+ "noProjectForChat": "No projects yet — add one before starting a chat"
+ },
"openControlPanel": "Open Control Panel",
"capabilitiesLabel": "Capabilities",
"projectsLabel": "Projects",
diff --git a/ui/src/i18n/zh.json b/ui/src/i18n/zh.json
index fd971ab7d..de5a6e8e3 100644
--- a/ui/src/i18n/zh.json
+++ b/ui/src/i18n/zh.json
@@ -404,6 +404,23 @@
"eyebrow": "工作台",
"placeholderTitle": "你的 AI 工作台正在搭建",
"placeholderBody": "Agents、Skills、Harness、Vaults 将会汇聚到这里。现在先进控制面板配置平台和 backend。",
+ "canvas": {
+ "heroTitle": "今天想搭点什么?",
+ "heroBody": "在下面输入想做的事,Agent 会按你的描述执行。你也可以从下面的建议开始。",
+ "v1Hint": "v1 占位 · 后续会做画布标注 + 多轮迭代",
+ "suggestions": {
+ "newProject": "新建项目",
+ "newProjectHint": "选个目录开个项目,会话默认会落在里面",
+ "openAgents": "管理 Agents",
+ "openAgentsHint": "添加或调整可选的 Agent",
+ "openHarness": "建后台任务",
+ "openHarnessHint": "让 Agent 帮你写 cron / watch"
+ },
+ "inputPlaceholder": "和 Agent 聊点什么…",
+ "inputHint": "Enter 发送",
+ "send": "发送",
+ "noProjectForChat": "还没有项目 — 先新建一个,再来这里聊"
+ },
"openControlPanel": "进入控制面板",
"capabilitiesLabel": "能力模块",
"projectsLabel": "项目",