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): host the Agent picker in the home and new-session composers (#2972)

Call Whitede3e5a622e4b
diff --git a/ui/e2e/home-media/sheet-suspension.spec.ts b/ui/e2e/home-media/sheet-suspension.spec.ts
index 53d6a2a10..4fd18b3e0 100644
--- a/ui/e2e/home-media/sheet-suspension.spec.ts
+++ b/ui/e2e/home-media/sheet-suspension.spec.ts
@@ -284,6 +284,8 @@ for (const width of [390, 1366]) test(`sheet ${width} keeps Unicode draft and se
await draft(page).fill('项目乙:请检查发布 ✓');
await page.getByRole('button', { name: '第二个项目', exact: true }).click();
await page.getByRole('button', { name: /codex/ }).first().click();
+ // The composer's picker keeps Agents one level below its model page.
+ await page.getByRole('button', { name: /^Agent/ }).click();
await page.getByRole('button', { name: /^claude/ }).click();
await settings(page);
await expect(page.getByTestId('sheet-logical-open')).toHaveText('true');
diff --git a/ui/src/components/Workbench.tsx b/ui/src/components/Workbench.tsx
index 696d43a4b..ecee202be 100644
--- a/ui/src/components/Workbench.tsx
+++ b/ui/src/components/Workbench.tsx
@@ -155,9 +155,10 @@ export const Workbench: React.FC = () => {
</div>
</div>
- {/* Input — the project chips and the Agent picker stand above the shared
- Composer, so where the session lands and which Agent runs it are both
- visible before anything is typed. */}
+ {/* Input — the project chips stand above the shared Composer and the
+ Agent picker sits in its action row beside Send, as in a chat, so where
+ the session lands and which Agent runs it are both visible before
+ anything is typed. */}
<div className="flex w-full max-w-[640px] flex-col gap-3">
{ns.projects.length > 0 && (
<ProjectPicker
@@ -168,26 +169,23 @@ export const Workbench: React.FC = () => {
disabled={ns.sending}
/>
)}
- <div className="flex min-w-0 flex-col gap-2">
- <div className="font-mono text-[11px] font-bold uppercase tracking-[0.08em] text-muted">{t('newSession.agent')}</div>
- <AgentRoutePicker
- value={ns.agentRoute}
- agents={ns.agents}
- onChange={ns.setAgentRoute}
- defaultLabel={ns.effectiveDefaultAgentName
- ? t('newSession.defaultAgentNamed', { name: ns.effectiveDefaultAgentName })
- : t('newSession.defaultAgent')}
- disabled={ns.sending}
- align="start"
- // Fill the column on mobile (≈ full screen); on desktop hug content
- // and cap at 62% so it reads like the compact Chat-header picker
- // instead of a full-width 640px bar. self-start defeats the flex-col
- // stretch that would otherwise force the trigger to the column width.
- triggerClassName="max-w-full sm:max-w-[62%] sm:self-start"
- />
- </div>
<Composer
stageMedia
+ layout="stacked"
+ actions={
+ <AgentRoutePicker
+ presentation="compact"
+ value={ns.agentRoute}
+ agents={ns.agents}
+ onChange={ns.setAgentRoute}
+ defaultLabel={ns.effectiveDefaultAgentName
+ ? t('newSession.defaultAgentNamed', { name: ns.effectiveDefaultAgentName })
+ : t('newSession.defaultAgent')}
+ disabled={ns.sending}
+ align="end"
+ triggerClassName="max-w-[min(60vw,360px)]"
+ />
+ }
onSend={send}
placeholder={t('workbench.home.inputPlaceholder')}
disabled={ns.sending || !ns.loaded}
diff --git a/ui/src/components/ui/responsive-menu.tsx b/ui/src/components/ui/responsive-menu.tsx
index 41fa5bea1..f74a14606 100644
--- a/ui/src/components/ui/responsive-menu.tsx
+++ b/ui/src/components/ui/responsive-menu.tsx
@@ -39,6 +39,9 @@ export const ResponsiveMenu: React.FC<{
className?: string;
align?: 'start' | 'center' | 'end';
sideOffset?: number;
+ /** Make the desktop popover a modal layer — required inside a modal Dialog,
+ * whose focus trap would otherwise leave the popover inert. */
+ modal?: boolean;
children: React.ReactNode;
}> = ({
open,
@@ -52,6 +55,7 @@ export const ResponsiveMenu: React.FC<{
className,
align = 'end',
sideOffset = 6,
+ modal,
children,
}) => {
const { t } = useTranslation();
@@ -60,7 +64,7 @@ export const ResponsiveMenu: React.FC<{
if (!isMobile) {
return (
- <Popover open={open} onOpenChange={onOpenChange}>
+ <Popover open={open} onOpenChange={onOpenChange} modal={modal}>
<PopoverTrigger asChild>{trigger}</PopoverTrigger>
<PopoverContent
align={align}
diff --git a/ui/src/components/workbench/AgentRoutePicker.tsx b/ui/src/components/workbench/AgentRoutePicker.tsx
index ba0af1e72..2e31ec1d2 100644
--- a/ui/src/components/workbench/AgentRoutePicker.tsx
+++ b/ui/src/components/workbench/AgentRoutePicker.tsx
@@ -628,6 +628,7 @@ export const AgentRoutePicker: React.FC<AgentRoutePickerProps> = ({
sheetCloseLabel={t('common.done')}
className="w-[320px] max-w-[92vw] overflow-hidden p-0"
align={align}
+ modal={modal}
>
{agentPage ? agentList : routeMenu}
</ResponsiveMenu>
diff --git a/ui/src/components/workbench/NewSessionSheet.tsx b/ui/src/components/workbench/NewSessionSheet.tsx
index ed2006d50..bb2df1c92 100644
--- a/ui/src/components/workbench/NewSessionSheet.tsx
+++ b/ui/src/components/workbench/NewSessionSheet.tsx
@@ -142,20 +142,6 @@ export const NewSessionSheet: React.FC<NewSessionSheetProps> = ({ open, onClose,
onNewProject={openNewProject}
disabled={ns.sending}
/>
- <div className="flex min-w-0 flex-col gap-2">
- <div className="font-mono text-[11px] font-bold uppercase tracking-[0.08em] text-muted">{t('newSession.agent')}</div>
- <AgentRoutePicker
- value={ns.agentRoute}
- agents={ns.agents}
- onChange={ns.setAgentRoute}
- defaultLabel={ns.effectiveDefaultAgentName ? t('newSession.defaultAgentNamed', { name: ns.effectiveDefaultAgentName }) : t('newSession.defaultAgent')}
- disabled={ns.sending}
- align="start"
- triggerClassName="w-full max-w-full"
- modal
- onNavigateAway={close}
- />
- </div>
{ns.error && (
<div className="rounded-md border border-destructive/40 bg-destructive/[0.06] px-3 py-2 text-[12px] text-destructive-ink">
@@ -172,6 +158,21 @@ export const NewSessionSheet: React.FC<NewSessionSheetProps> = ({ open, onClose,
create a session under a stale/removed cached project. initialDraft
re-seeds a prompt stashed when the no-project flow closed the sheet. */}
<Composer
+ layout="stacked"
+ actions={
+ <AgentRoutePicker
+ presentation="compact"
+ value={ns.agentRoute}
+ agents={ns.agents}
+ onChange={ns.setAgentRoute}
+ defaultLabel={ns.effectiveDefaultAgentName ? t('newSession.defaultAgentNamed', { name: ns.effectiveDefaultAgentName }) : t('newSession.defaultAgent')}
+ disabled={ns.sending}
+ align="end"
+ triggerClassName="max-w-[min(60vw,360px)]"
+ modal
+ onNavigateAway={close}
+ />
+ }
onSend={send}
onDraftChange={updateDraft}
placeholder={t('newSession.placeholder')}
diff --git a/ui/src/i18n/en.json b/ui/src/i18n/en.json
index 546292a91..a7fac9f28 100644
--- a/ui/src/i18n/en.json
+++ b/ui/src/i18n/en.json
@@ -327,7 +327,6 @@
"placeholder": "Describe what you want the agent to do…",
"loadError": "Couldn't load projects — close and reopen to retry.",
"createFailed": "Couldn't start the session. Please try again.",
- "agent": "Agent",
"defaultAgent": "Default agent",
"defaultAgentNamed": "Default · {{name}}"
},
diff --git a/ui/src/i18n/zh.json b/ui/src/i18n/zh.json
index 25ca786b1..ea6d1b476 100644
--- a/ui/src/i18n/zh.json
+++ b/ui/src/i18n/zh.json
@@ -327,7 +327,6 @@
"placeholder": "描述你想让 agent 做什么…",
"loadError": "项目加载失败,关掉重开可重试。",
"createFailed": "会话创建失败,请重试。",
- "agent": "选择 Agent",
"defaultAgent": "默认 Agent",
"defaultAgentNamed": "默认 · {{name}}"
},