Self-improving AI Employees for everyone
Python ai-agentsai-employeeai-employeesassistantautonomous-agentsco-employeescompanygrok-botinstinctloop-agentsmuseown-your-datapersonalself-hosted
fix(home): trim the employee page to what it needs to say
trohitgdd9f1a396259
diff --git a/client/src/components/shell/ModeToggle.tsx b/client/src/components/shell/ModeToggle.tsxindex 9106f214..7b9f2686 100644--- a/client/src/components/shell/ModeToggle.tsx+++ b/client/src/components/shell/ModeToggle.tsx@@ -3,7 +3,8 @@* (design handoff "Mode toggle"). Normal takes the skill role's green, Dev* the agent role's purple, each as the soft chip tint. Switching goes* through the shell actions, so the unsaved-work guard and the transition- * always run.+ * always run. `workflowId`: the workflow Dev opens (Home passes the+ * employee on screen); without one Dev shows what the editor last had.*/import { Clock, Zap } from 'lucide-react';@@ -14,7 +15,7 @@ import { enterDev, enterNormal } from '../../app/useShellActions';const ITEM = 'rounded-md data-[state=on]:shadow-none';-export function ModeToggle({ className }: { className?: string }) {+export function ModeToggle({ className, workflowId }: { className?: string; workflowId?: string }) {const mode = useShellMode();return (<ToggleGroup@@ -27,7 +28,7 @@ export function ModeToggle({ className }: { className?: string }) {onValueChange={(next) => {// Radix reports '' when the pressed item is clicked again.if (next === 'normal') void enterNormal();- else if (next === 'dev') void enterDev();+ else if (next === 'dev') void enterDev({ workflowId });}}className={cn('rounded-lg bg-bg-elevated p-0.5', className)}>diff --git a/client/src/features/home/__tests__/employeeView.test.tsx b/client/src/features/home/__tests__/employeeView.test.tsxindex 96110c12..f72aa288 100644--- a/client/src/features/home/__tests__/employeeView.test.tsx+++ b/client/src/features/home/__tests__/employeeView.test.tsx@@ -2,14 +2,13 @@* The employee page: the card's main button (Connect goes to the provider's* connect dialog, Pause sends the summary's revision and says "Pausing…"* until the summary shows the pause, never flashing "Pause" again in- * between), Watch live, More > Open in Dev mode, and the conversation under- * the card, which offers the same main action while the employee cannot- * read messages.+ * between), Watch live, what the card leaves out when the page already says+ * it, and the conversation under the card, which offers the same main+ * action while the employee cannot read messages.*/import { beforeEach, describe, expect, it, vi } from 'vitest';import { act, fireEvent, render, screen, waitFor } from '@testing-library/react';-import userEvent from '@testing-library/user-event';import { QueryClient, QueryClientProvider } from '@tanstack/react-query';const actions = {@@ -122,20 +121,27 @@ describe('EmployeeView', () => {expect(useHomeStore.getState()).toMatchObject({ workspaceOpen: true, workspaceFor: 'w1' });});- it('opens the workflow in Dev mode from More', async () => {- const user = userEvent.setup();- renderCard(summary({ status: 'working' }, { state: 'running' }));- expect(screen.queryByRole('button', { name: 'Open in Dev mode' })).not.toBeInTheDocument();- await user.click(screen.getByRole('button', { name: 'More' }));- await user.click(await screen.findByRole('menuitem', { name: 'Open in Dev mode' }));- expect(enterDev).toHaveBeenCalledWith({ workflowId: 'w1' });+ it('says only what the page does not already say', () => {+ // Waiting for the owner's messages (no task line), a role that repeats+ // the name, nothing done yet: none of it shows.+ renderCard(summary({ status: 'working', role: 'maya', task: null, done_today: 0, apps: [] }, { state: 'running' }));+ expect(screen.queryByText('maya')).not.toBeInTheDocument();+ expect(screen.queryByText(/done today/)).not.toBeInTheDocument();+ expect(screen.queryByText('Now')).not.toBeInTheDocument();+ expect(screen.queryByRole('button', { name: 'More' })).not.toBeInTheDocument();+ });++ it('shows the role, the task and the count once they say something', () => {+ renderCard(summary({ status: 'working', task: { label: 'Now', text: 'Waiting for new WhatsApp messages' }, done_today: 2 }, { state: 'running' }));+ expect(screen.getByText('Receptionist')).toBeInTheDocument();+ expect(screen.getByText('Waiting for new WhatsApp messages')).toBeInTheDocument();+ expect(screen.getByText(/done today/)).toHaveTextContent('2 done today');});it('makes Open in Dev mode the main button when nothing else is possible', () => {renderCard(summary({ status: 'attention' }, { state: 'failed', can_resume: false }));fireEvent.click(screen.getByRole('button', { name: 'Open in Dev mode' }));expect(enterDev).toHaveBeenCalledWith({ workflowId: 'w1' });- expect(screen.queryByRole('button', { name: 'More' })).not.toBeInTheDocument();});it('offers Start under the conversation while the employee is not running', async () => {diff --git a/client/src/features/home/__tests__/homeHeader.test.tsx b/client/src/features/home/__tests__/homeHeader.test.tsxnew file mode 100644index 00000000..8932d42f--- /dev/null+++ b/client/src/features/home/__tests__/homeHeader.test.tsx@@ -0,0 +1,38 @@+/**+ * The Home header's Normal/Dev switch: on an employee's page Dev opens that+ * employee's workflow (the card has no menu for it); elsewhere Dev shows+ * what the editor last had.+ */++import { beforeEach, describe, expect, it, vi } from 'vitest';+import { fireEvent, render, screen } from '@testing-library/react';++vi.mock('../../../app/useShellActions', () => ({ enterDev: vi.fn(), enterNormal: vi.fn() }));+vi.mock('../../../app/ShellModeSwitch', () => ({ useShellMode: () => 'normal' }));+vi.mock('../workspace/WorkspaceButton', () => ({ WorkspaceButton: () => null }));+vi.mock('../header/ThemeButton', () => ({ ThemeButton: () => null }));++import { enterDev } from '../../../app/useShellActions';+import { HomeHeader } from '../header/HomeHeader';+import { useHomeStore } from '../state/homeStore';++describe('HomeHeader', () => {+ beforeEach(() => {+ vi.mocked(enterDev).mockClear();+ useHomeStore.setState({ sidebarOpen: true });+ });++ it('opens the employee on screen in Dev mode', () => {+ useHomeStore.setState({ view: { kind: 'employee', workflowId: 'w1' } });+ render(<HomeHeader title="Maya" scrolled={false} />);+ fireEvent.click(screen.getByRole('radio', { name: 'Dev' }));+ expect(enterDev).toHaveBeenCalledWith({ workflowId: 'w1' });+ });++ it('opens what the editor last had from the hire view', () => {+ useHomeStore.setState({ view: { kind: 'hire' } });+ render(<HomeHeader title="New employee" scrolled={false} />);+ fireEvent.click(screen.getByRole('radio', { name: 'Dev' }));+ expect(enterDev).toHaveBeenCalledWith({ workflowId: undefined });+ });+});diff --git a/client/src/features/home/__tests__/talk.test.tsx b/client/src/features/home/__tests__/talk.test.tsxindex 52d58ffe..b82210ec 100644--- a/client/src/features/home/__tests__/talk.test.tsx+++ b/client/src/features/home/__tests__/talk.test.tsx@@ -120,13 +120,11 @@ describe('the thread', () => {expect(screen.getByRole('link', { name: 'the calendar' })).toHaveAttribute('target', '_blank');});- it('suggests a first message, which fills the box', async () => {+ it('starts as just the message box', async () => {renderTalk(employee());- fireEvent.click(await screen.findByRole('button', { name: 'What are you working on?' }));- const box = screen.getByRole('textbox', { name: 'Message Maya' });- expect(box).toHaveValue('What are you working on?');- expect(box).toHaveFocus();- expect(sendRequest).not.toHaveBeenCalledWith('send_chat_message', expect.anything());+ expect(await screen.findByRole('textbox', { name: 'Message Maya' })).toHaveValue('');+ expect(screen.getByRole('log', { name: 'Conversation with Maya' })).toBeEmptyDOMElement();+ expect(screen.queryByRole('button', { name: 'What are you working on?' })).not.toBeInTheDocument();});});diff --git a/client/src/features/home/data/liveTask.ts b/client/src/features/home/data/liveTask.tsindex e9e7cbff..99c9ef34 100644--- a/client/src/features/home/data/liveTask.ts+++ b/client/src/features/home/data/liveTask.ts@@ -7,6 +7,8 @@* 1. an in-progress todo of the employee's todo list ("Checking tomorrow's* appointments"),* 2. otherwise, one of its watched nodes running ("Working on it..."),+ * except the agent answering the owner in Talk: the conversation shows+ * its own "Thinking…",* 3. otherwise nothing, and the card shows the server's text ("Waiting for* new WhatsApp messages").*/@@ -40,14 +42,15 @@ export function useLiveTask(employee: EmployeeSummary): { label: 'Now'; text: ststaleTime: Infinity,});const watchKey = employee.watch_node_ids.join('|');+ const talkAgent = employee.talk.agent_node_id;const running = useNodeStatusStore(useCallback((state) => {const statuses = state.allStatuses[employee.workflow_id];if (!statuses) return false;- return watchKey.split('|').some((id) => id && statuses[id]?.status === 'executing');+ return watchKey.split('|').some((id) => id && id !== talkAgent && statuses[id]?.status === 'executing');},- [employee.workflow_id, watchKey],+ [employee.workflow_id, watchKey, talkAgent],),);// While the agent waits for the owner in the browser its node is stilldiff --git a/client/src/features/home/data/schemas.ts b/client/src/features/home/data/schemas.tsindex 52385ce9..6962e7a0 100644--- a/client/src/features/home/data/schemas.ts+++ b/client/src/features/home/data/schemas.ts@@ -42,9 +42,12 @@ export const employeeSummarySchema = z.object({color_role: z.enum(COLOR_ROLES).catch('agent'),derived: z.boolean().catch(true),status: z.enum(EMPLOYEE_STATUSES).catch('ready'),+ /** The card's task line; null when the page already says it (waiting for+ * the owner's messages, with the message box under the card). */task: z.object({ label: z.enum(TASK_LABELS).catch('Now'), text: z.string().catch('') })- .catch({ label: 'Next', text: '' }),+ .nullable()+ .catch(null),done_today: z.number().int().nonnegative().catch(0),pending_approvals: z.number().int().nonnegative().catch(0),apps: appList,diff --git a/client/src/features/home/employee/EmployeeTalk.tsx b/client/src/features/home/employee/EmployeeTalk.tsxindex 4d0d036b..29ff0794 100644--- a/client/src/features/home/employee/EmployeeTalk.tsx+++ b/client/src/features/home/employee/EmployeeTalk.tsx@@ -15,7 +15,7 @@* setup cannot answer gets a note.*/-import { ArrowUp, MessageSquare } from 'lucide-react';+import { ArrowUp } from 'lucide-react';import { Suspense, lazy, useEffect, useLayoutEffect, useRef, useState, type KeyboardEvent } from 'react';import { useQueryClient } from '@tanstack/react-query';import { Button } from '@/components/ui/button';@@ -39,8 +39,6 @@ import type { EmployeeControl } from './useEmployeeControl';// Its own chunk: the markdown stack stays out of Home's first load.const ThreadMarkdown = lazy(() => import('./ThreadMarkdown'));-const SUGGESTIONS = ['What are you working on?', 'What did you get done today?', 'What can you help me with?'];-/** Lines up an answer's time under its text, past the avatar. */const PAST_AVATAR = 'pl-10.5';@@ -75,51 +73,22 @@ function RestartDivider({ name }: { name: string }) {);}-function EmptyThread({ name, onPick }: { name: string; onPick: ((text: string) => void) | null }) {- return (- <div className="flex flex-col items-center gap-3 py-6 text-center">- <MessageSquare aria-hidden className="size-5 text-fg-faint" strokeWidth={1.75} />- <p className="m-0 text-md font-medium text-fg-default">Talk with {name}</p>- <p className="m-0 max-w-100 text-sm text-fg-muted">Ask a question, hand them a job, or check how things are going.</p>- {onPick && (- <div className="flex flex-wrap justify-center gap-2 pt-1">- {SUGGESTIONS.map((suggestion) => (- <Button key={suggestion} variant="chip" size="chip" onClick={() => onPick(suggestion)}>- {suggestion}- </Button>- ))}- </div>- )}- </div>- );-}-function TalkBox({name,value,onChange,onSend,canSend,- focusNonce,}: {name: string;value: string;onChange: (value: string) => void;onSend: () => void;canSend: boolean;- /** Change this number to move focus into the box. */- focusNonce: number;}) {const boxRef = useRef<HTMLTextAreaElement>(null);useAutoGrow(boxRef, value);- useEffect(() => {- if (!focusNonce) return;- const box = boxRef.current;- box?.focus();- box?.setSelectionRange(box.value.length, box.value.length);- }, [focusNonce]);-// Enter sends, Shift+Enter is a new line; while the box holds, Enter waits.const onKeyDown = (event: KeyboardEvent<HTMLTextAreaElement>) => {if (!isSendKey(event)) return;@@ -157,7 +126,6 @@ function Conversation({ employee, control }: { employee: EmployeeSummary; controconst mode = talkMode(employee.control);const [draft, setDraft] = useState('');const [queued, setQueued] = useState(false);- const [focusNonce, setFocusNonce] = useState(0);const endRef = useRef<HTMLDivElement>(null);// A message that waited for Resume reaches the employee when they run@@ -209,11 +177,6 @@ function Conversation({ employee, control }: { employee: EmployeeSummary; contro});};- const pick = (suggestion: string) => {- setDraft(suggestion);- setFocusNonce((n) => n + 1);- };-const rows = messages ? threadRows(messages) : [];const notice = talkNoticeText(mode, name, queued);const now = new Date();@@ -225,15 +188,15 @@ function Conversation({ employee, control }: { employee: EmployeeSummary; contro<Skeleton className="h-10 w-3/5 self-end rounded-card" /><Skeleton className="h-16 w-4/5 rounded-card" /></div>- ) : thread.isError ? (- <div className="flex flex-col items-center gap-2 py-6 text-center">- <p className="m-0 text-sm text-fg-default">Couldn’t load the conversation.</p>- <Button variant="quiet" onClick={() => void thread.refetch()} className="border-border-default text-fg-default">- Try again- </Button>- </div>) : (- rows.length === 0 && !waiting && <EmptyThread name={name} onPick={mode === 'start' ? null : pick} />+ thread.isError && (+ <div className="flex flex-col items-center gap-2 py-6 text-center">+ <p className="m-0 text-sm text-fg-default">Couldn’t load the conversation.</p>+ <Button variant="quiet" onClick={() => void thread.refetch()} className="border-border-default text-fg-default">+ Try again+ </Button>+ </div>+ ))}{/* A log: screen readers announce new messages and "Thinking…". */}<div role="log" aria-live="polite" aria-label={`Conversation with ${name}`} className="flex flex-col gap-4">@@ -260,9 +223,7 @@ function Conversation({ employee, control }: { employee: EmployeeSummary; contro<PrimaryActionButton control={control} /></div>)}- {mode !== 'start' && (- <TalkBox name={name} value={draft} onChange={setDraft} onSend={submit} canSend={canSend} focusNonce={focusNonce} />- )}+ {mode !== 'start' && <TalkBox name={name} value={draft} onChange={setDraft} onSend={submit} canSend={canSend} />}</div><div ref={endRef} aria-hidden /></section>diff --git a/client/src/features/home/employee/EmployeeView.tsx b/client/src/features/home/employee/EmployeeView.tsxindex 19974b9b..a468cbbb 100644--- a/client/src/features/home/employee/EmployeeView.tsx+++ b/client/src/features/home/employee/EmployeeView.tsx@@ -4,32 +4,24 @@* the bottom of the page.** The card shows the server's summary, which the server re-sends the- * moment the control plane moves: who they are, what they are doing now,- * the drafts waiting for the owner, the apps they use, how much they did- * today, and what to do next (Pause, Resume, Start, or connect what they- * are missing; useEmployeeControl, shared with the message box). "Watch- * live" opens the Workspace on this employee ("Help in browser", on its- * Browser tab, while the agent is waiting for the owner), and More opens- * their workflow in Dev mode.+ * moment the control plane moves: who they are, what they are doing (unless+ * the page already says it), the drafts waiting for the owner, the apps+ * they use, how much they did today, and what to do next (Pause, Resume,+ * Start, or connect what they are missing; useEmployeeControl, shared with+ * the message box). "Watch live" opens the Workspace on this employee+ * ("Help in browser", on its Browser tab, while the agent is waiting for the+ * owner). The header's Dev switch opens their workflow in Dev mode.*/-import { Code, Ellipsis, Monitor } from 'lucide-react';+import { Monitor } from 'lucide-react';import { useLayoutEffect, useRef, type RefObject } from 'react';import { ActionButton } from '@/components/ui/action-button';import { Button } from '@/components/ui/button';-import {- DropdownMenu,- DropdownMenuContent,- DropdownMenuItem,- DropdownMenuTrigger,-} from '@/components/ui/dropdown-menu';import { Skeleton } from '@/components/ui/skeleton';import { animate } from '@/lib/motion';import { cn } from '@/lib/utils';-import { enterDev } from '../../../app/useShellActions';import { useEmployeeDetailQuery, useEmployeesQuery } from '../data/employees';import { useLiveTask } from '../data/liveTask';-import { OPEN_IN_DEV_LABEL } from '../data/presentation';import type { EmployeeSummary } from '../data/schemas';import { HireNotice } from '../hire/HireNotice';import { OrbSlot } from '../orb/OrbSlot';@@ -41,15 +33,18 @@ import { EmployeeTalk } from './EmployeeTalk';import { PrimaryActionButton } from './PrimaryActionButton';import { useEmployeeControl, type EmployeeControl } from './useEmployeeControl';+/** What they are doing, or none when the page already says it. */function TaskBox({ employee }: { employee: EmployeeSummary }) {const live = useLiveTask(employee);const task = live ?? employee.task;+ const taskText = task?.text;const textRef = useRef<HTMLSpanElement>(null);- const shownText = useRef(task.text);+ const shownText = useRef(taskText);// A new task blurs in and the card's border flashes green (design handoff "Live work").useLayoutEffect(() => {- if (shownText.current === task.text) return;- shownText.current = task.text;+ if (shownText.current === taskText) return;+ shownText.current = taskText;+ if (!taskText) return;spikeOrb(SPIKE.task);const text = textRef.current;animate(@@ -64,7 +59,8 @@ function TaskBox({ employee }: { employee: EmployeeSummary }) {duration: 'glow',fill: 'none',});- }, [task.text]);+ }, [taskText]);+ if (!task) return null;return (<div className="flex flex-col gap-1.5 rounded-card border border-border-default bg-bg-app px-4 py-3.5"><MicroLabel>{task.label}</MicroLabel>@@ -75,25 +71,6 @@ function TaskBox({ employee }: { employee: EmployeeSummary }) {);}-/** Less-used actions, out of the way: opening the workflow in the editor. */-function MoreMenu({ workflowId }: { workflowId: string }) {- return (- <DropdownMenu>- <DropdownMenuTrigger asChild>- <Button variant="quiet" size="icon" aria-label="More" title="More" className="size-9 rounded-row border-border-strong text-fg-default">- <Ellipsis aria-hidden className="size-4" />- </Button>- </DropdownMenuTrigger>- <DropdownMenuContent align="end" className="w-max">- <DropdownMenuItem onSelect={() => void enterDev({ workflowId })}>- <Code aria-hidden />- {OPEN_IN_DEV_LABEL}- </DropdownMenuItem>- </DropdownMenuContent>- </DropdownMenu>- );-}-function EmployeeCard({employee,control,@@ -108,6 +85,8 @@ function EmployeeCard({const helpInBrowser = employee.browser_request !== null;const countRef = useRef<HTMLSpanElement>(null);const { view } = control;+ // A role that only repeats the name ("AI Assistant", "AI assistant") says nothing.+ const role = employee.role.trim().toLowerCase() === employee.name.trim().toLowerCase() ? '' : employee.role;// One more done today: the count bumps in green.const shownDone = useRef(employee.done_today);@@ -136,7 +115,7 @@ function EmployeeCard({<Avatar name={employee.name} colorRole={employee.color_role} size="lg" /><div className="flex min-w-40 flex-1 flex-col gap-0.75"><span className="text-title font-semibold tracking-[-0.02em] text-fg-default">{employee.name}</span>- <span className="text-base text-fg-muted">{employee.role}</span>+ {role && <span className="text-base text-fg-muted">{role}</span>}</div><StatusPill tone={view.pill.tone} label={view.pill.label} pulse={view.pulse} /></div>@@ -149,27 +128,31 @@ function EmployeeCard({paused={employee.control.state === 'paused' || employee.control.state === 'pausing'}/>- <div className="flex flex-wrap items-center gap-2">- {employee.apps.map((app) => (- <span- key={app.app_id}- className={cn(- 'flex h-7.5 items-center gap-1.5 rounded-pill border bg-bg-app pr-2.5 pl-1 text-meta text-fg-default',- app.connected ? 'border-border-default' : 'border-status-attention-border',- )}- title={app.connected ? `${app.name} is connected` : `${app.name} is not connected`}- >- <AppMark name={app.name} iconRef={app.icon_ref} size="xs" />- {app.name}- </span>- ))}- <span className="ml-auto font-mono text-sm whitespace-nowrap text-fg-muted">- <span ref={countRef} data-count={employee.workflow_id} className="inline-block text-fg-default">- {employee.done_today}- </span>{' '}- done today- </span>- </div>+ {(employee.apps.length > 0 || employee.done_today > 0) && (+ <div className="flex flex-wrap items-center gap-2">+ {employee.apps.map((app) => (+ <span+ key={app.app_id}+ className={cn(+ 'flex h-7.5 items-center gap-1.5 rounded-pill border bg-bg-app pr-2.5 pl-1 text-meta text-fg-default',+ app.connected ? 'border-border-default' : 'border-status-attention-border',+ )}+ title={app.connected ? `${app.name} is connected` : `${app.name} is not connected`}+ >+ <AppMark name={app.name} iconRef={app.icon_ref} size="xs" />+ {app.name}+ </span>+ ))}+ {employee.done_today > 0 && (+ <span className="ml-auto font-mono text-sm whitespace-nowrap text-fg-muted">+ <span ref={countRef} data-count={employee.workflow_id} className="inline-block text-fg-default">+ {employee.done_today}+ </span>{' '}+ done today+ </span>+ )}+ </div>+ )}{employee.unsupported_apps.length > 0 && (<p className="m-0 text-xs text-fg-muted">@@ -190,8 +173,6 @@ function EmployeeCard({<Monitor aria-hidden className="size-3.5" />{helpInBrowser ? 'Help in browser' : 'Watch live'}</ActionButton>- {/* The primary button already opens Dev mode when it can do nothing else. */}- {view.primary.kind !== 'open_workflow' && <MoreMenu workflowId={employee.workflow_id} />}</div></div>);diff --git a/client/src/features/home/header/HomeHeader.tsx b/client/src/features/home/header/HomeHeader.tsxindex b813628c..ba79fc64 100644--- a/client/src/features/home/header/HomeHeader.tsx+++ b/client/src/features/home/header/HomeHeader.tsx@@ -1,7 +1,8 @@/*** Normal mode's header (design handoff "Main header"): with the sidebar* collapsed, an open button and the logo; the view's title; the Workspace- * pill, the Normal/Dev switch and the theme button. The bottom border appears only once the+ * pill, the Normal/Dev switch (on an employee's page, Dev opens their+ * workflow) and the theme button. The bottom border appears only once the* content has scrolled, so the hero reads as one surface.*/@@ -18,6 +19,7 @@ export function HomeHeader({ title, scrolled }: { title: string; scrolled: booleconst sidebarOpen = useHomeStore((s) => s.sidebarOpen);const toggleSidebar = useHomeStore((s) => s.toggleSidebar);const logoPulse = useHomeStore((s) => s.logoPulse);+ const employeeId = useHomeStore((s) => (s.view.kind === 'employee' ? s.view.workflowId : undefined));return (<header@@ -38,7 +40,7 @@ export function HomeHeader({ title, scrolled }: { title: string; scrolled: boole<h2 className="truncate px-1.5 text-lead font-semibold text-fg-default">{title}</h2><div className="ml-auto flex shrink-0 items-center gap-2"><WorkspaceButton />- <ModeToggle />+ <ModeToggle workflowId={employeeId} /><ThemeButton /></div></header>diff --git a/client/src/features/home/workspace/WorkspaceDock.tsx b/client/src/features/home/workspace/WorkspaceDock.tsxindex e704c69c..72b07912 100644--- a/client/src/features/home/workspace/WorkspaceDock.tsx+++ b/client/src/features/home/workspace/WorkspaceDock.tsx@@ -72,7 +72,7 @@ function DockButtons() {/** Who, what they are doing, and a Live pill while they work. */function Identity({ employee }: { employee: EmployeeSummary }) {- const live = useLiveTask(employee);+ const task = useLiveTask(employee) ?? employee.task;const pill =employee.status === 'working' && !employee.browser_request ? { tone: 'live' as const, label: 'Live' } : presentEmployee(employee).pill;return (@@ -80,7 +80,7 @@ function Identity({ employee }: { employee: EmployeeSummary }) {<Avatar name={employee.name} colorRole={employee.color_role} size="sm" /><div className="flex min-w-0 flex-1 flex-col gap-px"><span className="truncate text-base font-semibold text-fg-default">{employee.name}’s workspace</span>- <span className="truncate font-mono text-2xs text-fg-muted">{(live ?? employee.task).text}</span>+ {task && <span className="truncate font-mono text-2xs text-fg-muted">{task.text}</span>}</div><StatusPill size="sm" tone={pill.tone} label={pill.label} /></>diff --git a/server/services/employees/summaries.py b/server/services/employees/summaries.pyindex 056bf55f..a988d4d8 100644--- a/server/services/employees/summaries.py+++ b/server/services/employees/summaries.py@@ -114,6 +114,10 @@ def _trigger_text(employee: Any, graph: GraphIndex) -> str:return "When you start them"+#: A running employee whose only work is what the owner sends them.+_WAITING_FOR_OWNER = "Waiting for your messages"++def _waiting_text(employee: Any, graph: GraphIndex) -> str:trigger = getattr(employee, "trigger", None) or {}kind = trigger.get("kind") if isinstance(trigger, Mapping) else None@@ -126,7 +130,7 @@ def _waiting_text(employee: Any, graph: GraphIndex) -> str:if SCHEDULE_TRIGGER_TYPE in graph.trigger_types:return "Waiting for the next scheduled run"if kind == "manual" or CHAT_TRIGGER_TYPE in graph.trigger_types:- return "Waiting for your messages"+ return _WAITING_FOR_OWNERreturn "Waiting for work"@@ -190,13 +194,18 @@ def _task(employee: Any,graph: GraphIndex,browser_request: Optional[Mapping[str, Any]] = None,-) -> Dict[str, str]:+ talk_on: bool = False,+) -> Optional[Dict[str, str]]:+ """The card's task line, or None when the page already says it: a+ running employee that only waits for the owner's messages, with the+ message box right under the card."""if browser_request is not None:return {"label": "Waiting", "text": _BROWSER_REQUEST_TEXT.get(browser_request["reason"], "Needs your help in the browser")}if pending > 0:return {"label": "Waiting", "text": f"{pending} {_plural(pending, 'draft is', 'drafts are')} waiting for you to check"}if status == "working":- return {"label": "Now", "text": _waiting_text(employee, graph)}+ text = _waiting_text(employee, graph)+ return None if talk_on and text == _WAITING_FOR_OWNER else {"label": "Now", "text": text}if status == "attention":return {"label": "Paused", "text": _attention_text(control)}if status == "paused":@@ -257,8 +266,6 @@ async def _summary(if not watch:watch = list(graph.agent_ids) + list(graph.todo_ids)talk = _talk(graph, control_row)- if talk.agent_node_id is not None and talk.agent_node_id not in watch:- watch.append(talk.agent_node_id)# The board Home's Workspace shows: the one the hire made, while it is# still in the graph, else the first canvas the owner added.canvas = roles.get("canvas") if roles else None@@ -280,6 +287,7 @@ async def _summary(employee=employee,graph=graph,browser_request=browser_request,+ talk_on=talk.state == "on",),"done_today": done_today,"pending_approvals": pending,diff --git a/server/tests/services/employees/test_enable_talk.py b/server/tests/services/employees/test_enable_talk.pyindex e9b2c48b..f633f462 100644--- a/server/tests/services/employees/test_enable_talk.py+++ b/server/tests/services/employees/test_enable_talk.py@@ -189,11 +189,12 @@ async def test_a_running_hire_gets_a_talk_line_and_restarts(harness):"talk_reply": "7:chatReply:1","builder": "7:agentBuilder:1",}- # Restarted on the saved graph, so the line runs and the page follows it.+ # Restarted on the saved graph, so the line runs and the page follows it+ # through `talk` (the card keeps following the worker).assert harness.restart.calls == [("7", "owner", "k1")]assert employee["talk"] == {"state": "on", "agent_node_id": "7:aiAgent:2"}assert employee["pending_changes"] is False- assert "7:aiAgent:2" in employee["watch_node_ids"]+ assert "7:aiAgent:2" not in employee["watch_node_ids"]assert employee["revision"] > before["revision"]# The talk agent: the worker's model, instructions written from the hire.diff --git a/server/tests/services/employees/test_list_employees.py b/server/tests/services/employees/test_list_employees.pyindex 0383dbcf..0dd7cf03 100644--- a/server/tests/services/employees/test_list_employees.py+++ b/server/tests/services/employees/test_list_employees.py@@ -354,14 +354,16 @@ async def test_talk_is_read_off_the_saved_graph_when_nothing_runs(real_database)assert detail["trigger_text"] == "When you message them"-async def test_a_hired_employee_watches_its_talk_agent_too(real_database):+async def test_the_card_follows_the_work_and_talk_follows_the_talk_agent(real_database):+ # The conversation shows its own "Thinking...", so the card does not+ # also follow the agent answering the owner.data = talking("23")data["nodes"].insert(0, node("23:aiAgent:2", "aiAgent", "Worker"))data["nodes"].insert(0, node("23:writeTodos:1", "writeTodos", "Checklist"))await save(real_database, "23", "Sam", data)await _hired(real_database, "23", {"agent": "23:aiAgent:2", "todos": "23:writeTodos:1", "talk_agent": "23:aiAgent:1"})summary = await get_employee_summary(real_database, "23", auth_service=FakeAuth(keys={"openai"}))- assert summary["watch_node_ids"] == ["23:aiAgent:2", "23:writeTodos:1", "23:aiAgent:1"]+ assert summary["watch_node_ids"] == ["23:aiAgent:2", "23:writeTodos:1"]assert summary["talk"]["agent_node_id"] == "23:aiAgent:1"@@ -378,7 +380,13 @@ async def test_talk_follows_the_live_generation_and_changes_wait_for_a_restart(rsummary = await get_employee_summary(real_database, "24", auth_service=FakeAuth(keys={"openai"}))assert summary["talk"] == {"state": "on", "agent_node_id": "24:aiAgent:1"}assert summary["pending_changes"] is False- assert "24:aiAgent:1" in summary["watch_node_ids"]+ # Waiting for the owner's messages goes without saying with the message+ # box under the card: no task line. Without Talk the line stays.+ assert summary["task"] is None+ await save(real_database, "24", "Sam", talking("24", reply=False))+ await control(real_database, "24", "running", generation=3, graph_snapshot=snapshot("24", talking("24", reply=False)))+ summary = await get_employee_summary(real_database, "24", auth_service=FakeAuth(keys={"openai"}))+ assert summary["task"] == {"label": "Now", "text": "Waiting for your messages"}async def test_asking_first(real_database):