Skip to content

Self-improving AI Employees for everyone

feat(home): the 3D orb, design fidelity fixes, and the Email icon

trohitg74cc9fbc405b
diff --git a/.gitignore b/.gitignore
index 5dd17a25..30be989f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -14,7 +14,7 @@ dist-ssr
test-temp*/
# External design handoff bundle (reference-only; merged copy lives in docs-internal/design-system/)
-design_handoff_theme_system/
+design_handoff_opencompany_home/
# npm-generated lock file. This project uses bun (canonical lock:
# ``bun.lock``, tracked). Source checkouts are gated to bun
diff --git a/client/src/app/AppShell.tsx b/client/src/app/AppShell.tsx
index a0af5e58..0a49822d 100644
--- a/client/src/app/AppShell.tsx
+++ b/client/src/app/AppShell.tsx
@@ -10,8 +10,9 @@
* changes on every console, chat and terminal line.
*/
-import { Suspense, lazy, useState } from 'react';
+import { Suspense, lazy, useEffect, useState } from 'react';
import { TooltipProvider } from '@/components/ui/tooltip';
+import { disposeOrb } from '../features/home/orb/orb';
import { useSoundSync } from '../hooks/useSound';
import { useSaveUserSettingsMutation } from '../hooks/useUserSettingsQuery';
import { useShellDialogsStore } from '../stores/shellDialogsStore';
@@ -33,6 +34,8 @@ function ShellEffects() {
useCurrentWorkflowSync();
useUIDefaultsOnce();
useModeShortcut();
+ // Home's orb keeps its renderer across mode switches; free it with the app.
+ useEffect(() => disposeOrb, []);
return null;
}
diff --git a/client/src/app/ShellModeSwitch.tsx b/client/src/app/ShellModeSwitch.tsx
index be17d255..dbf7b85c 100644
--- a/client/src/app/ShellModeSwitch.tsx
+++ b/client/src/app/ShellModeSwitch.tsx
@@ -26,7 +26,13 @@ export function preloadEditor(): Promise<unknown> {
}
// Home is its own chunk too, so a Dev-mode session never loads it.
-const LazyHome = lazy(() => import('../features/home/HomeShell'));
+const loadHome = () => import('../features/home/HomeShell');
+const LazyHome = lazy(loadHome);
+
+/** Start fetching the Home chunk. Safe to call repeatedly. */
+export function preloadHome(): Promise<unknown> {
+ return loadHome();
+}
/** The screen the shell shows. Always `dev` while the flag is off. */
export function useShellMode(): ShellMode {
diff --git a/client/src/app/__tests__/shellActions.test.ts b/client/src/app/__tests__/shellActions.test.ts
index d7f95e34..927cdffa 100644
--- a/client/src/app/__tests__/shellActions.test.ts
+++ b/client/src/app/__tests__/shellActions.test.ts
@@ -14,6 +14,7 @@ vi.mock('../ShellModeSwitch', () => ({
preloadEditor: vi.fn(async () => {
events.push('preload');
}),
+ preloadHome: vi.fn(async () => {}),
}));
vi.mock('../shellTransition', () => ({
diff --git a/client/src/app/useShellActions.ts b/client/src/app/useShellActions.ts
index fcbe859d..8954a9de 100644
--- a/client/src/app/useShellActions.ts
+++ b/client/src/app/useShellActions.ts
@@ -12,10 +12,11 @@
import { useMemo } from 'react';
import { toast } from 'sonner';
+import { SPIKE, spikeOrb } from '../features/home/orb/orb';
import { featureFlags } from '../lib/featureFlags';
import { useAppStore } from '../store/useAppStore';
import { useWorkflowSettingsStore } from '../stores/workflowSettingsStore';
-import { preloadEditor } from './ShellModeSwitch';
+import { preloadEditor, preloadHome } from './ShellModeSwitch';
import { transitionShell } from './shellTransition';
export interface EnterDevOptions {
@@ -64,7 +65,15 @@ export async function enterDev(options: EnterDevOptions = {}): Promise<void> {
export async function enterNormal(): Promise<void> {
if (!featureFlags.normalMode) return;
+ // Loaded before the swap, so Home's entrance never plays on a placeholder.
+ try {
+ await preloadHome();
+ } catch (error) {
+ console.error('[Shell] Could not load Home:', error);
+ }
await transitionShell('normal');
+ // Home's orb flares as it arrives (it fades out within a second).
+ spikeOrb(SPIKE.mode);
}
export function toggleShellMode(): Promise<void> {
diff --git a/client/src/components/ui/button.tsx b/client/src/components/ui/button.tsx
index f9178a88..dcc399e3 100644
--- a/client/src/components/ui/button.tsx
+++ b/client/src/components/ui/button.tsx
@@ -31,7 +31,7 @@ const buttonVariants = cva(
// the foreground colour as the fill, so it reads as the one strong
// control on a calm screen; a neutral fill when disabled.
invert:
- "bg-fg-default text-bg-app hover:opacity-88 disabled:bg-border-default disabled:text-fg-faint disabled:opacity-100",
+ "border-0 bg-fg-default text-bg-app hover:opacity-88 disabled:bg-border-default disabled:text-fg-faint disabled:opacity-100",
// Quiet icon/text buttons on Normal-mode surfaces (sidebar collapse,
// theme switch). Token-only, with no `dark:` rules that would
// out-specify a caller's tone classes.
diff --git a/client/src/features/home/HomeShell.tsx b/client/src/features/home/HomeShell.tsx
index 57ca2ad8..d3c04a1c 100644
--- a/client/src/features/home/HomeShell.tsx
+++ b/client/src/features/home/HomeShell.tsx
@@ -5,8 +5,9 @@
* current view, either hiring a new employee or one employee's card.
*
* The shell owns what spans views: the employee broadcasts that keep the
- * team current, the Settings dialog, and the connect dialog any view can
- * open. Switching views scrolls to the top and plays the view swap.
+ * team current, the orb behind the content, the Settings dialog, and the
+ * connect dialog any view can open. Switching views scrolls to the top and
+ * plays the view swap.
*/
import { useLayoutEffect, useRef, useState } from 'react';
@@ -16,6 +17,8 @@ import { useEmployeeLifecycle, useEmployeesQuery } from './data/employees';
import { EmployeeView } from './employee/EmployeeView';
import { HomeHeader } from './header/HomeHeader';
import { HireView } from './hire/HireView';
+import { SPIKE, spikeOrb } from './orb/orb';
+import { OrbStage } from './orb/OrbStage';
import { ConnectDialog } from './settings/ConnectDialog';
import { HomeSettings } from './settings/HomeSettings';
import { HomeSidebar } from './sidebar/HomeSidebar';
@@ -37,6 +40,10 @@ export default function HomeShell() {
const view = useHomeStore((s) => s.view);
const title = useViewTitle();
const [connectId, setConnectId] = useState<string | null>(null);
+ const openConnect = (providerId: string) => {
+ spikeOrb(SPIKE.connect);
+ setConnectId(providerId);
+ };
const [scrolled, setScrolled] = useState(false);
const scrollRef = useRef<HTMLDivElement>(null);
const viewRef = useRef<HTMLDivElement>(null);
@@ -59,21 +66,22 @@ export default function HomeShell() {
}, [viewKey]);
return (
- <div className="flex min-h-0 flex-1">
+ <div className="flex min-h-0 flex-1 antialiased">
<HomeSidebar />
<main className="relative flex min-w-0 flex-1 flex-col">
+ <OrbStage />
<HomeHeader title={title} scrolled={scrolled} />
<div
ref={scrollRef}
onScroll={(event) => setScrolled(event.currentTarget.scrollTop > HEADER_BORDER_AFTER_PX)}
- className="relative min-h-0 flex-1 overflow-x-hidden overflow-y-auto"
+ className="relative z-10 min-h-0 flex-1 overflow-x-hidden overflow-y-auto"
>
<div className="mx-auto flex max-w-(--w-home-content) flex-col items-center px-6 pt-2 pb-10">
<div ref={viewRef} key={viewKey} className="flex w-full flex-col items-center">
{view.kind === 'employee' ? (
- <EmployeeView workflowId={view.workflowId} onConnect={setConnectId} />
+ <EmployeeView workflowId={view.workflowId} onConnect={openConnect} />
) : (
- <HireView onConnect={setConnectId} />
+ <HireView onConnect={openConnect} />
)}
</div>
<p className="m-0 pt-7 text-center text-xs text-fg-muted">
@@ -82,7 +90,7 @@ export default function HomeShell() {
</div>
</div>
</main>
- <HomeSettings onConnect={setConnectId} />
+ <HomeSettings onConnect={openConnect} />
<ConnectDialog providerId={connectId} onClose={() => setConnectId(null)} />
</div>
);
diff --git a/client/src/features/home/data/presentation.ts b/client/src/features/home/data/presentation.ts
index 0c865db2..82ec996a 100644
--- a/client/src/features/home/data/presentation.ts
+++ b/client/src/features/home/data/presentation.ts
@@ -75,7 +75,8 @@ export function presentEmployee(
const pill = employee.pending_approvals > 0 ? { label: 'Needs you', tone: 'waiting' as const } : PILL[employee.status];
return {
pill,
- pulse: employee.status === 'working',
+ // Only a green working dot pulses (its ring is green).
+ pulse: pill.tone === 'working',
primary: primaryAction(employee),
busyLabel: pending ? BUSY[pending.action] : null,
};
diff --git a/client/src/features/home/employee/EmployeeView.tsx b/client/src/features/home/employee/EmployeeView.tsx
index 08864c4f..28ce781f 100644
--- a/client/src/features/home/employee/EmployeeView.tsx
+++ b/client/src/features/home/employee/EmployeeView.tsx
@@ -14,7 +14,7 @@
import { useQueryClient } from '@tanstack/react-query';
import { Code } from 'lucide-react';
-import { useEffect, useState } from 'react';
+import { useEffect, useLayoutEffect, useRef, useState } from 'react';
import { ActionButton } from '@/components/ui/action-button';
import { Button } from '@/components/ui/button';
import { Skeleton } from '@/components/ui/skeleton';
@@ -23,6 +23,7 @@ import {
useWebSocketActions,
type WorkflowControlStatus,
} from '@/contexts/WebSocketContext';
+import { animate } from '@/lib/motion';
import { cn } from '@/lib/utils';
import { useWorkflowControlPending } from '@/stores/workflowControlStore';
import { enterDev } from '../../../app/useShellActions';
@@ -31,6 +32,7 @@ import { useLiveTask } from '../data/liveTask';
import { busyLabelFor, presentEmployee, primaryActionLabel, type PrimaryAction } from '../data/presentation';
import type { EmployeeSummary } from '../data/schemas';
import { OrbSlot } from '../orb/OrbSlot';
+import { SPIKE, spikeOrb } from '../orb/orb';
import { useHomeStore } from '../state/homeStore';
import { pillToast } from '../ui/pillToast';
import { AppMark, Avatar, MicroLabel, StatusPill } from '../ui/primitives';
@@ -52,10 +54,31 @@ function controlErrorMessage(error: unknown): string {
function TaskBox({ employee }: { employee: EmployeeSummary }) {
const live = useLiveTask(employee);
const task = live ?? employee.task;
+ const textRef = useRef<HTMLSpanElement>(null);
+ const shownText = useRef(task.text);
+ // 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;
+ spikeOrb(SPIKE.task);
+ const text = textRef.current;
+ animate(
+ text,
+ [
+ { opacity: 0, transform: 'translateY(8px)', filter: 'blur(3px)' },
+ { opacity: 1, transform: 'none', filter: 'blur(0)' },
+ ],
+ { duration: 520, easing: 'spring', fill: 'backwards' },
+ );
+ animate(text?.closest('[data-employee]'), [{ borderColor: 'var(--status-working-border)' }, { borderColor: 'var(--border-default)' }], {
+ duration: 'glow',
+ fill: 'none',
+ });
+ }, [task.text]);
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>
- <span data-task={employee.workflow_id} className="text-md text-fg-default" aria-live="polite">
+ <span ref={textRef} data-task={employee.workflow_id} className="text-md text-fg-default" aria-live="polite">
{task.text}
</span>
</div>
@@ -72,6 +95,25 @@ function EmployeeCard({ employee, onConnect }: { employee: EmployeeSummary; onCo
const openSettings = useHomeStore((s) => s.openSettings);
const [running, setRunning] = useState<ControlKind | null>(null);
const [awaiting, setAwaiting] = useState<{ kind: ControlKind; target: WorkflowControlStatus } | null>(null);
+ const cardRef = useRef<HTMLDivElement>(null);
+ const countRef = useRef<HTMLSpanElement>(null);
+
+ // One more done today: the count bumps in green.
+ const shownDone = useRef(employee.done_today);
+ useLayoutEffect(() => {
+ const previous = shownDone.current;
+ shownDone.current = employee.done_today;
+ if (employee.done_today <= previous) return;
+ animate(
+ countRef.current,
+ [
+ { transform: 'none', color: 'var(--status-working-ink)' },
+ { transform: 'translateY(-3px) scale(1.25)', color: 'var(--status-working-ink)', offset: 0.35 },
+ { transform: 'none', color: 'var(--fg-default)' },
+ ],
+ { duration: 700, fill: 'none' },
+ );
+ }, [employee.done_today]);
// Caught up once the summary's control is at least as new as the result.
const caughtUp = !awaiting || mergeWorkflowControlStatus(awaiting.target, employee.control) === employee.control;
@@ -109,7 +151,14 @@ function EmployeeCard({ employee, onConnect }: { employee: EmployeeSummary; onCo
if (primary.kind === 'connect_app') onConnect(primary.app.provider_id);
else if (primary.kind === 'connect_ai') openSettings('connectors', 'ai');
else if (primary.kind === 'open_workflow') void enterDev({ workflowId: employee.workflow_id });
- else void control(primary.kind);
+ else {
+ animate(cardRef.current, [{ transform: 'scale(1)' }, { transform: 'scale(.97)', offset: 0.3 }, { transform: 'scale(1)' }], {
+ duration: 420,
+ easing: 'spring',
+ fill: 'none',
+ });
+ void control(primary.kind);
+ }
};
const inFlight = running ?? (waiting ? awaiting?.kind : null) ?? null;
@@ -119,13 +168,14 @@ function EmployeeCard({ employee, onConnect }: { employee: EmployeeSummary; onCo
return (
<div
+ ref={cardRef}
data-employee={employee.workflow_id}
className="flex w-full flex-col gap-4.5 rounded-draft border border-border-default bg-bg-elevated p-5.5 shadow-float"
>
<div className="flex flex-wrap items-center gap-3.5">
<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-hero text-fg-default">{employee.name}</span>
+ <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>
</div>
<StatusPill tone={view.pill.tone} label={view.pill.label} pulse={view.pulse} />
@@ -144,7 +194,7 @@ function EmployeeCard({ employee, onConnect }: { employee: EmployeeSummary; onCo
<span
key={app.app_id}
className={cn(
- 'flex h-7 items-center gap-1.5 rounded-pill border bg-bg-app pr-2.5 pl-1 text-meta text-fg-default',
+ '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`}
@@ -154,7 +204,7 @@ function EmployeeCard({ employee, onConnect }: { employee: EmployeeSummary; onCo
</span>
))}
<span className="ml-auto font-mono text-sm whitespace-nowrap text-fg-muted">
- <span data-count={employee.workflow_id} className="text-fg-default">
+ <span ref={countRef} data-count={employee.workflow_id} className="inline-block text-fg-default">
{employee.done_today}
</span>{' '}
done today
@@ -219,7 +269,7 @@ export function EmployeeView({ workflowId, onConnect }: { workflowId: string; on
return (
<section className="flex w-full max-w-(--w-employee-card) flex-col items-center gap-3 pt-16 text-center">
<p className="m-0 text-md text-fg-default">
- {detail.isError ? "Couldn't load this employee." : 'This employee is no longer on the team.'}
+ {detail.isError ? 'Couldn’t load this employee.' : 'This employee is no longer on the team.'}
</p>
<div className="flex gap-2">
{detail.isError && (
diff --git a/client/src/features/home/genui/HireDraftPanel.tsx b/client/src/features/home/genui/HireDraftPanel.tsx
index 6bafad8a..c92c928e 100644
--- a/client/src/features/home/genui/HireDraftPanel.tsx
+++ b/client/src/features/home/genui/HireDraftPanel.tsx
@@ -73,7 +73,7 @@ function WorkingSteps({ token }: { token: string | null }) {
{active && (
<span
aria-hidden
- className="mx-0.5 size-3.5 shrink-0 animate-spin rounded-full border-2 border-node-agent-border border-t-node-agent motion-reduce:animate-none"
+ className="mx-0.5 size-3.5 shrink-0 animate-[spin_700ms_linear_infinite] rounded-full border-2 border-node-agent-border border-t-node-agent motion-reduce:animate-none"
/>
)}
{!done && !active && (
@@ -92,9 +92,9 @@ function FailureNotice({ failure, onRetry, onConnectAi }: { failure: DraftFailur
return (
<div
role="alert"
- className="flex flex-wrap items-center gap-3 rounded-card border border-status-attention-border bg-status-attention-fill px-3.5 py-3"
+ className="flex flex-wrap items-center gap-3 rounded-card border border-node-trigger-border bg-node-trigger-soft px-3.5 py-3"
>
- <span aria-hidden className="size-2 shrink-0 rounded-full bg-status-attention-dot" />
+ <span aria-hidden className="size-2 shrink-0 rounded-full bg-node-trigger" />
<div className="flex min-w-50 flex-1 flex-col gap-0.5">
<span className="text-base font-semibold text-fg-default">
{failure.refine ? 'Couldn’t make that change' : 'Couldn’t finish setting this up'}
@@ -112,12 +112,12 @@ function FailureNotice({ failure, onRetry, onConnectAi }: { failure: DraftFailur
<Button
variant="quiet"
onClick={onRetry}
- className="h-8 rounded-md border-border-strong px-3.5 font-semibold text-fg-default"
+ className="h-8 rounded-lg border-border-strong px-3.5 font-semibold text-fg-default"
>
Try again
</Button>
) : (
- <ActionButton intent="run" onClick={onRetry}>
+ <ActionButton intent="stop" onClick={onRetry} className="rounded-lg">
Try again
</ActionButton>
)}
@@ -240,8 +240,15 @@ export function HireDraftPanel({ onConnect }: { onConnect: (providerId: string)
<div className="flex items-center gap-2.5">
<MicroLabel className="shrink-0 text-node-agent-ink">New employee</MicroLabel>
<span className="min-w-0 flex-1 truncate text-sm text-fg-muted">{job}</span>
- <Button variant="quiet" size="icon-sm" onClick={() => void discard()} title="Discard draft" aria-label="Discard draft">
- <X />
+ <Button
+ variant="quiet"
+ size="icon-sm"
+ onClick={() => void discard()}
+ title="Discard draft"
+ aria-label="Discard draft"
+ className="rounded-lg"
+ >
+ <X className="size-3.5" />
</Button>
</div>
@@ -269,7 +276,7 @@ export function HireDraftPanel({ onConnect }: { onConnect: (providerId: string)
onClick={() => setShowJson((on) => !on)}
title="See the layout the assistant generated"
aria-expanded={showJson}
- className="self-start font-mono text-2xs font-normal text-fg-faint hover:border-border-default"
+ className="gap-1.5 self-start font-mono text-2xs font-normal text-fg-faint hover:border-border-default hover:bg-transparent hover:text-fg-muted"
>
<Code aria-hidden />
{showJson ? 'Hide layout JSON' : 'Layout JSON'}
diff --git a/client/src/features/home/genui/render.tsx b/client/src/features/home/genui/render.tsx
index fe2630fe..14ef6546 100644
--- a/client/src/features/home/genui/render.tsx
+++ b/client/src/features/home/genui/render.tsx
@@ -41,11 +41,11 @@ function useSpec(): SpecContextValue {
// ----- token maps (Tailwind scans these literals) -----
const TONE_CARD: Record<Tone, string> = {
- agent: 'border-node-agent-border bg-linear-135 from-node-agent-soft to-bg-elevated to-60%',
- model: 'border-node-model-border bg-linear-135 from-node-model-soft to-bg-elevated to-60%',
- tool: 'border-node-tool-border bg-linear-135 from-node-tool-soft to-bg-elevated to-60%',
- trigger: 'border-node-trigger-border bg-linear-135 from-node-trigger-soft to-bg-elevated to-60%',
- workflow: 'border-node-workflow-border bg-linear-135 from-node-workflow-soft to-bg-elevated to-60%',
+ agent: 'border-node-agent-border bg-linear-135/srgb from-node-agent-soft to-bg-elevated to-60%',
+ model: 'border-node-model-border bg-linear-135/srgb from-node-model-soft to-bg-elevated to-60%',
+ tool: 'border-node-tool-border bg-linear-135/srgb from-node-tool-soft to-bg-elevated to-60%',
+ trigger: 'border-node-trigger-border bg-linear-135/srgb from-node-trigger-soft to-bg-elevated to-60%',
+ workflow: 'border-node-workflow-border bg-linear-135/srgb from-node-workflow-soft to-bg-elevated to-60%',
neutral: 'border-border-default bg-bg-elevated',
};
@@ -77,10 +77,12 @@ const TONE_BADGE: Record<Tone, string> = {
};
const STEP_TONE: Record<StepRole, string> = {
- trigger: 'border-node-trigger-edge bg-linear-135 from-node-trigger-fill to-bg-elevated',
- agent: 'border-node-agent-edge bg-linear-135 from-node-agent-fill to-bg-elevated',
- tool: 'border-node-tool-edge bg-linear-135 from-node-tool-fill to-bg-elevated',
- workflow: 'border-node-workflow-edge bg-linear-135 from-node-workflow-fill to-bg-elevated',
+ trigger:
+ 'border-node-trigger-edge bg-linear-135/srgb from-node-trigger-fill to-bg-elevated shadow-[0_0_18px_var(--node-trigger-soft)]',
+ agent: 'border-node-agent-edge bg-linear-135/srgb from-node-agent-fill to-bg-elevated shadow-[0_0_18px_var(--node-agent-soft)]',
+ tool: 'border-node-tool-edge bg-linear-135/srgb from-node-tool-fill to-bg-elevated shadow-[0_0_18px_var(--node-tool-soft)]',
+ workflow:
+ 'border-node-workflow-edge bg-linear-135/srgb from-node-workflow-fill to-bg-elevated shadow-[0_0_18px_var(--node-workflow-soft)]',
};
const STEP_LABEL: Record<StepRole, string> = { trigger: 'When', agent: 'Agent', tool: 'Uses', workflow: 'Then' };
@@ -88,8 +90,16 @@ const STEP_LABEL: Record<StepRole, string> = { trigger: 'When', agent: 'Agent',
const STACK_GAP = { sm: 'gap-2', md: 'gap-3', lg: 'gap-4.5' } as const;
const AGENT_STATUS = {
- ready: { label: 'Ready', dot: 'bg-status-working-dot', ink: 'text-status-working-ink' },
- working: { label: 'Working', dot: 'bg-status-ready-dot', ink: 'text-status-ready-ink' },
+ ready: {
+ label: 'Ready',
+ dot: 'bg-status-working-dot shadow-[0_0_8px_var(--status-working-dot)]',
+ ink: 'text-status-working-ink',
+ },
+ working: {
+ label: 'Working',
+ dot: 'bg-status-ready-dot shadow-[0_0_8px_var(--status-ready-dot)]',
+ ink: 'text-status-ready-ink',
+ },
paused: { label: 'Paused', dot: 'bg-status-paused-dot', ink: 'text-status-paused-ink' },
} as const;
@@ -162,7 +172,7 @@ function CardView({ props, children }: { props: PropsOf<'Card'>; children: React
function HeadingView({ props }: { props: PropsOf<'Heading'> }) {
const enter = useEnter<HTMLHeadingElement>();
return (
- <h3 ref={enter} className="m-0 text-md font-semibold tracking-tight text-fg-default">
+ <h3 ref={enter} className="m-0 text-md font-semibold tracking-[-0.01em] text-fg-default">
{props.text}
</h3>
);
@@ -182,7 +192,7 @@ function MetricView({ props }: { props: PropsOf<'Metric'> }) {
return (
<div ref={enter} className="flex flex-col gap-1 rounded-card border border-border-default bg-bg-elevated p-3.5">
<span className="text-xs text-fg-muted">{props.label}</span>
- <span className={cn('text-2xl font-semibold tracking-tight', TONE_INK[props.tone ?? 'neutral'])}>{props.value}</span>
+ <span className={cn('text-xl font-semibold tracking-[-0.02em]', TONE_INK[props.tone ?? 'neutral'])}>{props.value}</span>
{props.hint && <span className="text-xs text-fg-faint">{props.hint}</span>}
</div>
);
@@ -231,7 +241,7 @@ function PlanView({ props }: { props: PropsOf<'Plan'> }) {
return (
<div ref={enter} className="flex min-w-0 flex-col gap-3.5 rounded-card border border-border-default bg-bg-elevated p-4">
<div className="flex items-center gap-2">
- <span className="text-lead font-semibold text-fg-default">{props.title || 'Their routine'}</span>
+ <span className="text-lead font-semibold text-fg-default">{props.title || 'Automation'}</span>
<span className="ml-auto font-mono text-2xs text-fg-faint">
{props.steps.length} {props.steps.length === 1 ? 'step' : 'steps'}
</span>
@@ -361,7 +371,11 @@ function ProgressView({ props }: { props: PropsOf<'Progress'> }) {
</div>
<div className="h-1.5 overflow-hidden rounded-pill bg-border-default">
{/* Width is the runtime value. */}
- <div ref={barRef} className={cn('h-full rounded-pill', TONE_DOT[props.tone ?? 'model'])} style={{ width: `${props.value}%` }} />
+ <div
+ ref={barRef}
+ className={cn('h-full rounded-pill', TONE_DOT[!props.tone || props.tone === 'neutral' ? 'model' : props.tone])}
+ style={{ width: `${props.value}%` }}
+ />
</div>
</div>
);
@@ -382,7 +396,6 @@ function ToggleView({ props, raw }: { props: PropsOf<'Toggle'>; raw: SpecElement
tone="run"
aria-label={props.label}
checked={props.value}
- disabled={!path}
onCheckedChange={(next) => path && onValue(path, next)}
/>
</div>
@@ -406,7 +419,7 @@ function ChoiceView({ props, raw }: { props: PropsOf<'Choice'>; raw: SpecElement
className="flex-wrap self-start"
>
{props.options.map((option) => (
- <ToggleGroupItem key={option} value={option}>
+ <ToggleGroupItem key={option} value={option} className="border-0">
{option}
</ToggleGroupItem>
))}
@@ -428,7 +441,7 @@ function InputView({ props, raw }: { props: PropsOf<'Input'>; raw: SpecElement['
maxLength={200}
disabled={!path}
onChange={(event) => path && onValue(path, event.target.value)}
- className="h-9.5 bg-bg-app text-base text-fg-default"
+ className="h-9.5 rounded-lg bg-bg-app px-3 text-base font-normal text-fg-default md:text-base dark:bg-bg-app"
/>
</label>
);
@@ -440,7 +453,12 @@ function ButtonView({ props, raw }: { props: PropsOf<'Button'>; raw: SpecElement
const run = () => onAction(props.action, raw.actionParams);
if (props.variant === 'primary') {
return (
- <ActionButton ref={enter} intent="run" onClick={run} className="h-8.5 self-start px-4">
+ <ActionButton
+ ref={enter}
+ intent="run"
+ onClick={run}
+ className="h-8.5 self-start rounded-lg px-4 whitespace-nowrap active:translate-y-px"
+ >
{props.label}
</ActionButton>
);
@@ -450,7 +468,7 @@ function ButtonView({ props, raw }: { props: PropsOf<'Button'>; raw: SpecElement
ref={enter}
variant="quiet"
onClick={run}
- className="h-8.5 self-start rounded-md border-border-strong px-3.5 font-semibold text-fg-default"
+ className="h-8.5 self-start rounded-lg border-border-strong px-3.5 font-semibold text-fg-default"
>
{props.label}
</Button>
diff --git a/client/src/features/home/genui/useHire.ts b/client/src/features/home/genui/useHire.ts
index e8f03b3f..cdb64453 100644
--- a/client/src/features/home/genui/useHire.ts
+++ b/client/src/features/home/genui/useHire.ts
@@ -15,6 +15,7 @@ import { useQueryClient } from '@tanstack/react-query';
import { useWebSocketActions } from '@/contexts/WebSocketContext';
import { upsertEmployee } from '../data/employees';
import { parseEmployee } from '../data/schemas';
+import { SPIKE, spikeOrb } from '../orb/orb';
import { useHomeStore } from '../state/homeStore';
import { pillToast } from '../ui/pillToast';
import { beginHire, clearHiredDraft, endHire, useDraftStore } from './draftStore';
@@ -85,6 +86,7 @@ export function useHire(collapse: () => Promise<void>) {
const home = useHomeStore.getState();
home.glowRow(employee.workflow_id);
home.pulseLogo();
+ spikeOrb(SPIKE.hire);
pillToast(`${employee.name} joined your team`);
if (response?.started === false) home.showEmployee(employee.workflow_id);
} catch (error) {
diff --git a/client/src/features/home/header/HomeHeader.tsx b/client/src/features/home/header/HomeHeader.tsx
index 51179f4a..6c692d07 100644
--- a/client/src/features/home/header/HomeHeader.tsx
+++ b/client/src/features/home/header/HomeHeader.tsx
@@ -27,8 +27,8 @@ export function HomeHeader({ title, scrolled }: { title: string; scrolled: boole
>
{!sidebarOpen && (
<>
- <Button variant="quiet" size="icon" onClick={toggleSidebar} aria-label="Open sidebar" title="Open sidebar">
- <PanelLeft />
+ <Button variant="quiet" size="icon" onClick={toggleSidebar} aria-label="Open sidebar" title="Open sidebar" className="rounded-lg">
+ <PanelLeft className="size-4.25" strokeWidth={1.75} />
</Button>
<OcLogo size="header" pulseNonce={logoPulse} className="pr-1.5 pl-0.5" />
<span aria-hidden className="h-5 w-px bg-border-default" />
diff --git a/client/src/features/home/header/ThemeButton.tsx b/client/src/features/home/header/ThemeButton.tsx
index c5b6e3fe..dfa5547e 100644
--- a/client/src/features/home/header/ThemeButton.tsx
+++ b/client/src/features/home/header/ThemeButton.tsx
@@ -1,18 +1,26 @@
/**
* The Home header's sun/moon button (design handoff "theme button"): flips
- * between the light and dark families, revealing the new theme as a circle
- * grown from the button. From a stylized theme it goes to the other
- * family's base theme; the full theme menu stays in Dev mode.
+ * between light and dark, revealing the new theme as a circle grown from
+ * the button while the button spins once with a squash. Home shows only
+ * those two themes; the full theme menu stays in Dev mode.
*/
import { Moon, Sun } from 'lucide-react';
import { Button } from '@/components/ui/button';
import { isDarkTheme, useTheme } from '@/contexts/ThemeContext';
+import { animate } from '@/lib/motion';
+import { SPIKE, spikeOrb } from '../orb/orb';
+
+const SPIN: Keyframe[] = [
+ { transform: 'rotate(0deg) scale(1)' },
+ { transform: 'rotate(200deg) scale(.78)', offset: 0.45 },
+ { transform: 'rotate(360deg) scale(1)' },
+];
export function ThemeButton() {
const { theme, toggleTheme } = useTheme();
const dark = isDarkTheme(theme);
- const label = dark ? 'Switch to light theme' : 'Switch to dark theme';
+ const label = dark ? 'Switch to light mode' : 'Switch to dark mode';
return (
<Button
variant="quiet"
@@ -22,10 +30,12 @@ export function ThemeButton() {
className="size-8.5 rounded-pill border-border-default"
onClick={(event) => {
const rect = event.currentTarget.getBoundingClientRect();
+ animate(event.currentTarget, SPIN, { duration: 'theme-icon', easing: 'spring', fill: 'none' });
+ spikeOrb(SPIKE.theme);
toggleTheme({ reveal: true, origin: { x: rect.left + rect.width / 2, y: rect.top + rect.height / 2 } });
}}
>
- {dark ? <Sun aria-hidden /> : <Moon aria-hidden />}
+ {dark ? <Sun aria-hidden strokeWidth={1.75} /> : <Moon aria-hidden strokeWidth={1.75} />}
</Button>
);
}
diff --git a/client/src/features/home/hire/Composer.tsx b/client/src/features/home/hire/Composer.tsx
index 9bebc295..d4ad3753 100644
--- a/client/src/features/home/hire/Composer.tsx
+++ b/client/src/features/home/hire/Composer.tsx
@@ -15,6 +15,7 @@ import { useEffect, useLayoutEffect, useRef, type KeyboardEvent } from 'react';
import { Button } from '@/components/ui/button';
import { Textarea } from '@/components/ui/textarea';
import { animate } from '@/lib/motion';
+import { prefersReducedMotion } from '@/lib/useReducedMotion';
import { cn } from '@/lib/utils';
import { AppMark } from '../ui/primitives';
import { createLabel, isSendKey } from './composerKeys';
@@ -38,6 +39,10 @@ export interface ComposerProps {
onOpenApps: () => void;
/** Change this number to move focus into the box. */
focusNonce?: number;
+ /** Called once the box has taken the focus `focusNonce` asked for. */
+ onFocusTaken?: () => void;
+ /** Told when the box gains or loses focus. */
+ onFocusChange?: (focused: boolean) => void;
maxLength?: number;
}
@@ -53,6 +58,8 @@ export function Composer({
apps,
onOpenApps,
focusNonce = 0,
+ onFocusTaken,
+ onFocusChange,
maxLength,
}: ComposerProps) {
const boxRef = useRef<HTMLTextAreaElement>(null);
@@ -75,7 +82,8 @@ export function Composer({
const box = boxRef.current;
box?.focus();
if (box) box.setSelectionRange(box.value.length, box.value.length);
- }, [focusNonce]);
+ onFocusTaken?.();
+ }, [focusNonce, onFocusTaken]);
// Starting to edit the draft pulls focus here with a soft ring.
useEffect(() => {
@@ -96,6 +104,8 @@ export function Composer({
});
boxRef.current?.blur();
onSubmit();
+ // Keep the composer, and the draft appearing under it, in view.
+ surfaceRef.current?.scrollIntoView?.({ behavior: prefersReducedMotion() ? 'auto' : 'smooth', block: 'start' });
};
const onKeyDown = (event: KeyboardEvent<HTMLTextAreaElement>) => {
@@ -114,7 +124,7 @@ export function Composer({
ref={surfaceRef}
data-intro
className={cn(
- 'relative flex w-full max-w-(--w-composer) shrink-0 flex-col gap-2 rounded-composer border bg-bg-panel pt-3 pr-3 pb-2.5 pl-4 shadow-float transition-colors duration-(--dur-slow)',
+ 'relative flex w-full max-w-(--w-composer) shrink-0 scroll-mt-4 flex-col gap-2 rounded-composer border bg-bg-panel pt-3 pr-3 pb-2.5 pl-4 shadow-float transition-colors duration-(--dur-slow)',
refining ? 'border-node-agent-edge' : 'border-border-default focus-within:border-border-strong',
)}
>
@@ -126,13 +136,15 @@ export function Composer({
maxLength={maxLength}
onChange={(event) => onChange(event.target.value)}
onKeyDown={onKeyDown}
+ onFocus={() => onFocusChange?.(true)}
+ onBlur={() => onFocusChange?.(false)}
aria-label={refining ? 'What should change?' : 'Describe the job'}
placeholder={
refining
? 'What should change? e.g. Only reply during business hours'
: 'e.g. Answer customer messages on WhatsApp and book appointments'
}
- className="max-h-(--h-composer-max) overflow-hidden py-1.5 text-lead leading-normal text-fg-default"
+ className="max-h-(--h-composer-max) overflow-hidden py-1.5 text-lead leading-normal text-fg-default field-sizing-fixed"
/>
<div className="flex items-center gap-2">
<Button
@@ -149,7 +161,7 @@ export function Composer({
name={app.name}
iconRef={app.icon_ref}
size="sm"
- className="-mr-1.5 ring-2 ring-bg-panel"
+ className="-mr-1.5 border-0 ring-2 ring-bg-panel"
/>
))}
</span>
diff --git a/client/src/features/home/hire/HireView.tsx b/client/src/features/home/hire/HireView.tsx
index 2204f240..260ff693 100644
--- a/client/src/features/home/hire/HireView.tsx
+++ b/client/src/features/home/hire/HireView.tsx
@@ -6,12 +6,13 @@
* The hero rises in on arrival (every `[data-intro]` element, staggered).
*/
-import { useLayoutEffect, useRef } from 'react';
+import { useEffect, useLayoutEffect, useRef, useState } from 'react';
import { stagger } from '@/lib/motion';
import { useConnectors } from '../data/connectors';
import { useEmployeesQuery } from '../data/employees';
import { callName, useOwnerSettings } from '../data/profile';
import { HireDraftPanel, useHireComposer } from '../genui';
+import { ENERGY, setEnergyTarget } from '../orb/orb';
import { OrbSlot } from '../orb/OrbSlot';
import { useHomeStore } from '../state/homeStore';
import { Composer } from './Composer';
@@ -24,7 +25,9 @@ export function HireView({ onConnect }: { onConnect: (providerId: string) => voi
const { data: employees } = useEmployeesQuery();
const { data: settings } = useOwnerSettings();
const focusNonce = useHomeStore((s) => s.composerFocus);
+ const consumeComposerFocus = useHomeStore((s) => s.consumeComposerFocus);
const openSettings = useHomeStore((s) => s.openSettings);
+ const [focused, setFocused] = useState(false);
const rootRef = useRef<HTMLDivElement>(null);
useLayoutEffect(() => {
@@ -40,6 +43,13 @@ export function HireView({ onConnect }: { onConnect: (providerId: string) => voi
);
}, []);
+ // The orb livens up with the composer (design handoff "Orb reactivity").
+ const hasText = composer.value.trim().length > 0;
+ useEffect(() => {
+ setEnergyTarget(composer.working ? ENERGY.generating : hasText ? ENERGY.typing : focused ? ENERGY.focus : ENERGY.idle);
+ }, [composer.working, hasText, focused]);
+ useEffect(() => () => setEnergyTarget(ENERGY.idle), []);
+
const working = employees?.filter((employee) => employee.status === 'working').length ?? 0;
const name = callName(settings);
const apps = connectedApps.map((provider) => ({ id: provider.id, name: provider.name, icon_ref: provider.icon_ref }));
@@ -77,6 +87,8 @@ export function HireView({ onConnect }: { onConnect: (providerId: string) => voi
apps={apps}
onOpenApps={() => openSettings('connectors')}
focusNonce={focusNonce}
+ onFocusTaken={consumeComposerFocus}
+ onFocusChange={setFocused}
maxLength={2000}
/>
<TemplateChips onPick={(template) => composer.pick(template.job)} disabled={composer.working} />
diff --git a/client/src/features/home/orb/OrbSlot.tsx b/client/src/features/home/orb/OrbSlot.tsx
index 42c6678b..aec1dcb4 100644
--- a/client/src/features/home/orb/OrbSlot.tsx
+++ b/client/src/features/home/orb/OrbSlot.tsx
@@ -1,14 +1,13 @@
/**
* Where the orb sits on the hire and employee views (design handoff "Orb").
- *
- * The slot reserves the orb's square at the view's size token. It shows
- * the static mark: the WebGL orb is loaded lazily into these slots later
- * (features/home/orb), and the static mark stays for reduced motion, no
- * WebGL, or a lost WebGL context.
+ * The slot reserves the orb's square and the orb, drawn behind the content,
+ * glides into it. Where the orb cannot run, the slot shows the static mark.
*/
+import { useLayoutEffect, useRef } from 'react';
import { OcMark } from '@/components/brand/Logo';
import { cn } from '@/lib/utils';
+import { orbState, useOrbFallback } from './orb';
const SLOT_SIZE = {
hire: 'size-(--size-orb-hire)',
@@ -16,9 +15,20 @@ const SLOT_SIZE = {
} as const;
export function OrbSlot({ size }: { size: keyof typeof SLOT_SIZE }) {
+ const ref = useRef<HTMLDivElement>(null);
+ const fallback = useOrbFallback();
+
+ useLayoutEffect(() => {
+ const element = ref.current;
+ orbState.slot = element;
+ return () => {
+ if (orbState.slot === element) orbState.slot = null;
+ };
+ }, []);
+
return (
- <div aria-hidden data-orb-slot={size} className={cn('grid shrink-0 place-items-center', SLOT_SIZE[size])}>
- <OcMark className="w-3/5" />
+ <div ref={ref} aria-hidden data-orb-slot={size} className={cn('grid shrink-0 place-items-center', SLOT_SIZE[size])}>
+ {fallback && <OcMark className="w-3/5" />}
</div>
);
}
diff --git a/client/src/features/home/orb/OrbStage.tsx b/client/src/features/home/orb/OrbStage.tsx
new file mode 100644
index 00000000..01eee1e4
--- /dev/null
+++ b/client/src/features/home/orb/OrbStage.tsx
@@ -0,0 +1,26 @@
+/**
+ * The orb's canvas host (design handoff orb/ORB.md): fills Home's main area
+ * below the header, behind the content, and never takes pointer events.
+ */
+
+import { useLayoutEffect, useRef } from 'react';
+import { mountOrb, unmountOrb } from './orb';
+
+export function OrbStage() {
+ const ref = useRef<HTMLDivElement>(null);
+ useLayoutEffect(() => {
+ const element = ref.current;
+ if (!element) return;
+ mountOrb(element);
+ return () => unmountOrb(element);
+ }, []);
+ return (
+ <div
+ ref={ref}
+ aria-hidden
+ className="pointer-events-none absolute inset-x-0 top-(--h-home-header) bottom-0 z-0 overflow-hidden"
+ />
+ );
+}
+
+export default OrbStage;
diff --git a/client/src/features/home/orb/orb.ts b/client/src/features/home/orb/orb.ts
new file mode 100644
index 00000000..c5078c6e
--- /dev/null
+++ b/client/src/features/home/orb/orb.ts
@@ -0,0 +1,120 @@
+/**
+ * Home's 3D orb (design handoff orb/ORB.md): what the engine reads each
+ * frame (the slot to fill, the energy target, a spike), and its lifecycle.
+ * three.js loads only when the orb first runs (orbEngine, its own chunk).
+ * Leaving Home keeps the engine for the next visit; the app shell disposes
+ * it. Without WebGL, under reduced motion, or after a lost WebGL context,
+ * slots show the static mark instead.
+ */
+
+import { useSyncExternalStore } from 'react';
+import { prefersReducedMotion } from '@/lib/useReducedMotion';
+
+/** The prototype's energy levels and event bursts. */
+export const ENERGY = { idle: 0.15, focus: 0.35, typing: 0.55, generating: 1 } as const;
+export const SPIKE = { hire: 1, connect: 0.7, theme: 1, mode: 0.9, task: 0.35 } as const;
+
+/** Read by the engine every frame; the engine decays `spike` itself. */
+export const orbState = {
+ slot: null as HTMLElement | null,
+ target: ENERGY.idle as number,
+ spike: 0,
+};
+
+export function setEnergyTarget(target: number): void {
+ orbState.target = target;
+}
+
+export function spikeOrb(amount: number): void {
+ orbState.spike = Math.max(orbState.spike, amount);
+}
+
+interface OrbEngine {
+ attach(host: HTMLElement): void;
+ detach(): void;
+ dispose(): void;
+}
+
+let engine: OrbEngine | null = null;
+let loading = false;
+let host: HTMLElement | null = null;
+let fallback = false;
+const listeners = new Set<() => void>();
+
+function canRun(): boolean {
+ if (prefersReducedMotion()) return false;
+ try {
+ const canvas = document.createElement('canvas');
+ return Boolean(canvas.getContext('webgl2') || canvas.getContext('webgl'));
+ } catch {
+ return false;
+ }
+}
+
+function showFallback(): void {
+ fallback = true;
+ listeners.forEach((listener) => listener());
+}
+
+/** The stage mounted: draw the orb into it (loading it the first time). */
+export function mountOrb(element: HTMLElement): void {
+ host = element;
+ if (engine) {
+ engine.attach(element);
+ return;
+ }
+ if (loading || fallback) return;
+ if (!canRun()) {
+ showFallback();
+ return;
+ }
+ loading = true;
+ import('./orbEngine')
+ .then(({ createOrbEngine }) => {
+ loading = false;
+ engine = createOrbEngine(() => {
+ engine?.dispose();
+ engine = null;
+ showFallback();
+ });
+ if (host) engine.attach(host);
+ })
+ .catch(() => {
+ loading = false;
+ showFallback();
+ });
+}
+
+export function unmountOrb(element: HTMLElement): void {
+ if (host !== element) return;
+ host = null;
+ engine?.detach();
+}
+
+export function disposeOrb(): void {
+ engine?.dispose();
+ engine = null;
+ host = null;
+ orbState.slot = null;
+}
+
+/** True where slots show the static mark instead of the orb. */
+export function useOrbFallback(): boolean {
+ return useSyncExternalStore(
+ (listener) => {
+ listeners.add(listener);
+ return () => listeners.delete(listener);
+ },
+ () => fallback,
+ () => false,
+ );
+}
+
+/** Test-only. */
+export function resetOrbForTests(): void {
+ disposeOrb();
+ loading = false;
+ fallback = false;
+ orbState.target = ENERGY.idle;
+ orbState.spike = 0;
+}
diff --git a/client/src/features/home/orb/orbEngine.ts b/client/src/features/home/orb/orbEngine.ts
new file mode 100644
index 00000000..e5331d3b
--- /dev/null
+++ b/client/src/features/home/orb/orbEngine.ts
@@ -0,0 +1,375 @@
+/**
+ * The 3D orb's scene and frame loop: a port of the design prototype's
+ * `initScene` (design_handoff_opencompany_home, reference/OpenCompany
+ * Home.dc.html; spec in orb/ORB.md). Loaded only through orb.ts.
+ *
+ * Changes from the prototype's three r149 for current three:
+ * - colour management off and sRGB output, so colours read as authored;
+ * - lights are physically based now: intensities x PI, and the point
+ * lights keep the brightness the old linear falloff gave at the orb
+ * (about 80% at ~4 units) with no distance decay;
+ * - no preserveDrawingBuffer.
+ */
+
+import {
+ ACESFilmicToneMapping,
+ AdditiveBlending,
+ AmbientLight,
+ BufferAttribute,
+ BufferGeometry,
+ CanvasTexture,
+ Color,
+ ColorManagement,
+ DirectionalLight,
+ Group,
+ Line,
+ LineBasicMaterial,
+ Mesh,
+ MeshPhysicalMaterial,
+ NormalBlending,
+ PerspectiveCamera,
+ PointLight,
+ Points,
+ PointsMaterial,
+ QuadraticBezierCurve3,
+ SRGBColorSpace,
+ Scene,
+ SphereGeometry,
+ Sprite,
+ SpriteMaterial,
+ TorusGeometry,
+ Vector3,
+ WebGLRenderer,
+} from 'three';
+import { prefersReducedMotion } from '@/lib/useReducedMotion';
+import { orbState } from './orb';
+
+ColorManagement.enabled = false;
+
+const PI = Math.PI;
+const POINT = 0.8 * PI;
+
+export function createOrbEngine(onLost: () => void) {
+ const R = new WebGLRenderer({ antialias: true, alpha: true });
+ R.setPixelRatio(Math.min(window.devicePixelRatio || 1, 2));
+ R.outputColorSpace = SRGBColorSpace;
+ R.toneMapping = ACESFilmicToneMapping;
+ R.toneMappingExposure = 1.1;
+ R.domElement.style.cssText = 'position:absolute;inset:0;width:100%;height:100%';
+ const lost = (event: Event) => {
+ event.preventDefault();
+ onLost();
+ };
+ R.domElement.addEventListener('webglcontextlost', lost);
+
+ const scene = new Scene();
+ const cam = new PerspectiveCamera(35, 1, 0.1, 100);
+ cam.position.z = 9;
+ const amb = new AmbientLight(0xffffff, 0.35 * PI);
+ const key = new DirectionalLight(0xffffff, 1.1 * PI);
+ key.position.set(3, 4, 5);
+ const p1 = new PointLight(0xbd93f9, 2.4 * POINT, 20, 0);
+ p1.position.set(-3, 1, 3);
+ const p2 = new PointLight(0x8be9fd, 2.4 * POINT, 20, 0);
+ p2.position.set(3, -1.5, 2.5);
+ scene.add(amb, key, p1, p2);
+
+ const c = document.createElement('canvas');
+ c.width = c.height = 128;
+ const g = c.getContext('2d');
+ if (g) {
+ const gr = g.createRadialGradient(64, 64, 0, 64, 64, 64);
+ gr.addColorStop(0, 'rgba(255,255,255,1)');
+ gr.addColorStop(0.25, 'rgba(255,255,255,0.4)');
+ gr.addColorStop(1, 'rgba(255,255,255,0)');
+ g.fillStyle = gr;
+ g.fillRect(0, 0, 128, 128);
+ }
+ const glowTex = new CanvasTexture(c);
+ const glow = (color: number, size: number, opacity: number) => {
+ const s = new Sprite(
+ new SpriteMaterial({ map: glowTex, color, transparent: true, opacity, blending: AdditiveBlending, depthWrite: false }),
+ );
+ s.scale.setScalar(size);
+ return s;
+ };
+
+ const orb = new Group();
+ const tilt = new Group();
+ orb.add(tilt);
+ scene.add(orb);
+
+ // Ring: vertex colours purple -> cyan by angle; the light theme's greys kept beside them.
+ const rg = new TorusGeometry(1.2, 0.24, 48, 220);
+ const pos = rg.attributes.position;
+ const ringDark = new Float32Array(pos.count * 3);
+ const ringLight = new Float32Array(pos.count * 3);
+ const tmp = new Color();
+ const pairs = [
+ [new Color(0xbd93f9), new Color(0x8be9fd), ringDark],
+ [new Color(0x1a1d21), new Color(0x3a3f47), ringLight],
+ ] as const;
+ for (let i = 0; i < pos.count; i++) {
+ const t = (Math.sin(Math.atan2(pos.getY(i), pos.getX(i)) - 0.8) + 1) / 2;
+ for (const [a, b, out] of pairs) {
+ tmp.copy(a).lerp(b, t);
+ out.set([tmp.r, tmp.g, tmp.b], i * 3);
+ }
+ }
+ rg.setAttribute('color', new BufferAttribute(Float32Array.from(ringDark), 3));
+ const ringMat = new MeshPhysicalMaterial({
+ vertexColors: true,
+ metalness: 0.25,
+ roughness: 0.18,
+ clearcoat: 1,
+ clearcoatRoughness: 0.1,
+ iridescence: 0.7,
+ emissive: 0x2a1d4a,
+ emissiveIntensity: 0.5,
+ });
+ const ring = new Mesh(rg, ringMat);
+ tilt.add(ring);
+ const coreMat = new MeshPhysicalMaterial({ color: 0xf8f8f2, emissive: 0xf8f8f2, emissiveIntensity: 0.55, roughness: 0.3, clearcoat: 1 });
+ const core = new Mesh(new SphereGeometry(0.38, 64, 64), coreMat);
+ orb.add(core);
+ const coreGlow = glow(0xf8f8f2, 2.2, 0.35);
+ const ringGlow = glow(0xbd93f9, 5, 0.12);
+ orb.add(coreGlow, ringGlow);
+
+ const nodes = [0x50fa7b, 0xffb86c, 0xff79c6, 0xf1fa8c].map((col, i) => {
+ const mat = new MeshPhysicalMaterial({ color: col, emissive: col, emissiveIntensity: 0.35, roughness: 0.25, clearcoat: 1 });
+ const m = new Mesh(new SphereGeometry(0.2, 32, 32), mat);
+ const halo = glow(col, 1.1, 0.5);
+ m.add(halo);
+ const lg = new BufferGeometry();
+ lg.setAttribute('position', new BufferAttribute(new Float32Array(33 * 3), 3));
+ const line = new Line(lg, new LineBasicMaterial({ color: 0x6272a4, transparent: true, opacity: 0.7 }));
+ const pk = glow(col, 0.45, 0.9);
+ orb.add(m, line, pk);
+ const cd = new Color(col);
+ const cl = new Color([0x1a1d21, 0x2b2f37][i % 2]);
+ return { m, mat, halo, line, pk, cd, cl, phase: (i * PI) / 2 + PI / 4, r: 2.0 + (i % 2) * 0.15, off: Math.random() };
+ });
+
+ const N = 900;
+ const pp = new Float32Array(N * 3);
+ const pc = new Float32Array(N * 3);
+ const pal = [0x8be9fd, 0xbd93f9, 0x6272a4, 0xff79c6].map((hex) => new Color(hex));
+ for (let i = 0; i < N; i++) {
+ const r = 3 + Math.random() * 6;
+ const th = Math.random() * PI * 2;
+ const ph = Math.acos(2 * Math.random() - 1);
+ pp.set([r * Math.sin(ph) * Math.cos(th) * 1.6, r * Math.cos(ph), r * Math.sin(ph) * Math.sin(th) - 2], i * 3);
+ const cc = pal[i % 4];
+ pc.set([cc.r, cc.g, cc.b], i * 3);
+ }
+ const ptDark = Float32Array.from(pc);
+ const pg = new BufferGeometry();
+ pg.setAttribute('position', new BufferAttribute(pp, 3));
+ pg.setAttribute('color', new BufferAttribute(pc, 3));
+ const ptsMat = new PointsMaterial({
+ size: 0.07,
+ map: glowTex,
+ vertexColors: true,
+ transparent: true,
+ opacity: 0.6,
+ blending: AdditiveBlending,
+ depthWrite: false,
+ });
+ const pts = new Points(pg, ptsMat);
+ scene.add(pts);
+
+ const tc = {
+ lD: new Color(0x6272a4),
+ lL: new Color(0x6b7280),
+ eD: new Color(0x2a1d4a),
+ black: new Color(0x000000),
+ gD: new Color(0xf8f8f2),
+ gL: new Color(0x1a1d21),
+ cK: new Color(0x111317),
+ };
+ const bez = new QuadraticBezierCurve3(new Vector3(), new Vector3(), new Vector3());
+ const vh = 2 * 9 * Math.tan((17.5 * PI) / 180);
+
+ let host: HTMLElement | null = null;
+ let size = { w: 1, h: 1 };
+ const resize = () => {
+ if (!host) return;
+ const w = host.clientWidth || 1;
+ const h = host.clientHeight || 1;
+ R.setSize(w, h, false);
+ cam.aspect = w / h;
+ cam.updateProjectionMatrix();
+ size = { w, h };
+ };
+ const ro = new ResizeObserver(resize);
+ let mx = 0;
+ let my = 0;
+ const onMove = (e: PointerEvent) => {
+ mx = (e.clientX / window.innerWidth) * 2 - 1;
+ my = (e.clientY / window.innerHeight) * 2 - 1;
+ };
+
+ let raf = 0;
+ let last = 0;
+ let t = 0;
+ let energy = orbState.target;
+ let placed = false;
+ let rx = 0;
+ let ry = 0;
+ let lf = document.documentElement.classList.contains('dark') ? 0 : 1;
+ let lfApplied = -1;
+ let appliedLight: boolean | null = null;
+
+ const loop = (now: number) => {
+ raf = requestAnimationFrame(loop);
+ if (!host) return;
+ const dt = Math.min((now - last) / 1000, 0.05);
+ last = now;
+ const mot = prefersReducedMotion() ? 0.15 : 1;
+ energy += (orbState.target - energy) * Math.min(1, dt * 3);
+ orbState.spike = Math.max(0, orbState.spike - dt * 0.6);
+ const e = Math.max(energy, orbState.spike);
+ t += dt * mot * (0.4 + e * 1.8);
+
+ // Glide to the slot.
+ const { w, h } = size;
+ const px = vh / h;
+ let tx = orb.position.x;
+ let ty = orb.position.y;
+ let ts = orb.scale.x;
+ const sl = orbState.slot;
+ if (sl && sl.isConnected) {
+ const hr = host.getBoundingClientRect();
+ const r = sl.getBoundingClientRect();
+ tx = (r.left + r.width / 2 - hr.left - w / 2) * px;
+ ty = -(r.top + r.height / 2 - hr.top - h / 2) * px;
+ ts = ((Math.min(r.width, r.height) / 2) * px) / 2.3;
+ }
+ if (!placed) {
+ orb.position.set(tx, ty, 0);
+ orb.scale.setScalar(ts);
+ placed = true;
+ }
+ const k = Math.min(1, dt * 5);
+ orb.position.x += (tx - orb.position.x) * k;
+ orb.position.y += (ty - orb.position.y) * k;
+ orb.scale.setScalar(orb.scale.x + (ts - orb.scale.x) * k);
+ rx += (my * 0.25 - rx) * k;
+ ry += (mx * 0.4 - ry) * k;
+ orb.rotation.set(rx, ry, 0);
+ tilt.rotation.x = 0.3 + Math.sin(t * 0.5) * 0.18;
+ tilt.rotation.y = Math.cos(t * 0.4) * 0.22;
+ ring.rotation.z += dt * mot * (0.25 + e * 2.4);
+ core.scale.setScalar(1 + Math.sin(now * 0.004 * (1 + e * 2)) * 0.04 * (1 + e * 3));
+ coreGlow.material.opacity = 0.25 + e * 0.5;
+ coreGlow.scale.setScalar(2 + e * 1.6);
+ ringGlow.material.opacity = 0.08 + e * 0.18;
+ nodes.forEach((n, i) => {
+ const a = n.phase + t * 0.5;
+ n.m.position.set(Math.cos(a) * n.r, Math.sin(a) * n.r * 0.62, Math.sin(a + (i % 2 ? 0.4 : -0.4)) * 0.9);
+ const p = n.m.position;
+ bez.v1.set(p.x * 0.5 - p.y * 0.25, p.y * 0.5 + p.x * 0.25, p.z * 0.5 + 0.6);
+ bez.v2.copy(p);
+ const arr = n.line.geometry.attributes.position.array as Float32Array;
+ bez.getPoints(32).forEach((v, j) => arr.set([v.x, v.y, v.z], j * 3));
+ n.line.geometry.attributes.position.needsUpdate = true;
+ n.line.material.opacity = 0.45 + e * 0.45;
+ bez.getPoint((t * 0.9 + n.off) % 1, n.pk.position);
+ n.pk.material.opacity = 0.3 + e * 0.7;
+ });
+
+ // Light theme: monochrome, blended over ~0.3 s.
+ const light = !document.documentElement.classList.contains('dark');
+ ptsMat.opacity += ((light ? 0.45 : 0.6) - ptsMat.opacity) * k;
+ pts.rotation.y += dt * 0.02 * mot * (1 + e * 3);
+ pts.rotation.x = rx * 0.3;
+ lf += ((light ? 1 : 0) - lf) * Math.min(1, dt * 3.2);
+ nodes.forEach((n) => n.line.material.color.copy(tc.lD).lerp(tc.lL, lf));
+ ringMat.emissive.copy(tc.eD).lerp(tc.black, lf);
+ coreGlow.material.color.copy(tc.gD).lerp(tc.gL, lf);
+ ringMat.iridescence = 0.7 * (1 - lf);
+ ringMat.metalness = 0.25 * (1 - lf);
+ ringMat.emissiveIntensity = 0.5 - 0.2 * lf;
+ coreMat.color.copy(tc.gD).lerp(tc.cK, lf);
+ coreMat.emissive.copy(tc.gD).lerp(tc.black, lf);
+ coreMat.emissiveIntensity = 0.55 - 0.3 * lf;
+ if (Math.abs(lf - lfApplied) > 0.002) {
+ lfApplied = lf;
+ const ca = rg.attributes.color.array as Float32Array;
+ for (let i = 0; i < ca.length; i++) ca[i] = ringDark[i] + (ringLight[i] - ringDark[i]) * lf;
+ rg.attributes.color.needsUpdate = true;
+ nodes.forEach((n) => {
+ n.mat.color.copy(n.cd).lerp(n.cl, lf);
+ n.mat.emissive.copy(n.cd).lerp(tc.black, lf);
+ n.pk.material.color.copy(n.cd).lerp(tc.gL, lf);
+ });
+ const pa = pg.attributes.color.array as Float32Array;
+ for (let i = 0; i < pa.length; i += 3) {
+ pa[i] = ptDark[i] + (0.3 - ptDark[i]) * lf;
+ pa[i + 1] = ptDark[i + 1] + (0.31 - ptDark[i + 1]) * lf;
+ pa[i + 2] = ptDark[i + 2] + (0.33 - ptDark[i + 2]) * lf;
+ }
+ pg.attributes.color.needsUpdate = true;
+ }
+ ringMat.clearcoat = 1 - 0.6 * lf;
+ ringMat.roughness = 0.18 + 0.2 * lf;
+ nodes.forEach((n) => {
+ n.mat.emissiveIntensity = 0.35 - 0.2 * lf;
+ n.mat.clearcoat = 1 - 0.6 * lf;
+ n.halo.material.opacity = 0.5 - 0.3 * lf;
+ });
+ ringGlow.material.opacity *= 1 - 0.8 * lf;
+ coreGlow.material.opacity *= 1 - 0.9 * lf;
+ R.toneMappingExposure = 1.1 - 0.1 * lf;
+ amb.intensity = (0.35 + 0.2 * lf) * PI;
+ key.intensity = (1.1 - 0.4 * lf) * PI;
+ p1.intensity = p2.intensity = (2.4 - 1.2 * lf) * POINT;
+ const wantLight = lf > 0.5;
+ if (appliedLight !== wantLight) {
+ appliedLight = wantLight;
+ ptsMat.blending = ringGlow.material.blending = wantLight ? NormalBlending : AdditiveBlending;
+ ptsMat.needsUpdate = ringGlow.material.needsUpdate = true;
+ }
+ R.render(scene, cam);
+ };
+
+ const stop = () => {
+ cancelAnimationFrame(raf);
+ raf = 0;
+ };
+
+ return {
+ attach(element: HTMLElement) {
+ host = element;
+ element.appendChild(R.domElement);
+ ro.disconnect();
+ ro.observe(element);
+ resize();
+ placed = false;
+ window.addEventListener('pointermove', onMove, { passive: true });
+ if (!raf) {
+ last = performance.now();
+ raf = requestAnimationFrame(loop);
+ }
+ },
+ detach() {
+ stop();
+ ro.disconnect();
+ window.removeEventListener('pointermove', onMove);
+ R.domElement.remove();
+ host = null;
+ },
+ dispose() {
+ this.detach();
+ R.domElement.removeEventListener('webglcontextlost', lost);
+ scene.traverse((object) => {
+ const mesh = object as Mesh;
+ mesh.geometry?.dispose();
+ (mesh.material as { dispose?: () => void } | undefined)?.dispose?.();
+ });
+ glowTex.dispose();
+ R.dispose();
+ },
+ };
+}
diff --git a/client/src/features/home/settings/ConnectDialog.tsx b/client/src/features/home/settings/ConnectDialog.tsx
index 21183011..d369642f 100644
--- a/client/src/features/home/settings/ConnectDialog.tsx
+++ b/client/src/features/home/settings/ConnectDialog.tsx
@@ -5,14 +5,19 @@
* every connect / validate / sign-in rule; this is only its frame.
*
* Takes a provider id and reads the live catalogue entry, so the panel sees
- * `stored` / `connected` flip the moment the connection lands.
+ * `stored` / `connected` flip the moment the connection lands. When it does,
+ * the dialog closes; from outside Settings (a draft's or an employee's
+ * "Connect {App}") it also confirms with a toast, which Settings' own card
+ * does there.
*/
-import { useMemo } from 'react';
+import { useEffect, useMemo, useRef } from 'react';
import Modal from '@/components/ui/Modal';
import PanelRenderer from '@/components/credentials/PanelRenderer';
import { rehydrateProvider } from '@/components/credentials/catalogueAdapter';
-import { useHomeCatalogue } from '../data/connectors';
+import { isConnected, useHomeCatalogue } from '../data/connectors';
+import { useHomeStore } from '../state/homeStore';
+import { pillToast } from '../ui/pillToast';
export function ConnectDialog({ providerId, onClose }: { providerId: string | null; onClose: () => void }) {
const { data } = useHomeCatalogue();
@@ -21,6 +26,19 @@ export function ConnectDialog({ providerId, onClose }: { providerId: string | nu
[data, providerId],
);
const config = useMemo(() => (provider ? rehydrateProvider(provider) : null), [provider]);
+
+ // Only the same app going from not connected to connected counts.
+ const connected = provider ? isConnected(provider) : false;
+ const seen = useRef({ id: providerId, known: provider !== null, connected });
+ useEffect(() => {
+ const before = seen.current;
+ seen.current = { id: providerId, known: provider !== null, connected };
+ const flipped = before.id === providerId && before.known && !before.connected && connected;
+ if (!flipped || !provider) return;
+ if (!useHomeStore.getState().settingsOpen) pillToast(`${provider.name} is connected`);
+ onClose();
+ }, [providerId, provider, connected, onClose]);
+
return (
<Modal
isOpen={providerId !== null}
diff --git a/client/src/features/home/settings/ConnectorsTab.tsx b/client/src/features/home/settings/ConnectorsTab.tsx
index a367a6e5..893f70c9 100644
--- a/client/src/features/home/settings/ConnectorsTab.tsx
+++ b/client/src/features/home/settings/ConnectorsTab.tsx
@@ -73,8 +73,7 @@ function ConnectorCard({
animate(
ref.current,
[
- { boxShadow: '0 0 0 0 transparent' },
- { boxShadow: '0 0 0 1px var(--status-working-border), 0 0 28px var(--status-working-fill)', offset: 0.3 },
+ { boxShadow: '0 0 0 1px var(--action-run-border), 0 0 28px var(--status-working-border)' },
{ boxShadow: '0 0 0 0 transparent' },
],
{ duration: 1200, easing: 'default', fill: 'none' },
@@ -88,6 +87,7 @@ function ConnectorCard({
<div
ref={ref}
data-connector={provider.id}
+ data-stagger
className={cn(
'flex gap-3 rounded-card border bg-bg-elevated p-3.5 transition-[border-color,translate] duration-(--dur-slow) hover:-translate-y-px motion-reduce:hover:translate-y-0',
connected ? 'border-status-working-border' : 'border-border-default',
@@ -98,7 +98,7 @@ function ConnectorCard({
<div className="flex items-center gap-2">
<span className="truncate text-base font-semibold text-fg-default">{provider.name}</span>
{provider.runs_locally && (
- <span className="rounded-sm border border-node-workflow-edge px-1.25 font-mono text-2xs font-medium tracking-label text-node-workflow-ink">
+ <span className="rounded-sm border border-node-workflow-edge px-1.25 font-mono text-[10px] font-medium tracking-label text-node-workflow-ink">
LOCAL
</span>
)}
@@ -107,7 +107,7 @@ function ConnectorCard({
<div className="mt-1.5 flex min-h-7 items-center gap-2">
{connected ? (
<>
- <StatusDot tone="working" />
+ <StatusDot tone="working" className="size-1.5 shadow-[0_0_6px_var(--status-working-dot)]" />
<span className="truncate text-xs font-medium text-status-working-ink">
Connected{provider.account_label ? ` as ${provider.account_label}` : ''}
</span>
@@ -115,7 +115,7 @@ function ConnectorCard({
variant="quiet"
size="xs"
onClick={onDisconnect}
- className="ml-auto hover:border-status-attention-border hover:bg-status-attention-fill hover:text-status-attention-ink"
+ className="ml-auto h-6.5 rounded-lg px-2.5 hover:border-action-stop-border hover:bg-action-stop-soft hover:text-action-stop-ink"
>
Disconnect
</Button>
@@ -125,7 +125,7 @@ function ConnectorCard({
variant="quiet"
size="xs"
onClick={onConnect}
- className="border-border-strong text-fg-default hover:border-action-run-border hover:bg-action-run-soft hover:text-action-run-ink"
+ className="h-7 rounded-lg border-border-strong px-3 font-semibold text-fg-default hover:border-action-run-border hover:bg-action-run-soft hover:text-action-run-ink"
>
Connect
</Button>
@@ -151,7 +151,8 @@ export function ConnectorsTab({ onConnect }: { onConnect: (providerId: string) =
if (!provider) return;
try {
const done = await disconnect(provider, sendRequest);
- if (!done) onConnect(provider.id);
+ if (done) pillToast(`${provider.name} disconnected`, { tone: 'info' });
+ else onConnect(provider.id);
} catch (error) {
pillToast(error instanceof Error ? error.message : `Couldn't disconnect ${provider.name}`, { tone: 'error' });
}
@@ -159,19 +160,19 @@ export function ConnectorsTab({ onConnect }: { onConnect: (providerId: string) =
return (
<div className="flex flex-col gap-4.5 px-8 pt-7 pb-8">
- <div className="flex items-start gap-4 pr-9">
+ <div data-stagger className="flex items-start gap-4 pr-9">
<div className="flex flex-1 flex-col gap-1">
<h2 className="text-lg font-semibold text-fg-default">Connectors</h2>
<p className="text-sm text-pretty text-fg-muted">
Give your agents access to the apps you use. Credentials stay on this device.
</p>
</div>
- <span className="shrink-0 rounded-pill border border-status-working-border bg-status-working-fill px-2.5 py-1 font-mono text-2xs font-medium tracking-label text-status-working-ink uppercase">
+ <span className="shrink-0 rounded-pill border border-action-run-border bg-action-run-soft px-2.5 py-1 font-mono text-2xs font-medium tracking-label text-action-run-ink uppercase">
{connectedCount} connected
</span>
</div>
- <div className="flex flex-wrap items-center gap-2">
+ <div data-stagger className="flex flex-wrap items-center gap-2">
<div className="relative min-w-0 flex-[1_1_220px]">
<Search aria-hidden className="pointer-events-none absolute top-1/2 left-3 size-4 -translate-y-1/2 text-fg-faint" />
<Input
@@ -179,13 +180,14 @@ export function ConnectorsTab({ onConnect }: { onConnect: (providerId: string) =
onChange={(event) => setQuery(event.target.value)}
placeholder="Search connectors"
aria-label="Search connectors"
- className="h-9.5 pl-8.5"
+ className="h-9.5 bg-bg-app pl-8.5 text-base md:text-base dark:bg-bg-app"
/>
</div>
<ToggleGroup
type="single"
variant="chips"
size="lg"
+ className="gap-2"
aria-label="Category"
value={category}
onValueChange={(next) => next && setCategory(next)}
diff --git a/client/src/features/home/settings/HomeSettings.tsx b/client/src/features/home/settings/HomeSettings.tsx
index f7a61c7c..65650c37 100644
--- a/client/src/features/home/settings/HomeSettings.tsx
+++ b/client/src/features/home/settings/HomeSettings.tsx
@@ -6,10 +6,12 @@
*/
import { Plug, User, X } from 'lucide-react';
+import { useLayoutEffect, useRef } from 'react';
import { Tabs as TabsPrimitive } from 'radix-ui';
import { OcLogo } from '@/components/brand/Logo';
import { Button } from '@/components/ui/button';
import Modal from '@/components/ui/Modal';
+import { stagger } from '@/lib/motion';
import { cn } from '@/lib/utils';
import { useConnectors } from '../data/connectors';
import { useHomeStore, type SettingsTab } from '../state/homeStore';
@@ -22,9 +24,24 @@ const NAV_ITEM =
export function HomeSettings({ onConnect }: { onConnect: (providerId: string) => void }) {
const open = useHomeStore((s) => s.settingsOpen);
const tab = useHomeStore((s) => s.settingsTab);
+ const category = useHomeStore((s) => s.settingsCategory);
const setTab = useHomeStore((s) => s.setSettingsTab);
const close = useHomeStore((s) => s.closeSettings);
const { connectedCount } = useConnectors();
+ const bodyRef = useRef<HTMLDivElement>(null);
+
+ // The tab's blocks rise in, 30ms apart (design handoff "Settings modal").
+ useLayoutEffect(() => {
+ if (!open || !bodyRef.current) return;
+ stagger(
+ bodyRef.current.querySelectorAll('[data-stagger]'),
+ [
+ { opacity: 0, transform: 'translateY(10px)' },
+ { opacity: 1, transform: 'none' },
+ ],
+ { base: 40, step: 30, cap: 14, duration: 420, easing: 'spring' },
+ );
+ }, [open, tab, category]);
return (
<Modal
@@ -62,7 +79,7 @@ export function HomeSettings({ onConnect }: { onConnect: (providerId: string) =>
</TabsPrimitive.List>
<p className="mt-auto px-2.5 font-mono text-2xs text-fg-faint">Stored on this device</p>
</div>
- <div className="relative min-w-0 flex-1 overflow-y-auto">
+ <div ref={bodyRef} className="relative min-w-0 flex-1 overflow-y-auto">
<TabsPrimitive.Content value="profile" className="outline-none">
<ProfileTab onDone={close} />
</TabsPrimitive.Content>
diff --git a/client/src/features/home/settings/ProfileTab.tsx b/client/src/features/home/settings/ProfileTab.tsx
index 7287a1a5..8f809803 100644
--- a/client/src/features/home/settings/ProfileTab.tsx
+++ b/client/src/features/home/settings/ProfileTab.tsx
@@ -5,7 +5,7 @@
* trims and bounds them again on save.
*/
-import { useEffect, useState, type ReactNode } from 'react';
+import { useEffect, useRef, useState, type ReactNode } from 'react';
import { useForm, useWatch } from 'react-hook-form';
import { zodResolver } from '@hookform/resolvers/zod';
import { ActionButton } from '@/components/ui/action-button';
@@ -16,6 +16,7 @@ import { Switch } from '@/components/ui/switch';
import { Textarea } from '@/components/ui/textarea';
import { ToggleGroup, ToggleGroupItem } from '@/components/ui/toggle-group';
import { isDarkTheme, useTheme } from '@/contexts/ThemeContext';
+import { animate } from '@/lib/motion';
import {
browserTimezone,
profileFromSettings,
@@ -27,7 +28,9 @@ import {
import { Avatar } from '../ui/primitives';
import { pillToast } from '../ui/pillToast';
-const FIELD_INPUT = 'h-9.5 bg-bg-app';
+// The fields sit on the app surface at the design's size (the primitives
+// would tint them in dark and shrink the text to 13px from md up).
+const FIELD_INPUT = 'h-9.5 rounded-lg bg-bg-app px-3 text-base font-normal md:text-base dark:bg-bg-app';
function SettingRow({
title,
@@ -56,6 +59,8 @@ export function ProfileTab({ onDone }: { onDone: () => void }) {
const { saveProfile, isPending } = useSaveProfile();
const { theme, setTheme } = useTheme();
const [saved, setSaved] = useState(false);
+ const saveRef = useRef<HTMLButtonElement>(null);
+ const revealFrom = useRef<{ x: number; y: number } | undefined>(undefined);
const zone = browserTimezone() ?? String(settings?.profile_timezone ?? '');
const form = useForm<ProfileForm>({
@@ -70,13 +75,17 @@ export function ProfileTab({ onDone }: { onDone: () => void }) {
}, [settings, form]);
const fullName = useWatch({ control: form.control, name: 'profile_full_name' });
- const role = useWatch({ control: form.control, name: 'profile_role' });
+ const calledAs = (useWatch({ control: form.control, name: 'profile_call_name' }) || fullName || '').trim();
const onSubmit = async (values: ProfileForm) => {
try {
await saveProfile(values);
form.reset(values);
setSaved(true);
+ animate(saveRef.current, [{ transform: 'scale(1)' }, { transform: 'scale(1.06)', offset: 0.4 }, { transform: 'scale(1)' }], {
+ duration: 380,
+ fill: 'none',
+ });
pillToast('Profile saved');
} catch (error) {
pillToast(error instanceof Error ? error.message : "Couldn't save your profile", { tone: 'error' });
@@ -91,20 +100,22 @@ export function ProfileTab({ onDone }: { onDone: () => void }) {
className="flex max-w-160 flex-col gap-5.5 px-8 pt-7 pb-8"
onChange={() => setSaved(false)}
>
- <div className="flex flex-col gap-1">
+ <div data-stagger className="flex flex-col gap-1">
<h2 className="text-lg font-semibold text-fg-default">Profile</h2>
<p className="text-sm text-fg-muted">How your agents address you, and what they should know before they start.</p>
</div>
- <div className="flex items-center gap-4 rounded-card border border-border-default bg-bg-elevated p-4">
- <Avatar name={fullName || 'You'} colorRole="agent" size="lg" />
+ <div data-stagger className="flex items-center gap-4 rounded-card border border-border-default bg-bg-elevated p-4">
+ <Avatar name={fullName || 'You'} colorRole="agent" size="lg" className="shadow-[0_0_24px_var(--node-agent-fill)]" />
<div className="flex min-w-0 flex-col gap-0.75">
<span className="truncate text-lead font-semibold text-fg-default">{fullName || 'Your name'}</span>
- <span className="truncate font-mono text-xs text-fg-faint">{role || 'Owner'}</span>
+ <span className="truncate font-mono text-xs text-fg-faint">
+ {calledAs ? `Employees will call you ${calledAs}` : 'Add your name so employees know you'}
+ </span>
</div>
</div>
- <div className="grid grid-cols-[repeat(auto-fit,minmax(220px,1fr))] gap-3.5">
+ <div data-stagger className="grid grid-cols-[repeat(auto-fit,minmax(220px,1fr))] gap-3.5">
<FormField
control={form.control}
name="profile_full_name"
@@ -148,7 +159,7 @@ export function ProfileTab({ onDone }: { onDone: () => void }) {
<FormLabel className="text-xs text-fg-muted" htmlFor="profile-timezone">
Timezone
</FormLabel>
- <Input id="profile-timezone" value={zone} readOnly className={`${FIELD_INPUT} font-mono text-sm text-fg-muted`} />
+ <Input id="profile-timezone" value={zone} readOnly className={`${FIELD_INPUT} font-mono text-sm text-fg-muted md:text-sm`} />
</FormItem>
</div>
@@ -156,7 +167,7 @@ export function ProfileTab({ onDone }: { onDone: () => void }) {
control={form.control}
name="profile_preferences"
render={({ field }) => (
- <FormItem>
+ <FormItem data-stagger>
<FormLabel className="flex flex-col items-start gap-0.5 text-xs text-fg-muted">
Personal preferences
<span className="font-normal text-fg-faint">Applied to every chat and agent run.</span>
@@ -165,7 +176,7 @@ export function ProfileTab({ onDone }: { onDone: () => void }) {
<Textarea
rows={4}
placeholder="Keep replies short. Draft emails in my voice, never send without asking."
- className="min-h-24 resize-y bg-bg-app"
+ className="min-h-24 resize-y bg-bg-app px-3 py-2.5 text-base md:text-base dark:bg-bg-app"
{...field}
/>
</FormControl>
@@ -174,19 +185,28 @@ export function ProfileTab({ onDone }: { onDone: () => void }) {
)}
/>
- <div className="flex flex-col">
+ <div data-stagger className="flex flex-col">
<SettingRow title="Appearance" detail="Choose light or dark.">
<ToggleGroup
type="single"
variant="segmented"
aria-label="Appearance"
value={isDarkTheme(theme) ? 'dark' : 'light'}
+ // The new theme grows from where it was clicked.
+ onPointerDown={(event) => {
+ revealFrom.current = { x: event.clientX, y: event.clientY };
+ }}
onValueChange={(next) => {
- if (next === 'light' || next === 'dark') setTheme(next, { reveal: true });
+ if (next === 'light' || next === 'dark') setTheme(next, { reveal: true, origin: revealFrom.current });
+ revealFrom.current = undefined;
}}
>
- <ToggleGroupItem value="light">Light</ToggleGroupItem>
- <ToggleGroupItem value="dark">Dark</ToggleGroupItem>
+ <ToggleGroupItem value="light" className="px-3.5 text-xs">
+ Light
+ </ToggleGroupItem>
+ <ToggleGroupItem value="dark" className="px-3.5 text-xs">
+ Dark
+ </ToggleGroupItem>
</ToggleGroup>
</SettingRow>
<FormField
@@ -215,11 +235,11 @@ export function ProfileTab({ onDone }: { onDone: () => void }) {
/>
</div>
- <div className="flex justify-end gap-2">
+ <div data-stagger className="flex justify-end gap-2">
<Button type="button" variant="quiet" className="h-8.5 border-border-default px-3.5 font-semibold text-fg-default" onClick={onDone}>
Cancel
</Button>
- <ActionButton type="submit" intent="run" disabled={isPending} className="h-8.5 px-4">
+ <ActionButton ref={saveRef} type="submit" intent="run" disabled={isPending} className="h-8.5 px-4">
{isPending ? 'Saving…' : saved ? 'Saved' : 'Save changes'}
</ActionButton>
</div>
diff --git a/client/src/features/home/sidebar/HomeSidebar.tsx b/client/src/features/home/sidebar/HomeSidebar.tsx
index 49c5e69d..10fb1ffb 100644
--- a/client/src/features/home/sidebar/HomeSidebar.tsx
+++ b/client/src/features/home/sidebar/HomeSidebar.tsx
@@ -4,7 +4,7 @@
* (width + opacity); the header then shows the logo and an open button.
*/
-import { useEffect, useRef } from 'react';
+import { useLayoutEffect, useRef } from 'react';
import { PanelLeft, Plus, Settings } from 'lucide-react';
import { OcLogo } from '@/components/brand/Logo';
import { ActionButton } from '@/components/ui/action-button';
@@ -14,7 +14,7 @@ import { animate } from '@/lib/motion';
import { cn } from '@/lib/utils';
import { useEmployeesQuery } from '../data/employees';
import { presentEmployee } from '../data/presentation';
-import { callName, useOwnerSettings } from '../data/profile';
+import { useOwnerSettings } from '../data/profile';
import type { EmployeeSummary } from '../data/schemas';
import { useHomeStore } from '../state/homeStore';
import { Avatar, MicroLabel } from '../ui/primitives';
@@ -27,16 +27,26 @@ function EmployeeRow({ employee, selected }: { employee: EmployeeSummary; select
const ref = useRef<HTMLButtonElement>(null);
const view = presentEmployee(employee, pending);
- useEffect(() => {
+ // A new hire drops into the list with a green glow (design handoff "Hire").
+ useLayoutEffect(() => {
if (!glow) return;
animate(
ref.current,
[
- { boxShadow: '0 0 0 0 transparent' },
- { boxShadow: '0 0 0 1px var(--status-working-border), 0 0 24px var(--status-working-fill)', offset: 0.25 },
- { boxShadow: '0 0 0 0 transparent' },
+ {
+ opacity: 0,
+ transform: 'translateY(-24px) scale(.9)',
+ boxShadow: '0 0 0 2px var(--action-run-border), 0 0 40px var(--status-working-border)',
+ },
+ {
+ opacity: 1,
+ transform: 'none',
+ boxShadow: '0 0 0 2px var(--status-working-border), 0 0 24px var(--status-working-fill)',
+ offset: 0.6,
+ },
+ { opacity: 1, transform: 'none', boxShadow: '0 0 0 0 transparent' },
],
- { duration: 'glow', easing: 'default', fill: 'none' },
+ { duration: 'glow', easing: 'spring', fill: 'backwards' },
);
}, [glow]);
@@ -78,7 +88,7 @@ function TeamList() {
<>
<div className="flex items-center px-2.5 pt-4.5 pb-1.5">
<MicroLabel>AI employees</MicroLabel>
- <span className="ml-auto font-mono text-2xs text-fg-faint">{employees?.length ?? ''}</span>
+ <span className="ml-auto font-mono text-2xs font-medium tracking-label text-fg-faint">{employees?.length ?? ''}</span>
</div>
<nav aria-label="AI employees" className="flex min-h-0 flex-1 flex-col gap-0.5 overflow-x-hidden overflow-y-auto">
{isLoading &&
@@ -93,7 +103,7 @@ function TeamList() {
))}
{isError && (
<button type="button" onClick={() => void refetch()} className="px-2.5 py-2 text-left text-xs text-fg-muted hover:text-fg-default">
- Couldn't load your team. Try again
+ Couldn’t load your team. Try again
</button>
)}
{employees?.length === 0 && (
@@ -110,7 +120,7 @@ function TeamList() {
function ProfileRow() {
const openSettings = useHomeStore((s) => s.openSettings);
const { data: settings } = useOwnerSettings();
- const name = callName(settings) || String(settings?.profile_full_name ?? '').trim();
+ const name = String(settings?.profile_full_name ?? '').trim();
return (
<div className="border-t border-border-default pt-2">
<button
@@ -142,7 +152,7 @@ export function HomeSidebar() {
'flex shrink-0 flex-col gap-1 overflow-hidden border-border-default bg-bg-panel whitespace-nowrap transition-[width,opacity,padding] motion-reduce:transition-none',
open
? 'w-(--w-home-sidebar) border-r p-3 opacity-100 duration-(--dur-sidebar-in) ease-spring'
- : 'w-0 border-r-0 p-0 opacity-0 duration-(--dur-sidebar-out)',
+ : 'w-0 border-r-0 p-0 opacity-0 duration-(--dur-sidebar-out) ease-(--ease-default)',
)}
>
<div className="flex items-center px-1 pt-1 pb-3.5">
@@ -153,9 +163,9 @@ export function HomeSidebar() {
onClick={toggleSidebar}
aria-label="Close sidebar"
title="Close sidebar"
- className="ml-auto size-7.5"
+ className="ml-auto size-7.5 rounded-lg"
>
- <PanelLeft />
+ <PanelLeft className="size-4.25" strokeWidth={1.75} />
</Button>
</div>
<ActionButton
diff --git a/client/src/features/home/state/homeStore.ts b/client/src/features/home/state/homeStore.ts
index f4701bbf..f7c6adfb 100644
--- a/client/src/features/home/state/homeStore.ts
+++ b/client/src/features/home/state/homeStore.ts
@@ -43,6 +43,9 @@ interface HomeState {
setSettingsCategory: (category: string) => void;
glowRow: (workflowId: string) => void;
pulseLogo: () => void;
+ /** The composer took the focus it was asked for; a remount must not
+ * take it again. */
+ consumeComposerFocus: () => void;
}
export const useHomeStore = create<HomeState>((set) => ({
@@ -79,4 +82,5 @@ export const useHomeStore = create<HomeState>((set) => ({
glowRow: (workflowId) =>
set((state) => ({ glow: { workflowId, nonce: (state.glow?.nonce ?? 0) + 1 } })),
pulseLogo: () => set((state) => ({ logoPulse: state.logoPulse + 1 })),
+ consumeComposerFocus: () => set((state) => (state.composerFocus === 0 ? state : { composerFocus: 0 })),
}));
diff --git a/client/src/features/home/ui/pillToast.tsx b/client/src/features/home/ui/pillToast.tsx
index aef9f01e..d88bdefd 100644
--- a/client/src/features/home/ui/pillToast.tsx
+++ b/client/src/features/home/ui/pillToast.tsx
@@ -25,16 +25,19 @@ const TONE: Record<PillTone, { border: string; dot: string }> = {
};
function PillToast({ message, tone }: { message: string; tone: PillTone }) {
+ // Centred in sonner's toast column, on one line however long the message.
return (
- <div
- role="status"
- className={cn(
- 'flex items-center gap-2.5 rounded-pill border bg-bg-elevated px-4 py-2.5 font-body text-sm font-medium text-fg-default shadow-float',
- TONE[tone].border,
- )}
- >
- <span aria-hidden className={cn('size-1.75 shrink-0 rounded-full', TONE[tone].dot)} />
- {message}
+ <div className="flex w-full justify-center">
+ <div
+ role="status"
+ className={cn(
+ 'flex h-10 items-center gap-2.5 rounded-pill border bg-bg-elevated px-4 font-body text-sm font-medium whitespace-nowrap text-fg-default shadow-popover',
+ TONE[tone].border,
+ )}
+ >
+ <span aria-hidden className={cn('size-1.5 shrink-0 rounded-full', TONE[tone].dot)} />
+ {message}
+ </div>
</div>
);
}
@@ -50,5 +53,6 @@ export function pillToast(message: string, options: { tone?: PillTone } = {}): s
}
export function PillToaster() {
- return <Toaster id={PILL_TOASTER_ID} position="bottom-center" toastOptions={{ unstyled: true }} />;
+ // One pill at a time, 44px up from the bottom (design handoff "Toast").
+ return <Toaster id={PILL_TOASTER_ID} position="bottom-center" offset={44} visibleToasts={1} toastOptions={{ unstyled: true }} />;
}
diff --git a/client/src/features/home/ui/primitives.tsx b/client/src/features/home/ui/primitives.tsx
index 6e079b87..0294e1a5 100644
--- a/client/src/features/home/ui/primitives.tsx
+++ b/client/src/features/home/ui/primitives.tsx
@@ -50,7 +50,13 @@ export function Avatar({
)}
>
{initialOf(name)}
- {status && <StatusDot tone={status} pulse={pulse} className="absolute -right-px -bottom-px size-2.25 outline-2 outline-bg-panel" />}
+ {status && (
+ <StatusDot
+ tone={status}
+ pulse={pulse}
+ className="absolute -right-px -bottom-px box-content size-2.25 border-2 border-bg-panel"
+ />
+ )}
</span>
);
}
@@ -69,7 +75,7 @@ export function StatusPill({ tone, label, pulse = false }: { tone: StatusTone; l
return (
<span
className={cn(
- 'inline-flex h-7 shrink-0 items-center gap-1.5 rounded-pill border px-3 text-sm font-medium transition-colors',
+ 'inline-flex h-7.5 shrink-0 items-center gap-1.5 rounded-pill border px-3 text-sm font-medium transition-colors',
STATUS_PILL_CLASS[tone],
)}
>
diff --git a/client/src/index.css b/client/src/index.css
index 9c297acc..5636ee79 100644
--- a/client/src/index.css
+++ b/client/src/index.css
@@ -36,6 +36,13 @@
font-feature-settings: "rlig" 1, "calt" 1;
}
+ /* Tailwind v4 leaves buttons on the arrow; the designs point at them,
+ * with each theme's own pointer (--cursor-pointer). */
+ button:not(:disabled),
+ [role="button"]:not([aria-disabled="true"]) {
+ cursor: var(--cursor-pointer, pointer);
+ }
+
#root {
height: 100vh;
width: 100vw;
@@ -438,16 +445,15 @@ html {
/* ============================================================================
* Normal mode: a working employee's status pip breathes a ring (design
- * handoff "pulsing ring"). A CSS keyframe rather than a Web Animation so the
- * page-hidden pause in base.css covers it. The pip's panel-coloured ring is
- * an outline, which this box-shadow never overwrites.
+ * handoff "pulsing ring": 0 to 6px over the whole loop). A CSS keyframe
+ * rather than a Web Animation so the page-hidden pause in base.css covers
+ * it. The ring grows from the pip's border box, outside its panel ring.
* ============================================================================ */
@keyframes home-pip-ring {
0% {
box-shadow: 0 0 0 0 color-mix(in srgb, var(--status-working-dot) var(--tint-pip-ring), transparent);
}
- 70%,
100% {
box-shadow: 0 0 0 6px transparent;
}
diff --git a/client/src/themes/light.css b/client/src/themes/light.css
index b384ea4b..2f67c522 100644
--- a/client/src/themes/light.css
+++ b/client/src/themes/light.css
@@ -223,6 +223,10 @@
--shadow-float: 0 12px 40px rgb(15 23 42 / 0.10);
--shadow-popover: 0 12px 32px rgb(15 23 42 / 0.12);
--shadow-dialog: 0 24px 80px rgb(15 23 42 / 0.16);
+
+ /* A paused employee's dot stays the design's mid grey; only its pill
+ * text takes the darker muted ink (base.css). */
+ --status-paused-dot: #9aa1ac;
}
/* Code & syntax tokens (code editor / JSON output / variable tree) */
diff --git a/server/config/credential_providers.json b/server/config/credential_providers.json
index 386f5b68..275faa03 100644
--- a/server/config/credential_providers.json
+++ b/server/config/credential_providers.json
@@ -681,7 +681,7 @@
"email_password"
]
},
- "icon_ref": "/api/schemas/credentials/email_himalaya/icon"
+ "icon_ref": "/api/schemas/nodes/emailRead/icon"
},
"android_remote": {
"name": "Android Device",
diff --git a/server/services/approvals/waiter.py b/server/services/approvals/waiter.py
index 9fb29eb9..446edeb5 100644
--- a/server/services/approvals/waiter.py
+++ b/server/services/approvals/waiter.py
@@ -34,6 +34,11 @@ async def wait_for_change(approval_id: str, timeout: float) -> bool:
future.cancel()
+def waiting(approval_id: str) -> int:
+ """How many gates in this process are waiting on ``approval_id``."""
+ return len(_waiters.get(approval_id, ()))
+
+
def notify(approval_id: str) -> int:
"""Wake everything waiting on ``approval_id``. Returns how many."""
woken = 0
@@ -52,4 +57,4 @@ def reset_for_tests() -> None:
_waiters.clear()
-__all__ = ["notify", "reset_for_tests", "wait_for_change"]
+__all__ = ["notify", "reset_for_tests", "wait_for_change", "waiting"]
diff --git a/server/tests/services/approvals/test_approval_gate.py b/server/tests/services/approvals/test_approval_gate.py
index 412757a1..7a203f4e 100644
--- a/server/tests/services/approvals/test_approval_gate.py
+++ b/server/tests/services/approvals/test_approval_gate.py
@@ -6,12 +6,13 @@ Temporal, a Reset cancels it, and nothing about the message is broadcast."""
from __future__ import annotations
import asyncio
+import contextlib
from datetime import datetime, timedelta, timezone
from types import SimpleNamespace
import pytest
-from services.approvals import reconcile, store
+from services.approvals import reconcile, store, waiter
from services.plugin.context import NodeContext
pytestmark = pytest.mark.asyncio
@@ -56,6 +57,15 @@ async def pending(harness, *, count=1):
raise AssertionError("no pending draft appeared")
+async def until_waiting(approval_id):
+ """Until a gate is parked on the draft (between reads, not inside one)."""
+ for _ in range(400):
+ if waiter.waiting(approval_id):
+ return
+ await asyncio.sleep(0.005)
+ raise AssertionError("no gate started waiting on the draft")
+
+
async def decide(harness, approval_id, decision, key="d1", **extra):
from nodes.workflow.approval_gate._handlers import handle_decide_approval
@@ -117,11 +127,18 @@ async def test_edits_must_fit_and_not_be_empty(harness):
async def test_a_retry_finds_the_same_draft(harness):
first = asyncio.ensure_future(run_gate(harness))
(row,) = await pending(harness)
+ # Interrupt the first attempt while it waits, as a worker restart does,
+ # and let it unwind. Cancelled in the middle of a read instead, SQLite
+ # can hold the file long enough for the decision below to miss it.
+ await until_waiting(row.id)
first.cancel()
+ with contextlib.suppress(asyncio.CancelledError):
+ await first
retry = asyncio.ensure_future(run_gate(harness))
- await asyncio.sleep(0.05)
+ await until_waiting(row.id)
assert [r.id for r in await store.list_approvals(harness.database)] == [row.id]
- await decide(harness, row.id, "send")
+ decided = await decide(harness, row.id, "send")
+ assert decided["success"] is True, decided
assert (await asyncio.wait_for(retry, 5))["result"]["approved"] is True
# After the decision, another attempt returns the same outcome at once.
assert (await run_gate(harness))["result"]["approval_id"] == row.id
diff --git a/server/tests/test_credential_catalogue_consumer_fields.py b/server/tests/test_credential_catalogue_consumer_fields.py
index 375235c3..ef6ce519 100644
--- a/server/tests/test_credential_catalogue_consumer_fields.py
+++ b/server/tests/test_credential_catalogue_consumer_fields.py
@@ -107,6 +107,25 @@ class TestCatalogueFields:
def test_catalogue_payload_carries_consumer_categories(self, registry):
assert registry.get_catalogue()["consumer_categories"] == registry.get_consumer_categories()
+ def test_every_backend_icon_url_resolves(self, registry):
+ """An ``icon_ref`` on a backend icon route must name something that
+ route can serve, or the Connectors card shows a broken image (the
+ IMAP/SMTP account once pointed at a credential class that does not
+ exist)."""
+ import re
+
+ import nodes # noqa: F401 - registers every node type and credential class
+ from nodes._visuals import get_plugin_icon_path
+ from services.plugin.credential import CREDENTIAL_REGISTRY
+
+ for provider in registry.get_all_providers():
+ ref = provider.get("icon_ref") or ""
+ if match := re.fullmatch(r"/api/schemas/credentials/(\w+)/icon", ref):
+ credential = CREDENTIAL_REGISTRY.get(match.group(1))
+ assert credential is not None and credential.get_icon_path() is not None, provider["id"]
+ elif match := re.fullmatch(r"/api/schemas/nodes/(\w+)/icon", ref):
+ assert get_plugin_icon_path(match.group(1)) is not None, provider["id"]
+
class TestProviderConnectionState:
async def test_api_key_provider(self, registry):