An open-source, faster Devin alternative
TypeScript
Computer: plain header and one sessions list after setup
Slack U06H7D98X40d793a4db8690
diff --git a/web/src/managed-agents/Computer.test.tsx b/web/src/managed-agents/Computer.test.tsxindex f536b7f3..f410cd1c 100644--- a/web/src/managed-agents/Computer.test.tsx+++ b/web/src/managed-agents/Computer.test.tsx@@ -347,7 +347,7 @@ describe('Computer page', () => {await settle(() => location() === '/computer', 'redirect to /computer')})- it('shows live work instead of setup once onboarded', async () => {+ it('lists the work, live first, once onboarded', async () => {computerApi.getComputer.mockResolvedValue(onboarded)computerApi.getComputerSessions.mockResolvedValue([doneSession,@@ -357,45 +357,37 @@ describe('Computer page', () => {render('/computer')await settle(() => container.textContent?.includes('Fix the flaky') === true,- 'live session card',+ 'sessions',)- const live = container.querySelector('section[aria-labelledby="live-now"]')- expect(live?.textContent).toContain('Live now')- expect(live?.textContent).toContain('Fix the flaky checkout test')- expect(live?.textContent).toContain('Working…')- expect(live?.textContent).toContain('2 min ago')- expect(live?.textContent).not.toContain('Explain the billing flow')+ const list = container.querySelector(+ 'section[aria-labelledby="computer-sessions"]',+ )!+ const rows = [...list.querySelectorAll('tbody tr')].map(+ (row) => row.textContent,+ )+ expect(rows[0]).toContain('Fix the flaky checkout test')+ expect(rows[0]).toContain('Working')+ expect(rows[0]).toContain('2 min ago')+ expect(rows[1]).toContain('Explain the billing flow')+ expect(rows[1]).toContain('1 hr ago')+ expect(list.textContent).toContain('1 working now')expect(- live?.querySelector('a[href="https://acme.slack.com/archives/C1/p11"]')+ list.querySelector('a[href="https://acme.slack.com/archives/C1/p11"]')?.textContent,).toContain('Open in Slack')- expect(container.textContent).toContain('Recent')- expect(container.textContent).toContain('Explain the billing flow')- expect(container.textContent).toContain('1 hr ago')- expect(container.textContent).toContain('One thing in flight')+ expect(container.textContent).toContain('Online')expect(container.textContent).toContain('Acme')expect(container.textContent).toContain('acme')+ expect(container.querySelector('a[href="/new"]')).not.toBeNull()- // Setup is gone; specs never appear.+ // No setup, no chatter; specs never appear.expect(container.textContent).not.toContain('Set up your computer')expect(container.textContent).not.toContain('Add to Slack')+ expect(container.textContent).not.toContain('in flight')expect(container.textContent).not.toMatch(/vCPU|GiB/)})- it('invites a hand-off when nothing is live', async () => {- computerApi.getComputer.mockResolvedValue(onboarded)- computerApi.getComputerSessions.mockResolvedValue([doneSession])-- render('/computer')- await settle(- () => container.textContent?.includes('Quiet right now.') === true,- 'quiet live state',- )- expect(container.textContent).toContain('Ready when you are.')- expect(container.textContent).toContain('@OpenComputer why is the')- })-it('keeps a resting computer and the upgrade visible once onboarded', async () => {computerApi.getComputer.mockResolvedValue({...onboarded,@@ -405,11 +397,12 @@ describe('Computer page', () => {render('/computer')await settle(- () => container.textContent?.includes('Resting') === true,+ () => container.textContent?.includes('Sleeping') === true,'resting header',)- expect(container.textContent).toContain('Sleeping')- expect(container.textContent).toContain('Upgrade and it never sleeps.')+ expect(container.querySelector('a[href="/billing"]')?.textContent).toBe(+ 'Upgrade and it never sleeps',+ )})it('keeps the setup page until GitHub is connected too', async () => {diff --git a/web/src/managed-agents/Computer.tsx b/web/src/managed-agents/Computer.tsxindex 0a8ff25b..c8a4c1bc 100644--- a/web/src/managed-agents/Computer.tsx+++ b/web/src/managed-agents/Computer.tsx@@ -19,8 +19,6 @@ import {MessagesSquare,RotateCcw,Send,- Sparkles,- Terminal,TriangleAlert,Unplug,UsersRound,@@ -30,17 +28,10 @@ import { ConfirmDialog } from '@/components/confirm-dialog'import { EmptyState } from '@/components/empty-state'import { GithubMark } from '@/components/github-mark'import { CopyRow } from '@/components/copy-row'-import {- Panel,- PanelContent,- PanelDescription,- PanelHeader,- PanelTitle,-} from '@/components/panel'+import { Panel } from '@/components/panel'import { ResourceTable, type Column } from '@/components/resource-table'import { StatusBadge } from '@/components/status-badge'import { Button } from '@/components/ui/button'-import { Skeleton } from '@/components/ui/skeleton'import { notifyError, notifySuccess } from '@/lib/errors'import { cn } from '@/lib/utils'import { AuthContext } from '@/hooks/useAuth'@@ -64,11 +55,11 @@ import {alreadyLinkedCopy,SESSION_STATUS,START_SESSION_COPY,- compactStatusLine,computerIsOnboarded,computerPollInterval,computerPresentation,relativeTime,+ sessionIsLive,sessionPollInterval,setupStep,slackReturnFromSearch,@@ -211,34 +202,23 @@ function ComputerPageContent() {const step = setupStep(status.data, sessions.data)if (step === null) {return (- <div className="mx-auto max-w-5xl space-y-8">+ <div className="mx-auto max-w-4xl space-y-8 pt-2 sm:pt-8">{slackProblemPanel}- <CompactHeader+ <Overviewstatus={status.data}- liveCount={live.length}createError={createError}creating={create.isPending}onRetry={() => create.mutate()}/>- <LiveNow- sessions={live}- readAt={sessions.dataUpdatedAt}- loading={sessionsLoading}- failed={sessions.isError}- /><SessionsPanel- title="Recent"- description="Finished and waiting threads, newest first."- emptyTitle="Nothing here yet"- emptyDescription="Finished work lands here."- hasComputer={hasComputer}- sessions={recent}+ live={live}+ recent={recent}readAt={sessions.dataUpdatedAt}loading={sessionsLoading}failed={sessions.isError}/><IdeasToTry />- <CliFooter />+ <CustomAgentLink /></div>)}@@ -255,21 +235,21 @@ function ComputerPageContent() {)}-function CliFooter() {+/**+ * Projects are for building agents of your own: a side door, kept out of the+ * way of the computer.+ */+function CustomAgentLink() {return (- <Panel>- <PanelContent className="flex flex-wrap items-center justify-between gap-4">- <div className="flex items-center gap-3">- <Terminal className="text-muted-foreground size-4" aria-hidden />- <p className="text-muted-foreground text-sm">- Build and deploy agents of your own with the OpenComputer CLI.- </p>- </div>- <Button variant="outline" asChild>- <Link to="/new">Create an agent</Link>- </Button>- </PanelContent>- </Panel>+ <p className="text-muted-foreground pt-4 text-center text-xs">+ <Link+ to="/new"+ className="hover:text-foreground inline-flex items-center gap-1 transition-colors"+ >+ Set up a custom agent on OpenComputer infrastructure+ <ArrowRight className="size-3" aria-hidden />+ </Link>+ </p>)}@@ -373,204 +353,93 @@ function RetryButton({)}-function CompactHeader({+function Overview({status,- liveCount,createError,creating,onRetry,}: {status: ComputerStatus- liveCount: numbercreateError: Error | nullcreating: booleanonRetry: () => void}) {const { computer } = statusconst failedToCreate = !computer && createError !== null- const line = failedToCreate- ? { headline: 'Something went wrong.', detail: createError.message }- : compactStatusLine(computer, status.plan, liveCount)const offerUpgrade = computer?.state === 'parked' && status.plan === 'free'+ // Only what needs attention: the status speaks for itself otherwise.+ const problem = failedToCreate+ ? createError.message+ : computer?.state === 'failed'+ ? (computer.lastError ??+ 'Your computer could not start. Try again, or tell us if it keeps happening.')+ : nullconst canRetry = failedToCreate || computer?.state === 'failed'const accounts = status.github.installations.map((installation) => installation.accountLogin,)return (- <section className="from-primary/10 via-panel to-panel relative overflow-hidden rounded-2xl border bg-linear-to-br px-6 py-6 sm:px-8">- <div- className="bg-primary/15 pointer-events-none absolute -top-20 -right-16 size-56 rounded-full blur-3xl"- aria-hidden- />- <div className="relative flex flex-wrap items-end justify-between gap-x-8 gap-y-5">- <div className="min-w-0">- <StatusPill status={status} failedToCreate={failedToCreate} />- <h1 className="mt-3 text-2xl font-semibold tracking-tight text-balance sm:text-3xl">- {line.headline}- </h1>- {line.detail ? (- <p className="text-muted-foreground mt-1.5 text-sm">- {offerUpgrade ? (- <Link- to="/billing"- className="text-foreground decoration-foreground/30 hover:decoration-foreground underline underline-offset-4 transition-colors"- >- {line.detail}- </Link>- ) : (- line.detail- )}- </p>+ <header className="flex flex-wrap items-start justify-between gap-x-8 gap-y-4">+ <div className="min-w-0">+ <h1 className="text-2xl font-semibold tracking-tight">Computer</h1>+ <p className="text-muted-foreground mt-1.5 flex flex-wrap items-center gap-x-2 text-sm">+ <PulseDot tone={computerDot(status, failedToCreate)} />+ <span className="text-foreground font-medium">+ {failedToCreate+ ? 'Failed'+ : computerPresentation(computer, status.plan, true).label}+ </span>+ {offerUpgrade ? (+ <>+ <span aria-hidden>·</span>+ <Link+ to="/billing"+ className="decoration-muted-foreground/40 hover:text-foreground underline underline-offset-4 transition-colors"+ >+ Upgrade and it never sleeps+ </Link>+ </>) : null}- {canRetry ? (- <RetryButton- className="mt-4"- creating={creating}- onRetry={onRetry}- />+ {problem ? (+ <>+ <span aria-hidden>·</span>+ <span>{problem}</span>+ </>) : null}- </div>- <div className="flex flex-wrap items-center gap-2 text-sm">- <span className="bg-background/70 text-muted-foreground inline-flex items-center gap-1.5 rounded-full border px-3 py-1 backdrop-blur">- <Hash className="size-3.5" aria-hidden />- <span className="sr-only">Slack: </span>- {status.slack.teamName ?? 'Slack'}- </span>- <span- className="bg-background/70 text-muted-foreground inline-flex max-w-64 items-center gap-1.5 rounded-full border px-3 py-1 backdrop-blur"- title={accounts.join(', ')}- >- <GithubMark className="size-3.5 shrink-0" />- <span className="sr-only">GitHub: </span>- <span className="truncate">- {accounts.length ? accounts.join(', ') : 'GitHub'}- </span>- </span>- <Button variant="ghost" size="sm" asChild>- <Link to="/managed-agents/connections">Manage</Link>- </Button>- <SlackAction status={status} compact />- </div>- </div>- </section>- )-}--function LiveNow({- sessions,- readAt,- loading,- failed,-}: {- sessions: ComputerSession[]- /** When the sessions were read; relative times never predate it. */- readAt: number- loading: boolean- failed: boolean-}) {- const now = Math.max(useNow(30_000), readAt)- return (- <section aria-labelledby="live-now">- <div className="mb-3 flex items-baseline justify-between gap-4">- <h2 id="live-now" className="text-lg font-semibold tracking-tight">- Live now- </h2>- {sessions.length > 0 ? (- <span className="text-muted-foreground text-sm">- {sessions.length === 1- ? '1 session in flight'- : `${sessions.length} sessions in flight`}- </span>+ </p>+ {canRetry ? (+ <RetryButton className="mt-4" creating={creating} onRetry={onRetry} />) : null}</div>- {loading ? (- <Skeleton className="h-36 rounded-xl" />- ) : sessions.length > 0 ? (- <div- className={cn('grid gap-4', sessions.length > 1 && 'sm:grid-cols-2')}- >- {sessions.map((session) => (- <LiveCard key={session.key} session={session} now={now} />- ))}- </div>- ) : failed ? (- <div className="bg-panel text-muted-foreground rounded-xl border px-6 py-8 text-center text-sm">- Sessions are temporarily unavailable. They reload by themselves.- </div>- ) : (- <QuietNow />- )}- </section>- )-}--function LiveCard({ session, now }: { session: ComputerSession; now: number }) {- const busy = session.status === 'busy'- return (- <article- className={cn(- 'bg-panel relative overflow-hidden rounded-xl border bg-linear-to-br to-transparent p-6 shadow-sm',- busy ? 'from-emerald-500/[0.06]' : 'from-amber-500/[0.06]',- )}- >- <div- className={cn(- 'absolute inset-x-0 top-0 h-0.5 bg-linear-to-r from-transparent to-transparent',- busy ? 'via-emerald-500' : 'via-amber-500',- )}- aria-hidden- />- <div className="flex items-center gap-2.5 text-sm">- <PulseDot tone={busy ? 'alive' : 'busy'} className="size-2.5" />+ <div className="text-muted-foreground flex flex-wrap items-center gap-x-4 gap-y-2 text-sm">+ <span className="inline-flex items-center gap-1.5">+ <Hash className="size-3.5" aria-hidden />+ <span className="sr-only">Slack: </span>+ {status.slack.teamName ?? 'Slack'}+ </span><span- className={cn(- 'font-medium',- busy- ? 'text-emerald-600 dark:text-emerald-400'- : 'text-amber-600 dark:text-amber-400',- )}+ className="inline-flex max-w-56 items-center gap-1.5"+ title={accounts.join(', ')}>- {busy ? 'Working…' : 'Starting…'}+ <GithubMark className="size-3.5 shrink-0" />+ <span className="sr-only">GitHub: </span>+ <span className="truncate">+ {accounts.length ? accounts.join(', ') : 'GitHub'}+ </span></span>- <span className="text-muted-foreground">·</span>- <time- className="text-muted-foreground"- dateTime={session.updatedAt}- title={new Date(session.updatedAt).toLocaleString()}- >- {relativeTime(session.updatedAt, now)}- </time>- </div>- <div className="mt-4 flex flex-wrap items-end justify-between gap-4">- <h3 className="min-w-0 flex-1 text-xl font-semibold tracking-tight text-balance">- {session.title || 'Untitled session'}- </h3>- {session.slackUrl ? (- <Button variant="outline" asChild>- <a href={session.slackUrl} target="_blank" rel="noreferrer">- Open in Slack- <ExternalLink className="size-3.5" aria-hidden />- </a>+ <div className="flex items-center">+ <Button+ variant="ghost"+ size="sm"+ className="text-muted-foreground"+ asChild+ >+ <Link to="/managed-agents/connections">Manage</Link></Button>- ) : null}+ <SlackAction status={status} compact />+ </div></div>- </article>- )-}--function QuietNow() {- return (- <div className="bg-panel rounded-xl border border-dashed px-6 py-10 text-center">- <Sparkles className="text-primary mx-auto size-5" aria-hidden />- <p className="mt-3 font-medium">Quiet right now.</p>- <p className="text-muted-foreground mt-1 text-sm">- Mention @OpenComputer in Slack to hand it something.- </p>- <CopyRow- value={`@OpenComputer ${EXAMPLE_ASKS[0]}`}- className="mx-auto mt-5 max-w-2xl text-left"- />- </div>+ </header>)}@@ -848,17 +717,7 @@ function Setup({</SetupItem></ol>- {/* Projects are for building agents of your own: a side door, kept out- of the way of the setup above. */}- <p className="text-muted-foreground pt-6 text-center text-xs">- <Link- to="/new"- className="hover:text-foreground inline-flex items-center gap-1 transition-colors"- >- Set up a custom agent on OpenComputer infrastructure- <ArrowRight className="size-3" aria-hidden />- </Link>- </p>+ <CustomAgentLink /></div>)}@@ -1055,8 +914,15 @@ function sessionColumns(now: number): Column<ComputerSession>[] {key: 'title',header: 'Session',cell: (session) => (- <span className="block max-w-md truncate font-medium">- {session.title || 'Untitled session'}+ <span className="flex max-w-md items-center gap-2.5">+ {sessionIsLive(session) ? (+ <PulseDot tone={session.status === 'busy' ? 'alive' : 'busy'} />+ ) : (+ <span className="size-2 shrink-0" aria-hidden />+ )}+ <span className="truncate font-medium">+ {session.title || 'Untitled session'}+ </span></span>),},@@ -1089,7 +955,12 @@ function sessionColumns(now: number): Column<ComputerSession>[] {align: 'right',cell: (session) =>session.slackUrl ? (- <Button variant="ghost" size="sm" asChild>+ <Button+ variant="ghost"+ size="sm"+ className="text-muted-foreground"+ asChild+ ><a href={session.slackUrl} target="_blank" rel="noreferrer">Open in Slack<ExternalLink className="size-3.5" aria-hidden />@@ -1100,23 +971,17 @@ function sessionColumns(now: number): Column<ComputerSession>[] {]}+/** Every session in one list, the live ones first. */function SessionsPanel({- title,- description,- emptyTitle,- emptyDescription,- hasComputer,- sessions,+ live,+ recent,readAt,loading,failed,}: {- title: string- description: string- emptyTitle: string- emptyDescription: string- hasComputer: boolean- sessions: ComputerSession[]+ live: ComputerSession[]+ recent: ComputerSession[]+ /** When the sessions were read; relative times never predate it. */readAt: numberloading: booleanfailed: boolean@@ -1124,35 +989,39 @@ function SessionsPanel({const now = Math.max(useNow(30_000), readAt)const columns = useMemo(() => sessionColumns(now), [now])return (- <Panel>- <PanelHeader>- <div>- <PanelTitle>{title}</PanelTitle>- <PanelDescription className="mt-1">{description}</PanelDescription>- </div>- </PanelHeader>- <ResourceTable- columns={columns}- rows={sessions}- rowKey={(session) => session.key}- loading={loading}- skeletonRows={3}- empty={- <EmptyState- icon={MessagesSquare}- title={- failed- ? 'Sessions are temporarily unavailable'- : hasComputer- ? emptyTitle- : 'Sessions appear once your computer is set up'- }- description={- failed ? 'They reload by themselves.' : emptyDescription- }- />- }- />- </Panel>+ <section aria-labelledby="computer-sessions">+ <div className="mb-3 flex items-baseline justify-between gap-4">+ <h2 id="computer-sessions" className="text-base font-semibold">+ Sessions+ </h2>+ {live.length > 0 ? (+ <span className="text-muted-foreground text-sm">+ {live.length} working now+ </span>+ ) : null}+ </div>+ <Panel>+ <ResourceTable+ columns={columns}+ rows={[...live, ...recent]}+ rowKey={(session) => session.key}+ loading={loading}+ skeletonRows={3}+ empty={+ <EmptyState+ icon={MessagesSquare}+ title={+ failed+ ? 'Sessions are temporarily unavailable'+ : 'No sessions yet'+ }+ description={+ failed ? 'They reload by themselves.' : START_SESSION_COPY+ }+ />+ }+ />+ </Panel>+ </section>)}diff --git a/web/src/managed-agents/computer-state.test.ts b/web/src/managed-agents/computer-state.test.tsindex 4787aa3d..b2acaeb2 100644--- a/web/src/managed-agents/computer-state.test.ts+++ b/web/src/managed-agents/computer-state.test.ts@@ -12,7 +12,6 @@ import {LIVE_SESSION_POLL_MS,SESSION_POLL_MS,SLOW_POLL_MS,- compactStatusLine,computerIsOnboarded,computerPollInterval,computerPresentation,@@ -347,36 +346,3 @@ describe('relative time', () => {expect(relativeTime('not a date', now)).toBe('')})})--describe('compact status line', () => {- it('talks about the work when there is work', () => {- expect(compactStatusLine(computer, 'free', 0).headline).toBe(- 'Ready when you are.',- )- expect(compactStatusLine(computer, 'free', 1).headline).toContain(- 'One thing',- )- expect(compactStatusLine(computer, 'free', 3).headline).toContain(- '3 things',- )- })-- it('keeps resting, waking and failure visible, upgrade for free only', () => {- const parked = { ...computer, state: 'parked' as const }- expect(compactStatusLine(parked, 'free', 0)).toEqual({- headline: 'Resting — wakes when you mention it.',- detail: 'Upgrade and it never sleeps.',- })- expect(compactStatusLine(parked, 'paid', 0).detail).toBeUndefined()- expect(- compactStatusLine({ ...computer, state: 'waking' }, 'free', 0).headline,- ).toContain('Waking')- expect(- compactStatusLine(- { ...computer, state: 'failed', lastError: 'Setup timed out.' },- 'free',- 0,- ),- ).toEqual({ headline: 'Something went wrong.', detail: 'Setup timed out.' })- })-})diff --git a/web/src/managed-agents/computer-state.ts b/web/src/managed-agents/computer-state.tsindex 218ea00a..28d602a7 100644--- a/web/src/managed-agents/computer-state.ts+++ b/web/src/managed-agents/computer-state.ts@@ -292,47 +292,3 @@ export function relativeTime(iso: string, now: number = Date.now()): string {: 'numeric',})}--export type StatusLine = { headline: string; detail?: string }--/**- * The one line under the status dot once onboarded: short, in the hero's- * voice, and about the work when there is work.- */-export function compactStatusLine(- computer: Computer | null,- plan: ComputerStatus['plan'],- liveCount: number,-): StatusLine {- switch (computer?.state ?? 'provisioning') {- case 'provisioning':- return { headline: 'Coming to life. A minute or two.' }- case 'ready':- if (!computer?.connected) {- return { headline: 'Reconnecting. Usually within a minute.' }- }- if (liveCount === 0) return { headline: 'Ready when you are.' }- return {- headline:- liveCount === 1- ? 'On it. One thing in flight.'- : `On it. ${liveCount} things in flight.`,- }- case 'parked':- return {- headline: 'Resting — wakes when you mention it.',- detail: plan === 'paid' ? undefined : 'Upgrade and it never sleeps.',- }- case 'waking':- return { headline: 'Waking up. Picking up where it left off.' }- case 'failed':- return {- headline: 'Something went wrong.',- detail:- computer?.lastError ??- 'Your computer could not start. Try again, or tell us if it keeps happening.',- }- case 'deleting':- return { headline: 'Saying goodbye.' }- }-}