Skip to content

An open-source, faster Devin alternative

TypeScript

web: remove Credentials page and durableSessions nav preference (097 step 7.1)

Mohamed Habib via Computera187c7657f9e
diff --git a/web/src/App.tsx b/web/src/App.tsx
index 0e785d13..bf1031b1 100644
--- a/web/src/App.tsx
+++ b/web/src/App.tsx
@@ -10,7 +10,6 @@ import { templateDeployPathFromSearch } from './managed-agents/templates'
// Route pages are code-split so the initial bundle stays small; the heaviest
// deps (xterm, in Terminal/LogsPanel) only load on SandboxDetail when opened.
const Dashboard = lazy(() => import('./pages/Dashboard'))
-const Credentials = lazy(() => import('./pages/Credentials'))
const Browsers = lazy(() => import('./pages/Browsers'))
const Sandboxes = lazy(() => import('./pages/Sandboxes'))
const APIKeys = lazy(() => import('./pages/APIKeys'))
@@ -140,7 +139,6 @@ export default function App() {
path="managed-agents/:agentId"
element={<ManagedAgentDetail />}
/>
- <Route path="credentials" element={<Credentials />} />
<Route path="browsers" element={<Browsers />} />
{/* Sandbox plane */}
<Route path="sandboxes" element={<Sandboxes />} />
diff --git a/web/src/api/client.ts b/web/src/api/client.ts
index 9712b171..70a98d42 100644
--- a/web/src/api/client.ts
+++ b/web/src/api/client.ts
@@ -34,7 +34,6 @@ export type {
BrowserProfile,
SandboxWebhook,
SandboxWebhookDelivery,
- Credential,
} from './schemas'
const API_BASE = '/api/dashboard'
@@ -524,45 +523,6 @@ export const getBrowserProfiles = () =>
(r) => r.profiles,
)
-// Credentials — model-provider keys for Durable Agent Sessions, reached through
-// the edge's /api/dashboard/v3/* proxy to sessions-api. The agents and sessions
-// pages are gone; only the Credentials page still calls these, and it is
-// removed in a later change.
-export const getCredentials = () =>
- apiFetch('/v3/credentials', {}, S.CredentialListSchema).then((r) => r.data)
-
-export const createCredential = (body: {
- key: string
- provider?: string
- name?: string
- is_default?: boolean
-}) =>
- apiFetch(
- '/v3/credentials',
- { method: 'POST', body: JSON.stringify(body) },
- S.CredentialSchema,
- )
-
-export const deleteCredential = (id: string) =>
- apiFetch<void>(`/v3/credentials/${id}`, { method: 'DELETE' })
-
-// Set the org default credential for its provider (the one sessions fall back to).
-export const setDefaultCredential = (id: string) =>
- apiFetch(
- '/v3/credentials/default',
- { method: 'PUT', body: JSON.stringify({ credential: id }) },
- S.CredentialSchema,
- )
-
-// Rotate a credential's secret VALUE (versioned, write-only key). Returns updated
-// metadata (new last4).
-export const rotateCredential = (id: string, key: string) =>
- apiFetch(
- `/v3/credentials/${id}`,
- { method: 'PATCH', body: JSON.stringify({ key }) },
- S.CredentialSchema,
- )
-
// ── Sandbox lifecycle webhooks (org-scoped, Svix-backed at the edge) ─────────
// Reached via /api/dashboard/webhooks* (cookie auth → org), mirroring the public
// /api/webhooks API.
diff --git a/web/src/api/mock.ts b/web/src/api/mock.ts
index e3eb857e..68079647 100644
--- a/web/src/api/mock.ts
+++ b/web/src/api/mock.ts
@@ -21,7 +21,6 @@ const me = {
id: 'user_2abc',
orgId: 'org_digger',
- durableSessionsEnabled: true,
infrastructureEnabled: true,
computerEnabled: true,
orgs: [
@@ -541,25 +540,6 @@ const orgInvitations = [
},
]
-const credentials = [
- {
- id: 'cred_anth_1',
- provider: 'anthropic',
- name: 'Production',
- last4: 'a1b2',
- is_default: true,
- created_at: at(20),
- },
- {
- id: 'cred_anth_2',
- provider: 'anthropic',
- name: 'Staging',
- last4: 'c3d4',
- is_default: false,
- created_at: at(8),
- },
-]
-
const sandboxWebhooks = [
{
id: 'whk_1',
@@ -1240,8 +1220,6 @@ const ROUTES: Array<[RegExp, Handler]> = [
[/^\/org\/invitations$/, () => orgInvitations],
[/^\/org\/custom-domain$/, () => ({})],
[/^\/org$/, () => org],
- // The Credentials page is the last /v3 caller (removed in a later change).
- [/^\/v3\/credentials$/, () => ({ data: credentials })],
[
/^\/webhooks\/[^/]+\/deliveries$/,
() => ({ data: sandboxWebhookDeliveries }),
@@ -1342,7 +1320,7 @@ export function mockFetch<T>(path: string, options: RequestInit = {}): T {
if (method === 'PUT' && path === '/me/preferences') {
const body = typeof options.body === 'string' ? options.body : '{}'
const updates = JSON.parse(body) as Partial<
- Pick<typeof me, 'durableSessionsEnabled' | 'infrastructureEnabled'>
+ Pick<typeof me, 'infrastructureEnabled'>
>
Object.assign(me, updates)
return me as T
diff --git a/web/src/api/schemas.ts b/web/src/api/schemas.ts
index b1cd424b..a8a461b9 100644
--- a/web/src/api/schemas.ts
+++ b/web/src/api/schemas.ts
@@ -19,7 +19,6 @@ export const MeResponseSchema = z.object({
email: z.string(),
orgId: z.string(),
orgs: z.array(OrgInfoSchema).optional(),
- durableSessionsEnabled: z.boolean(),
infrastructureEnabled: z.boolean(),
/** Work 052 rollout: the organization has its computer. Absent on older edges. */
computerEnabled: z.boolean().optional(),
@@ -408,26 +407,6 @@ export const SandboxWebhookDeliveryListSchema = z.object({
data: z.array(SandboxWebhookDeliverySchema),
})
-// ── Durable Agent Sessions credentials ─────────────────────────────────────
-// Only the Credentials page still reads these (via the edge's /v3 proxy to
-// sessions-api); it is removed in a later change.
-// Credentials — the reusable model-provider keys an agent/session resolves. The
-// raw key is write-only; the API returns only metadata (last4 for display).
-export const CredentialSchema = z.object({
- id: z.string(),
- provider: z.string(),
- name: z.string().nullish(),
- last4: z.string().nullable().optional(),
- is_default: z.boolean().optional(),
- created_at: z.string(),
-})
-export const CredentialListSchema = z.object({
- data: z.array(CredentialSchema),
- next_cursor: z.string().nullish(),
-})
-
-export type Credential = z.infer<typeof CredentialSchema>
-
export type OrgInfo = z.infer<typeof OrgInfoSchema>
export type MeResponse = z.infer<typeof MeResponseSchema>
export type Sandbox = z.infer<typeof SandboxSchema>
diff --git a/web/src/components/app-shell-nav.ts b/web/src/components/app-shell-nav.ts
index 621513a7..77d9ad9e 100644
--- a/web/src/components/app-shell-nav.ts
+++ b/web/src/components/app-shell-nav.ts
@@ -39,7 +39,6 @@ export type NavGroup = {
export function managedAgentsNav(options: {
projectId?: string
- durableSessionsEnabled: boolean
infrastructureEnabled: boolean
computerEnabled?: boolean
swarmEnabled?: boolean
@@ -156,22 +155,6 @@ export function managedAgentsNav(options: {
],
})
- if (options.durableSessionsEnabled) {
- groups.push({
- label: 'Durable sessions',
- collapsible: true,
- landingTo: '/credentials',
- items: [
- {
- to: '/credentials',
- label: 'Credentials',
- icon: KeySquare,
- preview: true,
- },
- ],
- })
- }
-
if (options.infrastructureEnabled) {
groups.push({
label: 'Infrastructure',
diff --git a/web/src/components/app-shell.test.ts b/web/src/components/app-shell.test.ts
index 120c90d9..03262ac4 100644
--- a/web/src/components/app-shell.test.ts
+++ b/web/src/components/app-shell.test.ts
@@ -4,7 +4,6 @@ import { managedAgentsNav } from './app-shell-nav'
describe('managed agents navigation', () => {
const defaults = {
- durableSessionsEnabled: false,
infrastructureEnabled: false,
}
@@ -83,14 +82,7 @@ describe('managed agents navigation', () => {
)
})
- it('reveals each advanced area independently', () => {
- expect(
- managedAgentsNav({
- ...defaults,
- durableSessionsEnabled: true,
- }).map((group) => group.label),
- ).toEqual([undefined, 'Account', 'Durable sessions'])
-
+ it('reveals the infrastructure area when enabled', () => {
expect(
managedAgentsNav({
...defaults,
@@ -103,7 +95,6 @@ describe('managed agents navigation', () => {
expect(
managedAgentsNav({
projectId: 'project-one',
- durableSessionsEnabled: true,
infrastructureEnabled: true,
}).map((group) => group.label),
).toEqual([undefined, undefined])
diff --git a/web/src/components/app-shell.tsx b/web/src/components/app-shell.tsx
index 6ffd3a56..2f42380c 100644
--- a/web/src/components/app-shell.tsx
+++ b/web/src/components/app-shell.tsx
@@ -16,7 +16,6 @@ import {
Package,
Webhook,
KeyRound,
- KeySquare,
CreditCard,
Settings,
LogOut,
@@ -76,8 +75,7 @@ type NavItem = {
}
type LegacyNavGroup = Omit<NavGroup, 'items'> & { items: NavItem[] }
-// Two planes, subtly separated: the durable-agent plane and the raw-compute
-// (sandbox) plane, plus account/org. Groups render with spacing + a small muted
+// The raw-compute (sandbox) plane plus account/org. Groups render with spacing + a small muted
// label rather than hard dividers.
const LEGACY_NAV: LegacyNavGroup[] = [
{
@@ -86,17 +84,6 @@ const LEGACY_NAV: LegacyNavGroup[] = [
{ to: '/getting-started', label: 'Getting started', icon: Rocket },
],
},
- {
- label: 'Agents',
- items: [
- {
- to: '/credentials',
- label: 'Credentials',
- icon: KeySquare,
- preview: true,
- },
- ],
- },
{
label: 'Browser Sessions',
items: [
@@ -339,7 +326,6 @@ function SidebarNav({ onNavigate }: { onNavigate?: () => void }) {
const nav = managedAgentsExperimentEnabled
? managedAgentsNav({
projectId,
- durableSessionsEnabled: user?.durableSessionsEnabled ?? false,
infrastructureEnabled: user?.infrastructureEnabled ?? false,
computerEnabled,
swarmEnabled,
diff --git a/web/src/components/step-progress.tsx b/web/src/components/step-progress.tsx
deleted file mode 100644
index 89d57bb5..00000000
--- a/web/src/components/step-progress.tsx
+++ /dev/null
@@ -1,66 +0,0 @@
-import { Fragment } from 'react'
-import { Check, Loader2 } from 'lucide-react'
-import { cn } from '@/lib/utils'
-
-// Horizontal stepper for a known multi-step backend job. Nodes fill left → right:
-// steps before `current` are done (✓), `current` is active (spinner), the rest are
-// pending. The connector leading into each reached node fills with the accent. A
-// single status line below names the active step (full label), so long step names
-// don't crowd the nodes. `current === steps.length` reads fully done.
-export function StepProgress({
- steps,
- current,
-}: {
- steps: string[]
- current: number
-}) {
- const allDone = current >= steps.length
- return (
- <div className="space-y-4">
- <div className="flex items-center">
- {steps.map((label, i) => {
- const done = i < current
- const active = i === current
- return (
- <Fragment key={label}>
- {i > 0 ? (
- <span
- className={cn(
- 'h-px flex-1 transition-colors duration-300',
- i <= current ? 'bg-status-running' : 'bg-border',
- )}
- />
- ) : null}
- <span
- className={cn(
- 'flex size-7 shrink-0 items-center justify-center rounded-full border text-xs font-medium transition-colors duration-300',
- done || active
- ? 'border-status-running text-status-running'
- : 'border-border text-muted-foreground/50',
- )}
- >
- {done ? (
- <Check className="size-3.5" />
- ) : active ? (
- <Loader2 className="size-3.5 animate-spin" />
- ) : (
- i + 1
- )}
- </span>
- </Fragment>
- )
- })}
- </div>
- <div className="flex items-center gap-2 text-sm">
- {allDone ? (
- <Check className="text-status-running size-4 shrink-0" />
- ) : (
- <Loader2 className="text-status-running size-4 shrink-0 animate-spin" />
- )}
- <span className="text-foreground">
- {allDone ? 'Done' : steps[current]}
- </span>
- </div>
- </div>
- )
-}
diff --git a/web/src/hooks/useAuth.ts b/web/src/hooks/useAuth.ts
index 58dbe453..9d81f22e 100644
--- a/web/src/hooks/useAuth.ts
+++ b/web/src/hooks/useAuth.ts
@@ -8,7 +8,6 @@ export interface AuthUser {
email: string
orgId: string
orgs?: OrgInfo[]
- durableSessionsEnabled: boolean
infrastructureEnabled: boolean
computerEnabled?: boolean
onboardingExperience?: MeResponse['onboardingExperience']
diff --git a/web/src/managed-agents/AgentStep.test.tsx b/web/src/managed-agents/AgentStep.test.tsx
index 8ab7dc14..3be35318 100644
--- a/web/src/managed-agents/AgentStep.test.tsx
+++ b/web/src/managed-agents/AgentStep.test.tsx
@@ -59,7 +59,6 @@ const auth = {
id: 'u1',
orgId: 'org_1',
- durableSessionsEnabled: false,
infrastructureEnabled: false,
computerEnabled: true,
},
diff --git a/web/src/managed-agents/Computer.test.tsx b/web/src/managed-agents/Computer.test.tsx
index 7585e2d5..b45cf856 100644
--- a/web/src/managed-agents/Computer.test.tsx
+++ b/web/src/managed-agents/Computer.test.tsx
@@ -37,7 +37,6 @@ const authWith = (
id: 'u1',
orgId: 'org_1',
- durableSessionsEnabled: false,
infrastructureEnabled: false,
computerEnabled,
onboardingExperience,
diff --git a/web/src/managed-agents/Connections.test.tsx b/web/src/managed-agents/Connections.test.tsx
index be0d3c23..c177b5fe 100644
--- a/web/src/managed-agents/Connections.test.tsx
+++ b/web/src/managed-agents/Connections.test.tsx
@@ -34,7 +34,6 @@ const auth = {
id: 'u1',
orgId: 'org_1',
- durableSessionsEnabled: false,
infrastructureEnabled: false,
computerEnabled: true,
},
diff --git a/web/src/managed-agents/Home.test.tsx b/web/src/managed-agents/Home.test.tsx
index 686adc0b..6f105000 100644
--- a/web/src/managed-agents/Home.test.tsx
+++ b/web/src/managed-agents/Home.test.tsx
@@ -13,7 +13,6 @@ const authWith = (computerEnabled: boolean) =>
id: 'u1',
orgId: 'org_1',
- durableSessionsEnabled: false,
infrastructureEnabled: false,
computerEnabled,
},
diff --git a/web/src/pages/Credentials.tsx b/web/src/pages/Credentials.tsx
deleted file mode 100644
index 16fa5f36..00000000
--- a/web/src/pages/Credentials.tsx
+++ /dev/null
@@ -1,510 +0,0 @@
-import { useState } from 'react'
-import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query'
-import { KeySquare, Plus } from 'lucide-react'
-import { notifyError } from '@/lib/errors'
-import {
- createCredential,
- deleteCredential,
- getCredentials,
- rotateCredential,
- setDefaultCredential,
- type Credential,
-} from '@/api/client'
-import { PageHeader } from '@/components/page-header'
-import { Panel } from '@/components/panel'
-import { Button } from '@/components/ui/button'
-import { Badge } from '@/components/ui/badge'
-import { Checkbox } from '@/components/ui/checkbox'
-import {
- Dialog,
- DialogContent,
- DialogDescription,
- DialogFooter,
- DialogHeader,
- DialogTitle,
-} from '@/components/ui/dialog'
-import { Field, Input, Label, Select } from '@/components/form'
-import { EmptyState } from '@/components/empty-state'
-import { ConfirmDialog } from '@/components/confirm-dialog'
-import { ResourceTable, type Column } from '@/components/resource-table'
-import { StepProgress } from '@/components/step-progress'
-
-// Providers an agent runtime can use. claude → anthropic; openai lands when the
-// codex runtime ships, but a key can be stored ahead of it.
-const PROVIDERS = [
- { value: 'anthropic', label: 'Anthropic' },
- { value: 'openai', label: 'OpenAI' },
-]
-const KEY_HINT: Record<string, string> = {
- anthropic: 'sk-ant-…',
- openai: 'sk-…',
-}
-
-// The real phases a create runs through (reserve a ref → write to the secret
-// store → activate). We surface them so the wait reads as a job, not a hang.
-const CREATE_STEPS = [
- 'Securing your key',
- 'Provisioning in secure secret store',
- 'Finalizing credential',
-]
-const wait = (ms: number) => new Promise<void>((r) => setTimeout(r, ms))
-// Guaranteed minimum visible time per step (so the sequence has a steady rhythm
-// even when the backend is fast) + a beat to rest on the final green state.
-const STEP_MIN_MS = 550
-const DONE_PAUSE_MS = 800
-
-export default function Credentials() {
- const queryClient = useQueryClient()
- const { data: credentials, isLoading } = useQuery({
- queryKey: ['credentials'],
- queryFn: getCredentials,
- })
-
- const [showCreate, setShowCreate] = useState(false)
- const [name, setName] = useState('')
- const [provider, setProvider] = useState('anthropic')
- const [key, setKey] = useState('')
- const [makeDefault, setMakeDefault] = useState(true)
- const [toDelete, setToDelete] = useState<Credential | null>(null)
- const [toRotate, setToRotate] = useState<Credential | null>(null)
- const [rotateKey, setRotateKey] = useState('')
-
- const resetForm = () => {
- setName('')
- setProvider('anthropic')
- setKey('')
- setMakeDefault(true)
- }
-
- // Two strategies for the slow edge → sessions-api → Infisical chain:
- // - delete / set-default: OPTIMISTIC — apply to the cache instantly, roll back
- // on failure (no provisioning, nothing real to wait on).
- // - create: provisions a secret in the store, so rather than hide the wait we
- // SHOW it as a stepped job (reserve → provision → finalize).
- const CREDS_KEY = ['credentials'] as const
- const snapshot = async () => {
- await queryClient.cancelQueries({ queryKey: CREDS_KEY })
- return queryClient.getQueryData<Credential[]>(CREDS_KEY)
- }
- const rollback = (previous?: Credential[]) => {
- if (previous) queryClient.setQueryData(CREDS_KEY, previous)
- }
-
- // Create progress: 'form' shows the inputs; 'running' shows the step checklist.
- const [phase, setPhase] = useState<'form' | 'running'>('form')
- const [step, setStep] = useState(0)
- const [createError, setCreateError] = useState<string | null>(null)
-
- // Drive the steps on a guaranteed minimum cadence so they read as a steady job,
- // while the real request runs underneath. The provision step also absorbs the
- // actual store-write latency (it holds until the request settles AND its minimum
- // elapses). On failure we fall back to the form with the inputs + an inline error.
- const runCreate = async () => {
- setCreateError(null)
- setPhase('running')
- setStep(0) // Securing your key
- // Tagged so it never rejects unhandled while we dwell on the early steps.
- const settledP = createCredential({
- key: key.trim(),
- provider,
- name: name.trim() || undefined,
- is_default: makeDefault,
- }).then(
- (cred) => ({ ok: true as const, cred }),
- (err: unknown) => ({ ok: false as const, err }),
- )
-
- await wait(STEP_MIN_MS)
- setStep(1) // Provisioning in secure secret store (the long pole)
- const [settled] = await Promise.all([settledP, wait(STEP_MIN_MS)])
- if (!settled.ok) {
- setPhase('form')
- setCreateError(
- settled.err instanceof Error
- ? settled.err.message
- : "Couldn't add the credential.",
- )
- return
- }
-
- setStep(2) // Finalizing credential
- await wait(STEP_MIN_MS)
- setStep(CREATE_STEPS.length) // all done → the steps turn green
- void queryClient.invalidateQueries({ queryKey: CREDS_KEY })
- await wait(DONE_PAUSE_MS) // rest on the completed green state
- setShowCreate(false)
- setPhase('form')
- setStep(0)
- resetForm()
- }
-
- const defaultMutation = useMutation({
- mutationFn: (id: string) => setDefaultCredential(id),
- onMutate: async (id) => {
- const previous = await snapshot()
- const target = previous?.find((c) => c.id === id)
- queryClient.setQueryData<Credential[]>(CREDS_KEY, (old = []) =>
- old.map((c) =>
- c.provider === target?.provider
- ? { ...c, is_default: c.id === id }
- : c,
- ),
- )
- return { previous }
- },
- onError: (e, _id, ctx) => {
- rollback(ctx?.previous)
- notifyError("Couldn't set the default.", e)
- },
- onSettled: () => queryClient.invalidateQueries({ queryKey: CREDS_KEY }),
- })
-
- const deleteMutation = useMutation({
- mutationFn: (id: string) => deleteCredential(id),
- onMutate: async (id) => {
- const previous = await snapshot()
- queryClient.setQueryData<Credential[]>(CREDS_KEY, (old = []) =>
- old.filter((c) => c.id !== id),
- )
- setToDelete(null) // dismiss the confirm immediately
- return { previous }
- },
- onError: (e, _id, ctx) => {
- rollback(ctx?.previous)
- notifyError("Couldn't delete the credential.", e)
- },
- onSettled: () => queryClient.invalidateQueries({ queryKey: CREDS_KEY }),
- })
-
- // Rotate the secret VALUE of an existing credential (versioned; running sessions
- // re-seal to the new key). Not optimistic — it's a provisioning write.
- const rotateMutation = useMutation({
- mutationFn: ({ id, key }: { id: string; key: string }) =>
- rotateCredential(id, key),
- onSuccess: () => {
- void queryClient.invalidateQueries({ queryKey: CREDS_KEY })
- setToRotate(null)
- setRotateKey('')
- },
- onError: (e) => notifyError("Couldn't rotate the key.", e),
- })
-
- const openCreate = () => {
- setPhase('form')
- setStep(0)
- setCreateError(null)
- setShowCreate(true)
- }
- const closeCreate = () => {
- setShowCreate(false)
- setPhase('form')
- setStep(0)
- setCreateError(null)
- resetForm()
- }
-
- const columns: Column<Credential>[] = [
- {
- key: 'name',
- header: 'Name',
- cell: (c) => (
- <span className="flex items-center gap-2">
- <span className="text-foreground font-medium">
- {c.name || <span className="text-muted-foreground">Unnamed</span>}
- </span>
- {c.is_default ? <Badge variant="secondary">Default</Badge> : null}
- </span>
- ),
- },
- {
- key: 'provider',
- header: 'Provider',
- cell: (c) => (
- <span className="text-muted-foreground text-xs capitalize">
- {c.provider}
- </span>
- ),
- },
- {
- key: 'key',
- header: 'Key',
- cell: (c) => (
- <code className="text-muted-foreground font-mono text-xs">
- {c.last4 ? `··· ${c.last4}` : '—'}
- </code>
- ),
- },
- {
- key: 'created',
- header: 'Created',
- cell: (c) => (
- <span className="text-muted-foreground font-mono text-xs">
- {new Date(c.created_at).toLocaleDateString()}
- </span>
- ),
- },
- {
- key: 'actions',
- header: '',
- align: 'right',
- cell: (c) => (
- <div className="flex items-center justify-end gap-1">
- {!c.is_default ? (
- <Button
- variant="ghost"
- size="sm"
- className="text-muted-foreground hover:text-foreground underline-offset-2 hover:bg-transparent hover:underline"
- disabled={defaultMutation.isPending}
- onClick={() => defaultMutation.mutate(c.id)}
- >
- Set default
- </Button>
- ) : null}
- <Button
- variant="ghost"
- size="sm"
- className="text-muted-foreground hover:text-foreground underline-offset-2 hover:bg-transparent hover:underline"
- onClick={() => {
- setToRotate(c)
- setRotateKey('')
- }}
- >
- Rotate key
- </Button>
- <Button
- variant="ghost"
- size="sm"
- className="text-status-error underline-offset-2 hover:bg-transparent hover:underline"
- onClick={() => setToDelete(c)}
- >
- Delete
- </Button>
- </div>
- ),
- },
- ]
-
- const canCreate = key.trim().length > 0
-
- return (
- <div>
- <PageHeader
- title="Credentials"
- description="Model-provider keys your agents run on. Pick one per agent or set an org default."
- api={{
- method: 'POST',
- path: '/v3/credentials',
- sdk: 'oc.credentials.create()',
- docs: 'https://docs.opencomputer.dev/agent-sessions/credentials',
- }}
- actions={
- <Button onClick={openCreate}>
- <Plus className="size-4" />
- Add credential
- </Button>
- }
- />
-
- <Panel className="overflow-hidden">
- <ResourceTable
- columns={columns}
- rows={credentials ?? []}
- rowKey={(c) => c.id}
- loading={isLoading}
- empty={
- <EmptyState
- icon={KeySquare}
- title="No credentials yet"
- description="Add a model-provider key once, then reuse it across agents — no need to paste it every time."
- action={
- <Button size="sm" onClick={openCreate}>
- <Plus className="size-4" />
- Add credential
- </Button>
- }
- />
- }
- />
- </Panel>
-
- <Dialog
- open={showCreate}
- onOpenChange={(open) => {
- if (phase === 'running') return // lock the dialog while the job runs
- if (open) openCreate()
- else closeCreate()
- }}
- >
- <DialogContent>
- {/* Stable height across phases so submitting doesn't resize the dialog. */}
- <div className="flex min-h-[22rem] flex-col">
- {phase === 'running' ? (
- <div className="flex flex-1 flex-col justify-center gap-6">
- <DialogHeader>
- <DialogTitle>
- {step >= CREATE_STEPS.length
- ? 'Credential ready'
- : 'Adding credential'}
- </DialogTitle>
- <DialogDescription>
- {step >= CREATE_STEPS.length
- ? 'Encrypted and held in your dedicated secret store.'
- : 'Encrypting and provisioning it in your dedicated secret store.'}
- </DialogDescription>
- </DialogHeader>
- <StepProgress steps={CREATE_STEPS} current={step} />
- </div>
- ) : (
- <>
- <DialogHeader>
- <DialogTitle>Add credential</DialogTitle>
- <DialogDescription>
- Encrypted in a dedicated secret store, isolated from our
- database — and never shown again.
- </DialogDescription>
- </DialogHeader>
- <form
- className="flex flex-1 flex-col space-y-4"
- onSubmit={(e) => {
- e.preventDefault()
- if (canCreate) void runCreate()
- }}
- >
- {createError ? (
- <div className="border-status-error/30 bg-status-error-bg text-status-error rounded-md border px-3 py-2 text-xs">
- {createError}
- </div>
- ) : null}
- <div className="grid grid-cols-1 gap-4 sm:grid-cols-2">
- <Field label="Name" htmlFor="cred-name">
- <Input
- id="cred-name"
- value={name}
- onChange={(e) => setName(e.target.value)}
- placeholder="e.g. Production"
- />
- </Field>
- <Field label="Provider" htmlFor="cred-provider">
- <Select
- id="cred-provider"
- value={provider}
- onValueChange={setProvider}
- options={PROVIDERS}
- />
- </Field>
- </div>
- <Field label="API key" htmlFor="cred-key">
- <Input
- id="cred-key"
- type="password"
- value={key}
- onChange={(e) => setKey(e.target.value)}
- placeholder={KEY_HINT[provider] ?? 'sk-…'}
- />
- </Field>
- <div className="space-y-1.5">
- <div className="flex items-center gap-2">
- <Checkbox
- id="cred-default"
- checked={makeDefault}
- onCheckedChange={(v) => setMakeDefault(v === true)}
- />
- <Label
- htmlFor="cred-default"
- className="cursor-pointer font-normal"
- >
- Set as the org default
- </Label>
- </div>
- <p className="text-muted-foreground text-xs">
- Used when an agent doesn&apos;t pin its own credential.
- </p>
- </div>
- <DialogFooter className="mt-auto pt-2">
- <Button type="button" variant="ghost" onClick={closeCreate}>
- Cancel
- </Button>
- <Button type="submit" disabled={!canCreate}>
- Add credential
- </Button>
- </DialogFooter>
- </form>
- </>
- )}
- </div>
- </DialogContent>
- </Dialog>
-
- <Dialog
- open={toRotate !== null}
- onOpenChange={(open) => {
- if (!open) {
- setToRotate(null)
- setRotateKey('')
- }
- }}
- >
- <DialogContent>
- <DialogHeader>
- <DialogTitle>
- Rotate {toRotate?.name ? `"${toRotate.name}"` : 'credential'}
- </DialogTitle>
- <DialogDescription>
- Replace the secret value. Running sessions re-seal to the new key
- and the old value is purged. The key is write-only — never shown
- again.
- </DialogDescription>
- </DialogHeader>
- <form
- className="space-y-4"
- onSubmit={(e) => {
- e.preventDefault()
- if (toRotate && rotateKey.trim())
- rotateMutation.mutate({ id: toRotate.id, key: rotateKey.trim() })
- }}
- >
- <Field label="New API key" htmlFor="rotate-key">
- <Input
- id="rotate-key"
- type="password"
- value={rotateKey}
- onChange={(e) => setRotateKey(e.target.value)}
- placeholder={KEY_HINT[toRotate?.provider ?? 'anthropic'] ?? 'sk-…'}
- />
- </Field>
- <DialogFooter>
- <Button
- type="button"
- variant="ghost"
- onClick={() => {
- setToRotate(null)
- setRotateKey('')
- }}
- >
- Cancel
- </Button>
- <Button
- type="submit"
- disabled={rotateMutation.isPending || !rotateKey.trim()}
- >
- {rotateMutation.isPending ? 'Rotating…' : 'Rotate key'}
- </Button>
- </DialogFooter>
- </form>
- </DialogContent>
- </Dialog>
-
- <ConfirmDialog
- open={toDelete !== null}
- onOpenChange={(open) => !open && setToDelete(null)}
- title={`Delete ${toDelete?.name ? `"${toDelete.name}"` : 'this credential'}?`}
- description="Agents pinned to it, and sessions that fall back to it, will stop running until you point them at another credential. This can't be undone."
- confirmLabel="Delete credential"
- destructive
- onConfirm={() => {
- if (toDelete) deleteMutation.mutate(toDelete.id)
- }}
- />
- </div>
- )
-}
diff --git a/web/vite.config.ts b/web/vite.config.ts
index 70556942..7b2fd6c8 100644
--- a/web/vite.config.ts
+++ b/web/vite.config.ts
@@ -30,7 +30,8 @@ const injectKey: ProxyOptions['configure'] = (proxy) => {
// local-only, and it bypasses the edge's route allowlist and response shaping.
const managedAgentsToken = process.env.OC_MANAGED_AGENTS_TOKEN
const managedAgentsTarget =
- process.env.OC_MANAGED_AGENTS_TARGET || 'https://managedagents.opencomputer.dev'
+ process.env.OC_MANAGED_AGENTS_TARGET ||
+ 'https://managedagents.opencomputer.dev'
const managedAgentsProxy: Record<string, ProxyOptions> = managedAgentsToken
? {
// The dashboard's API base is /api/dashboard, so its managed-agents
@@ -42,7 +43,9 @@ const managedAgentsProxy: Record<string, ProxyOptions> = managedAgentsToken
ws: true,
rewrite: (p) => p.replace(/^\/api\/dashboard\/managed-agents/, '/v1'),
configure: (proxy) => {
- const inject = (proxyReq: { setHeader(k: string, v: string): void }) =>
+ const inject = (proxyReq: {
+ setHeader(k: string, v: string): void
+ }) =>
proxyReq.setHeader('x-opencomputer-agent-token', managedAgentsToken)
proxy.on('proxyReq', inject)
proxy.on('proxyReqWs', inject)
@@ -89,7 +92,6 @@ const localUser = {
id: 'local-dev-user',
orgId: 'local-dev-org',
- durableSessionsEnabled: false,
infrastructureEnabled: false,
authMode: 'development',
capabilities: {