Skip to content

An open-source, faster Devin alternative

TypeScript

feat(web): surface repository deployment history

Igor Zalutskic0716381358d
diff --git a/web/src/api/client.ts b/web/src/api/client.ts
index 22f970df..2a779302 100644
--- a/web/src/api/client.ts
+++ b/web/src/api/client.ts
@@ -661,13 +661,32 @@ export const unlinkDeploymentSource = (agentId: string) =>
apiFetch<void>(`/v3/agents/${agentId}/deployment-source`, { method: 'DELETE' })
// Deploy the linked repo's current production-branch HEAD now (no git push needed).
-// Returns { deployment } — fire-and-refetch, so we don't validate the body.
-export const deployFromGithub = (agentId: string) =>
- apiFetch<{ deployment?: { id: string; state: string } }>(
- `/v3/agents/${agentId}/deployments`,
- { method: 'POST', body: JSON.stringify({ input: { type: 'github' } }) },
+export const deployFromGithub = (agentId: string, idempotencyKey: string) =>
+ apiFetch(
+ `/v3/agents/${encodeURIComponent(agentId)}/deployments`,
+ {
+ method: 'POST',
+ body: JSON.stringify({ input: { type: 'github' } }),
+ headers: { 'Idempotency-Key': idempotencyKey },
+ },
+ S.AgentDeploymentCommandResponseSchema,
)
+export const getAgentDeployments = (
+ agentId: string,
+ options: { before?: string; limit?: number } = {},
+) => {
+ const query = new URLSearchParams()
+ if (options.before) query.set('before', options.before)
+ if (options.limit) query.set('limit', String(options.limit))
+ const qs = query.toString()
+ return apiFetch(
+ `/v3/agents/${encodeURIComponent(agentId)}/deployments${qs ? `?${qs}` : ''}`,
+ {},
+ S.AgentDeploymentListSchema,
+ )
+}
+
export const getAgentDeployment = (agentId: string, deploymentId: string) =>
apiFetch(
`/v3/agents/${encodeURIComponent(agentId)}/deployments/${encodeURIComponent(deploymentId)}`,
diff --git a/web/src/api/deployment-schemas.test.ts b/web/src/api/deployment-schemas.test.ts
index a443b199..5c8677cf 100644
--- a/web/src/api/deployment-schemas.test.ts
+++ b/web/src/api/deployment-schemas.test.ts
@@ -1,5 +1,7 @@
import { describe, expect, it } from 'vitest'
import {
+ AgentDeploymentCommandResponseSchema,
+ AgentDeploymentListSchema,
AgentDeploymentLogsSchema,
AgentDeploymentSchema,
DeployAppSchema,
@@ -106,6 +108,39 @@ describe('repository deployment API schemas', () => {
expect(parsed.data[0]?.seq).toBe(seq)
})
+ it('parses the exact cursor envelope for deployment history', () => {
+ const parsed = AgentDeploymentListSchema.parse({
+ data: [deployment],
+ next_cursor: 'opaque-history-cursor',
+ })
+
+ expect(parsed.data[0]?.id).toBe(deployment.id)
+ expect(parsed.next_cursor).toBe('opaque-history-cursor')
+ expect(() =>
+ AgentDeploymentListSchema.parse({ data: [deployment] }),
+ ).toThrow()
+ })
+
+ it('requires the deployment id returned by a deploy command', () => {
+ const response = {
+ deployment: {
+ id: 'dep_0123456789abcdef01234567',
+ state: 'accepted',
+ revision_id: null,
+ active: false,
+ },
+ }
+
+ expect(
+ AgentDeploymentCommandResponseSchema.parse(response).deployment.id,
+ ).toBe(response.deployment.id)
+ expect(() =>
+ AgentDeploymentCommandResponseSchema.parse({
+ deployment: { ...response.deployment, id: undefined },
+ }),
+ ).toThrow()
+ })
+
it('filters repositories without a registered import coordinate safely', () => {
const parsed = DeployAppSchema.parse({
installed: true,
diff --git a/web/src/api/mock.ts b/web/src/api/mock.ts
index 2ba4409e..2db4c7d6 100644
--- a/web/src/api/mock.ts
+++ b/web/src/api/mock.ts
@@ -689,6 +689,7 @@ const failedFlueDeployment = {
retryable: false,
},
error_class: 'install_failed',
+ allowed_actions: ['view_commit', 'deploy_latest'],
finished_at: at(0, 0),
timing: {
...flueDeployment.timing,
@@ -1136,7 +1137,22 @@ const ROUTES: Array<[RegExp, Handler]> = [
/^\/v3\/agents\/[^/]+\/deployments\/dep_flue_failed$/,
() => failedFlueDeployment,
],
+ [
+ /^\/v3\/agents\/agt_flue_import\/deployments(?:\?.*)?$/,
+ () => ({
+ data: [flueDeployment, failedFlueDeployment],
+ next_cursor: null,
+ }),
+ ],
+ [
+ /^\/v3\/agents\/[^/]+\/deployments(?:\?.*)?$/,
+ () => ({ data: [], next_cursor: null }),
+ ],
[/^\/v3\/agents\/[^/]+\/deployments\/[^/]+$/, () => flueDeployment],
+ [
+ /^\/v3\/agents\/agt_flue_import\/deployment-source$/,
+ () => ({ source: importedSource }),
+ ],
[
/^\/v3\/agents\/[^/]+\/deployment-source$/,
() =>
@@ -1147,7 +1163,7 @@ const ROUTES: Array<[RegExp, Handler]> = [
[/^\/v3\/agents\/[^/]+\/skills$/, () => agentSkills],
[/^\/v3\/agents\/agt_flue_import$/, () => importedAgent],
[/^\/v3\/agents\/[^/]+$/, () => agents[0]],
- [/^\/v3\/agents$/, () => ({ data: agents })],
+ [/^\/v3\/agents$/, () => ({ data: [...agents, importedAgent] })],
[/^\/v3\/credentials$/, () => ({ data: credentials })],
[/^\/v3\/sessions\/[^/]+\/events/, () => ({ data: sessionEvents })],
[/^\/v3\/sessions\/[^/]+\/turns$/, () => ({ data: sessionTurns })],
@@ -1182,6 +1198,17 @@ const POST_ROUTES: [RegExp, () => unknown][] = [
deployment: flueDeployment,
}),
],
+ [
+ /^\/v3\/agents\/[^/]+\/deployments$/,
+ () => ({
+ deployment: {
+ id: flueDeployment.id,
+ state: flueDeployment.state,
+ revision_id: flueDeployment.revision_id,
+ active: flueDeployment.active,
+ },
+ }),
+ ],
[/^\/v3\/agents$/, () => agents[0]],
[/^\/v3\/agents\/[^/]+\/slack\/manifest$/, () => slackManifest],
[
diff --git a/web/src/api/schemas.ts b/web/src/api/schemas.ts
index 1ece4c33..7e7f233c 100644
--- a/web/src/api/schemas.ts
+++ b/web/src/api/schemas.ts
@@ -518,6 +518,20 @@ export const AgentDeploymentSchema = z.object({
finished_at: z.string().nullish(),
})
+export const AgentDeploymentListSchema = z.object({
+ data: z.array(AgentDeploymentSchema),
+ next_cursor: z.string().nullable(),
+})
+
+export const AgentDeploymentCommandResponseSchema = z.object({
+ deployment: z.object({
+ id: z.string(),
+ state: z.string(),
+ revision_id: z.string().nullish(),
+ active: z.boolean(),
+ }),
+})
+
export const AgentDeploymentLogSchema = z.object({
// Postgres bigint serializers may return a decimal string. Treat this as an
// opaque cursor/identity in the dashboard rather than narrowing it to JS's
diff --git a/web/src/components/agent-deployments.tsx b/web/src/components/agent-deployments.tsx
new file mode 100644
index 00000000..09a622df
--- /dev/null
+++ b/web/src/components/agent-deployments.tsx
@@ -0,0 +1,218 @@
+import { useInfiniteQuery } from '@tanstack/react-query'
+import { Link } from 'react-router-dom'
+import { GitBranch, History } from 'lucide-react'
+import { getAgentDeployments, type AgentDeployment } from '@/api/client'
+import { EmptyState } from '@/components/empty-state'
+import {
+ Panel,
+ PanelContent,
+ PanelDescription,
+ PanelFooter,
+ PanelHeader,
+ PanelTitle,
+} from '@/components/panel'
+import { ResourceTable, type Column } from '@/components/resource-table'
+import { StatusBadge } from '@/components/status-badge'
+import { Alert, AlertDescription, AlertTitle } from '@/components/ui/alert'
+import { Button } from '@/components/ui/button'
+
+function titleCase(value: string): string {
+ const words = value.replace(/_/g, ' ')
+ return words.charAt(0).toUpperCase() + words.slice(1)
+}
+
+function deploymentResult(deployment: AgentDeployment): string {
+ if (deployment.error?.class) return titleCase(deployment.error.class)
+ if (deployment.revision?.number != null) {
+ return `Revision #${deployment.revision.number}${deployment.active ? ' · Active' : ''}`
+ }
+ if (deployment.state === 'skipped') return 'No change'
+ if (deployment.result) return titleCase(deployment.result)
+ return titleCase(deployment.phase)
+}
+
+function DeploymentSource({ deployment }: { deployment: AgentDeployment }) {
+ const relation = deployment.source_relation
+ const repo = relation?.repo?.full_name
+ const ref = relation?.ref ?? relation?.production_ref ?? deployment.ref
+ const sha = relation?.sha ?? deployment.sha
+
+ if (!repo && !ref && !sha) {
+ return (
+ <span className="text-muted-foreground text-xs capitalize">
+ {deployment.input_type}
+ </span>
+ )
+ }
+
+ return (
+ <span className="block min-w-0">
+ <span className="text-foreground flex items-center gap-1 text-xs">
+ <GitBranch className="size-3 shrink-0" aria-hidden />
+ <span className="max-w-52 truncate" title={repo ?? undefined}>
+ {repo ?? 'Repository'}
+ </span>
+ </span>
+ <span className="text-muted-foreground mt-0.5 block font-mono text-xs">
+ {[ref, sha?.slice(0, 7)].filter(Boolean).join(' · ')}
+ </span>
+ </span>
+ )
+}
+
+export function AgentDeployments({ agentId }: { agentId: string }) {
+ const deploymentsQuery = useInfiniteQuery({
+ queryKey: ['agent-deployments', agentId],
+ initialPageParam: null as string | null,
+ queryFn: ({ pageParam }) =>
+ getAgentDeployments(agentId, {
+ before: pageParam ?? undefined,
+ limit: 25,
+ }),
+ getNextPageParam: (lastPage) => lastPage.next_cursor,
+ refetchInterval: (query) =>
+ query.state.data?.pages.some((page) =>
+ page.data.some((deployment) => !deployment.terminal),
+ )
+ ? 2500
+ : false,
+ })
+
+ const deployments = Array.from(
+ new Map(
+ (deploymentsQuery.data?.pages.flatMap((page) => page.data) ?? []).map(
+ (deployment) => [deployment.id, deployment],
+ ),
+ ).values(),
+ )
+
+ const columns: Column<AgentDeployment>[] = [
+ {
+ key: 'deployment',
+ header: 'Deployment',
+ cell: (deployment) => (
+ <Link
+ to={`/agents/${agentId}/deployments/${deployment.id}`}
+ className="text-foreground font-mono text-xs underline-offset-4 hover:underline"
+ >
+ {deployment.id}
+ </Link>
+ ),
+ },
+ {
+ key: 'status',
+ header: 'Status',
+ cell: (deployment) => <StatusBadge status={deployment.state} />,
+ },
+ {
+ key: 'source',
+ header: 'Source',
+ cell: (deployment) => <DeploymentSource deployment={deployment} />,
+ },
+ {
+ key: 'result',
+ header: 'Result',
+ cell: (deployment) => (
+ <span
+ className="text-muted-foreground block max-w-48 truncate text-xs"
+ title={deploymentResult(deployment)}
+ >
+ {deploymentResult(deployment)}
+ </span>
+ ),
+ },
+ {
+ key: 'created',
+ header: 'Created',
+ align: 'right',
+ cell: (deployment) => (
+ <time
+ dateTime={deployment.created_at}
+ className="text-muted-foreground font-mono text-xs whitespace-nowrap"
+ >
+ {new Date(deployment.created_at).toLocaleString()}
+ </time>
+ ),
+ },
+ ]
+
+ const initialError = deploymentsQuery.isError && deployments.length === 0
+
+ return (
+ <Panel className="overflow-hidden">
+ <PanelHeader>
+ <div>
+ <PanelTitle>Deployments</PanelTitle>
+ <PanelDescription className="mt-1">
+ Each build attempt keeps its source, outcome, and persisted log.
+ </PanelDescription>
+ </div>
+ </PanelHeader>
+
+ {initialError ? (
+ <PanelContent>
+ <Alert variant="destructive">
+ <AlertTitle>Deployment history could not be loaded</AlertTitle>
+ <AlertDescription>
+ Retry this read. Existing deployments and logs are unchanged.
+ </AlertDescription>
+ <div className="mt-2">
+ <Button
+ size="sm"
+ variant="outline"
+ onClick={() => void deploymentsQuery.refetch()}
+ >
+ Retry history
+ </Button>
+ </div>
+ </Alert>
+ </PanelContent>
+ ) : (
+ <ResourceTable
+ columns={columns}
+ rows={deployments}
+ rowKey={(deployment) => deployment.id}
+ loading={deploymentsQuery.isLoading}
+ empty={
+ <EmptyState
+ icon={History}
+ title="No deployments yet"
+ description="Repository imports and deploys will appear here with their build logs."
+ />
+ }
+ />
+ )}
+
+ {!initialError &&
+ (deploymentsQuery.hasNextPage || deploymentsQuery.error) ? (
+ <PanelFooter className="justify-between">
+ <span className="text-muted-foreground text-xs">
+ {deploymentsQuery.error
+ ? 'History could not be refreshed.'
+ : 'Newest deployments first.'}
+ </span>
+ {deploymentsQuery.hasNextPage ? (
+ <Button
+ size="sm"
+ variant="outline"
+ disabled={deploymentsQuery.isFetchingNextPage}
+ onClick={() => void deploymentsQuery.fetchNextPage()}
+ >
+ {deploymentsQuery.isFetchingNextPage
+ ? 'Loading…'
+ : 'Load older deployments'}
+ </Button>
+ ) : deploymentsQuery.error ? (
+ <Button
+ size="sm"
+ variant="outline"
+ onClick={() => void deploymentsQuery.refetch()}
+ >
+ Retry history
+ </Button>
+ ) : null}
+ </PanelFooter>
+ ) : null}
+ </Panel>
+ )
+}
diff --git a/web/src/components/status-badge.tsx b/web/src/components/status-badge.tsx
index cb6fce7d..5e1ecdbd 100644
--- a/web/src/components/status-badge.tsx
+++ b/web/src/components/status-badge.tsx
@@ -29,6 +29,11 @@ const STATUS: Record<string, Meta> = {
active: { tone: 'running', label: 'Active', icon: CircleCheck },
success: { tone: 'running', label: 'Success', icon: CircleCheck },
stopped: { tone: 'stopped', label: 'Stopped', icon: CircleSlash },
+ not_deployed: {
+ tone: 'stopped',
+ label: 'Not deployed',
+ icon: CircleSlash,
+ },
canceled: { tone: 'stopped', label: 'Canceled', icon: CircleSlash },
unknown: { tone: 'stopped', label: 'Unknown', icon: CircleSlash },
hibernated: { tone: 'hibernated', label: 'Hibernated', icon: Moon },
@@ -82,6 +87,8 @@ const STATUS: Record<string, Meta> = {
deleting: { tone: 'pending', label: 'Deleting', icon: Loader2, spin: true },
error: { tone: 'error', label: 'Error', icon: CircleAlert },
failed: { tone: 'error', label: 'Failed', icon: CircleAlert },
+ unverified: { tone: 'error', label: 'Unverified', icon: CircleAlert },
+ verified: { tone: 'running', label: 'Verified', icon: CircleCheck },
superseded: { tone: 'stopped', label: 'Superseded', icon: CircleSlash },
skipped: { tone: 'stopped', label: 'Skipped', icon: CircleSlash },
degraded: { tone: 'error', label: 'Degraded', icon: CircleAlert },
diff --git a/web/src/lib/agent-deployment-status.test.ts b/web/src/lib/agent-deployment-status.test.ts
new file mode 100644
index 00000000..257d182c
--- /dev/null
+++ b/web/src/lib/agent-deployment-status.test.ts
@@ -0,0 +1,75 @@
+import { describe, expect, it } from 'vitest'
+import { agentDeploymentDisplayStatus } from './agent-deployment-status'
+
+const baseAgent = {
+ runtime: 'flue',
+ revision: 2,
+ active_revision_id: 'rev_123',
+ flue: {
+ agent_name: 'support',
+ live: {
+ status: 'verified',
+ },
+ },
+}
+
+describe('agent deployment display status', () => {
+ it('does not present a live-touching unverified deployment as ready', () => {
+ expect(
+ agentDeploymentDisplayStatus({
+ ...baseAgent,
+ deployment_status: {
+ deployment_id: 'dep_123',
+ state: 'ready',
+ result: 'created',
+ error_class: null,
+ live_touched: true,
+ live_status: 'unverified',
+ updated_at: '2026-07-14T20:00:00.000Z',
+ },
+ }),
+ ).toBe('unverified')
+ })
+
+ it('keeps a terminal failure visible even when an older live revision exists', () => {
+ expect(
+ agentDeploymentDisplayStatus({
+ ...baseAgent,
+ deployment_status: {
+ deployment_id: 'dep_124',
+ state: 'failed',
+ result: 'failed',
+ error_class: 'build_failed',
+ live_touched: false,
+ live_status: 'verified',
+ updated_at: '2026-07-14T20:00:00.000Z',
+ },
+ }),
+ ).toBe('failed')
+ })
+
+ it('uses the live pointer when deployment status is unavailable', () => {
+ expect(
+ agentDeploymentDisplayStatus({
+ ...baseAgent,
+ deployment_status: undefined,
+ flue: {
+ agent_name: 'support',
+ live: { status: 'unverified' },
+ },
+ }),
+ ).toBe('unverified')
+ })
+
+ it('labels an agent without a deployment or revision explicitly', () => {
+ expect(
+ agentDeploymentDisplayStatus({
+ runtime: 'flue',
+ revision: 0,
+ active_revision_id: null,
+ deployment_status: undefined,
+ flue: { agent_name: 'support', live: null },
+ }),
+ ).toBe('not_deployed')
+ })
+})
diff --git a/web/src/lib/agent-deployment-status.ts b/web/src/lib/agent-deployment-status.ts
new file mode 100644
index 00000000..47e1acd3
--- /dev/null
+++ b/web/src/lib/agent-deployment-status.ts
@@ -0,0 +1,28 @@
+import type { Agent } from '@/api/client'
+
+type AgentDeploymentHealth = Pick<
+ Agent,
+ 'runtime' | 'revision' | 'active_revision_id' | 'deployment_status' | 'flue'
+>
+
+/**
+ * The latest deployment is the primary status. A successful row is only
+ * healthy when a live-touching Flue deploy also left the live pointer verified.
+ */
+export function agentDeploymentDisplayStatus(
+ agent: AgentDeploymentHealth,
+): string {
+ const deployment = agent.deployment_status
+ const liveStatus = deployment?.live_status ?? agent.flue?.live?.status ?? null
+ const hasActiveRevision =
+ !!agent.active_revision_id || (agent.revision ?? 0) > 0
+ const status =
+ deployment?.state ?? (hasActiveRevision ? 'ready' : 'not_deployed')
+ const liveWasTouched = deployment?.live_touched ?? agent.flue?.live != null
+
+ if (status === 'ready' && liveWasTouched && liveStatus !== 'verified') {
+ return liveStatus === 'uploading' ? 'uploading' : 'unverified'
+ }
+
+ return status
+}
diff --git a/web/src/pages/AgentDeployment.tsx b/web/src/pages/AgentDeployment.tsx
index 4029e067..aedec1be 100644
--- a/web/src/pages/AgentDeployment.tsx
+++ b/web/src/pages/AgentDeployment.tsx
@@ -1,6 +1,6 @@
-import { Fragment, useEffect } from 'react'
-import { useQuery, useQueryClient } from '@tanstack/react-query'
-import { Link, useParams } from 'react-router-dom'
+import { Fragment, useEffect, useRef } from 'react'
+import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query'
+import { Link, useNavigate, useParams } from 'react-router-dom'
import {
ArrowLeft,
ArrowRight,
@@ -11,8 +11,11 @@ import {
ExternalLink,
GitCommitHorizontal,
Loader2,
+ RotateCw,
} from 'lucide-react'
import {
+ ApiError,
+ deployFromGithub,
getAgent,
getAgentDeployment,
getAgentDeploymentLogs,
@@ -40,6 +43,49 @@ const PHASES = [
{ label: 'Deploy', states: ['deploying'] },
{ label: 'Verify', states: ['verifying'] },
] as const
+const DEPLOY_COMMAND_STORAGE = 'oc.flue-deploy-latest-command.v1'
+
+type DeployCommand = { fingerprint: string; key: string }
+
+function newCommandKey(): string {
+ return (
+ globalThis.crypto?.randomUUID?.() ??
+ `deploy-${Date.now()}-${Math.random().toString(36).slice(2)}`
+ )
+}
+
+function stableCommandKey(
+ fingerprint: string,
+ storageKey: string,
+ memory: { current: DeployCommand | null },
+): string {
+ if (memory.current?.fingerprint === fingerprint) return memory.current.key
+
+ try {
+ const stored = window.sessionStorage.getItem(storageKey)
+ if (stored) {
+ const parsed = JSON.parse(stored) as Partial<DeployCommand>
+ if (parsed.fingerprint === fingerprint && parsed.key) {
+ memory.current = { fingerprint, key: parsed.key }
+ return parsed.key
+ }
+ }
+ } catch {
+ // Storage can be unavailable in privacy-restricted browser contexts.
+ }
+
+ const key = newCommandKey()
+ memory.current = { fingerprint, key }
+ try {
+ window.sessionStorage.setItem(
+ storageKey,
+ JSON.stringify({ fingerprint, key }),
+ )
+ } catch {
+ // The in-memory key still makes repeated submits stable for this page load.
+ }
+ return key
+}
function errorMessage(deployment: AgentDeployment): string | undefined {
if (deployment.error?.message) return deployment.error.message
@@ -371,7 +417,10 @@ function Metadata({ deployment }: { deployment: AgentDeployment }) {
export default function AgentDeployment() {
const { agentId = '', deploymentId = '' } = useParams()
+ const navigate = useNavigate()
const queryClient = useQueryClient()
+ const deployCommand = useRef<DeployCommand | null>(null)
+ const deployCommandStorage = `${DEPLOY_COMMAND_STORAGE}:${agentId}`
const deploymentQuery = useQuery({
queryKey: ['agent-deployment', agentId, deploymentId],
queryFn: () => getAgentDeployment(agentId, deploymentId),
@@ -415,6 +464,27 @@ export default function AgentDeployment() {
enabled: !!agentId && !!deploymentId,
refetchInterval: deploymentQuery.data?.terminal ? false : 1500,
})
+ const deployLatestMutation = useMutation({
+ mutationFn: (fingerprint: string) =>
+ deployFromGithub(
+ agentId,
+ stableCommandKey(fingerprint, deployCommandStorage, deployCommand),
+ ),
+ onSuccess: ({ deployment }) => {
+ deployCommand.current = null
+ try {
+ window.sessionStorage.removeItem(deployCommandStorage)
+ } catch {
+ // Storage can be unavailable in privacy-restricted browser contexts.
+ }
+ void queryClient.invalidateQueries({
+ queryKey: ['agent-deployments', agentId],
+ })
+ void queryClient.invalidateQueries({ queryKey: ['agent', agentId] })
+ void queryClient.invalidateQueries({ queryKey: ['agents'] })
+ void navigate(`/agents/${agentId}/deployments/${deployment.id}`)
+ },
+ })
const terminal = deploymentQuery.data?.terminal ?? false
const refetchLogs = logsQuery.refetch
@@ -437,9 +507,9 @@ export default function AgentDeployment() {
return (
<div className="space-y-5">
<Button variant="ghost" size="sm" asChild>
- <Link to={`/agents/${agentId}`}>
+ <Link to={`/agents/${agentId}/deployments`}>
<ArrowLeft className="size-4" />
- Back to agent
+ Back to deployments
</Link>
</Button>
<Alert variant="destructive">
@@ -476,16 +546,28 @@ export default function AgentDeployment() {
deployment.allowed_actions.includes('view_commit') && !!commitUrl
const canOpenAgent = deployment.allowed_actions.includes('open_agent')
const canStartSession = deployment.allowed_actions.includes('start_session')
+ const canDeployLatest = deployment.allowed_actions.includes('deploy_latest')
+ const deployLatestFingerprint = JSON.stringify({
+ agent_id: agentId,
+ repo_id: deployment.source_relation?.repo?.id ?? null,
+ path: deployment.source_relation?.path ?? '',
+ production_ref: deployment.source_relation?.production_ref ?? null,
+ })
+ const deployLatestConflict =
+ deployLatestMutation.error instanceof ApiError &&
+ deployLatestMutation.error.status === 409
return (
<div className="space-y-5">
<div>
<Link
- to={`/agents/${agentId}`}
+ to={`/agents/${agentId}/deployments`}
className="text-muted-foreground hover:text-foreground mb-4 inline-flex items-center gap-1.5 text-sm"
>
<ArrowLeft className="size-4" />
- {agent?.name ? `Back to ${agent.name}` : 'Back to agent'}
+ {agent?.name
+ ? `Back to ${agent.name} deployments`
+ : 'Back to deployments'}
</Link>
<div className="flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between">
<div>
@@ -514,6 +596,27 @@ export default function AgentDeployment() {
<Link to={`/agents/${agentId}`}>Open agent</Link>
</Button>
) : null}
+ {canDeployLatest ? (
+ <Button
+ size="sm"
+ variant={canStartSession ? 'outline' : 'default'}
+ disabled={deployLatestMutation.isPending}
+ onClick={() =>
+ deployLatestMutation.mutate(deployLatestFingerprint)
+ }
+ >
+ <RotateCw
+ className={cn(
+ 'size-4',
+ deployLatestMutation.isPending &&
+ 'animate-spin motion-reduce:animate-none',
+ )}
+ />
+ {deployLatestMutation.isPending
+ ? 'Starting deployment…'
+ : 'Deploy latest'}
+ </Button>
+ ) : null}
{canStartSession ? (
<Button size="sm" asChild>
<Link to={`/agents/${agentId}/sessions`}>
@@ -526,6 +629,22 @@ export default function AgentDeployment() {
</div>
</div>
+ {deployLatestMutation.isError ? (
+ <Alert variant="destructive">
+ <CircleAlert className="size-4" />
+ <AlertTitle>
+ {deployLatestConflict
+ ? 'Repository needs attention'
+ : 'Deployment could not start'}
+ </AlertTitle>
+ <AlertDescription>
+ {deployLatestMutation.error instanceof Error
+ ? deployLatestMutation.error.message
+ : 'No new deployment was started. Retry when the repository is available.'}
+ </AlertDescription>
+ </Alert>
+ ) : null}
+
<Outcome deployment={deployment} />
<Panel>
diff --git a/web/src/pages/AgentDetail.tsx b/web/src/pages/AgentDetail.tsx
index 71cb0f00..9d00304a 100644
--- a/web/src/pages/AgentDetail.tsx
+++ b/web/src/pages/AgentDetail.tsx
@@ -32,11 +32,13 @@ import { AgentSkills } from '@/components/agent-skills'
import { AgentDeploySource } from '@/components/agent-deploy-source'
import { AgentSchedulesTab } from '@/components/agent-schedules'
import { AgentRevisions } from '@/components/agent-revisions'
+import { AgentDeployments } from '@/components/agent-deployments'
import {
WorkingRepoField,
type WorkingRepo,
} from '@/components/working-repo-field'
import { ApiHint, type ApiRef } from '@/components/api-hint'
+import { agentDeploymentDisplayStatus } from '@/lib/agent-deployment-status'
import { getRuntime, keyFieldFor, providerForModel, withModelGroups } from '@/lib/runtimes'
const DOCS = 'https://docs.opencomputer.dev/agent-sessions'
@@ -46,27 +48,36 @@ const ORG_DEFAULT = '__default__' // no pinned credential → org default resolv
const NEW_CRED = '__new__' // create one inline
const MANAGED = 'managed' // run via OpenComputer, no BYO key (token-billing §6.6)
-type Tab = 'overview' | 'revisions' | 'sessions' | 'schedules' | 'settings'
+type Tab =
+ | 'overview'
+ | 'deployments'
+ | 'revisions'
+ | 'sessions'
+ | 'schedules'
+ | 'settings'
export default function AgentDetail() {
const { agentId = '', tab } = useParams()
const navigate = useNavigate()
const queryClient = useQueryClient()
const active: Tab =
- tab === 'revisions'
- ? 'revisions'
- : tab === 'sessions'
- ? 'sessions'
- : tab === 'schedules'
- ? 'schedules'
- : tab === 'settings'
- ? 'settings'
- : 'overview'
+ tab === 'deployments'
+ ? 'deployments'
+ : tab === 'revisions'
+ ? 'revisions'
+ : tab === 'sessions'
+ ? 'sessions'
+ : tab === 'schedules'
+ ? 'schedules'
+ : tab === 'settings'
+ ? 'settings'
+ : 'overview'
// Each tab is a thin control panel over one API resource — surface the call it drives
// (REST + SDK), same as the other pages, so the dashboard reads as programmable.
const tabApi: Record<Tab, ApiRef> = {
overview: { method: 'GET', path: `/v3/agents/${agentId}`, sdk: 'oc.agents.get(id)', docs: `${DOCS}/agents` },
+ deployments: { method: 'GET', path: `/v3/agents/${agentId}/deployments` },
revisions: { method: 'GET', path: `/v3/agents/${agentId}/revisions`, sdk: 'oc.agents.revisions.list(id)', docs: `${DOCS}/revisions` },
sessions: { method: 'POST', path: '/v3/sessions', sdk: 'oc.sessions.create({ agent })', docs: `${DOCS}/sessions` },
schedules: { method: 'GET', path: `/v3/agents/${agentId}/schedules`, sdk: 'oc.agents.schedules.list(id)', docs: `${DOCS}/schedules` },
@@ -284,8 +295,17 @@ export default function AgentDetail() {
)
}
- const activeRev = agent.active_revision?.number ?? agent.revision ?? 1
+ const activeRev =
+ agent.active_revision?.number ??
+ (agent.revision && agent.revision > 0 ? agent.revision : null)
const base = `/agents/${agent.id}`
+ const latestDeploymentId = agent.deployment_status?.deployment_id
+ const deploymentStatus = agentDeploymentDisplayStatus(agent)
+ const liveStatus =
+ agent.deployment_status?.live_status ?? agent.flue?.live?.status ?? null
+ const canStartNewSession =
+ activeRev !== null &&
+ (agent.runtime !== 'flue' || !liveStatus || liveStatus === 'verified')
return (
<div className="mx-auto max-w-5xl">
@@ -301,19 +321,49 @@ export default function AgentDetail() {
<div className="text-muted-foreground flex flex-wrap items-center gap-x-3 gap-y-1 text-xs">
<span className="font-mono">{agent.id}</span>
<span className="capitalize">{agent.runtime}</span>
- <span className="font-mono">rev #{activeRev}</span>
+ <span className="font-mono">
+ {activeRev ? `rev #${activeRev}` : 'Not deployed'}
+ </span>
+ {latestDeploymentId ? (
+ <Link
+ to={`${base}/deployments/${latestDeploymentId}`}
+ aria-label={`Open latest deployment: ${deploymentStatus.replace(/_/g, ' ')}`}
+ className="focus-visible:ring-ring/50 rounded-md outline-none focus-visible:ring-3"
+ >
+ <StatusBadge status={deploymentStatus} />
+ </Link>
+ ) : null}
<SourceChip source={source ?? null} />
</div>
</div>
- <Button asChild size="sm">
- <Link to={`${base}/sessions`}>
+ {canStartNewSession ? (
+ <Button asChild size="sm">
+ <Link to={`${base}/sessions`}>
+ <Send className="size-4" />
+ New session
+ </Link>
+ </Button>
+ ) : (
+ <Button
+ size="sm"
+ disabled
+ title="A verified deployment is required before starting a session"
+ >
<Send className="size-4" />
New session
- </Link>
- </Button>
+ </Button>
+ )}
</div>
- <nav className="-mb-px flex gap-1">
+ <nav
+ className="-mb-px flex gap-1 overflow-x-auto"
+ aria-label="Agent"
+ >
<TabLink to={base} label="Overview" current={active === 'overview'} />
+ <TabLink
+ to={`${base}/deployments`}
+ label="Deployments"
+ current={active === 'deployments'}
+ />
<TabLink
to={`${base}/revisions`}
label="Revisions"
@@ -353,7 +403,7 @@ export default function AgentDetail() {
<GitBranch className="text-muted-foreground mt-0.5 size-3.5 shrink-0" />
<div className="space-y-0.5">
<p className="text-foreground">
- Managed from a connected repo —{' '}
+ Managed from a connected repo:{' '}
<span className="font-mono">
{source.full_name ?? source.path ?? 'repo'}
{source.full_name && source.path
@@ -363,15 +413,36 @@ export default function AgentDetail() {
</span>
</p>
<p className="text-muted-foreground">
- The repo is the source of truth. Edit there and
- push, or{' '}
- <Link
- className="underline underline-offset-4"
- to={`${base}/revisions`}
- >
- browse revisions
- </Link>
- .
+ The repo is the source of truth.{' '}
+ {agent.runtime === 'flue' ? (
+ <>
+ Edit and push there, then{' '}
+ <Link
+ className="underline underline-offset-4"
+ to={
+ latestDeploymentId
+ ? `${base}/deployments/${latestDeploymentId}`
+ : `${base}/deployments`
+ }
+ >
+ {latestDeploymentId
+ ? 'open the latest deployment'
+ : 'open Deployments'}
+ </Link>{' '}
+ and choose Deploy latest.
+ </>
+ ) : (
+ <>
+ Edit there and push, or{' '}
+ <Link
+ className="underline underline-offset-4"
+ to={`${base}/revisions`}
+ >
+ browse revisions
+ </Link>
+ .
+ </>
+ )}
</p>
</div>
</div>
@@ -455,6 +526,9 @@ export default function AgentDetail() {
)}
{active === 'revisions' && <AgentRevisions agentId={agent.id} />}
+ {active === 'deployments' && (
+ <AgentDeployments agentId={agent.id} />
+ )}
{active === 'schedules' && <AgentSchedulesTab agentId={agent.id} />}
{active === 'sessions' && (
@@ -469,40 +543,61 @@ export default function AgentDetail() {
</Link>
</PanelHeader>
<PanelContent className="border-b">
- <form
- className="space-y-2"
- onSubmit={(e) => {
- e.preventDefault()
- if (task.trim()) startMutation.mutate()
- }}
- >
- <ChatTextarea
- value={task}
- onChange={(e) => setTask(e.target.value)}
- onSend={() => {
- if (task.trim() && !startMutation.isPending)
- startMutation.mutate()
+ {canStartNewSession ? (
+ <form
+ className="space-y-2"
+ onSubmit={(e) => {
+ e.preventDefault()
+ if (task.trim()) startMutation.mutate()
}}
- placeholder="Give this agent a task — it runs durably as a new session…"
- className="min-h-20"
- />
- <div className="flex flex-wrap items-center justify-between gap-2">
- <WorkingRepoField
- value={workingRepo}
- onChange={setWorkingRepo}
+ >
+ <ChatTextarea
+ value={task}
+ onChange={(e) => setTask(e.target.value)}
+ onSend={() => {
+ if (task.trim() && !startMutation.isPending)
+ startMutation.mutate()
+ }}
+ placeholder="Give this agent a task that runs durably as a new session…"
+ className="min-h-20"
/>
- <Button
- type="submit"
- size="sm"
- title="Enter to start · Shift+Enter for newline"
- disabled={startMutation.isPending || !task.trim()}
- className="ml-auto"
- >
- <Send className="size-4" />
- {startMutation.isPending ? 'Starting…' : 'Start session'}
+ <div className="flex flex-wrap items-center justify-between gap-2">
+ <WorkingRepoField
+ value={workingRepo}
+ onChange={setWorkingRepo}
+ />
+ <Button
+ type="submit"
+ size="sm"
+ title="Enter to start · Shift+Enter for newline"
+ disabled={startMutation.isPending || !task.trim()}
+ className="ml-auto"
+ >
+ <Send className="size-4" />
+ {startMutation.isPending
+ ? 'Starting…'
+ : 'Start session'}
+ </Button>
+ </div>
+ </form>
+ ) : (
+ <div className="flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between">
+ <div>
+ <p className="text-sm font-medium">
+ {activeRev
+ ? 'New sessions are paused until the live deployment is verified.'
+ : 'Deploy this agent before starting a session.'}
+ </p>
+ <p className="text-muted-foreground mt-1 text-xs">
+ Open deployment history to inspect progress and build
+ logs.
+ </p>
+ </div>
+ <Button variant="outline" size="sm" asChild>
+ <Link to={`${base}/deployments`}>View deployments</Link>
</Button>
</div>
- </form>
+ )}
</PanelContent>
<ResourceTable
columns={sessionColumns}
@@ -631,7 +726,7 @@ function TabLink({
to={to}
aria-current={current ? 'page' : undefined}
className={
- 'border-b-2 px-3 py-2 text-sm transition-colors ' +
+ 'shrink-0 border-b-2 px-3 py-2 text-sm transition-colors ' +
(current
? 'border-foreground text-foreground font-medium'
: 'text-muted-foreground hover:text-foreground border-transparent')
diff --git a/web/src/pages/Agents.tsx b/web/src/pages/Agents.tsx
index 948c5d0f..a41b52d1 100644
--- a/web/src/pages/Agents.tsx
+++ b/web/src/pages/Agents.tsx
@@ -1,12 +1,14 @@
import { useQuery } from '@tanstack/react-query'
-import { useNavigate } from 'react-router-dom'
+import { Link, useNavigate } from 'react-router-dom'
import { Bot, Plus } from 'lucide-react'
import { getAgents, type Agent } from '@/api/client'
import { EmptyState } from '@/components/empty-state'
import { PageHeader } from '@/components/page-header'
import { Panel } from '@/components/panel'
import { ResourceTable, type Column } from '@/components/resource-table'
+import { StatusBadge } from '@/components/status-badge'
import { Button } from '@/components/ui/button'
+import { agentDeploymentDisplayStatus } from '@/lib/agent-deployment-status'
export default function Agents() {
const navigate = useNavigate()
@@ -41,6 +43,26 @@ export default function Agents() {
</span>
),
},
+ {
+ key: 'deployment',
+ header: 'Deployment',
+ cell: (agent) => {
+ const status = agentDeploymentDisplayStatus(agent)
+ const deploymentId = agent.deployment_status?.deployment_id
+ if (!deploymentId) return <StatusBadge status={status} />
+ return (
+ <Link
+ to={`/agents/${agent.id}/deployments/${deploymentId}`}
+ aria-label={`Open latest deployment for ${agent.name}: ${status.replace(/_/g, ' ')}`}
+ className="focus-visible:ring-ring/50 inline-flex rounded-md outline-none focus-visible:ring-3"
+ onClick={(event) => event.stopPropagation()}
+ onKeyDown={(event) => event.stopPropagation()}
+ >
+ <StatusBadge status={status} />
+ </Link>
+ )
+ },
+ },
{
key: 'revision',
header: 'Active revision',
@@ -72,7 +94,7 @@ export default function Agents() {
<div>
<PageHeader
title="Agents"
- description="Reusable definitions: a prompt, model, and runtime a session runs."
+ description="Reusable agents, from built-in prompts to Flue code deployed from a repository."
api={{
method: 'POST',
path: '/v3/agents',