Skip to content

An open-source, faster Devin alternative

TypeScript

Models: a row for Claude Code and for Codex, connected or not, with their marks

Igor Zalutski via Computerc8c5d7c49513
diff --git a/web/src/api/mock.ts b/web/src/api/mock.ts
index 1b98e496..c23545d5 100644
--- a/web/src/api/mock.ts
+++ b/web/src/api/mock.ts
@@ -1298,7 +1298,8 @@ let previewBootSince: number | null = null
// containing "rejected" is refused, "taken" is someone else's, "unchecked"
// is saved without a check; any other well-formed one is verified.
// Unlinked with Slack installed, the card mints a link code (work 083).
-// `?agent=codex` is a connected ChatGPT plan. The one-command connect (work
+// `?agent=codex` is a connected ChatGPT plan; `?agent=both` has Claude and
+// Codex connected, Claude running threads. The one-command connect (work
// 082) mints a placeholder code; with `?connect=auto` the preview plays the
// person running it: about six seconds later the card's subscription (Codex
// when Codex is chosen, else Claude) is connected. `?harnesses=claude,codex`
@@ -1308,6 +1309,7 @@ let previewBootSince: number | null = null
// refused the way blue refuses a harness it cannot run (409, in its own
// words).
type PreviewAgent = {
+ subscriptions?: Record<'claude' | 'codex', PreviewAgent['subscription']>
harnesses?: string[]
choice: 'claude' | 'codex' | 'credits' | null
linked: boolean
@@ -1360,41 +1362,58 @@ function previewAgent(): PreviewAgent | null {
? { ...base, ...link, choice: 'credits', subscription: null }
: param === 'unlinked'
? { ...base, choice: 'credits', linked: false, subscription: null }
- : param === 'codex'
+ : param === 'both'
? {
...base,
...link,
- choice: 'codex',
- subscription: {
- provider: 'codex',
- health: 'ok',
- setAt: new Date(BASE).toISOString(),
- plan: 'plus',
+ harnesses: ['claude', 'codex'],
+ choice: 'claude',
+ subscription: subscription('ok'),
+ subscriptions: {
+ claude: subscription('ok'),
+ codex: {
+ provider: 'codex',
+ health: 'ok',
+ setAt: new Date(BASE).toISOString(),
+ plan: 'plus',
+ },
},
}
- : param === 'unchecked' ||
- param === 'paused' ||
- param === 'limited' ||
- param === 'invalid'
+ : param === 'codex'
? {
...base,
...link,
- choice: 'claude',
- subscription: subscription(param),
+ choice: 'codex',
+ subscription: {
+ provider: 'codex',
+ health: 'ok',
+ setAt: new Date(BASE).toISOString(),
+ plan: 'plus',
+ },
}
- : setup
+ : param === 'unchecked' ||
+ param === 'paused' ||
+ param === 'limited' ||
+ param === 'invalid'
? {
- ...base,
- choice: connect === 'unavailable' ? 'codex' : null,
- linked: false,
- subscription: null,
- }
- : {
...base,
...link,
choice: 'claude',
- subscription: subscription('ok'),
+ subscription: subscription(param),
}
+ : setup
+ ? {
+ ...base,
+ choice: connect === 'unavailable' ? 'codex' : null,
+ linked: false,
+ subscription: null,
+ }
+ : {
+ ...base,
+ ...link,
+ choice: 'claude',
+ subscription: subscription('ok'),
+ }
return previewAgentState
}
diff --git a/web/src/components/service-logo.tsx b/web/src/components/service-logo.tsx
index 43273889..c1c4b469 100644
--- a/web/src/components/service-logo.tsx
+++ b/web/src/components/service-logo.tsx
@@ -1,7 +1,14 @@
import { Plug } from 'lucide-react'
type ServiceLogoProps = {
- service?: 'gmail' | 'calendar' | 'drive' | 'sheets' | 'linear'
+ service?:
+ | 'gmail'
+ | 'calendar'
+ | 'drive'
+ | 'sheets'
+ | 'linear'
+ | 'claude'
+ | 'openai'
className?: string
}
@@ -31,6 +38,17 @@ const logos = {
color: '#5E6AD2',
path: 'M2.886 4.18A11.982 11.982 0 0 1 11.99 0C18.624 0 24 5.376 24 12.009c0 3.64-1.62 6.903-4.18 9.105L2.887 4.18ZM1.817 5.626l16.556 16.556c-.524.33-1.075.62-1.65.866L.951 7.277c.247-.575.537-1.126.866-1.65ZM.322 9.163l14.515 14.515c-.71.172-1.443.282-2.195.322L0 11.358a12 12 0 0 1 .322-2.195Zm-.17 4.862 9.823 9.824a12.02 12.02 0 0 1-9.824-9.824Z',
},
+ claude: {
+ label: 'Claude',
+ color: '#D97757',
+ path: 'm4.7144 15.9555 4.7174-2.6471.079-.2307-.079-.1275h-.2307l-.7893-.0486-2.6956-.0729-2.3375-.0971-2.2646-.1214-.5707-.1215-.5343-.7042.0546-.3522.4797-.3218.686.0608 1.5179.1032 2.2767.1578 1.6514.0972 2.4468.255h.3886l.0546-.1579-.1336-.0971-.1032-.0972L6.973 9.8356l-2.55-1.6879-1.3356-.9714-.7225-.4918-.3643-.4614-.1578-1.0078.6557-.7225.8803.0607.2246.0607.8925.686 1.9064 1.4754 2.4893 1.8336.3643.3035.1457-.1032.0182-.0728-.164-.2733-1.3539-2.4467-1.445-2.4893-.6435-1.032-.17-.6194c-.0607-.255-.1032-.4674-.1032-.7285L6.287.1335 6.6997 0l.9957.1336.419.3642.6192 1.4147 1.0018 2.2282 1.5543 3.0296.4553.8985.2429.8318.091.255h.1579v-.1457l.1275-1.706.2368-2.0947.2307-2.6957.0789-.7589.3764-.9107.7468-.4918.5828.2793.4797.686-.0668.4433-.2853 1.8517-.5586 2.9021-.3643 1.9429h.2125l.2429-.2429.9835-1.3053 1.6514-2.0643.7286-.8196.85-.9046.5464-.4311h1.0321l.759 1.1293-.34 1.1657-1.0625 1.3478-.8804 1.1414-1.2628 1.7-.7893 1.36.0729.1093.1882-.0183 2.8535-.607 1.5421-.2794 1.8396-.3157.8318.3886.091.3946-.3278.8075-1.967.4857-2.3072.4614-3.4364.8136-.0425.0304.0486.0607 1.5482.1457.6618.0364h1.621l3.0175.2247.7892.522.4736.6376-.079.4857-1.2142.6193-1.6393-.3886-3.825-.9107-1.3113-.3279h-.1822v.1093l1.0929 1.0686 2.0035 1.8092 2.5075 2.3314.1275.5768-.3218.4554-.34-.0486-2.2039-1.6575-.85-.7468-1.9246-1.621h-.1275v.17l.4432.6496 2.3436 3.5214.1214 1.0807-.17.3521-.6071.2125-.6679-.1214-1.3721-1.9246L14.38 17.959l-1.1414-1.9428-.1397.079-.674 7.2552-.3156.3703-.7286.2793-.6071-.4614-.3218-.7468.3218-1.4753.3886-1.9246.3157-1.53.2853-1.9004.17-.6314-.0121-.0425-.1397.0182-1.4328 1.9672-2.1796 2.9446-1.7243 1.8456-.4128.164-.7164-.3704.0667-.6618.4008-.5889 2.386-3.0357 1.4389-1.882.929-1.0868-.0062-.1579h-.0546l-6.3385 4.1164-1.1293.1457-.4857-.4554.0608-.7467.2307-.2429 1.9064-1.3114Z',
+ },
+ openai: {
+ // The mark is black or white, never a brand color: the text's.
+ label: 'OpenAI',
+ color: 'currentColor',
+ path: 'M22.2819 9.8211a5.9847 5.9847 0 0 0-.5157-4.9108 6.0462 6.0462 0 0 0-6.5098-2.9A6.0651 6.0651 0 0 0 4.9807 4.1818a5.9847 5.9847 0 0 0-3.9977 2.9 6.0462 6.0462 0 0 0 .7427 7.0966 5.98 5.98 0 0 0 .511 4.9107 6.051 6.051 0 0 0 6.5146 2.9001A5.9847 5.9847 0 0 0 13.2599 24a6.0557 6.0557 0 0 0 5.7718-4.2058 5.9894 5.9894 0 0 0 3.9977-2.9001 6.0557 6.0557 0 0 0-.7475-7.0729zm-9.022 12.6081a4.4755 4.4755 0 0 1-2.8764-1.0408l.1419-.0804 4.7783-2.7582a.7948.7948 0 0 0 .3927-.6813v-6.7369l2.02 1.1686a.071.071 0 0 1 .038.052v5.5826a4.504 4.504 0 0 1-4.4945 4.4944zm-9.6607-4.1254a4.4708 4.4708 0 0 1-.5346-3.0137l.142.0852 4.783 2.7582a.7712.7712 0 0 0 .7806 0l5.8428-3.3685v2.3324a.0804.0804 0 0 1-.0332.0615L9.74 19.9502a4.4992 4.4992 0 0 1-6.1408-1.6464zM2.3408 7.8956a4.485 4.485 0 0 1 2.3655-1.9728V11.6a.7664.7664 0 0 0 .3879.6765l5.8144 3.3543-2.0201 1.1685a.0757.0757 0 0 1-.071 0l-4.8303-2.7865A4.504 4.504 0 0 1 2.3408 7.872zm16.5963 3.8558L13.1038 8.364 15.1192 7.2a.0757.0757 0 0 1 .071 0l4.8303 2.7913a4.4944 4.4944 0 0 1-.6765 8.1042v-5.6772a.79.79 0 0 0-.407-.667zm2.0107-3.0231l-.142-.0852-4.7735-2.7818a.7759.7759 0 0 0-.7854 0L9.409 9.2297V6.8974a.0662.0662 0 0 1 .0284-.0615l4.8303-2.7866a4.4992 4.4992 0 0 1 6.6802 4.66zM8.3065 12.863l-2.02-1.1638a.0804.0804 0 0 1-.038-.0567V6.0742a4.4992 4.4992 0 0 1 7.3757-3.4537l-.142.0805L8.704 5.459a.7948.7948 0 0 0-.3927.6813zm1.0976-2.3654l2.602-1.4998 2.6069 1.4998v2.9994l-2.5974 1.4997-2.6067-1.4997Z',
+ },
} as const
export function ServiceLogo({ service, className }: ServiceLogoProps) {
diff --git a/web/src/managed-agents/AgentStep.test.tsx b/web/src/managed-agents/AgentStep.test.tsx
index da1c16a8..85e28128 100644
--- a/web/src/managed-agents/AgentStep.test.tsx
+++ b/web/src/managed-agents/AgentStep.test.tsx
@@ -191,6 +191,14 @@ describe('choosing the coding agent', () => {
await settle(() => text().includes(until), until)
}
+ // A button in one subscription's row on the Models card.
+ const rowButton = (row: string, label: string) =>
+ [
+ ...document.body.querySelectorAll(`section[aria-label="${row}"] button`),
+ ].find((b) => b.textContent?.trim() === label) as
+ | HTMLButtonElement
+ | undefined
+
function openPaste() {
act(() => button('Or paste a token')!.click())
}
@@ -793,9 +801,9 @@ describe('choosing the coding agent', () => {
'Models',
CONNECTIONS,
)
- expect(button('Connect Claude Code')).toBeDefined()
- expect(button('Use Codex instead')).toBeUndefined()
- expect(button('Connect Codex')).toBeUndefined()
+ expect(rowButton('Claude Code', 'Connect')).toBeDefined()
+ expect(rowButton('Codex', 'Connect')).toBeUndefined()
+ expect(text()).toContain("Coming soon. We'll let you know.")
})
})
@@ -837,9 +845,8 @@ describe('choosing the coding agent', () => {
'Models',
CONNECTIONS,
)
- expect(button('Connect Claude Code')).toBeDefined()
- act(() => button('Use Codex instead')!.click())
- act(() => button('Connect Codex')!.click())
+ expect(rowButton('Claude Code', 'Connect')).toBeDefined()
+ act(() => rowButton('Codex', 'Connect')!.click())
await settle(() => command()?.includes(' codex ') === true, 'codex command')
})
@@ -930,6 +937,42 @@ describe('choosing the coding agent', () => {
await settle(() => text().includes('Connected'), 'resumed')
})
+ it('shows a row for each subscription, and switches which runs threads', async () => {
+ const codex = {
+ provider: 'codex' as const,
+ health: 'ok' as const,
+ setAt: '2026-10-22T10:00:00Z',
+ plan: 'plus',
+ }
+ const both = {
+ ...withCodex,
+ choice: 'claude' as const,
+ linked: true,
+ subscription: subscription('ok'),
+ subscriptions: { claude: subscription('ok'), codex },
+ }
+ await show({ ...onboarded, agent: both }, 'Models', CONNECTIONS)
+ const row = (name: string) =>
+ document.querySelector(`section[aria-label="${name}"]`)!.textContent
+ expect(row('Claude Code')).toContain('Runs your threads')
+ expect(row('Codex')).not.toContain('Runs your threads')
+ expect(rowButton('Claude Code', 'Use for threads')).toBeUndefined()
+ computerApi.setAgentChoice.mockResolvedValue({
+ ...both,
+ choice: 'codex',
+ subscription: codex,
+ })
+ act(() => rowButton('Codex', 'Use for threads')!.click())
+ await settle(
+ () => row('Codex')?.includes('Runs your threads') === true,
+ 'codex runs',
+ )
+ expect(computerApi.setAgentChoice).toHaveBeenCalledWith('codex')
+ expect(notify.notifySuccess).toHaveBeenCalledWith(
+ 'Codex runs your threads now.',
+ )
+ })
+
it('says an unchecked token is saved on the card', async () => {
await show(
{
@@ -969,7 +1012,10 @@ describe('choosing the coding agent', () => {
},
})
refocus()
- await settle(() => text().includes('Connect Claude Code'), 'connect card')
+ await settle(
+ () => rowButton('Claude Code', 'Connect') !== undefined,
+ 'connect card',
+ )
expect(notify.notifySuccess).toHaveBeenCalledWith(
'Linked to your Slack account.',
)
diff --git a/web/src/managed-agents/AgentStep.tsx b/web/src/managed-agents/AgentStep.tsx
index f796555e..792ef6db 100644
--- a/web/src/managed-agents/AgentStep.tsx
+++ b/web/src/managed-agents/AgentStep.tsx
@@ -18,6 +18,7 @@ import { Link } from 'react-router-dom'
import { ApiError } from '@/api/errors'
import { ConfirmDialog } from '@/components/confirm-dialog'
import { CopyCommand, CopyRow } from '@/components/copy-row'
+import { ServiceLogo } from '@/components/service-logo'
import { Button } from '@/components/ui/button'
import {
Dialog,
@@ -54,6 +55,7 @@ import {
subscriptionProviderSchema,
type AgentChoice,
type ComputerAgent,
+ type AgentSubscription,
type ComputerConnectCode,
type ConnectCodePurpose,
type ComputerStatus,
@@ -997,10 +999,31 @@ function healthLine(
})}.`
}
+/** Each subscription's row: its mark, and what it takes. */
+const PROVIDER_ROW: Record<
+ SubscriptionProvider,
+ { logo: 'claude' | 'openai'; plans: string }
+> = {
+ claude: { logo: 'claude', plans: 'Claude Pro or Max' },
+ codex: { logo: 'openai', plans: 'ChatGPT Plus or Pro' },
+}
+
+/** Every provider's subscription, from an older backend's one if need be. */
+function subscriptionsOf(
+ agent: ComputerAgent,
+): Record<SubscriptionProvider, AgentSubscription | null> {
+ if (agent.subscriptions) return agent.subscriptions
+ const one = agent.subscription
+ return {
+ claude: one?.provider === 'claude' ? one : null,
+ codex: one?.provider === 'codex' ? one : null,
+ }
+}
+
/**
- * What runs the person's threads, and its housekeeping: health, Resume,
- * Replace, Disconnect; or how to connect one. The Your agent card after
- * setup.
+ * The person's subscriptions, one row each whether connected or not (work
+ * 083): health, Connect, Replace, Resume, Disconnect, and which one runs
+ * their threads. The Models card on Connections.
*/
export function AgentManage({
agent,
@@ -1008,19 +1031,54 @@ export function AgentManage({
}: {
agent: ComputerAgent
slackInstalled: boolean
+}) {
+ const needsLink = slackInstalled && !agent.linked
+ const linked = linkedSlackUserLine(agent, slackInstalled)
+ const subscriptions = subscriptionsOf(agent)
+ return (
+ <div className="text-muted-foreground space-y-3 text-sm">
+ <div className="space-y-0.5">
+ <p className="text-foreground font-medium">{agentSummary(agent)}</p>
+ {needsLink ? (
+ // After Slack, subscriptions belong to Slack users: a person not
+ // linked to one links first, on the Slack card above.
+ <p>Link your Slack account above to use your own subscription.</p>
+ ) : linked ? (
+ <p>{linked}</p>
+ ) : null}
+ </div>
+ <div className="divide-y rounded-lg border">
+ {subscriptionProviderSchema.options.map((provider) => (
+ <ProviderRow
+ key={provider}
+ agent={agent}
+ provider={provider}
+ subscription={subscriptions[provider]}
+ locked={needsLink}
+ />
+ ))}
+ </div>
+ </div>
+ )
+}
+
+function ProviderRow({
+ agent,
+ provider,
+ subscription,
+ locked,
+}: {
+ agent: ComputerAgent
+ provider: SubscriptionProvider
+ subscription: AgentSubscription | null
+ locked: boolean
}) {
const { setAgent, reread } = useAgentCache()
- const [replacing, setReplacing] = useState(false)
+ const [connecting, setConnecting] = useState(false)
const [confirmDisconnect, setConfirmDisconnect] = useState(false)
- // Which subscription to connect when there is none: only the harnesses
- // this computer can run (the rollout gate), the chosen one first.
- const [picked, setPicked] = useState<SubscriptionProvider>(
- agent.choice === 'codex' ? 'codex' : 'claude',
- )
- const available = subscriptionProviderSchema.options.filter((provider) =>
- isHarnessAvailable(agent, provider),
- )
- const connecting = available.includes(picked) ? picked : available[0]
+ const available = isHarnessAvailable(agent, provider)
+ const name = PROVIDER_NAME[provider]
+ const runs = agent.subscription?.provider === provider
const resume = useMutation({
mutationFn: resumeClaudeSubscription,
onSuccess: async (next) => {
@@ -1032,129 +1090,140 @@ export function AgentManage({
notifyError("Couldn't resume.", error)
},
})
+ const use = useMutation({
+ mutationFn: () => setAgentChoice(provider),
+ onSuccess: async (next) => {
+ await setAgent(next)
+ trackAgentChosen(provider)
+ notifySuccess(`${name} runs your threads now.`)
+ },
+ onError: (error) => notifyError("Couldn't switch.", error),
+ })
const disconnect = useMutation({
mutationFn: disconnectSubscription,
- onSuccess: (_, provider) => {
+ onSuccess: () => {
setConfirmDisconnect(false)
- notifySuccess(`${PROVIDER_NAME[provider]} is disconnected.`)
+ notifySuccess(`${name} is disconnected.`)
reread()
},
onError: (error) => notifyError("Couldn't disconnect.", error),
})
- const { subscription } = agent
-
- const linked = linkedSlackUserLine(agent, slackInstalled)
- const linkedLine = linked ? <p>{linked}</p> : null
-
- if (!subscription) {
- // After Slack, subscriptions belong to Slack users: a person not linked
- // to one links first, on the Slack card above (work 083).
- if (slackInstalled && !agent.linked) {
- return (
- <div className="text-muted-foreground space-y-1 text-sm">
- <p className="text-foreground font-medium">{agentSummary(agent)}</p>
- <p>Link your Slack account above to use your own subscription.</p>
- </div>
- )
- }
- const others = available.filter((provider) => provider !== connecting)
- return (
- <div className="text-muted-foreground space-y-4 text-sm">
- <p className="text-foreground font-medium">{agentSummary(agent)}</p>
- {linkedLine}
- {connecting ? (
- <SubscriptionConnect
- key={connecting}
- provider={connecting}
- mintOnShow={false}
- />
- ) : null}
- {others.map((other) => (
- <Button
- key={other}
- variant="link"
- size="sm"
- className="text-muted-foreground h-auto px-0"
- onClick={() => setPicked(other)}
- >
- Use {PROVIDER_NAME[other]} instead
- </Button>
- ))}
- </div>
- )
- }
-
- const name = PROVIDER_NAME[subscription.provider]
// Resume is Claude's: a ChatGPT login that stopped working signs in again.
const canResume =
- subscription.provider === 'claude' &&
- (subscription.health === 'paused' || subscription.health === 'invalid')
+ provider === 'claude' &&
+ (subscription?.health === 'paused' || subscription?.health === 'invalid')
+ const status = subscription
+ ? healthLine(subscription)
+ : available
+ ? 'Not connected'
+ : "Coming soon. We'll let you know."
+
return (
- <div className="text-muted-foreground space-y-4 text-sm">
- <div className="space-y-1">
- <p className="text-foreground font-medium">{agentSummary(agent)}</p>
- <p
- className={cn(
- subscription.health === 'invalid' && 'text-destructive',
- )}
- >
- {healthLine(subscription)}
- </p>
- {linkedLine}
+ <section aria-label={name} className="space-y-3 px-4 py-3">
+ <div className="flex flex-wrap items-center gap-3">
+ <div className="bg-muted flex size-8 shrink-0 items-center justify-center rounded-md">
+ <ServiceLogo
+ service={PROVIDER_ROW[provider].logo}
+ className="text-foreground size-4"
+ />
+ </div>
+ <div className="min-w-0 flex-1">
+ <p className="text-foreground font-medium">
+ {name}
+ {runs ? (
+ <span className="bg-muted text-muted-foreground ml-2 rounded px-1.5 py-0.5 text-xs font-normal">
+ Runs your threads
+ </span>
+ ) : null}
+ </p>
+ <p
+ className={cn(
+ 'text-xs',
+ subscription?.health === 'invalid' && 'text-destructive',
+ )}
+ >
+ {subscription?.plan
+ ? `ChatGPT ${subscription.plan.charAt(0).toUpperCase()}${subscription.plan.slice(1)} · ${status}`
+ : subscription
+ ? status
+ : `${PROVIDER_ROW[provider].plans} · ${status}`}
+ </p>
+ </div>
+ {locked || connecting ? null : (
+ <div className="flex flex-wrap items-center gap-1">
+ {canResume ? (
+ <Button
+ size="sm"
+ onClick={() => resume.mutate()}
+ disabled={resume.isPending}
+ >
+ {resume.isPending ? (
+ <Loader2 className="size-4 animate-spin" aria-hidden />
+ ) : null}
+ Resume
+ </Button>
+ ) : null}
+ {subscription && !runs && available ? (
+ <Button
+ size="sm"
+ variant="outline"
+ onClick={() => use.mutate()}
+ disabled={use.isPending}
+ >
+ Use for threads
+ </Button>
+ ) : null}
+ {available ? (
+ // A login whose harness the gate switched off can still be
+ // disconnected, not signed in again.
+ <Button
+ size="sm"
+ variant={subscription ? 'ghost' : 'outline'}
+ onClick={() => setConnecting(true)}
+ >
+ {!subscription
+ ? 'Connect'
+ : provider === 'codex'
+ ? 'Reconnect'
+ : 'Replace'}
+ </Button>
+ ) : null}
+ {subscription ? (
+ <Button
+ size="sm"
+ variant="ghost"
+ className="text-destructive"
+ onClick={() => setConfirmDisconnect(true)}
+ >
+ Disconnect
+ </Button>
+ ) : null}
+ </div>
+ )}
</div>
- {replacing ? (
+ {connecting ? (
<SubscriptionConnect
- provider={subscription.provider}
- replacing
- onDone={() => setReplacing(false)}
- onCancel={() => setReplacing(false)}
+ provider={provider}
+ replacing={Boolean(subscription)}
+ onDone={() => setConnecting(false)}
+ onCancel={() => setConnecting(false)}
/>
- ) : (
- <div className="flex flex-wrap gap-2">
- {canResume ? (
- <Button
- size="sm"
- onClick={() => resume.mutate()}
- disabled={resume.isPending}
- >
- {resume.isPending ? (
- <Loader2 className="size-4 animate-spin" aria-hidden />
- ) : null}
- Resume
- </Button>
- ) : null}
- {isHarnessAvailable(agent, subscription.provider) ? (
- // A login whose harness the gate switched off can still be
- // disconnected, not signed in again.
- <Button
- size="sm"
- variant="outline"
- onClick={() => setReplacing(true)}
- >
- {subscription.provider === 'codex' ? 'Reconnect' : 'Replace'}
- </Button>
- ) : null}
- <Button
- size="sm"
- variant="ghost"
- className="text-destructive"
- onClick={() => setConfirmDisconnect(true)}
- >
- Disconnect
- </Button>
- </div>
- )}
+ ) : null}
<ConfirmDialog
open={confirmDisconnect}
onOpenChange={setConfirmDisconnect}
title={`Disconnect ${name}?`}
- description={`Threads run on free credits (${agent.managedModel}) until you connect it again.`}
+ description={
+ runs
+ ? `Threads run on free credits (${agent.managedModel}) until you connect one again.`
+ : `${name} stays off until you connect it again.`
+ }
confirmLabel="Disconnect"
destructive
pending={disconnect.isPending}
- onConfirm={() => disconnect.mutate(subscription.provider)}
+ onConfirm={() => disconnect.mutate(provider)}
/>
- </div>
+ </section>
)
}
diff --git a/web/src/managed-agents/computer-api.ts b/web/src/managed-agents/computer-api.ts
index 4a316e23..c15310f4 100644
--- a/web/src/managed-agents/computer-api.ts
+++ b/web/src/managed-agents/computer-api.ts
@@ -41,6 +41,16 @@ export const agentSubscriptionHealthSchema = z.enum([
export const subscriptionProviderSchema = z.enum(['claude', 'codex'])
+const agentSubscriptionSchema = z.object({
+ // `codex` is a ChatGPT plan running Codex (work 082).
+ provider: subscriptionProviderSchema,
+ health: agentSubscriptionHealthSchema,
+ limitedUntil: z.string().optional(),
+ setAt: z.string(),
+ /** ChatGPT only: the plan from the login ("plus", "pro"…). */
+ plan: z.string().optional(),
+})
+
export const computerAgentSchema = z.object({
choice: agentChoiceSchema.nullable(),
/** This dashboard user is linked to a Slack user (through the install). */
@@ -48,17 +58,18 @@ export const computerAgentSchema = z.object({
linkedSlackUser: z
.object({ id: z.string(), name: z.string(), teamName: z.string() })
.optional(),
- subscription: z
+ /** The one that runs threads: the chosen provider's, else the other's. */
+ subscription: agentSubscriptionSchema.nullable(),
+ /**
+ * Every provider's, connected or not (work 083), so each gets a row.
+ * Absent from an older backend: only `subscription` is known.
+ */
+ subscriptions: z
.object({
- // `codex` is a ChatGPT plan running Codex (work 082).
- provider: subscriptionProviderSchema,
- health: agentSubscriptionHealthSchema,
- limitedUntil: z.string().optional(),
- setAt: z.string(),
- /** ChatGPT only: the plan from the login ("plus", "pro"…). */
- plan: z.string().optional(),
+ claude: agentSubscriptionSchema.nullable(),
+ codex: agentSubscriptionSchema.nullable(),
})
- .nullable(),
+ .optional(),
/** The model free credits run, e.g. "Claude Opus 5.5". */
managedModel: z.string(),
/**
@@ -138,6 +149,7 @@ export type ComputerState = z.infer<typeof computerStateSchema>
export type Computer = z.infer<typeof computerSchema>
export type ComputerStatus = z.infer<typeof computerStatusSchema>
export type ComputerAgent = z.infer<typeof computerAgentSchema>
+export type AgentSubscription = z.infer<typeof agentSubscriptionSchema>
export type AgentChoice = z.infer<typeof agentChoiceSchema>
export type SubscriptionProvider = z.infer<typeof subscriptionProviderSchema>
export type ComputerConnectCode = z.infer<typeof computerConnectCodeSchema>