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): sidebar project menu + harness search/filter

cyh27b553ba33af
diff --git a/ui/src/components/workbench/HarnessPage.tsx b/ui/src/components/workbench/HarnessPage.tsx
index 0a5a8f736..3c5840574 100644
--- a/ui/src/components/workbench/HarnessPage.tsx
+++ b/ui/src/components/workbench/HarnessPage.tsx
@@ -17,6 +17,7 @@ import {
Loader2,
Clock,
PauseCircle,
+ Search,
} from 'lucide-react';
import clsx from 'clsx';
@@ -88,6 +89,11 @@ export const HarnessPage: React.FC = () => {
// spinner without disabling siblings.
const [pendingMutation, setPendingMutation] = useState<Record<string, boolean>>({});
const [createKind, setCreateKind] = useState<CreateViaChatKind | null>(null);
+ // Search + status filter live on the page so the same controls work
+ // for tasks and watches; reset between tab switches happens via
+ // setSelection(null) below.
+ const [search, setSearch] = useState('');
+ const [statusFilter, setStatusFilter] = useState<'all' | 'enabled' | 'disabled'>('all');
const refresh = useCallback(async () => {
setLoading(true);
@@ -251,7 +257,43 @@ export const HarnessPage: React.FC = () => {
[watches],
);
+ // Search + status filter applied client-side. Searches name / id /
+ // schedule snippets / command snippets — enough to find rows by any
+ // identifying string a user would remember.
+ const filteredTasks = useMemo(() => {
+ const q = search.trim().toLowerCase();
+ return sortedTasks.filter((task) => {
+ if (statusFilter === 'enabled' && !task.enabled) return false;
+ if (statusFilter === 'disabled' && task.enabled) return false;
+ if (!q) return true;
+ return (
+ (task.name ?? '').toLowerCase().includes(q) ||
+ task.id.toLowerCase().includes(q) ||
+ (task.cron ?? '').toLowerCase().includes(q) ||
+ (task.agent_name ?? '').toLowerCase().includes(q)
+ );
+ });
+ }, [sortedTasks, search, statusFilter]);
+ const filteredWatches = useMemo(() => {
+ const q = search.trim().toLowerCase();
+ return sortedWatches.filter((watch) => {
+ if (statusFilter === 'enabled' && !watch.enabled) return false;
+ if (statusFilter === 'disabled' && watch.enabled) return false;
+ if (!q) return true;
+ const cmd = watch.shell_command || (Array.isArray(watch.command) ? watch.command.join(' ') : '');
+ return (
+ (watch.name ?? '').toLowerCase().includes(q) ||
+ watch.id.toLowerCase().includes(q) ||
+ cmd.toLowerCase().includes(q) ||
+ (watch.agent_name ?? '').toLowerCase().includes(q)
+ );
+ });
+ }, [sortedWatches, search, statusFilter]);
+
const hasSelection = !!(selectedTask || selectedWatch || selectedRun);
+ const showSearchBar = tab === 'tasks' || tab === 'watches';
+ const totalForTab = tab === 'tasks' ? sortedTasks.length : sortedWatches.length;
+ const shownForTab = tab === 'tasks' ? filteredTasks.length : filteredWatches.length;
return (
<div className="mx-auto flex w-full max-w-[1180px] flex-col gap-5 py-2">
@@ -321,6 +363,44 @@ export const HarnessPage: React.FC = () => {
})}
</div>
+ {/* Search + status filter — only meaningful for tasks/watches. The
+ runs tab has its own server-side query in /api/harness/runs. */}
+ {showSearchBar && (
+ <div className="flex flex-wrap items-center gap-2.5">
+ <div className="flex w-[320px] items-center gap-2 rounded-md border border-border-strong bg-surface px-3 py-2">
+ <Search className="size-3.5 shrink-0 text-muted" />
+ <input
+ value={search}
+ onChange={(e) => setSearch(e.target.value)}
+ placeholder={t('harness.searchPlaceholder')}
+ className="flex-1 bg-transparent text-[12px] text-foreground outline-none placeholder:text-muted"
+ />
+ </div>
+ <div className="flex rounded-md border border-border-strong bg-surface p-0.5">
+ {(['all', 'enabled', 'disabled'] as const).map((opt) => (
+ <button
+ key={opt}
+ type="button"
+ onClick={() => setStatusFilter(opt)}
+ className={clsx(
+ 'rounded px-2.5 py-1 text-[11px] font-medium transition',
+ statusFilter === opt
+ ? 'bg-violet/[0.12] text-violet'
+ : 'text-muted hover:text-foreground',
+ )}
+ >
+ {t(`harness.statusFilter.${opt}`)}
+ </button>
+ ))}
+ </div>
+ {(search || statusFilter !== 'all') && (
+ <span className="ml-auto font-mono text-[10px] text-muted">
+ {t('harness.filtered', { shown: shownForTab, total: totalForTab })}
+ </span>
+ )}
+ </div>
+ )}
+
{error && (
<div className="rounded-md border border-destructive/40 bg-destructive/[0.06] px-3 py-2 text-[12px] text-destructive">
{error}
@@ -340,7 +420,7 @@ export const HarnessPage: React.FC = () => {
<div className="flex min-w-0 flex-col gap-2">
{tab === 'tasks' && (
<TasksList
- tasks={sortedTasks}
+ tasks={filteredTasks}
loading={loading}
selectedId={selection?.kind === 'task' ? selection.id : null}
onSelect={(id) => setSelection({ kind: 'task', id })}
@@ -351,7 +431,7 @@ export const HarnessPage: React.FC = () => {
)}
{tab === 'watches' && (
<WatchesList
- watches={sortedWatches}
+ watches={filteredWatches}
loading={loading}
selectedId={selection?.kind === 'watch' ? selection.id : null}
onSelect={(id) => setSelection({ kind: 'watch', id })}
diff --git a/ui/src/components/workbench/WorkbenchSidebar.tsx b/ui/src/components/workbench/WorkbenchSidebar.tsx
index 0bf9fdd52..eefa6da01 100644
--- a/ui/src/components/workbench/WorkbenchSidebar.tsx
+++ b/ui/src/components/workbench/WorkbenchSidebar.tsx
@@ -3,14 +3,17 @@ import { useTranslation } from 'react-i18next';
import { NavLink, useLocation, useNavigate } from 'react-router-dom';
import {
Activity,
+ Archive,
ArrowRight,
Bot,
ChevronDown,
ChevronRight,
+ Ellipsis,
Folder,
Inbox,
KeyRound,
Loader2,
+ Pencil,
Plus,
WandSparkles,
} from 'lucide-react';
@@ -21,6 +24,7 @@ import { useApi } from '../../context/ApiContext';
import { useWorkbenchInbox } from '../../context/WorkbenchInboxContext';
import type { WorkbenchMessage, WorkbenchProject, WorkbenchSession } from '../../context/ApiContext';
import { formatRelativeTime } from '../../lib/relativeTime';
+import { Popover, PopoverContent, PopoverTrigger } from '../ui/popover';
import { NewProjectDialog } from './NewProjectDialog';
interface CapabilityNavItem {
@@ -152,6 +156,8 @@ const ProjectRow: React.FC<{
creatingSession: boolean;
unreadByScope: Record<string, number>;
onSessionMarkRead: (sessionId: string) => void;
+ onRename: (next: string) => Promise<void>;
+ onArchive: () => Promise<void>;
}> = ({
project,
expanded,
@@ -162,11 +168,32 @@ const ProjectRow: React.FC<{
creatingSession,
unreadByScope,
onSessionMarkRead,
+ onRename,
+ onArchive,
}) => {
const { t } = useTranslation();
const navigate = useNavigate();
const location = useLocation();
const Chevron = expanded ? ChevronDown : ChevronRight;
+ const [renaming, setRenaming] = useState(false);
+ const [renameDraft, setRenameDraft] = useState(project.display_name);
+ const [menuOpen, setMenuOpen] = useState(false);
+ const renameInputRef = useRef<HTMLInputElement | null>(null);
+
+ useEffect(() => {
+ if (renaming) renameInputRef.current?.focus();
+ }, [renaming]);
+
+ const commitRename = async () => {
+ const trimmed = renameDraft.trim();
+ if (!trimmed || trimmed === project.display_name) {
+ setRenaming(false);
+ setRenameDraft(project.display_name);
+ return;
+ }
+ await onRename(trimmed);
+ setRenaming(false);
+ };
return (
<div className="flex flex-col gap-0.5">
@@ -174,30 +201,98 @@ const ProjectRow: React.FC<{
className="group flex items-center gap-1.5 rounded-md px-2 py-1.5 transition hover:bg-foreground/[0.04]"
title={project.folder_path}
>
- <button
- type="button"
- onClick={onToggle}
- className="flex flex-1 items-center gap-1.5 text-left"
- >
- <Chevron className="size-3 shrink-0 text-muted" />
- <Folder className="size-3.5 shrink-0 text-muted" />
- <span className="flex-1 truncate text-[12px] font-medium text-foreground">
- {project.display_name}
- </span>
- </button>
- <button
- type="button"
- aria-label={t('workbench.addSession')}
- onClick={onCreateSession}
- disabled={creatingSession}
- className={clsx(
- 'flex size-5 shrink-0 items-center justify-center rounded-md text-muted transition',
- 'opacity-0 group-hover:opacity-100 hover:text-foreground hover:bg-foreground/[0.06]',
- creatingSession && 'opacity-100',
- )}
- >
- {creatingSession ? <Loader2 className="size-3 animate-spin" /> : <Plus className="size-3" />}
- </button>
+ {renaming ? (
+ <div className="flex flex-1 items-center gap-1.5">
+ <Folder className="size-3.5 shrink-0 text-muted" />
+ <input
+ ref={renameInputRef}
+ value={renameDraft}
+ onChange={(e) => setRenameDraft(e.target.value)}
+ onBlur={commitRename}
+ onKeyDown={(e) => {
+ if (e.key === 'Enter') commitRename();
+ if (e.key === 'Escape') {
+ setRenameDraft(project.display_name);
+ setRenaming(false);
+ }
+ }}
+ placeholder={t('workbench.projectRenamePlaceholder')}
+ className="flex-1 rounded border border-mint/40 bg-surface-2 px-1.5 py-0.5 text-[12px] font-medium text-foreground outline-none focus:border-mint"
+ />
+ </div>
+ ) : (
+ <button
+ type="button"
+ onClick={onToggle}
+ className="flex flex-1 items-center gap-1.5 text-left"
+ >
+ <Chevron className="size-3 shrink-0 text-muted" />
+ <Folder className="size-3.5 shrink-0 text-muted" />
+ <span className="flex-1 truncate text-[12px] font-medium text-foreground">
+ {project.display_name}
+ </span>
+ </button>
+ )}
+ {!renaming && (
+ <>
+ <Popover open={menuOpen} onOpenChange={setMenuOpen}>
+ <PopoverTrigger asChild>
+ <button
+ type="button"
+ aria-label={t('workbench.projectActions')}
+ className={clsx(
+ 'flex size-5 shrink-0 items-center justify-center rounded-md text-muted transition',
+ 'opacity-0 group-hover:opacity-100 hover:text-foreground hover:bg-foreground/[0.06]',
+ menuOpen && 'opacity-100',
+ )}
+ >
+ <Ellipsis className="size-3" />
+ </button>
+ </PopoverTrigger>
+ <PopoverContent align="end" className="w-[160px] p-1">
+ <button
+ type="button"
+ onClick={() => {
+ setMenuOpen(false);
+ setRenaming(true);
+ setRenameDraft(project.display_name);
+ }}
+ className="flex w-full items-center gap-2 rounded px-2 py-1.5 text-left text-[12px] text-foreground transition hover:bg-foreground/[0.04]"
+ >
+ <Pencil className="size-3 text-muted" />
+ {t('workbench.projectRename')}
+ </button>
+ <button
+ type="button"
+ onClick={async () => {
+ setMenuOpen(false);
+ const ok = window.confirm(
+ t('workbench.projectArchiveConfirm', { name: project.display_name }),
+ );
+ if (ok) await onArchive();
+ }}
+ className="flex w-full items-center gap-2 rounded px-2 py-1.5 text-left text-[12px] text-pink transition hover:bg-pink/[0.08]"
+ >
+ <Archive className="size-3" />
+ {t('workbench.projectArchive')}
+ </button>
+ </PopoverContent>
+ </Popover>
+ <button
+ type="button"
+ aria-label={t('workbench.addSession')}
+ onClick={onCreateSession}
+ disabled={creatingSession}
+ className={clsx(
+ 'flex size-5 shrink-0 items-center justify-center rounded-md text-muted transition',
+ 'opacity-0 group-hover:opacity-100 hover:text-foreground hover:bg-foreground/[0.06]',
+ creatingSession && 'opacity-100',
+ )}
+ >
+ {creatingSession ? <Loader2 className="size-3 animate-spin" /> : <Plus className="size-3" />}
+ </button>
+ </>
+ )}
</div>
{expanded && (
@@ -367,6 +462,40 @@ export const WorkbenchSidebar: React.FC = () => {
[markRead],
);
+ const renameProject = useCallback(
+ async (projectId: string, newName: string) => {
+ try {
+ const updated = await api.updateProject(projectId, { display_name: newName });
+ setProjects((prev) =>
+ prev ? prev.map((p) => (p.id === projectId ? updated : p)) : prev,
+ );
+ } catch (err) {
+ console.error('[sidebar] rename project failed', err);
+ }
+ },
+ [api],
+ );
+
+ const archiveProject = useCallback(
+ async (projectId: string) => {
+ try {
+ await api.archiveProject(projectId);
+ // Drop from the visible list. Sessions stay in the DB; user can
+ // still reach them by URL or by un-archiving via the CLI for now.
+ setProjects((prev) => (prev ? prev.filter((p) => p.id !== projectId) : prev));
+ setExpanded((prev) => {
+ if (!prev.has(projectId)) return prev;
+ const next = new Set(prev);
+ next.delete(projectId);
+ return next;
+ });
+ } catch (err) {
+ console.error('[sidebar] archive project failed', err);
+ }
+ },
+ [api],
+ );
+
// Small open/close delays so the popover doesn't flicker as the cursor
// brushes through the inbox row on its way somewhere else, and survives
// the gap between the row and the popover body.
@@ -540,6 +669,8 @@ export const WorkbenchSidebar: React.FC = () => {
creatingSession={creatingSession.has(project.id)}
unreadByScope={unreadByScope}
onSessionMarkRead={onSessionMarkRead}
+ onRename={(next) => renameProject(project.id, next)}
+ onArchive={() => archiveProject(project.id)}
/>
))}
</div>
diff --git a/ui/src/i18n/en.json b/ui/src/i18n/en.json
index d0e3c459b..1c1e5e6f7 100644
--- a/ui/src/i18n/en.json
+++ b/ui/src/i18n/en.json
@@ -427,6 +427,10 @@
"addProject": "Add project",
"addSession": "New session in this project",
"projectActions": "Project actions",
+ "projectRename": "Rename",
+ "projectArchive": "Archive",
+ "projectArchiveConfirm": "Archive project \"{{name}}\"? Session history is preserved; it just stops showing in the sidebar.",
+ "projectRenamePlaceholder": "New name",
"projectsEmpty": "No projects yet — add one to start a session.",
"projectsLoading": "Loading projects…",
"projectsLoadError": "Couldn't load projects.",
@@ -1291,6 +1295,13 @@
"subtitle": "Scheduled tasks, watches, webhooks, and the run history of all three.",
"soon": "soon",
"create": "Create",
+ "searchPlaceholder": "Search…",
+ "statusFilter": {
+ "all": "All",
+ "enabled": "Enabled only",
+ "disabled": "Disabled only"
+ },
+ "filtered": "{{shown}}/{{total}}",
"selectPrompt": "Select a row to view its full configuration.",
"emptyTasks": "No scheduled tasks. Ask an agent to create one.",
"emptyWatches": "No watches running. Ask an agent to start one.",
diff --git a/ui/src/i18n/zh.json b/ui/src/i18n/zh.json
index de5a6e8e3..ecdfd5eed 100644
--- a/ui/src/i18n/zh.json
+++ b/ui/src/i18n/zh.json
@@ -427,6 +427,10 @@
"addProject": "添加项目",
"addSession": "在该项目新建会话",
"projectActions": "项目操作",
+ "projectRename": "重命名",
+ "projectArchive": "归档",
+ "projectArchiveConfirm": "确定归档项目「{{name}}」?会话历史会保留,侧栏不再显示。",
+ "projectRenamePlaceholder": "新名字",
"projectsEmpty": "还没有项目 — 添加一个就能开始会话。",
"projectsLoading": "加载项目中…",
"projectsLoadError": "项目加载失败。",
@@ -1290,6 +1294,13 @@
"subtitle": "定时任务、Watch、Webhook 及其运行历史。",
"soon": "敬请期待",
"create": "创建",
+ "searchPlaceholder": "搜索…",
+ "statusFilter": {
+ "all": "全部",
+ "enabled": "仅启用",
+ "disabled": "仅禁用"
+ },
+ "filtered": "{{shown}}/{{total}}",
"selectPrompt": "选择左侧条目查看完整配置。",
"emptyTasks": "暂无定时任务。让 Agent 帮你创建一个。",
"emptyWatches": "没有正在运行的 Watch。让 Agent 帮你开启一个。",