Skip to content

An open-source, faster Devin alternative

TypeScript

feat(web): subtle per-page API hint (endpoint · SDK · docs)

Igor Zalutskibdfb50441de2
diff --git a/web/src/components/api-hint.tsx b/web/src/components/api-hint.tsx
new file mode 100644
index 00000000..0724fdcb
--- /dev/null
+++ b/web/src/components/api-hint.tsx
@@ -0,0 +1,45 @@
+import { ExternalLink } from 'lucide-react'
+
+export type ApiRef = {
+ method?: string
+ path?: string
+ sdk?: string
+ docs?: string
+}
+
+// A subtle "this page is an API" hint — the REST endpoint, the SDK call, and a
+// docs link. Every screen here is a thin control panel over the public API/SDK;
+// this nudges users toward driving it programmatically. Understated by design
+// (muted, mono, small) so it reads as metadata, not chrome.
+export function ApiHint({ method, path, sdk, docs }: ApiRef) {
+ if (!path && !sdk && !docs) return null
+ return (
+ <div className="text-muted-foreground/70 flex flex-wrap items-center gap-x-2.5 gap-y-1 pt-1 text-xs">
+ {path ? (
+ <span className="font-mono">
+ {method ? (
+ <span className="text-muted-foreground/50">{method} </span>
+ ) : null}
+ {path}
+ </span>
+ ) : null}
+ {sdk ? (
+ <span className="text-muted-foreground/50 font-mono">
+ {path ? '· ' : ''}
+ {sdk}
+ </span>
+ ) : null}
+ {docs ? (
+ <a
+ href={docs}
+ target="_blank"
+ rel="noreferrer"
+ className="hover:text-foreground inline-flex items-center gap-1 underline-offset-4 hover:underline"
+ >
+ Docs
+ <ExternalLink className="size-3" />
+ </a>
+ ) : null}
+ </div>
+ )
+}
diff --git a/web/src/components/page-header.tsx b/web/src/components/page-header.tsx
index 7d63e468..a2f72245 100644
--- a/web/src/components/page-header.tsx
+++ b/web/src/components/page-header.tsx
@@ -1,21 +1,24 @@
import type { ReactNode } from 'react'
import { cn } from '@/lib/utils'
+import { ApiHint, type ApiRef } from '@/components/api-hint'
export function PageHeader({
title,
description,
actions,
+ api,
className,
}: {
title: ReactNode
description?: ReactNode
actions?: ReactNode
+ api?: ApiRef
className?: string
}) {
return (
<div
className={cn(
- 'mb-6 flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between',
+ 'mb-6 flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between',
className,
)}
>
@@ -26,6 +29,7 @@ export function PageHeader({
{description ? (
<p className="text-muted-foreground text-sm">{description}</p>
) : null}
+ {api ? <ApiHint {...api} /> : null}
</div>
{actions ? (
<div className="flex shrink-0 items-center gap-2">{actions}</div>
diff --git a/web/src/pages/Agents.tsx b/web/src/pages/Agents.tsx
index e06e21b1..3a4e8955 100644
--- a/web/src/pages/Agents.tsx
+++ b/web/src/pages/Agents.tsx
@@ -149,6 +149,12 @@ export default function Agents() {
<PageHeader
title="Agents"
description="Reusable definitions — a prompt, model, and runtime a session runs."
+ api={{
+ method: 'POST',
+ path: '/v3/agents',
+ sdk: 'oc.agents.create()',
+ docs: 'https://docs.opencomputer.dev/agent-sessions/agents',
+ }}
actions={
<Button onClick={() => setShowCreate(true)}>
<Plus className="size-4" />
diff --git a/web/src/pages/Checkpoints.tsx b/web/src/pages/Checkpoints.tsx
index 040c2873..549b4734 100644
--- a/web/src/pages/Checkpoints.tsx
+++ b/web/src/pages/Checkpoints.tsx
@@ -163,6 +163,10 @@ export default function Checkpoints() {
<PageHeader
title="Checkpoints"
description="Sandbox snapshots across your organization"
+ api={{
+ sdk: 'sandbox.checkpoints.list()',
+ docs: 'https://docs.opencomputer.dev/sandboxes/checkpoints',
+ }}
actions={
<label
htmlFor="show-failed"
diff --git a/web/src/pages/SandboxWebhooks.tsx b/web/src/pages/SandboxWebhooks.tsx
index 6f4648f3..75d9358e 100644
--- a/web/src/pages/SandboxWebhooks.tsx
+++ b/web/src/pages/SandboxWebhooks.tsx
@@ -118,6 +118,12 @@ export default function SandboxWebhooks() {
<PageHeader
title="Webhooks"
description="Deliver sandbox lifecycle events (created, ready, stopped, …) to your endpoints, signed and retried."
+ api={{
+ method: 'POST',
+ path: '/api/webhooks',
+ sdk: 'Webhooks.create()',
+ docs: 'https://docs.opencomputer.dev/sandboxes/webhooks',
+ }}
actions={
<Button onClick={() => setShowAdd(true)}>
<Plus className="size-4" />
diff --git a/web/src/pages/Sandboxes.tsx b/web/src/pages/Sandboxes.tsx
index b2223de2..65b3145d 100644
--- a/web/src/pages/Sandboxes.tsx
+++ b/web/src/pages/Sandboxes.tsx
@@ -142,7 +142,16 @@ export default function Sandboxes() {
return (
<div>
- <PageHeader title="Sandboxes" description="Active and recent sandboxes" />
+ <PageHeader
+ title="Sandboxes"
+ description="Active and recent sandboxes"
+ api={{
+ method: 'POST',
+ path: '/api/sandboxes',
+ sdk: 'Sandbox.create()',
+ docs: 'https://docs.opencomputer.dev/sandboxes/overview',
+ }}
+ />
<ActivityChart sessions={allSessions ?? []} loading={loadingAll} />
diff --git a/web/src/pages/SessionDetail.tsx b/web/src/pages/SessionDetail.tsx
index 16c59bfe..2d8a6244 100644
--- a/web/src/pages/SessionDetail.tsx
+++ b/web/src/pages/SessionDetail.tsx
@@ -20,6 +20,7 @@ import { StatusBadge } from '@/components/status-badge'
import { EmptyState } from '@/components/empty-state'
import { ConfirmDialog } from '@/components/confirm-dialog'
import { SessionWebhooks } from '@/components/session-webhooks'
+import { ApiHint } from '@/components/api-hint'
import { MessagesSquare } from 'lucide-react'
import { cn } from '@/lib/utils'
@@ -181,6 +182,12 @@ export default function SessionDetail() {
? new Date(session.created_at).toLocaleString()
: '—'}
</p>
+ <ApiHint
+ method="GET"
+ path="/v3/sessions/:id"
+ sdk="oc.sessions.get()"
+ docs="https://docs.opencomputer.dev/agent-sessions/sessions"
+ />
</div>
<div className="flex items-center gap-2">
{canCancel ? (
diff --git a/web/src/pages/Sessions.tsx b/web/src/pages/Sessions.tsx
index 397431c2..0815728e 100644
--- a/web/src/pages/Sessions.tsx
+++ b/web/src/pages/Sessions.tsx
@@ -111,6 +111,12 @@ export default function Sessions() {
<PageHeader
title="Sessions"
description="Durable agent runs — an append-only event log you can steer."
+ api={{
+ method: 'POST',
+ path: '/v3/sessions',
+ sdk: 'oc.sessions.create()',
+ docs: 'https://docs.opencomputer.dev/agent-sessions/sessions',
+ }}
actions={
<Button onClick={openStart}>
<Plus className="size-4" />
diff --git a/web/src/pages/Templates.tsx b/web/src/pages/Templates.tsx
index 79341872..e52fcda0 100644
--- a/web/src/pages/Templates.tsx
+++ b/web/src/pages/Templates.tsx
@@ -145,6 +145,10 @@ export default function Templates() {
<PageHeader
title="Templates"
description="Declarative image snapshots for your organization"
+ api={{
+ sdk: 'Templates.list()',
+ docs: 'https://docs.opencomputer.dev/sandboxes/templates',
+ }}
/>
<Panel className="overflow-hidden">