An open-source, faster Devin alternative
TypeScript
Connections: bring back Google and Linear accounts under "Other accounts"
Slack U06GFN8DJ7P07920965ec75
diff --git a/web/src/managed-agents/Connections.test.tsx b/web/src/managed-agents/Connections.test.tsxindex bd6666fe..276f22cb 100644--- a/web/src/managed-agents/Connections.test.tsx+++ b/web/src/managed-agents/Connections.test.tsx@@ -18,6 +18,10 @@ vi.mock('./computer-api', async (importOriginal) => ({const api = vi.hoisted(() => ({addManagedGitHubConnection: vi.fn(),claimManagedAgentChannelIdentity: vi.fn(),+ disconnectManagedAgentConnection: vi.fn(),+ displayManagedAgentName: (agent: { id: string }) => agent.id,+ getManagedAgentConnections: vi.fn(),+ getManagedAgents: vi.fn(),getManagedGitHubConnections: vi.fn(),linkManagedAgentConnection: vi.fn(),}))@@ -51,6 +55,20 @@ const installation = {updatedAt: '2026-10-11T10:00:00.000Z',}+const linearAccount = {+ id: 'conn_1',+ kind: 'tool',+ provider: 'linear',+ label: 'linear',+ agentId: 'email-triage',+ alias: 'default',+ displayName: 'Acme Linear',+ scopes: [],+ status: 'connected',+ createdAt: '2026-10-11T10:00:00.000Z',+ updatedAt: '2026-10-11T10:00:00.000Z',+}+let root: Root | undefinedlet container: HTMLDivElement@@ -93,6 +111,8 @@ beforeEach(() => {connections: [installation],app: { slug: 'opencomputerdev' },})+ api.getManagedAgents.mockResolvedValue([{ id: 'email-triage' }])+ api.getManagedAgentConnections.mockResolvedValue([linearAccount])})afterEach(() => {@@ -102,7 +122,7 @@ afterEach(() => {})describe('Connections', () => {- it('shows the organization Slack app and GitHub accounts, with nothing to add beyond them', async () => {+ it('shows the organization Slack app and GitHub accounts', async () => {await render()const text = container.textContent ?? ''expect(text).toContain('Acme')@@ -114,8 +134,6 @@ describe('Connections', () => {).toBe(true)expect(text).toContain('acme')expect(text).toContain('All repositories')- expect(text).not.toContain('Add connection')- expect(text).not.toContain('Personal accounts')const configure = container.querySelector<HTMLAnchorElement>('a[href*="/settings/installations/"]',)@@ -123,4 +141,23 @@ describe('Connections', () => {'https://github.com/organizations/acme/settings/installations/7',)})++ it('lists Google and Linear accounts below Slack and GitHub', async () => {+ await render()+ const text = container.textContent ?? ''+ expect(text.indexOf('Other accounts')).toBeGreaterThan(+ text.indexOf('GitHub'),+ )+ const section = container.querySelector(+ 'section[aria-label="Other accounts"]',+ )+ expect(section?.textContent).toContain(+ 'Linear · Acme Linear · email-triage',+ )+ const buttons = [...(section?.querySelectorAll('button') ?? [])]+ expect(buttons.some((button) => button.textContent === 'Remove')).toBe(true)+ expect(+ buttons.some((button) => button.textContent?.includes('Add account')),+ ).toBe(true)+ })})diff --git a/web/src/managed-agents/Connections.tsx b/web/src/managed-agents/Connections.tsxindex 9b535a9b..dda88128 100644--- a/web/src/managed-agents/Connections.tsx+++ b/web/src/managed-agents/Connections.tsx@@ -2,30 +2,52 @@ import { useContext, useEffect, useRef, useState, type ReactNode } from 'react'import { useQuery } from '@tanstack/react-query'import { ExternalLink, Loader2, Plus, RefreshCw } from 'lucide-react'import { useSearchParams } from 'react-router-dom'+import { ConfirmDialog } from '@/components/confirm-dialog'import { GithubMark } from '@/components/github-mark'import { PageHeader } from '@/components/page-header'import { Panel } from '@/components/panel'+import { ServiceLogo } from '@/components/service-logo'import { SlackMark } from '@/components/slack-mark'import { StatusBadge } from '@/components/status-badge'import { Button } from '@/components/ui/button'+import {+ Dialog,+ DialogContent,+ DialogDescription,+ DialogFooter,+ DialogHeader,+ DialogTitle,+} from '@/components/ui/dialog'+import { Input } from '@/components/ui/input'+import { Label } from '@/components/ui/label'import { Skeleton } from '@/components/ui/skeleton'import { AuthContext } from '@/hooks/useAuth'import { notifyError } from '@/lib/errors'import {addManagedGitHubConnection,claimManagedAgentChannelIdentity,+ disconnectManagedAgentConnection,+ displayManagedAgentName,+ getManagedAgentConnections,+ getManagedAgents,getManagedGitHubConnections,linkManagedAgentConnection,+ type ManagedAgentConnection,} from './api'-import { launchAuthorizationWindow } from './authorization-window'+import {+ launchAuthorizationWindow,+ navigateAuthorizationWindow,+ openAuthorizationWindow,+} from './authorization-window'import { computerQueryKey, getComputer } from './computer-api'import { SlackInstallButton, UnlinkSlackDialog } from './computer-slack'import { slackLinks } from './computer-state'// The organization's connections: the Slack app the computer answers in and-// the GitHub accounts it works in. Serverless agents still send people here-// to link a channel identity or connect an account (`?channel_link=…`,-// `?connect=1&service=…`); those links are handled, nothing else is listed.+// the GitHub accounts it works in, then, less prominently, the Google and+// Linear accounts agents call through callService(). Serverless agents also+// send people here to link a channel identity or connect an account+// (`?channel_link=…`, `?connect=1&service=…`).function displayResourceName(value: string) {return value@@ -33,6 +55,47 @@ function displayResourceName(value: string) {.replace(/\b\w/g, (character) => character.toUpperCase())}+// A Google grant's scopes say which service it is; the provider does not.+// Sheets is checked before Drive because a Sheets grant carries drive scopes+// too, and Drive first would claim it.+const GOOGLE_SERVICES = [+ { id: 'calendar', name: 'Google Calendar', scope: '/auth/calendar' },+ { id: 'sheets', name: 'Google Sheets', scope: '/auth/spreadsheets' },+ { id: 'drive', name: 'Google Drive', scope: '/auth/drive' },+ { id: 'gmail', name: 'Gmail', scope: '/auth/gmail.' },+] as const++const OTHER_SERVICES = [+ { id: 'gmail', name: 'Gmail' },+ { id: 'calendar', name: 'Google Calendar' },+ { id: 'drive', name: 'Google Drive' },+ { id: 'sheets', name: 'Google Sheets' },+ { id: 'linear', name: 'Linear' },+] as const++function googleServiceFor(scopes: string[]) {+ return GOOGLE_SERVICES.find((service) =>+ scopes.some((scope) => scope.toLowerCase().includes(service.scope)),+ )+}++function connectionService(connection: ManagedAgentConnection) {+ return (+ googleServiceFor(connection.scopes)?.name ??+ displayResourceName(connection.provider)+ )+}++function connectionServiceId(+ connection: ManagedAgentConnection,+): 'gmail' | 'calendar' | 'drive' | 'sheets' | 'github' | 'linear' | undefined {+ if (connection.provider === 'github') return 'github'+ if (connection.provider === 'linear') return 'linear'+ if (connection.provider !== 'google') return undefined+ // Returning undefined here strands the connection: it cannot be removed.+ return googleServiceFor(connection.scopes)?.id+}+/** GitHub's settings page for one installation, where repositories are chosen. */function githubInstallationSettingsUrl(installation: {githubInstallationId: number@@ -140,6 +203,7 @@ export default function ManagedAgentConnections() {{computerEnabled ? <SlackConnection /> : null}<GitHubConnection />+ <OtherConnections /></div></div>)@@ -425,3 +489,328 @@ function GitHubConnection() {</ServiceCard>)}++/** Google and Linear accounts agents use; secondary to Slack and GitHub. */+function OtherConnections() {+ const connections = useQuery({+ queryKey: ['managed-agent-connections'],+ queryFn: getManagedAgentConnections,+ // Authorization finishes in another window; pick it up on return.+ refetchOnWindowFocus: 'always',+ })+ const agents = useQuery({+ queryKey: ['managed-agents'],+ queryFn: getManagedAgents,+ })+ const agentNames = new Map(+ (agents.data ?? []).map((agent) => [+ agent.id,+ displayManagedAgentName(agent),+ ]),+ )+ const [addOpen, setAddOpen] = useState(false)+ const [toRemove, setToRemove] = useState<ManagedAgentConnection>()+ const [removing, setRemoving] = useState(false)+ const [removeError, setRemoveError] = useState<string>()+ const accounts = connections.data ?? []++ return (+ <section aria-label="Other accounts" className="pt-4">+ <div className="mb-2 flex items-center justify-between gap-4">+ <div className="min-w-0">+ <h2 className="text-muted-foreground text-sm font-medium">+ Other accounts+ </h2>+ <p className="text-muted-foreground text-xs">+ Google and Linear accounts your agents use.+ </p>+ </div>+ <Button+ variant="ghost"+ size="sm"+ className="text-muted-foreground"+ onClick={() => setAddOpen(true)}+ >+ <Plus className="size-3.5" aria-hidden />+ Add account+ </Button>+ </div>+ <Panel>+ {connections.isLoading ? (+ <OtherRow title={<Skeleton className="h-4 w-28" />} />+ ) : connections.isError ? (+ <div className="flex items-center justify-between gap-4 px-5 py-3">+ <p className="text-muted-foreground text-sm">+ Accounts are temporarily unavailable.+ </p>+ <Button+ variant="outline"+ size="sm"+ onClick={() => void connections.refetch()}+ >+ Try again+ </Button>+ </div>+ ) : accounts.length ? (+ <div className="divide-y">+ {accounts.map((connection) => {+ const service = connectionServiceId(connection)+ const agentName = agentNames.get(connection.agentId)+ return (+ <OtherRow+ key={connection.id}+ icon={+ service === 'github' ? (+ <GithubMark className="size-4" />+ ) : (+ <ServiceLogo service={service} className="size-4" />+ )+ }+ title={displayResourceName(+ connection.label || connection.provider,+ )}+ detail={[+ connectionService(connection),+ connection.displayName,+ agentName,+ ]+ .filter(Boolean)+ .join(' · ')}+ trailing={+ <>+ {connection.status === 'connected' ? null : (+ <StatusBadge status={connection.status} />+ )}+ {service ? (+ <Button+ variant="ghost"+ size="sm"+ className="text-muted-foreground hover:text-destructive"+ onClick={() => {+ setRemoveError(undefined)+ setToRemove(connection)+ }}+ >+ Remove+ </Button>+ ) : null}+ </>+ }+ />+ )+ })}+ </div>+ ) : (+ <p className="text-muted-foreground px-5 py-3 text-sm">+ No accounts yet.+ </p>+ )}+ </Panel>++ <AddAccountDialog+ open={addOpen}+ onOpenChange={setAddOpen}+ onConnected={() => void connections.refetch()}+ />++ <ConfirmDialog+ open={Boolean(toRemove)}+ onOpenChange={(open) => {+ if (!open) setToRemove(undefined)+ }}+ title="Remove account?"+ description={+ toRemove+ ? removeError+ ? `The account could not be removed: ${removeError}`+ : `Agents will no longer be able to use the “${toRemove.label}” account. You can reconnect it later.`+ : undefined+ }+ confirmLabel="Remove account"+ destructive+ pending={removing}+ onConfirm={() => {+ if (!toRemove) return+ const service = connectionServiceId(toRemove)+ if (!service) return+ setRemoving(true)+ setRemoveError(undefined)+ void disconnectManagedAgentConnection(+ service === 'github' || service === 'linear' ? service : 'google',+ service,+ toRemove.id,+ )+ .then(() => connections.refetch())+ .then(() => setToRemove(undefined))+ .catch((error: unknown) =>+ setRemoveError(+ error instanceof Error+ ? error.message+ : 'The account could not be removed.',+ ),+ )+ .finally(() => setRemoving(false))+ }}+ />+ </section>+ )+}++function OtherRow({+ icon,+ title,+ detail,+ trailing,+}: {+ icon?: ReactNode+ title: ReactNode+ detail?: ReactNode+ trailing?: ReactNode+}) {+ return (+ <div className="flex min-h-12 items-center gap-3 py-2.5 pr-3 pl-5">+ {icon ? (+ <div className="text-muted-foreground flex size-5 shrink-0 items-center justify-center">+ {icon}+ </div>+ ) : null}+ <div className="min-w-0 flex-1">+ <p className="truncate text-sm font-medium">{title}</p>+ {detail ? (+ <p className="text-muted-foreground truncate text-xs">{detail}</p>+ ) : null}+ </div>+ {trailing ? (+ <div className="flex shrink-0 items-center gap-1">{trailing}</div>+ ) : null}+ </div>+ )+}++function AddAccountDialog({+ open,+ onOpenChange,+ onConnected,+}: {+ open: boolean+ onOpenChange: (open: boolean) => void+ onConnected: () => void+}) {+ const [service, setService] = useState<string>('gmail')+ const [alias, setAlias] = useState('gmail')+ const [connecting, setConnecting] = useState(false)+ const [error, setError] = useState<string>()++ return (+ <Dialog+ open={open}+ onOpenChange={(next) => {+ if (connecting) return+ onOpenChange(next)+ if (!next) setError(undefined)+ }}+ >+ <DialogContent>+ <DialogHeader>+ <DialogTitle>Add account</DialogTitle>+ <DialogDescription>+ Choose a service and a memorable alias for this account.+ </DialogDescription>+ </DialogHeader>+ <form+ className="grid gap-4"+ onSubmit={(event) => {+ event.preventDefault()+ const label = alias.trim()+ if (!label || connecting) return+ setError(undefined)+ let authorizationWindow: Window+ try {+ authorizationWindow = openAuthorizationWindow()+ } catch (cause) {+ setError(+ cause instanceof Error+ ? cause.message+ : 'The account could not be connected.',+ )+ return+ }+ setConnecting(true)+ void linkManagedAgentConnection(service, label)+ .then((result) => {+ if (result.authorizationUrl) {+ navigateAuthorizationWindow(+ authorizationWindow,+ result.authorizationUrl,+ )+ } else {+ authorizationWindow.close()+ onConnected()+ }+ onOpenChange(false)+ })+ .catch((cause: unknown) => {+ authorizationWindow.close()+ setError(+ cause instanceof Error+ ? cause.message+ : 'The account could not be connected.',+ )+ })+ .finally(() => setConnecting(false))+ }}+ >+ <div className="grid gap-2">+ <Label htmlFor="connection-service">Service</Label>+ <select+ id="connection-service"+ value={service}+ onChange={(event) => {+ setService(event.target.value)+ setAlias(event.target.value)+ }}+ className="border-input bg-background ring-offset-background focus-visible:ring-ring h-9 w-full rounded-md border px-3 text-sm focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none"+ >+ {OTHER_SERVICES.map((option) => (+ <option key={option.id} value={option.id}>+ {option.name}+ </option>+ ))}+ </select>+ </div>+ <div className="grid gap-2">+ <Label htmlFor="connection-alias">Account alias</Label>+ <Input+ id="connection-alias"+ value={alias}+ onChange={(event) => setAlias(event.target.value)}+ pattern="[A-Za-z0-9._-]+"+ placeholder="work-gmail"+ required+ />+ <p className="text-muted-foreground text-xs">+ Agents use this alias to select the account in callService().+ </p>+ </div>+ {error ? <p className="text-destructive text-sm">{error}</p> : null}+ <DialogFooter>+ <Button+ type="button"+ variant="outline"+ disabled={connecting}+ onClick={() => onOpenChange(false)}+ >+ Cancel+ </Button>+ <Button type="submit" disabled={!alias.trim() || connecting}>+ {connecting ? (+ <Loader2 className="size-4 animate-spin" aria-hidden />+ ) : null}+ Continue+ </Button>+ </DialogFooter>+ </form>+ </DialogContent>+ </Dialog>+ )+}