Open source CapCut alternative.
TypeScript
feat(site): notch reply mode in the prototype
David Le96af27a6e37b
diff --git a/site/src/app/prototype/_components/App.tsx b/site/src/app/prototype/_components/App.tsxindex 56695756..46e29be7 100644--- a/site/src/app/prototype/_components/App.tsx+++ b/site/src/app/prototype/_components/App.tsx@@ -5,6 +5,7 @@ import { type FormEvent, useCallback, useEffect, useLayoutEffect, useRef, useStaimport { DemoControls } from '@/app/prototype/_components/DemoControls';import { MacDesktop } from '@/app/prototype/_components/MacDesktop';import {+ AUTH_ERROR_MESSAGE,INITIAL_LIVE_TASKS,MAX_LIVE_TASKS,SAMPLE_SUBTEXTS,@@ -28,13 +29,16 @@ export default function App() {// App-update notification is detected once on launch; the prototype seeds it on.const [updateAvailable, setUpdateAvailable] = useState(true);const [missingPermissions, setMissingPermissions] = useState(false);+ // Logged out gates the notch into a login call-to-action; the prototype seeds it off.+ const [loggedOut, setLoggedOut] = useState(false);const [liveTasks, setLiveTasks] = useState<LiveTask[]>(INITIAL_LIVE_TASKS);// The update currently streaming into the collapsed notch chin (rotates across running tasks).const [chinUpdate, setChinUpdate] = useState<NotchUpdate | null>(INITIAL_UPDATE);- // Completed tasks keep surfacing in the collapsed notch until the user expands; expanding marks- // them acknowledged so they stop surfacing as floating pointers (they stay in the expanded list).- const [acknowledgedDoneIds, setAcknowledgedDoneIds] = useState<Set<string>>(() => new Set());- const acknowledgedDoneRef = useRef(acknowledgedDoneIds);+ // Terminal tasks — completions and errors — keep surfacing in the collapsed notch until the user+ // expands; expanding marks them acknowledged so they stop surfacing as floating pointers / chin+ // messages (they stay in the expanded list).+ const [acknowledgedIds, setAcknowledgedIds] = useState<Set<string>>(() => new Set());+ const acknowledgedRef = useRef(acknowledgedIds);const [activeTaskId, setActiveTaskId] = useState<TaskId>('compare');const [notchExpanded, setNotchExpanded] = useState(false);// Center composer is summoned with a double-tap of Cmd (like the app), hidden otherwise.@@ -120,14 +124,20 @@ export default function App() {// Keep a ref of the acknowledged set so the rotation timer can read it without re-subscribing.useEffect(() => {- acknowledgedDoneRef.current = acknowledgedDoneIds;- }, [acknowledgedDoneIds]);+ acknowledgedRef.current = acknowledgedIds;+ }, [acknowledgedIds]);- // Rotate the collapsed chin through running tasks' streaming updates, one at a time. When nothing- // is running, keep surfacing the most recent completed task's result until the user dismisses it.+ // Rotate the collapsed chin through running tasks' streaming updates, one at a time. An+ // unacknowledged error outranks everything and holds the chin until the user expands; otherwise,+ // when nothing is running, the most recent completion keeps surfacing until it's acknowledged.useEffect(() => {const interval = window.setInterval(() => {const tasks = liveTasksRef.current;+ const errored = tasks.find((task) => task.status === 'error' && !acknowledgedRef.current.has(task.id));+ if (errored) {+ setChinUpdate({ color: errored.color, message: errored.detail, isError: true });+ return;+ }const running = tasks.filter((task) => task.status === 'running');if (running.length > 0) {updateCounterRef.current += 1;@@ -136,7 +146,7 @@ export default function App() {setChinUpdate({ color: task.color, message });return;}- const done = tasks.find((task) => task.status === 'done' && !acknowledgedDoneRef.current.has(task.id));+ const done = tasks.find((task) => task.status === 'done' && !acknowledgedRef.current.has(task.id));setChinUpdate(done ? { color: done.color, message: done.detail } : null);}, 2600);@@ -154,6 +164,37 @@ export default function App() {setChinUpdate({ color, message: detail });}, []);+ // Simulate an auth error. It attaches to a real task (the most recent running one, else any live+ // task) so the error is tied to that task's own pointer — the chin holds its message with a red+ // warning glyph in the right rail until the user expands to acknowledge it. Only when there's no+ // task to attach to does it synthesize one, so the demo can still show the error chin.+ const triggerAuthError = useCallback(() => {+ const tasks = liveTasksRef.current;+ const target = tasks.find((task) => task.status === 'running') ?? tasks.find((task) => task.status !== 'error');+ if (target) {+ setLiveTasks((current) =>+ current.map((task) =>+ task.id === target.id ? { ...task, status: 'error', detail: AUTH_ERROR_MESSAGE } : task,+ ),+ );+ setChinUpdate({ color: target.color, message: AUTH_ERROR_MESSAGE, isError: true });+ return;+ }++ liveTaskIdRef.current += 1;+ const color = TASK_COLORS[(INITIAL_LIVE_TASKS.length + liveTaskIdRef.current) % TASK_COLORS.length];+ const created: LiveTask = {+ id: `live-${liveTaskIdRef.current}`,+ title: 'Authentication required',+ detail: AUTH_ERROR_MESSAGE,+ color,+ seconds: 0,+ status: 'error',+ };+ setLiveTasks((current) => (current.length >= MAX_LIVE_TASKS ? current : [created, ...current]));+ setChinUpdate({ color, message: AUTH_ERROR_MESSAGE, isError: true });+ }, []);+const stopLiveTask = useCallback((id: string) => {setLiveTasks((tasks) => tasks.map((task) => (task.id === id ? { ...task, status: 'stopped' } : task)));}, []);@@ -162,6 +203,14 @@ export default function App() {setLiveTasks((tasks) => tasks.map((task) => (task.id === id ? { ...task, status: 'running' } : task)));}, []);+ // Replying to a thread continues it with the user's message: the task goes back to running and its+ // line shows what the user just said, mirroring the app's "pin the next message to this task".+ const replyToLiveTask = useCallback((id: string, text: string) => {+ setLiveTasks((tasks) =>+ tasks.map((task) => (task.id === id ? { ...task, status: 'running', detail: text } : task)),+ );+ }, []);+const closeLiveTask = useCallback((id: string) => {setLiveTasks((tasks) => tasks.filter((task) => task.id !== id));}, []);@@ -180,16 +229,17 @@ export default function App() {const isNotchExpanded = notchExpanded || state === 'expanded-pinned';- // Expanding the notch dismisses the surfaced completions: the running tasks keep streaming, but the- // completed pointers that piled up in the collapsed notch are acknowledged and stop floating there.+ // Expanding the notch acknowledges the surfaced terminal tasks: the running tasks keep streaming,+ // but the completions and errors that piled up in the collapsed notch (pointers + the held error+ // chin) are acknowledged and stop surfacing there.useEffect(() => {if (!isNotchExpanded) return;- setAcknowledgedDoneIds((prev) => {+ setAcknowledgedIds((prev) => {let changed = false;const next = new Set(prev);for (const task of liveTasksRef.current) {- if (task.status === 'done' && !next.has(task.id)) {+ if ((task.status === 'done' || task.status === 'error') && !next.has(task.id)) {next.add(task.id);changed = true;}@@ -198,9 +248,12 @@ export default function App() {});}, [isNotchExpanded]);- // The collapsed notch surfaces running tasks and completed-but-undismissed tasks as a pointer cluster.+ // The collapsed notch surfaces running tasks plus unacknowledged terminal tasks (completions and+ // errors) as a pointer cluster.const surfacedTasks = liveTasks.filter(- (task) => task.status === 'running' || (task.status === 'done' && !acknowledgedDoneIds.has(task.id)),+ (task) =>+ task.status === 'running' ||+ ((task.status === 'done' || task.status === 'error') && !acknowledgedIds.has(task.id)),);return (@@ -226,7 +279,10 @@ export default function App() {onAddTask={addLiveTask}onStopTask={stopLiveTask}onResumeTask={resumeLiveTask}+ onReplyToTask={replyToLiveTask}onCloseTask={closeLiveTask}+ loggedOut={loggedOut}+ onLogin={() => setLoggedOut(false)}/><DemoControlsstate={state}@@ -237,8 +293,11 @@ export default function App() {setUpdateAvailable={setUpdateAvailable}missingPermissions={missingPermissions}setMissingPermissions={setMissingPermissions}+ loggedOut={loggedOut}+ setLoggedOut={setLoggedOut}activeTaskId={activeTaskId}setActiveTaskId={setActiveTaskId}+ onTriggerAuthError={triggerAuthError}/></div>);diff --git a/site/src/app/prototype/_components/DemoControls.tsx b/site/src/app/prototype/_components/DemoControls.tsxindex 193d57c1..e154e707 100644--- a/site/src/app/prototype/_components/DemoControls.tsx+++ b/site/src/app/prototype/_components/DemoControls.tsx@@ -16,6 +16,9 @@ type Props = {setMissingPermissions: (missing: boolean) => void;activeTaskId: TaskId;setActiveTaskId: (id: TaskId) => void;+ onTriggerAuthError: () => void;+ loggedOut: boolean;+ setLoggedOut: (loggedOut: boolean) => void;};type StateOption = {@@ -48,6 +51,9 @@ export function DemoControls({setMissingPermissions,activeTaskId,setActiveTaskId,+ onTriggerAuthError,+ loggedOut,+ setLoggedOut,}: Props) {const [notificationsOpen, setNotificationsOpen] = useState(false);@@ -108,6 +114,29 @@ export function DemoControls({<div className="h-7 w-px bg-white/10" />+ <button+ type="button"+ onClick={onTriggerAuthError}+ className="h-8 rounded-lg px-2.5 text-[11px] font-medium transition"+ style={{ background: 'rgba(255,255,255,0.08)', color: 'rgba(255,255,255,0.72)' }}+ >+ Auth error+ </button>++ <button+ type="button"+ onClick={() => setLoggedOut(!loggedOut)}+ className="h-8 rounded-lg px-2.5 text-[11px] font-medium transition"+ style={{+ background: loggedOut ? 'rgba(255,255,255,0.92)' : 'rgba(255,255,255,0.08)',+ color: loggedOut ? 'rgba(0,0,0,0.82)' : 'rgba(255,255,255,0.72)',+ }}+ >+ Logged out+ </button>++ <div className="h-7 w-px bg-white/10" />+<div className="relative flex items-center gap-1.5"><buttontype="button"diff --git a/site/src/app/prototype/_components/ExpandedTaskRow.tsx b/site/src/app/prototype/_components/ExpandedTaskRow.tsxindex 6b6406b0..08336772 100644--- a/site/src/app/prototype/_components/ExpandedTaskRow.tsx+++ b/site/src/app/prototype/_components/ExpandedTaskRow.tsx@@ -1,4 +1,5 @@-import { Play, Square, X } from 'lucide-react';+import { MessageSquareReply, Play, Square, X } from 'lucide-react';+import type { MouseEvent } from 'react';import { DonkeyCursor } from '@/app/prototype/_components/DonkeyCursor';import type { LiveTaskStatus } from '@/app/prototype/_components/types';@@ -9,48 +10,112 @@ type Props = {color: string;status: LiveTaskStatus;timeText: string;+ // Whether this row is the active reply target (full opacity, lit pointer, accent focus).+ isReplyTarget: boolean;+ // Whether another row is the reply target, so this one recedes.+ dimmed: boolean;onStop: () => void;onResume: () => void;onClose: () => void;+ // Begin/toggle reply for this thread — fired by tapping the row and by the Reply button.+ onActivate: () => void;};const controlClass ='grid h-6 w-6 place-items-center rounded-full bg-white/[0.12] text-white/[0.88] transition hover:bg-white/[0.2]';-export function ExpandedTaskRow({ title, detail, color, status, timeText, onStop, onResume, onClose }: Props) {+export function ExpandedTaskRow({+ title,+ detail,+ color,+ status,+ timeText,+ isReplyTarget,+ dimmed,+ onStop,+ onResume,+ onClose,+ onActivate,+}: Props) {const running = status === 'running';+ // The agent is waiting on the user (a clarification/review): it's the only state with a Reply button,+ // and its pointer gently pulses to call attention.+ const waiting = status === 'waiting';+ // Leave room for the pinned controls (a two-button pair when stopped or waiting, else a single+ // button) so the title runs to just left of them; the subtext also clears the bottom-pinned time.+ const controlsReserve = status === 'stopped' || waiting ? 74 : 44;+ const detailReserve = Math.max(controlsReserve, 52);++ // The reply dim is applied per-element so an attention pointer (a waiting thread) can stay lit while+ // the rest of its row recedes. The targeted row's pointer shows its live color even if it had stopped.+ const contentOpacity = dimmed ? 0.5 : 1;+ const pointerOpacity = waiting ? 1 : contentOpacity;+ const pointerActive = running || isReplyTarget;++ // Buttons sit inside the clickable row, so stop their clicks from also activating reply.+ const withStop = (handler: () => void) => (event: MouseEvent) => {+ event.stopPropagation();+ handler();+ };return (- <article className="group relative flex items-start gap-3 rounded-lg px-3 py-2.5 transition-colors hover:bg-white/[0.07]">- <DonkeyCursor color={color} size={14} silhouette={!running} className="mt-0.5" />- <div className="min-w-0 flex-1 pr-[88px]">- <h2 className="truncate text-[13px] font-normal leading-4 text-white/[0.9]">{title}</h2>+ <article+ onClick={withStop(onActivate)}+ className="group relative flex cursor-pointer items-start gap-3 rounded-lg px-3 py-2.5 transition-colors hover:bg-white/[0.07]"+ style={{ background: isReplyTarget ? 'rgba(255,255,255,0.07)' : undefined }}+ >+ <div+ style={{+ opacity: pointerOpacity,+ animation: waiting ? 'notchArrowPulse 1.6s ease-in-out infinite' : undefined,+ }}+ >+ <DonkeyCursor color={color} size={14} silhouette={!pointerActive} className="mt-0.5" />+ </div>+ <div className="min-w-0 flex-1" style={{ opacity: contentOpacity }}>+ <h2 className="truncate text-[13px] font-normal leading-4 text-white/[0.9]" style={{ paddingRight: controlsReserve }}>+ {title}+ </h2>{detail && (- <p className="mt-1 line-clamp-5 text-[12px] font-normal leading-[14px] text-white/[0.42]">{detail}</p>+ <p+ className="mt-1 line-clamp-5 text-[12px] font-normal leading-[14px] text-white/[0.42]"+ style={{ paddingRight: detailReserve }}+ >+ {detail}+ </p>)}</div>- {/* Controls (fixed top-right): running → stop; stopped → resume + close; done → close. */}- <div className="absolute right-3 top-2 flex items-center gap-1.5">+ {/* Controls (fixed top-right): running → stop; stopped → resume + close; waiting → reply + close;+ done / error → close. A finished or failed thread has no button — tap the row to reply. */}+ <div className="absolute right-3 top-2 flex items-center gap-1.5" style={{ opacity: contentOpacity }}>{running && (- <button type="button" onClick={onStop} aria-label="Stop" className={controlClass}>+ <button type="button" onClick={withStop(onStop)} aria-label="Stop" className={controlClass}><Square size={9} fill="currentColor" /></button>)}{status === 'stopped' && (- <button type="button" onClick={onResume} aria-label="Resume" className={controlClass}>+ <button type="button" onClick={withStop(onResume)} aria-label="Resume" className={controlClass}><Play size={10} fill="currentColor" /></button>)}+ {waiting && (+ <button type="button" onClick={withStop(onActivate)} aria-label="Reply" className={controlClass}>+ <MessageSquareReply size={12} strokeWidth={2} />+ </button>+ )}{!running && (- <button type="button" onClick={onClose} aria-label="Close" className={controlClass}>+ <button type="button" onClick={withStop(onClose)} aria-label="Close" className={controlClass}><X size={11} strokeWidth={2.25} /></button>)}</div>{/* Elapsed time is pinned to the bottom-right of the cell so it never moves as the cell grows. */}- <span className="absolute bottom-2.5 right-3 whitespace-nowrap text-[10px] leading-none text-white/[0.55]">+ <span+ className="absolute bottom-2.5 right-3 whitespace-nowrap text-[10px] leading-none text-white/[0.55]"+ style={{ opacity: contentOpacity }}+ >{timeText}</span></article>diff --git a/site/src/app/prototype/_components/MacDesktop.tsx b/site/src/app/prototype/_components/MacDesktop.tsxindex a30db53f..8cd947e2 100644--- a/site/src/app/prototype/_components/MacDesktop.tsx+++ b/site/src/app/prototype/_components/MacDesktop.tsx@@ -25,7 +25,10 @@ type Props = {onAddTask: (title: string) => void;onStopTask: (id: string) => void;onResumeTask: (id: string) => void;+ onReplyToTask: (id: string, text: string) => void;onCloseTask: (id: string) => void;+ loggedOut: boolean;+ onLogin: () => void;};const LAYOUT = {@@ -62,7 +65,10 @@ export function MacDesktop({onAddTask,onStopTask,onResumeTask,+ onReplyToTask,onCloseTask,+ loggedOut,+ onLogin,}: Props) {const hasPromptText = promptText.trim().length > 0;@@ -117,7 +123,10 @@ export function MacDesktop({onAddTask={onAddTask}onStopTask={onStopTask}onResumeTask={onResumeTask}+ onReplyToTask={onReplyToTask}onCloseTask={onCloseTask}+ loggedOut={loggedOut}+ onLogin={onLogin}/><sectiondiff --git a/site/src/app/prototype/_components/Notch.tsx b/site/src/app/prototype/_components/Notch.tsxindex 2d6d43c8..463533bd 100644--- a/site/src/app/prototype/_components/Notch.tsx+++ b/site/src/app/prototype/_components/Notch.tsx@@ -1,8 +1,9 @@import { ArrowUp, CloudSync, MessageCircleWarning, Shield } from 'lucide-react';-import { type FormEvent, useEffect, useRef, useState } from 'react';+import { type FormEvent, useEffect, useLayoutEffect, useRef, useState } from 'react';import { DonkeyCursor } from '@/app/prototype/_components/DonkeyCursor';import { ExpandedTaskRow } from '@/app/prototype/_components/ExpandedTaskRow';+import { ERROR_RED } from '@/app/prototype/_components/tasks';import type { LiveTask, NotchState, NotchUpdate, NotchVariant } from '@/app/prototype/_components/types';type Props = {@@ -20,7 +21,10 @@ type Props = {onAddTask: (title: string) => void;onStopTask: (id: string) => void;onResumeTask: (id: string) => void;+ onReplyToTask: (id: string, text: string) => void;onCloseTask: (id: string) => void;+ loggedOut: boolean;+ onLogin: () => void;};const METRICS = {@@ -28,8 +32,11 @@ const METRICS = {collapsedHeight: 32,// The MacBook notch void sits between two 34px content areas (left arrow, right time).contentAreaWidth: 34,- // Chin hangs below the real notch: single streaming line, 9px font, no top padding.- chinHeight: 20,+ // Chin hangs below the real notch: a 12px streaming line (no top padding) that grows to a second+ // line before truncating. `chinBaseHeight` is one line + the bottom margin; each extra line adds+ // exactly `chinLineHeight`, so the bottom margin stays constant no matter the line count.+ chinBaseHeight: 23,+ chinLineHeight: 15,// Surfaced pointers (running + undismissed completions) stack as an overlapping cluster.pointerSize: 14,pointerStepX: 8,@@ -45,6 +52,10 @@ const METRICS = {// Spec: the expanded notch window and its input box both use a 14px radius.expandedCornerRadius: 14,contentInset: 14,+ // Logged out: collapsed just shows the "Login to use Donkey" line; expanding reveals a wide bar with+ // the label on the left and the Login button on the right.+ loginCollapsedChinHeight: 22,+ loginExpandedHeight: 84,} as const;// The follow-up input starts as one line and grows with content up to a scroll cap.@@ -96,7 +107,10 @@ export function Notch({onAddTask,onStopTask,onResumeTask,+ onReplyToTask,onCloseTask,+ loggedOut,+ onLogin,}: Props) {const isRunning = isRunningState(state);const isActive = hasActiveTask(state);@@ -108,6 +122,8 @@ export function Notch({// The left content area surfaces a cluster of pointers — running tasks plus completions the user// hasn't dismissed yet. One pointer renders alone; several overlap as a centered, cascading stack// (newest on top), capped so the notch never crowds. A completed pointer is colored but still.+ // A failed task is a real task, so it keeps its own pointer here (alongside the right-rail warning+ // glyph and held chin); each surfaced task shows a single pointer.const clusterTasks = surfacedTasks.slice(0, METRICS.maxClusterPointers);const clusterCount = clusterTasks.length;const clusterWidth = METRICS.pointerSize + METRICS.pointerStepX * Math.max(0, clusterCount - 1);@@ -132,8 +148,20 @@ export function Notch({// The chin (real) / inline (simulated) shows the current streaming update; hidden when expanded or// once nothing is surfaced, so it never lingers a beat after the last pointer is dismissed.const message = !expanded && chinUpdate && surfacedTasks.length > 0 ? chinUpdate.message : '';+ const isErrorChin = chinUpdate?.isError === true;const collapsedTime = formatCompactTime(runningSeconds);+ // Measure how many lines the chin message wraps to (capped at two) so the band grows by exactly one+ // line-height for a second line, keeping the bottom margin constant.+ const chinTextRef = useRef<HTMLParagraphElement | null>(null);+ const [chinLines, setChinLines] = useState(1);+ useLayoutEffect(() => {+ const el = chinTextRef.current;+ if (!el) return;+ setChinLines(Math.min(2, Math.max(1, Math.round(el.offsetHeight / METRICS.chinLineHeight))));+ }, [message]);+ const chinHeight = METRICS.chinBaseHeight + (chinLines - 1) * METRICS.chinLineHeight;+// App-level notices share a single slot; permissions outranks update since it blocks functionality.const appNotice: 'permissions' | 'update' | null = missingPermissions? 'permissions'@@ -144,12 +172,16 @@ export function Notch({const isSimulatedExpandedMessage = variant === 'simulated' && message !== '';const collapsedHeight = expanded- ? METRICS.expandedHeight- : variant === 'real'- ? METRICS.collapsedHeight + (showChin ? METRICS.chinHeight : 0)- : isSimulatedExpandedMessage- ? METRICS.simulatedMessageHeight- : METRICS.collapsedHeight;+ ? loggedOut+ ? METRICS.loginExpandedHeight+ : METRICS.expandedHeight+ : loggedOut+ ? METRICS.collapsedHeight + METRICS.loginCollapsedChinHeight+ : variant === 'real'+ ? METRICS.collapsedHeight + (showChin ? chinHeight : 0)+ : isSimulatedExpandedMessage+ ? METRICS.simulatedMessageHeight+ : METRICS.collapsedHeight;const collapsedWidth = expanded ? METRICS.expandedWidth : METRICS.collapsedWidth;// Both variants keep a flush top edge (no top corner radius) and round only the bottom.@@ -165,6 +197,29 @@ export function Notch({const followUpRef = useRef<HTMLTextAreaElement | null>(null);const [canSendFollowUp, setCanSendFollowUp] = useState(false);+ // Reply mode: the thread the user is replying to. Tapping a repliable row (waiting / done / error)+ // pins the next message to it and dims the others; the composer takes that thread's accent color.+ const [replyTargetId, setReplyTargetId] = useState<string | null>(null);+ const replyTarget = replyTargetId ? liveTasks.find((task) => task.id === replyTargetId) ?? null : null;++ // Every thread is repliable by tapping its row, whatever its state. Tapping the active thread again+ // leaves reply mode; tapping any other switches to it. (Only 'waiting' also shows a Reply button,+ // since only there is the agent actively asking.)+ const handleRowActivate = (task: LiveTask) => {+ setReplyTargetId((current) => (current === task.id ? null : task.id));+ };++ // Focus the composer when a reply begins, so the user can type straight away (no second click).+ useEffect(() => {+ if (replyTargetId) followUpRef.current?.focus();+ }, [replyTargetId]);++ // Collapsing the notch also leaves reply mode, so it never reopens with stale dimming.+ const collapse = () => {+ setExpanded(false);+ setReplyTargetId(null);+ };+const resizeFollowUp = () => {const input = followUpRef.current;if (!input) return;@@ -182,7 +237,13 @@ export function Notch({const taskText = String(formData.get('followUp') ?? '').trim();if (!taskText) return;- onAddTask(taskText);+ if (replyTargetId) {+ // Replying to a pinned thread continues it with the message rather than starting a new task.+ onReplyToTask(replyTargetId, taskText);+ setReplyTargetId(null);+ } else {+ onAddTask(taskText);+ }form.reset();setCanSendFollowUp(false);if (followUpRef.current) followUpRef.current.style.height = `${FOLLOWUP_MIN_HEIGHT}px`;@@ -203,9 +264,9 @@ export function Notch({onClick={() => setExpanded(true)}onFocus={() => setExpanded(true)}onPointerEnter={() => setExpanded(true)}- onPointerLeave={() => setExpanded(false)}+ onPointerLeave={collapse}onMouseEnter={() => setExpanded(true)}- onMouseLeave={() => setExpanded(false)}+ onMouseLeave={collapse}><style>{`@keyframes notchArrowPulse {@@ -226,6 +287,66 @@ export function Notch({'width 550ms cubic-bezier(0.2,0.9,0.24,1), height 550ms cubic-bezier(0.2,0.9,0.24,1), border-radius 550ms cubic-bezier(0.2,0.9,0.24,1), box-shadow 300ms ease-out',}}>+ {/* Logged out: the notch becomes a login call-to-action instead of the task surface. The+ collapsed chin reads "Login to use Donkey" with a Login button; expanding shows the+ minimal login view. */}+ {loggedOut && (+ <>+ {/* Collapsed: the idle silhouette sits in the left gutter beside the void, and the chin+ below reads "Login to use Donkey" — no button until expanded. */}+ <div+ className="absolute inset-0"+ style={{ opacity: expanded ? 0 : 1, transition: 'opacity 150ms ease-out' }}+ >+ <div+ className="absolute left-0 top-0 grid place-items-center"+ style={{ width: METRICS.contentAreaWidth, height: contentRowHeight }}+ >+ <DonkeyCursor color={activeColor} size={METRICS.pointerSize} silhouette />+ </div>+ <div+ className="absolute left-0 overflow-hidden"+ style={{+ top: METRICS.collapsedHeight,+ width: METRICS.collapsedWidth,+ height: METRICS.loginCollapsedChinHeight,+ padding: '0 12px',+ }}+ >+ <p className="truncate text-[12px] leading-[15px] text-white/[0.82]">Login to use Donkey</p>+ </div>+ </div>++ {/* Expanded: a wide bar — the label on the left, the Login button on the right. */}+ <div+ className="absolute left-0 flex items-center justify-between"+ style={{+ top: METRICS.collapsedHeight,+ width: METRICS.expandedWidth,+ height: METRICS.loginExpandedHeight - METRICS.collapsedHeight,+ padding: `0 ${METRICS.contentInset + 4}px`,+ opacity: expanded ? 1 : 0,+ pointerEvents: expanded ? 'auto' : 'none',+ transition: expanded ? 'opacity 300ms ease-out 150ms' : 'opacity 100ms ease-out',+ }}+ >+ <span className="text-[16px] leading-none text-white/[0.92]">Login to use Donkey</span>+ <button+ type="button"+ onClick={(event) => {+ event.stopPropagation();+ onLogin();+ }}+ className="flex items-center rounded-lg bg-white px-5 py-2 text-[14px] font-medium leading-none text-black/[0.82] transition hover:bg-white/[0.92]"+ >+ Login+ </button>+ </div>+ </>+ )}++ {!loggedOut && (+ <><divclassName="absolute inset-0"style={{@@ -274,7 +395,16 @@ export function Notch({</div>{/* Right content area — notifications surface here only when needed, otherwise run time. */}- {needsAttention ? (+ {isErrorChin && message !== '' ? (+ // Error (e.g. an auth failure): the warning glyph rides the right rail in error red while+ // the message holds the chin, until the user expands to acknowledge it.+ <div+ className="absolute right-0 top-0 grid place-items-center"+ style={{ width: METRICS.contentAreaWidth, height: contentRowHeight }}+ >+ <MessageCircleWarning size={15} strokeWidth={1.9} color={ERROR_RED} />+ </div>+ ) : needsAttention ? (// Chat-bubble alert: the LLM needs the user's attention (e.g. clarification).<divclassName="absolute right-0 top-0 grid place-items-center text-white/[0.85]"@@ -304,22 +434,35 @@ export function Notch({</div>) : null}- {/* Real notch: chin hangs below with the single streaming line (ellipsis if too long). */}+ {/* Real notch: chin hangs below with the streaming line, growing to two lines before it+ truncates with an ellipsis. An error holds the chin; its warning icon rides the right rail. */}{variant === 'real' && showChin && (<divclassName="absolute left-0 overflow-hidden"style={{top: METRICS.collapsedHeight,width: METRICS.collapsedWidth,- height: METRICS.chinHeight,+ height: chinHeight,padding: '0 12px',}}>- <p className="truncate text-[9px] leading-[12px] text-white/[0.72]">{message}</p>+ <p+ ref={chinTextRef}+ className="text-[12px] leading-[15px] text-white/[0.72]"+ style={{+ display: '-webkit-box',+ WebkitLineClamp: 2,+ WebkitBoxOrient: 'vertical',+ overflow: 'hidden',+ }}+ >+ {message}+ </p></div>)}- {/* Simulated notch: message sits inline between the arrow and the run time (two lines max). */}+ {/* Simulated notch: message sits inline between the arrow and the run time (two lines max);+ an error's warning icon rides the right rail, matching the real notch. */}{variant === 'simulated' && message !== '' && (<divclassName="absolute flex items-center"@@ -331,7 +474,7 @@ export function Notch({}}><p- className="text-[9px] leading-[12px] text-white/[0.72]"+ className="text-[12px] leading-[15px] text-white/[0.72]"style={{display: '-webkit-box',WebkitLineClamp: 2,@@ -381,6 +524,10 @@ export function Notch({pointerEvents: expanded ? 'auto' : 'none',transition: expanded ? 'opacity 300ms ease-out 150ms' : 'opacity 100ms ease-out',}}+ // Tapping bare chrome (not a row or the composer, which stop propagation) leaves reply mode.+ onClick={() => {+ if (replyTargetId) setReplyTargetId(null);+ }}>{/* Scrollable task list fills the space above the always-visible input. */}<div className="min-h-0 flex-1 overflow-y-auto pt-2.5">@@ -393,17 +540,29 @@ export function Notch({color={task.color}status={task.status}timeText={formatRunningTime(task.seconds)}+ isReplyTarget={replyTargetId === task.id}+ dimmed={replyTargetId !== null && replyTargetId !== task.id}onStop={() => onStopTask(task.id)}onResume={() => onResumeTask(task.id)}- onClose={() => onCloseTask(task.id)}+ onClose={() => {+ if (replyTargetId === task.id) setReplyTargetId(null);+ onCloseTask(task.id);+ }}+ onActivate={() => handleRowActivate(task)}/>))}</div></div>- {/* Input box is pinned to the bottom and always visible — one line that grows with its text. */}+ {/* Input box is pinned to the bottom and always visible — one line that grows with its text.+ While replying it's outlined in the targeted thread's accent color. */}<formclassName="relative flex min-h-[40px] w-[576px] shrink-0 items-center rounded-[14px] bg-white/[0.085] px-5 py-1.5"+ style={{+ boxShadow: replyTarget ? `inset 0 0 0 1.5px ${replyTarget.color}` : undefined,+ transition: 'box-shadow 160ms ease-out',+ }}+ onClick={(event) => event.stopPropagation()}onSubmit={handleFollowUpSubmit}><label className="sr-only" htmlFor="donkey-follow-up-input">@@ -446,6 +605,8 @@ export function Notch({</button></form></div>+ </>+ )}</div></section>);diff --git a/site/src/app/prototype/_components/tasks.ts b/site/src/app/prototype/_components/tasks.tsindex 8c1b6e8d..1cd71b91 100644--- a/site/src/app/prototype/_components/tasks.ts+++ b/site/src/app/prototype/_components/tasks.ts@@ -42,6 +42,10 @@ export const UPDATE_MESSAGES = [// A running task finishes (→ done) once it reaches this elapsed time.export const TASK_DONE_AT_SECONDS = 180;+// Error chin: macOS system red for the warning icon, plus the copy an auth failure surfaces.+export const ERROR_RED = 'rgb(255,69,58)';+export const AUTH_ERROR_MESSAGE = 'Authentication failed — sign in again to keep running your tasks.';+export const INITIAL_LIVE_TASKS: LiveTask[] = [{id: 'seed-long',@@ -53,6 +57,9 @@ export const INITIAL_LIVE_TASKS: LiveTask[] = [status: 'running',},{ id: 'seed-1', title: TASKS.compare.label, detail: TASKS.compare.detail, color: TASKS.compare.color, seconds: 95, status: 'running' },+ // Waiting on the user: the agent asked a question and is blocked — shows the Reply button and a+ // gently pulsing pointer until the user answers.+ { id: 'seed-wait', title: 'Reschedule the standup', detail: 'Which day works better — Tuesday or Thursday?', color: TASK_COLORS[6], seconds: 18, status: 'waiting' },{ id: 'seed-2', title: TASKS.research.label, detail: TASKS.research.detail, color: TASKS.research.color, seconds: 527, status: 'stopped' },{ id: 'seed-3', title: TASKS.reply.label, detail: TASKS.reply.detail, color: TASKS.reply.color, seconds: 180, status: 'done' },{ id: 'seed-4', title: TASKS.schedule.label, detail: TASKS.schedule.detail, color: TASKS.schedule.color, seconds: 40, status: 'running' },diff --git a/site/src/app/prototype/_components/types.ts b/site/src/app/prototype/_components/types.tsindex ae976392..fe999b32 100644--- a/site/src/app/prototype/_components/types.ts+++ b/site/src/app/prototype/_components/types.ts@@ -19,13 +19,19 @@ export type TaskSample = {detail: string;};-// 'running' ticks; 'stopped' is paused (resume or close); 'done' is finished (close only).-export type LiveTaskStatus = 'running' | 'stopped' | 'done';+// 'running' ticks; 'stopped' is paused (resume or close); 'done' is finished; 'waiting' means the+// agent is blocked on the user (a clarification or review — the only state with a Reply button, since+// only there is the agent asking); 'error' is a terminal failure (e.g. an auth error) that keeps+// surfacing until acknowledged. 'waiting', 'done', and 'error' threads are repliable: the user taps the+// row to pick them back up.+export type LiveTaskStatus = 'running' | 'stopped' | 'done' | 'waiting' | 'error';// The streaming update currently surfaced in the collapsed notch chin (with its task's color).+// `isError` marks a failure so the chin renders the warning icon in error red.export type NotchUpdate = {color: string;message: string;+ isError?: boolean;};// A task shown in the expanded notch list.