Skip to content

An open-source, faster Devin alternative

TypeScript

Redesign the first-run starting screen

Igor Zalutski01c4a81ac041
diff --git a/web/src/pages/AgentNew.tsx b/web/src/pages/AgentNew.tsx
index 6891f9d6..85114ddd 100644
--- a/web/src/pages/AgentNew.tsx
+++ b/web/src/pages/AgentNew.tsx
@@ -166,7 +166,7 @@ function ModeButton({
)
}
-function StarterGuide() {
+export function RepositoryStarterGuide() {
return (
<aside
className="bg-panel rounded-lg border p-4 xl:sticky xl:top-24"
@@ -199,6 +199,66 @@ function StarterGuide() {
)
}
+export function RepositoryImportPanel({
+ initialSource,
+}: {
+ initialSource?: RepositorySeed
+}) {
+ const deployAppQuery = useQuery({
+ queryKey: ['deploy-app'],
+ queryFn: getDeployApp,
+ refetchOnWindowFocus: 'always',
+ })
+
+ if (deployAppQuery.isLoading) {
+ return (
+ <Panel aria-busy="true">
+ <PanelHeader>
+ <div>
+ <PanelTitle>Connect GitHub</PanelTitle>
+ <PanelDescription className="mt-1">
+ Loading your GitHub installation and repositories.
+ </PanelDescription>
+ </div>
+ </PanelHeader>
+ <PanelContent>
+ <Skeleton className="h-10 w-full max-w-sm" />
+ </PanelContent>
+ </Panel>
+ )
+ }
+
+ if (deployAppQuery.isError) {
+ return (
+ <Alert variant="destructive">
+ <AlertTitle>GitHub import could not be loaded</AlertTitle>
+ <AlertDescription>
+ {deployAppQuery.error instanceof Error
+ ? deployAppQuery.error.message
+ : 'The GitHub installation request failed.'}
+ </AlertDescription>
+ <div className="mt-3">
+ <Button
+ size="sm"
+ variant="outline"
+ onClick={() => void deployAppQuery.refetch()}
+ disabled={deployAppQuery.isFetching}
+ >
+ {deployAppQuery.isFetching ? (
+ <Loader2 className="size-4 animate-spin motion-reduce:animate-none" />
+ ) : null}
+ Retry
+ </Button>
+ </div>
+ </Alert>
+ )
+ }
+
+ return deployAppQuery.data ? (
+ <GithubImport app={deployAppQuery.data} initialSource={initialSource} />
+ ) : null
+}
+
function GithubImport({
app,
initialSource,
@@ -1007,11 +1067,6 @@ function GithubImport({
export default function AgentNew() {
const [searchParams, setSearchParams] = useSearchParams()
const location = useLocation()
- const deployAppQuery = useQuery({
- queryKey: ['deploy-app'],
- queryFn: getDeployApp,
- refetchOnWindowFocus: 'always',
- })
const mode = resolveAgentCreationMode(searchParams.get('mode'))
const setMode = (next: AgentCreationMode) =>
setSearchParams(next === 'github' ? {} : { mode: 'manual' }, {
@@ -1057,48 +1112,9 @@ export default function AgentNew() {
<div className="grid items-start gap-5 xl:grid-cols-[minmax(0,42rem)_17rem] xl:gap-8">
<div className="order-2 min-w-0 xl:order-1">
{mode === 'github' ? (
- deployAppQuery.isLoading ? (
- <Panel aria-busy="true">
- <PanelHeader>
- <div>
- <PanelTitle>Connect GitHub</PanelTitle>
- <PanelDescription className="mt-1">
- Loading your GitHub installation and repositories.
- </PanelDescription>
- </div>
- </PanelHeader>
- <PanelContent>
- <Skeleton className="h-10 w-full max-w-sm" />
- </PanelContent>
- </Panel>
- ) : deployAppQuery.isError ? (
- <Alert variant="destructive">
- <AlertTitle>GitHub import could not be loaded</AlertTitle>
- <AlertDescription>
- {deployAppQuery.error instanceof Error
- ? deployAppQuery.error.message
- : 'The GitHub installation request failed.'}
- </AlertDescription>
- <div className="mt-3">
- <Button
- size="sm"
- variant="outline"
- onClick={() => void deployAppQuery.refetch()}
- disabled={deployAppQuery.isFetching}
- >
- {deployAppQuery.isFetching ? (
- <Loader2 className="size-4 animate-spin motion-reduce:animate-none" />
- ) : null}
- Retry
- </Button>
- </div>
- </Alert>
- ) : deployAppQuery.data ? (
- <GithubImport
- app={deployAppQuery.data}
- initialSource={repositorySeedFromState(location.state)}
- />
- ) : null
+ <RepositoryImportPanel
+ initialSource={repositorySeedFromState(location.state)}
+ />
) : (
<Panel>
<PanelHeader>
@@ -1117,7 +1133,7 @@ export default function AgentNew() {
)}
</div>
<div className="order-1 xl:order-2">
- <StarterGuide />
+ <RepositoryStarterGuide />
</div>
</div>
</div>
diff --git a/web/src/pages/Dashboard.tsx b/web/src/pages/Dashboard.tsx
index 844805d0..53fe2c80 100644
--- a/web/src/pages/Dashboard.tsx
+++ b/web/src/pages/Dashboard.tsx
@@ -1,16 +1,13 @@
-import { useEffect, useRef, useState, type ReactNode } from 'react'
+import { useEffect, useRef } from 'react'
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query'
-import { Link, useNavigate, useLocation } from 'react-router-dom'
+import { Link, useLocation } from 'react-router-dom'
import {
- ArrowLeft,
- BarChart3,
Boxes,
- ChevronDown,
- Code2,
- Globe,
+ Check,
+ Copy,
+ ExternalLink,
+ KeyRound,
MessagesSquare,
- Sparkles,
- Terminal,
} from 'lucide-react'
import {
createAPIKey,
@@ -18,11 +15,6 @@ import {
getSandboxes,
getSessions,
getAgents,
- createAgent,
- createSession,
- createSandbox,
- getMe,
- getBilling,
type Sandbox,
} from '@/api/client'
import type { Session } from '@/api/schemas'
@@ -31,175 +23,39 @@ import { PageHeader } from '@/components/page-header'
import { Panel, PanelHeader, PanelTitle } from '@/components/panel'
import { MetricCard } from '@/components/metric-card'
import { CopyRow } from '@/components/copy-row'
-import { CodeOffRamp, type CodeTab } from '@/components/code-off-ramp'
import { StatusBadge } from '@/components/status-badge'
import { EmptyState } from '@/components/empty-state'
import { ResourceTable, type Column } from '@/components/resource-table'
import { Button } from '@/components/ui/button'
-import { DEFAULT_RUNTIME, defaultModelFor } from '@/lib/runtimes'
-
-const SKILL_INSTALL_CMD = 'npx skills add diggerhq/opencomputer'
-
-// One-click launch defaults. Mirrors the Create-agent dialog's defaults so the
-// dashboard button produces the same agent the modal would — but with the
-// "managed" credential (run via OpenComputer, billed to credits, no BYO key) so
-// a brand-new user with no key can go straight to a live session.
-const QUICKLAUNCH_PROMPT =
- 'You are a helpful AI assistant working in a sandboxed computer. Complete tasks end to end, use the tools available to you, and keep your answers clear and concise. When something is ambiguous, make a sensible assumption and say so.'
-// Starter task so the agent does something visible the moment the session opens.
-const QUICKLAUNCH_TASK =
- 'Give me a quick tour of this sandbox: check the OS and what tools/languages are installed, then suggest three things we could build together.'
-const QL_ADJ = ['swift', 'calm', 'bright', 'clever', 'bold', 'quiet', 'keen', 'brave', 'nimble', 'lucid', 'deft', 'vivid']
-const QL_NOUN = ['otter', 'harbor', 'falcon', 'cedar', 'comet', 'ember', 'grove', 'heron', 'lynx', 'nova', 'quartz', 'willow']
-function quicklaunchName(): string {
- const pick = (a: readonly string[]) => a[Math.floor(Math.random() * a.length)]
- return `${pick(QL_ADJ)}-${pick(QL_NOUN)}`
-}
+import { notifyError } from '@/lib/errors'
+import { useTransientFlag } from '@/lib/use-transient-flag'
+import { RepositoryImportPanel, RepositoryStarterGuide } from './AgentNew'
+
+const SANDBOX_API_CODE = `import { Sandbox } from "@opencomputer/sdk";
+
+const sandbox = await Sandbox.create();
+const result = await sandbox.commands.run("python3 --version");
+
+console.log(result.stdout);
+await sandbox.kill();`
+
+const SESSION_API_CODE = `import { OpenComputer } from "@opencomputer/sdk";
+
+const oc = new OpenComputer({
+ apiKey: process.env.OPENCOMPUTER_API_KEY,
+});
-// Example tasks shown as chips on the launch card — concrete starting points so a
-// new user sees what the product actually does, instead of a blank button.
-const QUICKLAUNCH_TASKS: { icon: typeof BarChart3; label: string; task: string }[] = [
- {
- icon: BarChart3,
- label: 'Analyze a CSV',
- task: 'Create a small sample sales CSV, analyze it with Python, and produce a chart summarizing the key trends.',
- },
- {
- icon: Globe,
- label: 'Build a web app',
- task: 'Build a small working single-page web app, start a dev server, and give me the preview URL so I can see it.',
- },
- {
- icon: Terminal,
- label: 'Write & run a script',
- task: 'Write a short Python script that prints the current date/time and basic system info, then run it and show me the output.',
- },
-]
-
-// Sandbox example chips. Unlike the agent chips (which are tasks for Claude), a
-// sandbox has no "task" — so each chip creates the box and lands you somewhere
-// useful: two auto-run a starter command in the terminal; "Drive it from code"
-// jumps to the Connect panel (SDK snippets). Commands lean on python3 (always
-// present on the base image) so the demo is self-contained — no external routing.
-// "Host a web app" is a webApp intent (not a static command): the sandbox page
-// exposes :8000, then builds the terminal command with the real preview hostname
-// so it can echo the live URL. See buildWebAppCommand in SandboxDetail.
-const SANDBOX_TRY_TOOL_CMD =
- `echo "Python $(python3 --version 2>&1 | cut -d' ' -f2) · Node $(node --version) · $(uname -sr)" && echo "It's a real machine — try: pip install <pkg> or npm i <pkg>"`
-
-type SandboxIntent = {
- startupCommand?: string
- focus?: 'connect'
- exposePort?: number
- webApp?: boolean
-}
-const SANDBOX_EXAMPLES: {
- icon: typeof Globe
- label: string
- intent: SandboxIntent
-}[] = [
- {
- icon: Globe,
- label: 'Host a web app',
- intent: { exposePort: 8000, webApp: true },
- },
- {
- icon: Terminal,
- label: 'Try a tool',
- intent: { startupCommand: SANDBOX_TRY_TOOL_CMD },
- },
- { icon: Code2, label: 'Use from code', intent: { focus: 'connect' } },
-]
-
-// Dev off-ramps: the exact public API/SDK/CLI calls each one-click card runs
-// under the hood. Surfaced (collapsed) so technical users see the dashboard is a
-// thin client over the API and can copy the real call. Kept in sync with the
-// launchMutation / createSandboxMutation bodies below.
-const AGENT_CODE: CodeTab[] = [
- {
- label: 'SDK',
- code: `import { OpenComputer } from "@opencomputer/sdk";
-
-const oc = new OpenComputer({ apiKey: process.env.OPENCOMPUTER_API_KEY });
-
-// Create a managed agent — billed to your OpenComputer credits, no model key
const agent = await oc.agents.create({
name: "my-agent",
runtime: "claude",
model: "anthropic/claude-opus-4-8",
- prompt: "You are a helpful AI assistant working in a sandboxed computer.",
credential: "managed",
});
-// Start a session — returns a browser-safe client token you can stream from
const session = await oc.sessions.create({
agent: agent.id,
- input: "Give me a quick tour of this sandbox.",
-});
-console.log(session.id, session.clientToken);`,
- },
- {
- label: 'CLI',
- code: `oc agent create my-agent \\
- --runtime claude --model anthropic/claude-opus-4-8 --credential managed
-
-oc session create --agent my-agent \\
- --input "Give me a quick tour of this sandbox."`,
- },
- {
- label: 'cURL',
- code: `# 1. Create a managed agent
-curl -X POST https://api.opencomputer.dev/v3/agents \\
- -H "Authorization: Bearer $OPENCOMPUTER_API_KEY" \\
- -H "Content-Type: application/json" \\
- -d '{"name":"my-agent","runtime":"claude","model":"anthropic/claude-opus-4-8","prompt":"You are a helpful AI assistant.","credential":"managed"}'
-
-# 2. Start a session on that agent
-curl -X POST https://api.opencomputer.dev/v3/sessions \\
- -H "Authorization: Bearer $OPENCOMPUTER_API_KEY" \\
- -H "Content-Type: application/json" \\
- -d '{"agent":"agt_...","input":"Give me a quick tour of this sandbox."}'`,
- },
-]
-
-const SANDBOX_CODE: CodeTab[] = [
- {
- label: 'SDK',
- code: `import { Sandbox } from "@opencomputer/sdk";
-
-const sandbox = await Sandbox.create();
-
-const result = await sandbox.commands.run("python3 --version");
-console.log(result.stdout);
-
-// It stays alive until you kill it or it idles out
-await sandbox.kill();`,
- },
- {
- label: 'CLI',
- code: `# Create a sandbox
-oc create
-
-# Run a command in it — or drop into an interactive shell
-oc exec <sandbox-id> -- python3 --version
-oc shell <sandbox-id>`,
- },
- {
- label: 'cURL',
- code: `curl -X POST https://app.opencomputer.dev/api/sandboxes \\
- -H "X-API-Key: $OPENCOMPUTER_API_KEY" \\
- -H "Content-Type: application/json" \\
- -d '{"memoryMB":1024,"cpuCount":1,"networkEnabled":true}'`,
- },
-]
-
-// Derive a friendly first name from an email local part (brian+test81@… → "Brian").
-function firstNameFromEmail(email: string | undefined): string {
- if (!email) return ''
- const local = email.split('@')[0]?.split('+')[0] ?? ''
- const first = local.replace(/[._-]+/g, ' ').trim().split(' ')[0] ?? ''
- return first ? first.charAt(0).toUpperCase() + first.slice(1) : ''
-}
+ input: "Triage the latest support requests.",
+});`
function formatDuration(sandbox: Sandbox): string {
const start = new Date(sandbox.startedAt).getTime()
@@ -233,7 +89,6 @@ const isLiveSession = (s: Session) =>
export default function Dashboard() {
const prefetch = usePrefetchSandbox()
const location = useLocation()
- const navigate = useNavigate()
// Getting started is its own left-nav item (/getting-started). Brand-new orgs
// also see it inline on first run (at /).
const onGettingStartedRoute = location.pathname === '/getting-started'
@@ -377,9 +232,7 @@ export default function Dashboard() {
)}
{showOnboarding ? (
- <GettingStarted
- onBack={onGettingStartedRoute ? () => navigate('/') : undefined}
- />
+ <GettingStarted />
) : (
<div className="space-y-6">
<div className="grid grid-cols-2 gap-4 lg:grid-cols-4">
@@ -463,358 +316,256 @@ export default function Dashboard() {
}
/* ── First-run onboarding ─────────────────────────────────────────────────── */
-function GettingStarted({ onBack }: { onBack?: () => void }) {
+export function GettingStarted() {
const queryClient = useQueryClient()
- const {
- data: keys,
- isLoading: loadingKeys,
- isSuccess: keysLoaded,
- } = useQuery({
+ const keysQuery = useQuery({
queryKey: ['api-keys'],
queryFn: getAPIKeys,
})
- const { data: me } = useQuery({ queryKey: ['me'], queryFn: getMe })
- const { data: billing } = useQuery({ queryKey: ['billing'], queryFn: getBilling })
const autoCreateRef = useRef(false)
- const [showTerminal, setShowTerminal] = useState(false)
-
- const navigate = useNavigate()
const createMutation = useMutation({
mutationFn: () => createAPIKey('Default'),
onSuccess: () => queryClient.invalidateQueries({ queryKey: ['api-keys'] }),
})
- // One click: create a managed agent + start a session on it (with the given
- // task), then drop the user straight onto the live session screen. No skill,
- // no key, no terminal. The task varies by which chip/button the user picked.
- const launchMutation = useMutation({
- mutationFn: async (task: string) => {
- const agent = await createAgent({
- name: quicklaunchName(),
- prompt: QUICKLAUNCH_PROMPT,
- model: defaultModelFor(DEFAULT_RUNTIME),
- runtime: DEFAULT_RUNTIME,
- credential: 'managed', // run via OpenComputer, billed to credits, no BYO key
- })
- return createSession({ agent: agent.id, input: task })
- },
- onSuccess: (session) => {
- void queryClient.invalidateQueries({ queryKey: ['agents'] })
- // Land on the session with the first-run guided overlay (maps this UI to
- // the API calls that produced it). SessionDetail reads this nav state.
- void navigate(`/sessions/${session.id}`, { state: { guide: 'agent' } })
- },
- })
- const launching = launchMutation.isPending
-
- // Second door: create a real sandbox and drop into its live terminal. Goes
- // through the CP (edge → home cell → /internal/sandboxes/create), so unlike
- // the managed-agent path this works end to end today.
- const createSandboxMutation = useMutation({
- mutationFn: (_intent: SandboxIntent) =>
- createSandbox({ memoryMB: 1024, cpuCount: 1, networkEnabled: true }),
- onSuccess: (sb, intent) => {
- void queryClient.invalidateQueries({ queryKey: ['sandboxes'] })
- // Always land with the first-run guided overlay (SandboxDetail reads
- // `guide`); the chip's intent fields order the tour to lead with its step.
- void navigate(`/sandboxes/${sb.sandboxID}`, {
- state: { ...intent, guide: true },
- })
- },
- })
- const creatingSandbox = createSandboxMutation.isPending
-
+ const keys = keysQuery.data
const hasKeys = (keys?.length ?? 0) > 0
const createdKey = createMutation.data?.key ?? null
- const firstName = firstNameFromEmail(me?.email)
- const freeCents = billing?.freeCreditsRemainingCents ?? null
- // On first signup (no keys), auto-create a Default key so the user sees it
- // immediately without clicking anything.
+ // New organizations get one usable key without an extra setup step. Existing
+ // secrets remain intentionally unrecoverable; those users get the key manager.
useEffect(() => {
- // Only auto-create after a SUCCESSFUL (empty) keys list — never after the
- // list errored (keys would be undefined → falsely "no keys").
- if (!keysLoaded || autoCreateRef.current) return
+ if (!keysQuery.isSuccess || autoCreateRef.current) return
if (!hasKeys && !createdKey && !createMutation.isPending) {
autoCreateRef.current = true
createMutation.mutate()
}
- }, [keysLoaded, hasKeys, createdKey, createMutation])
+ }, [keysQuery.isSuccess, hasKeys, createdKey, createMutation])
return (
- <div className="space-y-5">
- {onBack ? (
- <button
- type="button"
- onClick={onBack}
- className="text-muted-foreground hover:text-foreground -mb-1 inline-flex items-center gap-1.5 text-sm underline-offset-4 hover:underline"
- >
- <ArrowLeft className="size-3.5" />
- Back to dashboard
- </button>
- ) : null}
-
- {/* Personalized welcome + reassurance in the first paint */}
- <div className="space-y-2">
- <h2 className="text-foreground text-2xl font-semibold tracking-tight">
- Welcome{firstName ? `, ${firstName}` : ''}.
- </h2>
- <p className="text-muted-foreground text-sm">
- {freeCents != null && freeCents > 0
- ? `$${(freeCents / 100).toFixed(2)} in free credits. Give your agent a real computer.`
- : 'Run a managed Claude agent in an isolated cloud sandbox, ready in seconds.'}
+ <div className="mx-auto max-w-5xl pb-12">
+ <header className="max-w-2xl">
+ <h1 className="text-foreground text-2xl font-semibold tracking-tight">
+ Get started
+ </h1>
+ <p className="text-muted-foreground mt-2 text-sm leading-6">
+ Deploy an agent from GitHub, or build directly with sandboxes and
+ durable agent sessions.
</p>
- <div className="text-muted-foreground flex flex-wrap items-center gap-x-2 gap-y-1 pt-0.5 text-xs">
- <span>Claude Opus</span>
- <span aria-hidden>·</span>
- <span>Isolated cloud VM</span>
- <span aria-hidden>·</span>
- <span>Real-time execution</span>
- </div>
- </div>
-
- {/* Agent card — primary door, with concrete example tasks */}
- <Panel className="p-5">
- <div className="flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between">
- <div className="space-y-1">
- <h3 className="text-foreground text-base font-semibold">
- Run an agent
- </h3>
- <p className="text-muted-foreground text-sm">
- Run a Claude agent in an isolated sandbox and monitor its work in
- real time. Billed to your account credits.
+ </header>
+
+ <section className="mt-10" aria-labelledby="repository-start-heading">
+ <div className="mb-5 flex flex-col gap-3 sm:flex-row sm:items-end sm:justify-between">
+ <div className="max-w-2xl">
+ <h2
+ id="repository-start-heading"
+ className="text-foreground text-lg font-semibold tracking-tight"
+ >
+ Deploy an agent from GitHub
+ </h2>
+ <p className="text-muted-foreground mt-1 text-sm leading-6">
+ Choose a repository. OpenComputer reviews it, starts the first
+ deployment, and keeps it in sync when you push.
</p>
</div>
- <Button
- size="lg"
- className="shrink-0"
- onClick={() => launchMutation.mutate(QUICKLAUNCH_TASK)}
- disabled={launching}
+ <a
+ href="#api"
+ className="text-muted-foreground hover:text-foreground shrink-0 text-sm underline-offset-4 hover:underline"
>
- <Sparkles className="size-4" />
- {launching ? 'Launching…' : 'Launch agent'}
- </Button>
+ Prefer the API?
+ </a>
</div>
- <div className="border-border/60 mt-4 border-t pt-4">
- <p className="text-muted-foreground mb-2 text-xs">
- Start from a template:
- </p>
- <div className="flex flex-wrap gap-2">
- {QUICKLAUNCH_TASKS.map((t) => (
- <button
- key={t.label}
- type="button"
- onClick={() => launchMutation.mutate(t.task)}
- disabled={launching}
- className="border-border bg-background hover:bg-secondary text-foreground inline-flex items-center gap-1.5 rounded-full border px-3 py-1.5 text-xs font-medium transition-colors disabled:opacity-50"
- >
- <t.icon className="size-3.5" />
- {t.label}
- </button>
- ))}
- </div>
- <CodeOffRamp
- className="mt-3"
- tabs={AGENT_CODE}
- docs="https://docs.opencomputer.dev/agent-sessions/quickstart"
- />
- </div>
-
- {launchMutation.isError ? (
- <div className="mt-3 flex items-center gap-3">
- <span className="text-status-error text-sm">
- Couldn&apos;t launch the agent.
- </span>
- <button
- className="text-foreground text-sm font-medium underline underline-offset-4"
- onClick={() =>
- launchMutation.mutate(launchMutation.variables ?? QUICKLAUNCH_TASK)
- }
- >
- Retry
- </button>
+ <div className="grid items-start gap-5 xl:grid-cols-[minmax(0,42rem)_17rem] xl:gap-8">
+ <div className="order-2 min-w-0 xl:order-1">
+ <RepositoryImportPanel />
</div>
- ) : null}
- </Panel>
-
- {/* Second door: a real sandbox — a full VM you drive yourself */}
- <Panel className="p-5">
- <div className="flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between">
- <div className="space-y-1">
- <h3 className="text-foreground text-base font-semibold">
- Work in a sandbox
- </h3>
- <p className="text-muted-foreground text-sm">
- Provision an isolated Linux environment with full shell, file, and
- network access. Control it from the browser or programmatically.
- </p>
+ <div className="order-1 xl:order-2">
+ <RepositoryStarterGuide />
</div>
- <Button
- size="lg"
- variant="outline"
- className="shrink-0"
- onClick={() => createSandboxMutation.mutate({})}
- disabled={creatingSandbox}
- >
- <Boxes className="size-4" />
- {creatingSandbox ? 'Creating…' : 'Create a sandbox'}
- </Button>
</div>
-
- <div className="border-border/60 mt-4 border-t pt-4">
- <p className="text-muted-foreground mb-2 text-xs">Get started:</p>
- <div className="flex flex-wrap gap-2">
- {SANDBOX_EXAMPLES.map((ex) => (
- <button
- key={ex.label}
- type="button"
- onClick={() => createSandboxMutation.mutate(ex.intent)}
- disabled={creatingSandbox}
- className="border-border bg-background hover:bg-secondary text-foreground inline-flex items-center gap-1.5 rounded-full border px-3 py-1.5 text-xs font-medium transition-colors disabled:opacity-50"
- >
- <ex.icon className="size-3.5" />
- {ex.label}
- </button>
- ))}
- </div>
- <CodeOffRamp
- className="mt-3"
- tabs={SANDBOX_CODE}
- docs="https://docs.opencomputer.dev/quickstart"
- />
+ </section>
+
+ <section
+ id="api"
+ className="border-border/70 mt-16 scroll-mt-8 border-t pt-10"
+ aria-labelledby="api-start-heading"
+ >
+ <div className="max-w-2xl">
+ <h2
+ id="api-start-heading"
+ className="text-foreground text-lg font-semibold tracking-tight"
+ >
+ Build with the API
+ </h2>
+ <p className="text-muted-foreground mt-1 text-sm leading-6">
+ Use the SDK when you want to own the product flow. The same API key
+ works across compute and agent sessions.
+ </p>
</div>
- <p className="text-muted-foreground mt-3 text-xs">
- {creatingSandbox
- ? 'Booting a fresh cloud VM…'
- : 'Ubuntu · Python and Node.js preinstalled · Interactive terminal'}
- </p>
- {createSandboxMutation.isError ? (
- <div className="mt-3 flex items-center gap-3">
- <span className="text-status-error text-sm">
- Couldn&apos;t create the sandbox.
- </span>
- <button
- className="text-foreground text-sm font-medium underline underline-offset-4"
- onClick={() => createSandboxMutation.mutate({})}
- >
- Retry
- </button>
- </div>
- ) : null}
- </Panel>
-
- {/* Terminal / power-user path — available, not the required first step */}
- <div>
- <button
- type="button"
- onClick={() => setShowTerminal((v) => !v)}
- className="text-muted-foreground hover:text-foreground flex items-center gap-1.5 px-1 text-xs font-medium"
- >
- <ChevronDown
- className={`size-3.5 transition-transform ${showTerminal ? '' : '-rotate-90'}`}
- />
- Prefer the command line? Use OpenComputer with Claude Code or the CLI
- </button>
-
- {showTerminal ? (
- <div className="mt-3 space-y-4">
- <StepCard
- index={1}
- title="Install the OpenComputer skill"
- description="Adds OpenComputer controls to Claude Code so you can create and manage agents, sessions, and sandboxes from your terminal."
- >
- <CopyRow value={SKILL_INSTALL_CMD} />
- </StepCard>
+ <Panel className="mt-5 p-5">
+ <div className="grid gap-4 sm:grid-cols-[11rem_minmax(0,1fr)] sm:items-start">
+ <div className="flex items-center gap-2">
+ <KeyRound className="text-muted-foreground size-4" aria-hidden />
+ <div>
+ <h3 className="text-sm font-semibold">Your API key</h3>
+ <p className="text-muted-foreground mt-0.5 text-xs">
+ OPENCOMPUTER_API_KEY
+ </p>
+ </div>
+ </div>
- <StepCard
- index={2}
- title="Your API key"
- description="The skill uses this key to authenticate with OpenComputer. We've created a Default key for you — copy it now, you won't be able to see it again."
- >
- {loadingKeys || createMutation.isPending ? (
- <p className="text-muted-foreground text-sm">
+ <div className="min-w-0">
+ {keysQuery.isLoading || createMutation.isPending ? (
+ <p className="text-muted-foreground py-2 text-sm">
Preparing your API key…
</p>
) : null}
{createdKey ? (
- <div className="space-y-2.5">
+ <div className="space-y-2">
<CopyRow value={createdKey} maskable />
<p className="text-muted-foreground text-xs">
- Then run this in your terminal to configure the CLI:
+ Copy it now. For security, it cannot be shown again.
</p>
- <CopyRow
- value={createdKey}
- maskable
- transform={(s) => `oc config set api-key ${s}`}
- />
</div>
) : null}
{!createdKey && !createMutation.isPending && hasKeys ? (
- <p className="text-muted-foreground text-sm">
- You already have {keys!.length} API key
- {keys!.length === 1 ? '' : 's'} from a previous session. For
- security, existing key values can&apos;t be re-displayed.{' '}
- <Link
- to="/api-keys"
- className="text-foreground font-medium underline underline-offset-4"
+ <div className="flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between">
+ <p className="text-muted-foreground text-sm">
+ API key ready. Existing secret values cannot be displayed.
+ </p>
+ <Button size="sm" variant="outline" asChild>
+ <Link to="/api-keys">Manage keys</Link>
+ </Button>
+ </div>
+ ) : null}
+
+ {keysQuery.isError ? (
+ <div className="flex flex-wrap items-center gap-3">
+ <span className="text-status-error text-sm">
+ Couldn&apos;t load your API keys.
+ </span>
+ <Button
+ size="sm"
+ variant="outline"
+ onClick={() => void keysQuery.refetch()}
>
- Manage keys
- </Link>{' '}
- to rotate.
- </p>
+ Retry
+ </Button>
+ </div>
) : null}
{createMutation.isError ? (
- <div className="flex items-center gap-3">
+ <div className="flex flex-wrap items-center gap-3">
<span className="text-status-error text-sm">
- Failed to create your API key.
+ Couldn&apos;t create your API key.
</span>
- <button
- className="text-foreground text-sm font-medium underline underline-offset-4"
+ <Button
+ size="sm"
+ variant="outline"
onClick={() => createMutation.mutate()}
>
Retry
- </button>
+ </Button>
</div>
) : null}
- </StepCard>
+ </div>
</div>
- ) : null}
- </div>
+ </Panel>
+
+ <div className="mt-8 grid gap-10 md:grid-cols-2 md:gap-0 md:divide-x">
+ <ApiExample
+ icon={Boxes}
+ title="Sandboxes"
+ description="Create isolated computers and control their files, commands, processes, and network."
+ code={SANDBOX_API_CODE}
+ docs="https://docs.opencomputer.dev/quickstart"
+ />
+ <ApiExample
+ icon={MessagesSquare}
+ title="Durable agent sessions"
+ description="Create an agent, start a durable run, then stream and steer its event log."
+ code={SESSION_API_CODE}
+ docs="https://docs.opencomputer.dev/agent-sessions/quickstart"
+ className="md:pl-8"
+ />
+ </div>
+ </section>
</div>
)
}
-function StepCard({
- index,
+function ApiExample({
+ icon: Icon,
title,
description,
- children,
+ code,
+ docs,
+ className,
}: {
- index: number
+ icon: typeof Boxes
title: string
description: string
- children: ReactNode
+ code: string
+ docs: string
+ className?: string
}) {
+ const [copied, markCopied] = useTransientFlag(1500)
+
+ const copy = () => {
+ void navigator.clipboard.writeText(code).then(
+ () => markCopied(),
+ (error: unknown) => notifyError("Couldn't copy to clipboard.", error),
+ )
+ }
+
return (
- <Panel className="p-5">
- <div className="flex items-start gap-4">
- <span className="bg-secondary flex size-7 shrink-0 items-center justify-center rounded-full font-mono text-sm font-semibold">
- {index}
+ <article className={className}>
+ <div className="flex items-start gap-3">
+ <span className="bg-secondary mt-0.5 flex size-8 shrink-0 items-center justify-center rounded-md">
+ <Icon className="text-muted-foreground size-4" aria-hidden />
</span>
- <div className="flex-1 space-y-3">
- <div className="space-y-1">
- <h3 className="text-foreground text-sm font-semibold">{title}</h3>
- <p className="text-muted-foreground text-sm">{description}</p>
- </div>
- {children}
+ <div>
+ <h3 className="text-sm font-semibold">{title}</h3>
+ <p className="text-muted-foreground mt-1 text-sm leading-6">
+ {description}
+ </p>
</div>
</div>
- </Panel>
+
+ <div className="bg-panel-2 relative mt-4 overflow-hidden rounded-lg border">
+ <pre className="overflow-x-auto p-4 pr-12 font-mono text-xs leading-5">
+ <code>{code}</code>
+ </pre>
+ <Button
+ type="button"
+ size="icon-sm"
+ variant="ghost"
+ className="bg-panel-2 absolute top-2 right-2"
+ onClick={copy}
+ aria-label={copied ? 'Copied' : `Copy ${title} example`}
+ >
+ {copied ? (
+ <Check className="size-3.5" />
+ ) : (
+ <Copy className="size-3.5" />
+ )}
+ </Button>
+ </div>
+
+ <a
+ href={docs}
+ target="_blank"
+ rel="noreferrer"
+ className="text-muted-foreground hover:text-foreground mt-3 inline-flex items-center gap-1.5 text-xs font-medium underline-offset-4 hover:underline"
+ >
+ Read the guide
+ <ExternalLink className="size-3" aria-hidden />
+ </a>
+ </article>
)
}
diff --git a/web/src/pages/getting-started.test.tsx b/web/src/pages/getting-started.test.tsx
new file mode 100644
index 00000000..5a91e215
--- /dev/null
+++ b/web/src/pages/getting-started.test.tsx
@@ -0,0 +1,70 @@
+import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
+import { renderToStaticMarkup } from 'react-dom/server'
+import { MemoryRouter } from 'react-router-dom'
+import { describe, expect, it } from 'vitest'
+import type { APIKey, DeployApp } from '@/api/client'
+import { GettingStarted } from './Dashboard'
+
+function renderGettingStarted() {
+ const app: DeployApp = {
+ installed: true,
+ install_url: null,
+ configure_url: 'https://github.com/settings/installations/1',
+ account: 'example',
+ repository_selection: 'selected',
+ repositories: [
+ {
+ id: 'repo_0123456789abcdef01234567',
+ full_name: 'example/flue-starter',
+ default_branch: 'main',
+ private: false,
+ linked_sources: [],
+ },
+ ],
+ }
+ const keys: APIKey[] = [
+ {
+ id: 'key_0123456789abcdef01234567',
+ orgId: 'org_0123456789abcdef01234567',
+ keyPrefix: 'osb_example',
+ name: 'Default',
+ scopes: [],
+ createdAt: '2026-07-17T00:00:00.000Z',
+ },
+ ]
+ const queryClient = new QueryClient({
+ defaultOptions: { queries: { retry: false, staleTime: Infinity } },
+ })
+ queryClient.setQueryData(['deploy-app'], app)
+ queryClient.setQueryData(['api-keys'], keys)
+
+ return renderToStaticMarkup(
+ <QueryClientProvider client={queryClient}>
+ <MemoryRouter>
+ <GettingStarted />
+ </MemoryRouter>
+ </QueryClientProvider>,
+ )
+}
+
+describe('getting started', () => {
+ it('leads with the shared repository flow and keeps both API paths visible', () => {
+ const markup = renderGettingStarted()
+
+ expect(markup).toContain('Deploy an agent from GitHub')
+ expect(markup).toContain('example/flue-starter')
+ expect(markup).toContain('Choose repository')
+
+ expect(markup).toContain('Build with the API')
+ expect(markup).toContain('API key ready')
+ expect(markup).toContain('Sandboxes')
+ expect(markup).toContain('Durable agent sessions')
+ expect(markup).toContain('Sandbox.create()')
+ expect(markup).toContain('oc.sessions.create')
+
+ expect(markup).not.toContain('free credits')
+ expect(markup).not.toContain('Claude Opus')
+ expect(markup).not.toContain('Analyze a CSV')
+ expect(markup).not.toContain('Build a web app')
+ })
+})