Skip to content

An open-source, faster Devin alternative

TypeScript

Dashboard: Agent Revisions panel (history, active pointer, rollback) (#465)

Igor Zalutski093e6a5de0cd
diff --git a/docs/agent-sessions/agents.mdx b/docs/agent-sessions/agents.mdx
index b7e5cfc3..1f3bf26f 100644
--- a/docs/agent-sessions/agents.mdx
+++ b/docs/agent-sessions/agents.mdx
@@ -4,7 +4,7 @@ title: "Agents"
description: "Reusable agent configuration"
---
-An **agent** is reusable configuration: `name`, `prompt`, `model`, and [`runtime`](/agent-sessions/runtimes). Every [session](/agent-sessions/sessions) runs on an agent, so create one first, then start as many sessions on it as you like.
+An **agent** is reusable configuration: `name`, `prompt`, `model`, [`runtime`](/agent-sessions/runtimes), and optional [**skills**](/agent-sessions/revisions). Every [session](/agent-sessions/sessions) runs on an agent, so create one first, then start as many sessions on it as you like. The behavior (`prompt`/`model`/`skills`) is versioned as [**revisions**](/agent-sessions/revisions): every edit deploys a new one, and you can roll back.
<Note>You can create and edit agents in the [dashboard](https://app.opencomputer.dev) too — the create dialog also lets you pick or add a [credential](/agent-sessions/credentials) inline.</Note>
@@ -46,7 +46,7 @@ Pass your model `key` inline and it's stored as a [credential](/agent-sessions/c
## Session-pinned config
-When a session is created it **freezes** the agent's `prompt`, `model`, `runtime`, and `revision` (a number that bumps on every edit) into the session — and pins the resolved credential too. Editing the named agent afterwards never changes a running or resumed session — its behavior is pinned for its whole life. Update an agent freely: existing sessions keep what they started with, new sessions pick up the change. (Rotating a credential's **key value** is the exception — that flows to running sessions, so a compromised key can be replaced; see [credentials](/agent-sessions/credentials).)
+When a session is created it **freezes** the agent's **active [revision](/agent-sessions/revisions)** — `prompt`, `model`, `runtime`, and `skills` — into the session, and pins the resolved credential too. Editing the named agent afterwards never changes a running or resumed session — its behavior is pinned for its whole life. Update an agent freely: existing sessions keep what they started with, new sessions pick up the change. (Rotating a credential's **key value** is the exception — that flows to running sessions, so a compromised key can be replaced; see [credentials](/agent-sessions/credentials).)
## Model
diff --git a/docs/agent-sessions/overview.mdx b/docs/agent-sessions/overview.mdx
index c565c128..59735892 100644
--- a/docs/agent-sessions/overview.mdx
+++ b/docs/agent-sessions/overview.mdx
@@ -37,7 +37,7 @@ Create an agent, start a session, stream its event log, steer it with messages,
<Steps>
<Step title="Define an agent">
- Create a reusable `{ name, model, prompt, runtime }` from your backend — `runtime: "claude"` (Anthropic models) or `"codex"` (OpenAI models). Run **Managed** (`credential: "managed"`, billed to your OpenComputer credits — no key) or pass your own model `key` inline / reference a saved [credential](/agent-sessions/credentials). ([Agents](/agent-sessions/agents))
+ Create a reusable `{ name, model, prompt, runtime }` from your backend — `runtime: "claude"` (Anthropic models) or `"codex"` (OpenAI models). Run **Managed** (`credential: "managed"`, billed to your OpenComputer credits — no key) or pass your own model `key` inline / reference a saved [credential](/agent-sessions/credentials). Every edit is versioned as a [revision](/agent-sessions/revisions), and you can attach [skills](/agent-sessions/revisions#skills). ([Agents](/agent-sessions/agents))
</Step>
<Step title="Start a session">
Start a session with `{ agent, input }`. The agent starts immediately and returns a browser-safe `client_token`.
diff --git a/docs/agent-sessions/repos.mdx b/docs/agent-sessions/repos.mdx
index 13c828a0..4a173a53 100644
--- a/docs/agent-sessions/repos.mdx
+++ b/docs/agent-sessions/repos.mdx
@@ -315,6 +315,12 @@ After checkout, the agent works with ordinary files. It can inspect, edit, test,
make local commits. Anything needing GitHub credentials runs outside the agent sandbox, so
the agent never runs authenticated `git`/`gh` and never sees a token.
+<Warning>
+Opening PRs from the agent (`github_publish_pull_request`) is **temporarily unavailable**
+while the runtime is being updated — checkout (read) works today; the agent-driven PR-open
+described below will be re-enabled in an upcoming runtime release.
+</Warning>
+
To open a pull request, the agent calls the
[`github_publish_pull_request`](/agent-sessions/runtime-tools#github-tools) runtime tool —
it is **not** an SDK method; the agent invokes it from inside the sandbox. It takes the
diff --git a/docs/agent-sessions/revisions.mdx b/docs/agent-sessions/revisions.mdx
new file mode 100644
index 00000000..4b99a06f
--- /dev/null
+++ b/docs/agent-sessions/revisions.mdx
@@ -0,0 +1,140 @@
+---
+mode: "wide"
+title: "Revisions & skills"
+description: "Versioned agent behavior — deploy, roll back, and manage skills"
+---
+
+An agent's behavior — its `prompt`, `model`, and **skills** — is versioned as **revisions**. Every change is a **deploy** that appends a new immutable revision; the agent's **active revision** is what new [sessions](/agent-sessions/sessions) use. Rolling back is just re-activating an earlier revision.
+
+<Note>Revisions are **linear**: each deploy is a new revision (like a deployment on Vercel/Fly), and the number only goes up. Re-activating an older revision (rollback) moves the **active pointer** back, but never deletes or rewrites history. In-flight sessions keep the revision they started on; only new sessions pick up the change.</Note>
+
+## What's on a revision
+
+| Field | |
+|---|---|
+| `number` | Monotonic per agent (`1, 2, 3, …`). |
+| `prompt` / `model` | The behavior at deploy time. |
+| `skill_bundle_digest` | Points at the skill files (a content-addressed bundle); `null` when the agent has no skills. |
+| `digest` | A content hash of the behavior — two revisions with the same behavior share a digest (the bundle is also deduplicated in storage), but each deploy is still its own revision. |
+
+The agent row keeps only **identity + bindings** (`name`, `runtime`, `credential`, `limits`) plus a pointer to the active revision. `prompt`/`model` are served from that revision.
+
+## Deploy a revision
+
+Editing an agent's `prompt` or `model` deploys a revision automatically (the response shape of [`PATCH /agents/:id`](/agent-sessions/agents) is unchanged):
+
+```http REST API
+PATCH https://api.opencomputer.dev/v3/agents/agt_123
+Authorization: Bearer $OPENCOMPUTER_API_KEY
+Content-Type: application/json
+
+{ "prompt": "You are a meticulous reviewer. Run the tests." }
+```
+
+For a full behavior payload (prompt + model + skills in one go), deploy directly. This is the **complete** behavior — omitted fields are not inherited (`prompt` is required; omitted `skills` means *no skills*).
+
+```http REST API
+POST https://api.opencomputer.dev/v3/agents/agt_123/revisions
+Authorization: Bearer $OPENCOMPUTER_API_KEY
+Content-Type: application/json
+
+{
+ "prompt": "You triage pull requests.",
+ "model": "anthropic/claude-opus-4-8",
+ "skills": [
+ { "path": "triage/SKILL.md", "content": "---\nname: triage\ndescription: Triage a PR\n---\nSummarize the diff…" }
+ ],
+ "activate": true
+}
+```
+
+```json Response (201)
+{
+ "deploy_id": "dep_…",
+ "state": "ready",
+ "result": "created",
+ "revision": { "id": "rev_…", "number": 5, "digest": "sha256:…", "active": true }
+}
+```
+
+`activate` defaults to `true` (deploy straight to production). Pass `activate: false` to stage a revision without changing what new sessions use.
+
+## Roll back / promote
+
+Re-activate any earlier revision by **number** or `rev_…` id — this moves the active pointer. Running sessions are unaffected; new sessions use it.
+
+```http REST API
+POST https://api.opencomputer.dev/v3/agents/agt_123/revisions/3/activate
+Authorization: Bearer $OPENCOMPUTER_API_KEY
+```
+
+```json Response (200)
+{ "active_revision_id": "rev_…" }
+```
+
+## Inspect history
+
+```http REST API
+GET /v3/agents/agt_123/revisions # history (newest first; `active` flags the current one)
+GET /v3/agents/agt_123/revisions/5 # one revision + its skill file manifest
+GET /v3/agents/agt_123/deploys # deploy timeline (provenance + state)
+GET /v3/agents/agt_123/activations # pointer-move audit log
+```
+
+`GET /agents/:id` also includes an `active_revision` summary (`id`, `number`, `digest`).
+
+## Skills
+
+A **skill** is a folder containing a `SKILL.md` (with YAML frontmatter — `name` + `description` — followed by instructions the agent loads at the start of a turn) plus any helper files it references. An agent can have several. Skills are materialized into the runtime when a session runs, so the agent can use them.
+
+Manage them as a sub-resource of the agent. **List** the active revision's skills:
+
+```http REST API
+GET https://api.opencomputer.dev/v3/agents/agt_123/skills
+Authorization: Bearer $OPENCOMPUTER_API_KEY
+```
+
+```json Response (200)
+{
+ "revision": { "id": "rev_…", "number": 5, "digest": "sha256:…" },
+ "skill_bundle_digest": "sha256:…",
+ "skills": [
+ { "name": "triage", "description": "Triage a PR", "files": [{ "path": "triage/SKILL.md", "mode": 420, "size": 812 }] }
+ ]
+}
+```
+
+**Upload** a `.zip` of your skills — the API unzips, validates, and deploys a new revision with those skills (keeping the agent's current prompt + model). The zip body is sent raw:
+
+```http REST API
+PUT https://api.opencomputer.dev/v3/agents/agt_123/skills
+Authorization: Bearer $OPENCOMPUTER_API_KEY
+Content-Type: application/zip
+
+<binary .zip>
+```
+
+The zip should contain **one folder per skill**, each with a `SKILL.md`:
+
+```
+triage/
+ SKILL.md
+ checklist.md
+pr-review/
+ SKILL.md
+```
+
+A top-level `skills/` wrapper is fine too (it's stripped). **Remove** all skills (deploys a revision with none):
+
+```http REST API
+DELETE https://api.opencomputer.dev/v3/agents/agt_123/skills
+Authorization: Bearer $OPENCOMPUTER_API_KEY
+```
+
+Uploading and removing are both **deploys** — each is a new revision (not a rollback). Limits: up to 64 files, 256 KiB total, UTF-8 text only, modes `0644`/`0755`.
+
+<Note>**v1 supports skills on the `claude` runtime only.** Skills on a `codex` agent are rejected; custom runtimes and MCP servers are not yet supported.</Note>
+
+## Dashboard
+
+Everything here is in the [dashboard](https://app.opencomputer.dev) on the agent page: a **Revisions** panel (history, the active revision, one-click rollback) and a **Skills** panel (the current skills with descriptions, plus upload-a-`.zip` and remove).
diff --git a/docs/agent-sessions/runtime-tools.mdx b/docs/agent-sessions/runtime-tools.mdx
index 2c5bc553..46be961b 100644
--- a/docs/agent-sessions/runtime-tools.mdx
+++ b/docs/agent-sessions/runtime-tools.mdx
@@ -32,6 +32,12 @@ The agent's final `say` is the session result. `ask` ends the turn with `yield_r
## GitHub tools
+<Warning>
+`github_publish_pull_request` is **temporarily unavailable** — the current agent runtime
+does not expose it yet, while the runtime is being updated. The description below is the
+intended behavior; the tool will be re-enabled in an upcoming runtime release.
+</Warning>
+
| Tool | What it does |
| --- | --- |
| `github_publish_pull_request` | Open a pull request from a checked-out [Repo](/agent-sessions/repos) source. |
diff --git a/docs/docs.json b/docs/docs.json
index 340fae6c..bafe7974 100644
--- a/docs/docs.json
+++ b/docs/docs.json
@@ -73,6 +73,7 @@
"agent-sessions/overview",
"agent-sessions/quickstart",
"agent-sessions/agents",
+ "agent-sessions/revisions",
"agent-sessions/sessions",
"agent-sessions/credentials",
"agent-sessions/repos",
diff --git a/web/package-lock.json b/web/package-lock.json
index 8f74c1af..171c165a 100644
--- a/web/package-lock.json
+++ b/web/package-lock.json
@@ -47,6 +47,9 @@
"typescript": "^6.0.3",
"typescript-eslint": "^8.62.0",
"vite": "^8.1.0"
+ },
+ "engines": {
+ "node": ">=20.19.0"
}
},
"node_modules/@babel/code-frame": {
diff --git a/web/src/api/client.ts b/web/src/api/client.ts
index c41ac3ea..001f370a 100644
--- a/web/src/api/client.ts
+++ b/web/src/api/client.ts
@@ -28,6 +28,10 @@ export type {
BrowserSession,
BrowserProfile,
Agent,
+ AgentRevision,
+ AgentSkills,
+ SkillItem,
+ AgentDeploy,
Session,
SessionEvent,
Turn,
@@ -427,6 +431,44 @@ export const updateAgent = (
S.AgentSchema,
)
+// Agent Revisions (design 009) — the deploy history of an agent's behavior. List
+// endpoints wrap rows in { data: [...] }; callers want the array. Rollback = activate
+// an earlier revision (by id or number); it moves the production pointer.
+export const getAgentRevisions = (agentId: string) =>
+ apiFetch(`/v3/agents/${agentId}/revisions`, {}, S.AgentRevisionListSchema).then(
+ (r) => r.data,
+ )
+
+export const getAgentDeploys = (agentId: string) =>
+ apiFetch(`/v3/agents/${agentId}/deploys`, {}, S.AgentDeployListSchema).then(
+ (r) => r.data,
+ )
+
+export const activateRevision = (agentId: string, rev: string | number) =>
+ apiFetch(
+ `/v3/agents/${agentId}/revisions/${rev}/activate`,
+ { method: 'POST', body: JSON.stringify({}) },
+ S.ActivateRevisionSchema,
+ )
+
+// Skills sub-resource (design 009 §8) — the API owns zip → validate → bundle, so the
+// dashboard is a thin consumer: read the file list, upload a .zip, or clear.
+export const getAgentSkills = (agentId: string) =>
+ apiFetch(`/v3/agents/${agentId}/skills`, {}, S.AgentSkillsSchema)
+
+// Upload a .zip of skills → the API unzips + deploys a new revision (active behavior with
+// skills replaced). The raw file is the body; no client-side parsing.
+export const putAgentSkills = (agentId: string, zip: File | Blob) =>
+ apiFetch(
+ `/v3/agents/${agentId}/skills`,
+ { method: 'PUT', body: zip, headers: { 'Content-Type': 'application/zip' } },
+ S.DeployResultSchema,
+ )
+
+// Remove all skills → deploys a revision from the active behavior with no skills.
+export const deleteAgentSkills = (agentId: string) =>
+ apiFetch(`/v3/agents/${agentId}/skills`, { method: 'DELETE' }, S.DeployResultSchema)
+
// Slack — an agent's BYO Slack app (1 app ⟷ 1 agent ⟷ 1 workspace). Two-step
// connect: START (manifest) returns the app manifest + guided steps; COMPLETE
// posts the three pasted values back. No secrets are ever returned.
diff --git a/web/src/api/schemas.ts b/web/src/api/schemas.ts
index 394db4fc..1efd3e7d 100644
--- a/web/src/api/schemas.ts
+++ b/web/src/api/schemas.ts
@@ -331,6 +331,11 @@ export const AgentSchema = z.object({
runtime: z.string(),
credential_id: z.string().nullable().optional(),
revision: z.number().optional(),
+ // Agent Revisions (design 009): the active production pointer + a summary of it.
+ active_revision_id: z.string().nullish(),
+ active_revision: z
+ .object({ id: z.string(), number: z.number(), digest: z.string() })
+ .nullish(),
limits: record.nullish(),
created_at: z.string(),
})
@@ -340,6 +345,65 @@ export const AgentListSchema = z.object({
next_cursor: z.string().nullish(),
})
+// Agent Revisions (design 009) — immutable deployed versions of an agent's behavior.
+// `active` flags the production pointer; rollback = activate an earlier revision.
+export const AgentRevisionSchema = z.object({
+ id: z.string(),
+ number: z.number(),
+ digest: z.string(),
+ created_at: z.string(),
+ active: z.boolean(),
+})
+export const AgentRevisionListSchema = z.object({
+ data: z.array(AgentRevisionSchema),
+})
+// A deploy event (provenance + state); one revision can be produced by many deploys.
+export const AgentDeploySchema = z.object({
+ id: z.string(),
+ state: z.string(), // validating | uploading | ready | failed
+ result: z.string().nullish(), // created | deduped | failed
+ source: record.nullish(), // { via, repo_id?, path?, git_sha? }
+ actor: z.string().nullish(),
+ revision_id: z.string().nullish(),
+ created_at: z.string(),
+})
+export const AgentDeployListSchema = z.object({
+ data: z.array(AgentDeploySchema),
+})
+// The pointer-move response from POST …/revisions/:rev/activate.
+export const ActivateRevisionSchema = z.object({
+ active_revision_id: z.string(),
+})
+// A file within a skill (path/mode/size).
+export const SkillFileSchema = z.object({
+ path: z.string(),
+ mode: z.number(),
+ size: z.number(),
+})
+// A skill — the domain unit: a folder with a SKILL.md (name + description from frontmatter).
+export const SkillItemSchema = z.object({
+ name: z.string(),
+ description: z.string().nullish(),
+ files: z.array(SkillFileSchema).default([]),
+})
+// The agent's skills (GET …/skills) — the active revision's skills, enumerated.
+export const AgentSkillsSchema = z.object({
+ revision: z
+ .object({ id: z.string(), number: z.number(), digest: z.string() })
+ .nullish(),
+ skill_bundle_digest: z.string().nullish(),
+ skills: z.array(SkillItemSchema).default([]),
+})
+// The deploy-shaped response from POST …/revisions.
+export const DeployResultSchema = z.object({
+ deploy_id: z.string(),
+ state: z.string(),
+ result: z.string().nullish(),
+ revision: z
+ .object({ id: z.string(), number: z.number(), digest: z.string(), active: z.boolean() })
+ .nullish(),
+})
+
// 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({
@@ -469,6 +533,10 @@ export const DeliverySchema = z.object({
})
export type Agent = z.infer<typeof AgentSchema>
+export type AgentRevision = z.infer<typeof AgentRevisionSchema>
+export type AgentSkills = z.infer<typeof AgentSkillsSchema>
+export type SkillItem = z.infer<typeof SkillItemSchema>
+export type AgentDeploy = z.infer<typeof AgentDeploySchema>
export type Credential = z.infer<typeof CredentialSchema>
export type SlackConnection = z.infer<typeof SlackConnectionSchema>
export type SlackManifestResponse = z.infer<typeof SlackManifestResponseSchema>
diff --git a/web/src/components/agent-revisions.tsx b/web/src/components/agent-revisions.tsx
new file mode 100644
index 00000000..3b5ec0d5
--- /dev/null
+++ b/web/src/components/agent-revisions.tsx
@@ -0,0 +1,164 @@
+import { useState } from 'react'
+import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query'
+import { History, RotateCcw, ArrowUp } from 'lucide-react'
+import { notifyError } from '@/lib/errors'
+import {
+ getAgentRevisions,
+ getAgentDeploys,
+ activateRevision,
+ type AgentRevision,
+} from '@/api/client'
+import { Panel, PanelHeader, PanelTitle } from '@/components/panel'
+import { ResourceTable, type Column } from '@/components/resource-table'
+import { StatusBadge } from '@/components/status-badge'
+import { Button } from '@/components/ui/button'
+import { ConfirmDialog } from '@/components/confirm-dialog'
+import { EmptyState } from '@/components/empty-state'
+
+// Short, legible digest (e.g. "sha256:a14f940d82") for the table.
+const shortDigest = (d: string) => d.slice(0, 19)
+const sourceVia = (s?: Record<string, unknown> | null) =>
+ (s && typeof s.via === 'string' && s.via) || 'api'
+
+/**
+ * Agent Revisions panel (design 009 §13): the deploy history of an agent's behavior,
+ * the active production pointer made visible, one-click rollback (activate an earlier
+ * revision), and a compact deploy timeline (provenance + state).
+ */
+export function AgentRevisions({ agentId }: { agentId: string }) {
+ const queryClient = useQueryClient()
+ const [pending, setPending] = useState<AgentRevision | null>(null)
+
+ const { data: revisions = [], isLoading } = useQuery({
+ queryKey: ['agent-revisions', agentId],
+ queryFn: () => getAgentRevisions(agentId),
+ })
+ const { data: deploys = [] } = useQuery({
+ queryKey: ['agent-deploys', agentId],
+ queryFn: () => getAgentDeploys(agentId),
+ })
+ // A revision's provenance lives on the deploy that CREATED it (one revision, many
+ // deploys — source is a deploy field). Fold source.via into the revisions table so
+ // we don't need a second, near-duplicate table.
+ const createdVia = new Map<string, string>()
+ for (const d of deploys) {
+ if (d.revision_id && d.result === 'created') createdVia.set(d.revision_id, sourceVia(d.source))
+ }
+
+ const activateMutation = useMutation({
+ mutationFn: (rev: AgentRevision) => activateRevision(agentId, rev.number),
+ onSuccess: () => {
+ void queryClient.invalidateQueries({ queryKey: ['agent-revisions', agentId] })
+ void queryClient.invalidateQueries({ queryKey: ['agent-deploys', agentId] })
+ // prompt/model are sourced from the active revision → refresh the agent too.
+ void queryClient.invalidateQueries({ queryKey: ['agent', agentId] })
+ void queryClient.invalidateQueries({ queryKey: ['agents'] })
+ setPending(null)
+ },
+ onError: (e) => {
+ notifyError("Couldn't activate that revision.", e)
+ setPending(null)
+ },
+ })
+
+ const revisionColumns: Column<AgentRevision>[] = [
+ {
+ key: 'number',
+ header: 'Revision',
+ cell: (r) => (
+ <span className="text-foreground font-mono text-[13px]">#{r.number}</span>
+ ),
+ },
+ {
+ key: 'source',
+ header: 'Source',
+ cell: (r) => (
+ <span className="text-muted-foreground text-xs capitalize">
+ {createdVia.get(r.id) ?? '—'}
+ </span>
+ ),
+ },
+ {
+ key: 'digest',
+ header: 'Digest',
+ cell: (r) => (
+ <span className="text-muted-foreground font-mono text-xs">
+ {shortDigest(r.digest)}
+ </span>
+ ),
+ },
+ {
+ key: 'created',
+ header: 'Created',
+ cell: (r) => (
+ <span className="text-muted-foreground font-mono text-xs">
+ {new Date(r.created_at).toLocaleString()}
+ </span>
+ ),
+ },
+ {
+ key: 'action',
+ header: '',
+ align: 'right',
+ cell: (r) => {
+ if (r.active) return <StatusBadge status="active" />
+ // Activating an older revision is a rollback; a newer one is a promote. Show just the
+ // icon (it repeats down the column); the label slides in on hover so it stays legible.
+ const isRollback = !!revisions[0] && r.number < revisions[0].number
+ const Icon = isRollback ? RotateCcw : ArrowUp
+ const label = isRollback ? 'Roll back' : 'Activate'
+ return (
+ <Button
+ variant="ghost"
+ size="xs"
+ aria-label={label}
+ title={label}
+ className="group text-muted-foreground hover:text-foreground gap-0"
+ disabled={activateMutation.isPending}
+ onClick={() => setPending(r)}
+ >
+ <Icon className="size-3.5 shrink-0" />
+ <span className="max-w-0 overflow-hidden whitespace-nowrap opacity-0 transition-all duration-200 ease-out group-hover:ml-1.5 group-hover:max-w-[6rem] group-hover:opacity-100 motion-reduce:transition-none motion-reduce:group-hover:ml-1.5">
+ {label}
+ </span>
+ </Button>
+ )
+ },
+ },
+ ]
+
+ return (
+ <Panel className="overflow-hidden">
+ <PanelHeader>
+ <PanelTitle>Revisions</PanelTitle>
+ <span className="text-muted-foreground text-xs">
+ Each deploy is an immutable revision. Rolling back re-points the active one.
+ </span>
+ </PanelHeader>
+
+ <ResourceTable
+ columns={revisionColumns}
+ rows={revisions}
+ rowKey={(r) => r.id}
+ loading={isLoading}
+ empty={
+ <EmptyState
+ icon={History}
+ title="No revisions yet"
+ description="Editing the prompt or model, or deploying an agent directory, creates a revision."
+ />
+ }
+ />
+
+ <ConfirmDialog
+ open={pending !== null}
+ onOpenChange={(open) => !open && setPending(null)}
+ title={`Activate revision #${pending?.number ?? ''}?`}
+ description="New sessions will use this revision. In-flight sessions keep the revision they started with."
+ confirmLabel="Activate"
+ pending={activateMutation.isPending}
+ onConfirm={() => pending && activateMutation.mutate(pending)}
+ />
+ </Panel>
+ )
+}
diff --git a/web/src/components/agent-skills.tsx b/web/src/components/agent-skills.tsx
new file mode 100644
index 00000000..c4fb92da
--- /dev/null
+++ b/web/src/components/agent-skills.tsx
@@ -0,0 +1,147 @@
+import { useRef } from 'react'
+import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query'
+import { FileArchive, Upload } from 'lucide-react'
+import { notifyError, notifySuccess } from '@/lib/errors'
+import { getAgentSkills, putAgentSkills, deleteAgentSkills } from '@/api/client'
+import {
+ Panel,
+ PanelContent,
+ PanelHeader,
+ PanelTitle,
+} from '@/components/panel'
+import { Button } from '@/components/ui/button'
+
+const fmtBytes = (n: number) => (n < 1024 ? `${n} B` : `${(n / 1024).toFixed(1)} KiB`)
+
+/**
+ * Skills panel — a thin consumer of the agent skills sub-resource (design 009 §8). The API owns
+ * unzip + validate + canonicalize + bundle: we just GET the file list, PUT a raw .zip to deploy a
+ * new revision (active behavior, skills replaced), or DELETE to clear. No client-side parsing.
+ */
+export function AgentSkills({ agentId }: { agentId: string }) {
+ const queryClient = useQueryClient()
+ const inputRef = useRef<HTMLInputElement>(null)
+
+ const { data, isLoading } = useQuery({
+ queryKey: ['agent-skills', agentId],
+ queryFn: () => getAgentSkills(agentId),
+ })
+ const skills = data?.skills ?? []
+
+ // A skills change deploys a new active revision — refresh the dependent views.
+ const invalidate = () => {
+ void queryClient.invalidateQueries({ queryKey: ['agent-skills', agentId] })
+ void queryClient.invalidateQueries({ queryKey: ['agent-revisions', agentId] })
+ void queryClient.invalidateQueries({ queryKey: ['agent-deploys', agentId] })
+ void queryClient.invalidateQueries({ queryKey: ['agent', agentId] })
+ }
+ const upload = useMutation({
+ mutationFn: (zip: File) => putAgentSkills(agentId, zip),
+ onSuccess: (r) => {
+ invalidate()
+ notifySuccess(`Skills deployed${r.revision ? ` — revision #${r.revision.number} active` : ''}`)
+ },
+ onError: (e) => notifyError("Couldn't upload the skills.", e),
+ })
+ const remove = useMutation({
+ mutationFn: () => deleteAgentSkills(agentId),
+ onSuccess: (r) => {
+ invalidate()
+ // Removing skills deploys a new forward revision (no skills); name it for clear feedback.
+ notifySuccess(`Skills removed${r.revision ? ` — revision #${r.revision.number} active` : ''}`)
+ },
+ onError: (e) => notifyError("Couldn't remove the skills.", e),
+ })
+ const busy = upload.isPending || remove.isPending
+
+ return (
+ <Panel className="overflow-hidden">
+ <PanelHeader>
+ <PanelTitle>Skills</PanelTitle>
+ <span className="text-muted-foreground text-xs">
+ Skill files the agent loads at run time.
+ </span>
+ </PanelHeader>
+ <PanelContent className="space-y-4">
+ {!isLoading && skills.length === 0 ? (
+ <div className="flex items-center justify-between gap-6 rounded-md border border-dashed px-5 py-6">
+ <div className="space-y-1.5">
+ <div className="text-foreground flex items-center gap-2 text-sm font-medium">
+ <FileArchive className="text-muted-foreground size-5" />
+ No skills yet
+ </div>
+ <p className="text-muted-foreground text-xs">
+ A skill is a folder with a SKILL.md — upload a .zip like this:
+ </p>
+ </div>
+ <pre className="text-muted-foreground/70 shrink-0 text-left font-mono text-xs leading-relaxed">
+{`skills/
+├─ triage/
+│ └─ SKILL.md
+└─ pr-review/
+ ├─ SKILL.md
+ └─ run.sh`}
+ </pre>
+ </div>
+ ) : (
+ <ul className="divide-border divide-y rounded-md border">
+ {skills.map((s) => (
+ <li key={s.name} className="px-3 py-2.5">
+ <div className="flex items-baseline justify-between gap-3">
+ <span className="text-foreground font-mono text-[13px]">{s.name}</span>
+ <span className="text-muted-foreground shrink-0 text-xs">
+ {s.files.length} file{s.files.length === 1 ? '' : 's'} ·{' '}
+ {fmtBytes(s.files.reduce((n, f) => n + f.size, 0))}
+ </span>
+ </div>
+ {s.description ? (
+ <p className="text-muted-foreground mt-0.5 text-xs">{s.description}</p>
+ ) : (
+ <p className="text-muted-foreground/70 mt-0.5 text-xs italic">no description</p>
+ )}
+ </li>
+ ))}
+ </ul>
+ )}
+
+ <div className="flex items-center gap-3">
+ <input
+ ref={inputRef}
+ type="file"
+ accept=".zip,application/zip"
+ className="hidden"
+ onChange={(e) => {
+ const f = e.target.files?.[0]
+ if (f) upload.mutate(f)
+ e.target.value = '' // allow re-selecting the same file
+ }}
+ />
+ <p className="text-muted-foreground text-xs">
+ Deploys a new revision; prompt &amp; model unchanged.
+ </p>
+ <div className="ml-auto flex items-center gap-2">
+ {skills.length > 0 ? (
+ <Button
+ variant="ghost"
+ size="sm"
+ className="text-muted-foreground hover:text-foreground"
+ disabled={busy}
+ onClick={() => remove.mutate()}
+ >
+ {remove.isPending ? 'Removing…' : 'Remove all'}
+ </Button>
+ ) : null}
+ <Button size="sm" disabled={busy} onClick={() => inputRef.current?.click()}>
+ <Upload className="size-4" />
+ {upload.isPending
+ ? 'Uploading…'
+ : skills.length
+ ? 'Replace skills (.zip)'
+ : 'Upload skills (.zip)'}
+ </Button>
+ </div>
+ </div>
+ </PanelContent>
+ </Panel>
+ )
+}
diff --git a/web/src/lib/errors.ts b/web/src/lib/errors.ts
index 0d52c733..548f5309 100644
--- a/web/src/lib/errors.ts
+++ b/web/src/lib/errors.ts
@@ -16,3 +16,8 @@ export function notifyError(message: string, error?: unknown): void {
detail && detail !== message ? { description: detail } : undefined,
)
}
+
+/** Show a brief success toast (e.g. confirming a deploy + which revision is now active). */
+export function notifySuccess(message: string, description?: string): void {
+ toast.success(message, description ? { description } : undefined)
+}
diff --git a/web/src/pages/AgentDetail.tsx b/web/src/pages/AgentDetail.tsx
index 9c30f3bf..422bcca3 100644
--- a/web/src/pages/AgentDetail.tsx
+++ b/web/src/pages/AgentDetail.tsx
@@ -28,6 +28,8 @@ import { EmptyState } from '@/components/empty-state'
import { ResourceTable, type Column } from '@/components/resource-table'
import { Skeleton } from '@/components/ui/skeleton'
import { SlackConnect } from '@/components/slack-connect'
+import { AgentSkills } from '@/components/agent-skills'
+import { AgentRevisions } from '@/components/agent-revisions'
import { getRuntime } from '@/lib/runtimes'
// Sentinels for the non-credential choices in the picker. The model list +
@@ -95,6 +97,9 @@ export default function AgentDetail() {
const settleAgent = () => {
void queryClient.invalidateQueries({ queryKey: ['agent', agentId] })
void queryClient.invalidateQueries({ queryKey: ['agents'] })
+ // A prompt/model save creates a new revision → refresh the Revisions panel too.
+ void queryClient.invalidateQueries({ queryKey: ['agent-revisions', agentId] })
+ void queryClient.invalidateQueries({ queryKey: ['agent-deploys', agentId] })
}
const optimistic = async (patch: Partial<Agent>) => {
await queryClient.cancelQueries({ queryKey: ['agent', agentId] })
@@ -267,9 +272,9 @@ export default function AgentDetail() {
<span className="text-foreground font-mono">{agent.id}</span>
<span>Runtime</span>
<span className="text-foreground capitalize">{agent.runtime}</span>
- <span>Revision</span>
+ <span>Active revision</span>
<span className="text-foreground font-mono">
- {agent.revision ?? 1}
+ #{agent.active_revision?.number ?? agent.revision ?? 1}
</span>
<span>Created</span>
<span className="text-foreground">
@@ -404,6 +409,12 @@ export default function AgentDetail() {
{/* Slack — kept above Sessions so it's visible without scrolling */}
<SlackConnect agentId={agent.id} agentName={agent.name} />
+ {/* Skills — current files + upload-a-zip to deploy a new revision */}
+ <AgentSkills agentId={agent.id} />
+
+ {/* Revisions — deploy history + active pointer + rollback */}
+ <AgentRevisions agentId={agent.id} />
+
{/* Sessions */}
<Panel className="overflow-hidden">
<PanelHeader>
diff --git a/web/src/pages/Agents.tsx b/web/src/pages/Agents.tsx
index 34d6a98e..4500335a 100644
--- a/web/src/pages/Agents.tsx
+++ b/web/src/pages/Agents.tsx
@@ -185,11 +185,11 @@ export default function Agents() {
},
{
key: 'revision',
- header: 'Revision',
+ header: 'Active revision',
align: 'right',
cell: (a) => (
<span className="text-muted-foreground font-mono text-xs">
- {a.revision ?? 1}
+ #{a.active_revision?.number ?? a.revision ?? 1}
</span>
),
},