Skip to content

Self-improving AI Employees for everyone

fix(home): keep the orb above an employee's conversation

trohitg4913252138ad
diff --git a/client/src/features/chat/host.ts b/client/src/features/chat/host.ts
index 3503fa22..8af505e7 100644
--- a/client/src/features/chat/host.ts
+++ b/client/src/features/chat/host.ts
@@ -43,7 +43,7 @@ export interface ChatHost {
/** Above the box, while there is something to act on (Start, Apply, Help
* in browser). */
notices?: ReactNode;
- /** The first item of the thread's scroll area (Home: the orb). */
+ /** The first item of the thread's scroll area (Home: a new hire's notes). */
top?: ReactNode;
/** After the conversation, inside the scroll area (Home: the drafts
* waiting for the owner). */
diff --git a/client/src/features/chat/thread/ChatThread.tsx b/client/src/features/chat/thread/ChatThread.tsx
index 6f446d18..e38915c3 100644
--- a/client/src/features/chat/thread/ChatThread.tsx
+++ b/client/src/features/chat/thread/ChatThread.tsx
@@ -1,7 +1,7 @@
/**
* The conversation's scroll area (design handoff chat, "Thread"): the
- * host's top slot (Home: the orb), the turns in a centred column, and what
- * the host shows after them.
+ * host's top slot (Home: a new hire's notes), the turns in a centred
+ * column, and what the host shows after them.
*
* - **Sticks to the bottom.** While the newest turn is in view, anything
* that grows the thread (a new turn, text arriving, a markdown chunk
diff --git a/client/src/features/home/__tests__/employeeChat.test.tsx b/client/src/features/home/__tests__/employeeChat.test.tsx
index 497fdc8e..b029422a 100644
--- a/client/src/features/home/__tests__/employeeChat.test.tsx
+++ b/client/src/features/home/__tests__/employeeChat.test.tsx
@@ -264,6 +264,19 @@ describe('sending', () => {
});
describe('the orb and Ask first', () => {
+ it('keeps the orb above the conversation, outside what scrolls', async () => {
+ server.messages = [row(1, 'user', 'Morning!'), row(2, 'assistant', 'Two bookings today.')];
+ renderChat(employee());
+ const log = await screen.findByRole('log', { name: 'Conversation with Maya' });
+ await screen.findByText('Two bookings today.');
+ // The thread opens at its newest turn, so a slot inside its scroll area
+ // would take the orb out of view.
+ const slot = document.querySelector('[data-orb-slot="employee"]');
+ expect(slot).not.toBeNull();
+ expect(slot!.closest('[data-scrollable]')).toBeNull();
+ expect(slot!.compareDocumentPosition(log) & Node.DOCUMENT_POSITION_FOLLOWING).toBeTruthy();
+ });
+
it('brightens while the owner writes and spikes when a message goes', async () => {
orbState.spike = 0;
orbState.target = ENERGY.idle;
diff --git a/client/src/features/home/employee/EmployeeChat.tsx b/client/src/features/home/employee/EmployeeChat.tsx
index 1b77810c..eb2f0d94 100644
--- a/client/src/features/home/employee/EmployeeChat.tsx
+++ b/client/src/features/home/employee/EmployeeChat.tsx
@@ -2,11 +2,12 @@
* Talking to an employee on their page: the shared chat (features/chat)
* over the session whose id is their workflow id, with Home around it.
*
- * - The thread scrolls under the header with the orb as its first item (and
- * a new hire's notes under it); what they want to send waits for the
- * owner on cards in the chat (features/chat), with the Ask first chip
- * beside the box; the line under the box says whether they ask before
- * sending anything.
+ * - The orb stays above the conversation: the thread scrolls under it, so a
+ * long conversation never takes it out of view. A new hire's notes are
+ * the thread's first item. What they want to send waits for the owner on
+ * cards in the chat (features/chat), with the Ask first chip beside the
+ * box; the line under the box says whether they ask before sending
+ * anything.
* - The message box follows their control state the way the server does: a
* message goes at once while they run, waits for Resume while they are
* paused, and cannot be sent otherwise. Above it, what to act on: Resume or
@@ -187,37 +188,37 @@ export function EmployeeChat({
};
return (
- <ChatPane
- ref={pane}
- host={{
- kind: 'home',
- sessionId: workflowId,
- scope: 'all',
- persona: { name, colorRole: employee.color_role, photo: employee.photo_url },
- composer,
- placeholder: composer === 'wait' ? `${name} is starting…` : undefined,
- notices: <Notices employee={employee} control={control} queued={lane?.state === 'queued'} firstDay={Boolean(firstDay)} />,
- top: (
- <div className="flex flex-col items-center gap-4">
- <OrbSlot size="employee" />
- <HireNotice workflowId={workflowId} />
- </div>
- ),
- emptyState: firstDay && phase ? <FirstDay employee={employee} firstDay={firstDay} phase={phase} control={control} /> : undefined,
- greetings: firstDay ? GREETINGS : undefined,
- footnote: employee.asks_first
- ? `${name} asks before sending anything on your behalf.`
- : `${name} doesn’t ask before sending anything on your behalf.`,
- notify: (message, tone) => pillToast(message, { tone }),
- openArtifact: (artifact) => useHomeStore.getState().openCanvasItem(artifact),
- onSendRefused,
- onSent,
- onComposerChange,
- modelPicker: true,
- liveNote,
- onScrolledChange,
- }}
- />
+ <>
+ <div className="flex flex-none justify-center pt-7">
+ <OrbSlot size="employee" />
+ </div>
+ <ChatPane
+ ref={pane}
+ host={{
+ kind: 'home',
+ sessionId: workflowId,
+ scope: 'all',
+ persona: { name, colorRole: employee.color_role, photo: employee.photo_url },
+ composer,
+ placeholder: composer === 'wait' ? `${name} is starting…` : undefined,
+ notices: <Notices employee={employee} control={control} queued={lane?.state === 'queued'} firstDay={Boolean(firstDay)} />,
+ top: <HireNotice workflowId={workflowId} />,
+ emptyState: firstDay && phase ? <FirstDay employee={employee} firstDay={firstDay} phase={phase} control={control} /> : undefined,
+ greetings: firstDay ? GREETINGS : undefined,
+ footnote: employee.asks_first
+ ? `${name} asks before sending anything on your behalf.`
+ : `${name} doesn’t ask before sending anything on your behalf.`,
+ notify: (message, tone) => pillToast(message, { tone }),
+ openArtifact: (artifact) => useHomeStore.getState().openCanvasItem(artifact),
+ onSendRefused,
+ onSent,
+ onComposerChange,
+ modelPicker: true,
+ liveNote,
+ onScrolledChange,
+ }}
+ />
+ </>
);
}
diff --git a/client/src/features/home/employee/EmployeeView.tsx b/client/src/features/home/employee/EmployeeView.tsx
index 11c5069b..af60f664 100644
--- a/client/src/features/home/employee/EmployeeView.tsx
+++ b/client/src/features/home/employee/EmployeeView.tsx
@@ -1,8 +1,8 @@
/**
* One employee's page (design handoff chat): the conversation with them
* (EmployeeChat) fills the page under the header, which names them; the
- * orb sits at the top of the conversation, and a new hire's notes
- * (HireNotice) under it.
+ * orb stays above the conversation, and a new hire's notes (HireNotice)
+ * open the thread.
*
* What to act on lives above the message box, and only while there is
* something to do: their main action while they cannot read messages
diff --git a/docs-internal/normal_mode.md b/docs-internal/normal_mode.md
index da2cf854..d60bbbdf 100644
--- a/docs-internal/normal_mode.md
+++ b/docs-internal/normal_mode.md
@@ -644,7 +644,9 @@ sending and drafts belong to the chat (wire and client rules in
- **The thread** is `get_chat_messages` with `all_generations: true` (the
newest 200 messages): the conversation since the employee last started,
since a Reset clears it (see [Turn on Talk and Apply](#turn-on-talk-and-apply)).
- The orb sits at its top (`min(96px, 14vh)`), a new hire's notes under it.
+ The orb (`min(96px, 14vh)`) stays above it, outside its scroll area, so a
+ long conversation never takes it out of view; a new hire's notes are the
+ thread's first item.
Where a message's `run_key` (its generation) differs from the one before (a
message left from before a Start, such as a test run in Dev mode), a divider
reads "{Name} restarted — they start fresh from here". The owner's messages