Skip to content

An open-source, faster Devin alternative

TypeScript

feat(web): manage Flue Worker config and write-only secrets

Igor Zalutski715721b80120
diff --git a/web/src/api/client.ts b/web/src/api/client.ts
index 0923fbdc..9e1ed343 100644
--- a/web/src/api/client.ts
+++ b/web/src/api/client.ts
@@ -32,6 +32,8 @@ export type {
AgentSkills,
SkillItem,
AgentDeploy,
+ FlueAgentConfig,
+ FlueAgentSecret,
Session,
AgentSnapshot,
SessionEvent,
@@ -88,7 +90,11 @@ function errorMessage(body: unknown, status: number): string {
function errorType(body: unknown): string | undefined {
if (body && typeof body === 'object') {
const err = (body as Record<string, unknown>).error
- if (err && typeof err === 'object' && typeof (err as Record<string, unknown>).type === 'string') {
+ if (
+ err &&
+ typeof err === 'object' &&
+ typeof (err as Record<string, unknown>).type === 'string'
+ ) {
return (err as Record<string, unknown>).type as string
}
}
@@ -139,7 +145,11 @@ export async function apiFetch<T>(
if (!res.ok) {
const body: unknown = await res.json().catch(() => ({}))
- throw new ApiError(errorMessage(body, res.status), res.status, errorType(body))
+ throw new ApiError(
+ errorMessage(body, res.status),
+ res.status,
+ errorType(body),
+ )
}
if (res.status === 204) {
@@ -461,13 +471,47 @@ export const updateAgent = (
S.AgentSchema,
)
+// Flue Worker config. PUT is a replacement operation, so UI/SDK callers that
+// want merge semantics read first and send both vars + egress_allowlist.
+export const getFlueAgentConfig = (id: string) =>
+ apiFetch(`/v3/agents/${id}/config`, {}, S.FlueAgentConfigSchema)
+
+export const putFlueAgentConfig = (
+ id: string,
+ body: { vars: Record<string, string>; egress_allowlist: string[] },
+) =>
+ apiFetch(
+ `/v3/agents/${id}/config`,
+ { method: 'PUT', body: JSON.stringify(body) },
+ S.FlueAgentConfigSchema,
+ )
+
+export const getFlueAgentSecrets = (id: string) =>
+ apiFetch(`/v3/agents/${id}/secrets`, {}, S.FlueAgentSecretListSchema).then(
+ (r) => r.data,
+ )
+
+export const putFlueAgentSecret = (id: string, name: string, value: string) =>
+ apiFetch(
+ `/v3/agents/${id}/secrets/${encodeURIComponent(name)}`,
+ { method: 'PUT', body: JSON.stringify({ value }) },
+ S.FlueAgentSecretSchema,
+ )
+
+export const deleteFlueAgentSecret = (id: string, name: string) =>
+ apiFetch<void>(`/v3/agents/${id}/secrets/${encodeURIComponent(name)}`, {
+ method: 'DELETE',
+ })
+
// 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,
- )
+ apiFetch(
+ `/v3/agents/${agentId}/revisions`,
+ {},
+ S.AgentRevisionListSchema,
+ ).then((r) => r.data)
export const getAgentDeploys = (agentId: string) =>
apiFetch(`/v3/agents/${agentId}/deploys`, {}, S.AgentDeployListSchema).then(
@@ -515,22 +559,36 @@ export interface ScheduleRun {
}
export const getSchedules = (agentId: string) =>
- apiFetch<{ schedules: Schedule[] }>(`/v3/agents/${agentId}/schedules`).then((r) => r.schedules)
+ apiFetch<{ schedules: Schedule[] }>(`/v3/agents/${agentId}/schedules`).then(
+ (r) => r.schedules,
+ )
export const createSchedule = (
agentId: string,
- body: { name: string; cron: string; tz?: string | null; input: string; overlap?: ScheduleOverlap },
+ body: {
+ name: string
+ cron: string
+ tz?: string | null
+ input: string
+ overlap?: ScheduleOverlap
+ },
) =>
- apiFetch<{ schedule: Schedule }>(
- `/v3/agents/${agentId}/schedules`,
- { method: 'POST', body: JSON.stringify(body) },
- ).then((r) => r.schedule)
+ apiFetch<{ schedule: Schedule }>(`/v3/agents/${agentId}/schedules`, {
+ method: 'POST',
+ body: JSON.stringify(body),
+ }).then((r) => r.schedule)
// PATCH accepts any of { cron, tz, input, overlap, paused }. `paused` toggles pause/resume.
export const updateSchedule = (
agentId: string,
scheduleId: string,
- body: Partial<{ cron: string; tz: string | null; input: string; overlap: ScheduleOverlap; paused: boolean }>,
+ body: Partial<{
+ cron: string
+ tz: string | null
+ input: string
+ overlap: ScheduleOverlap
+ paused: boolean
+ }>,
) =>
apiFetch<{ schedule: Schedule }>(
`/v3/agents/${agentId}/schedules/${scheduleId}`,
@@ -538,7 +596,9 @@ export const updateSchedule = (
).then((r) => r.schedule)
export const deleteSchedule = (agentId: string, scheduleId: string) =>
- apiFetch<void>(`/v3/agents/${agentId}/schedules/${scheduleId}`, { method: 'DELETE' })
+ apiFetch<void>(`/v3/agents/${agentId}/schedules/${scheduleId}`, {
+ method: 'DELETE',
+ })
// Test-fire now — enacts synchronously (a failed fire still returns a run with outcome:"failed").
export const fireSchedule = (agentId: string, scheduleId: string) =>
@@ -547,7 +607,11 @@ export const fireSchedule = (agentId: string, scheduleId: string) =>
{ method: 'POST', body: JSON.stringify({}) },
).then((r) => r.run)
-export const getScheduleRuns = (agentId: string, scheduleId: string, limit = 10) =>
+export const getScheduleRuns = (
+ agentId: string,
+ scheduleId: string,
+ limit = 10,
+) =>
apiFetch<{ runs: ScheduleRun[]; next_cursor: string | null }>(
`/v3/agents/${agentId}/schedules/${scheduleId}/runs?limit=${limit}`,
).then((r) => r.runs)
@@ -562,24 +626,42 @@ export const getAgentSkills = (agentId: string) =>
export const putAgentSkills = (agentId: string, zip: File | Blob) =>
apiFetch(
`/v3/agents/${agentId}/skills`,
- { method: 'PUT', body: zip, headers: { 'Content-Type': 'application/zip' } },
+ {
+ 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)
+ apiFetch(
+ `/v3/agents/${agentId}/skills`,
+ { method: 'DELETE' },
+ S.DeployResultSchema,
+ )
// The OC GitHub App (deploy) install-state + pickable repos — org-scoped admin read.
-export const getDeployApp = () => apiFetch('/v3/github/deploy-app', {}, S.DeployAppSchema)
+export const getDeployApp = () =>
+ apiFetch('/v3/github/deploy-app', {}, S.DeployAppSchema)
// Deployment source — link an agent to a repo dir for push-to-deploy (deploy-from-github).
export const getDeploymentSource = (agentId: string) =>
- apiFetch(`/v3/agents/${agentId}/deployment-source`, {}, S.DeploymentSourceResponseSchema)
+ apiFetch(
+ `/v3/agents/${agentId}/deployment-source`,
+ {},
+ S.DeploymentSourceResponseSchema,
+ )
export const linkDeploymentSource = (
agentId: string,
- body: { repo: string; path: string; production_ref?: string; deploy_now?: boolean },
+ body: {
+ repo: string
+ path: string
+ production_ref?: string
+ deploy_now?: boolean
+ },
) =>
apiFetch(
`/v3/agents/${agentId}/deployment-source`,
@@ -588,7 +670,9 @@ export const linkDeploymentSource = (
)
export const unlinkDeploymentSource = (agentId: string) =>
- apiFetch<void>(`/v3/agents/${agentId}/deployment-source`, { method: 'DELETE' })
+ 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.
@@ -679,7 +763,12 @@ export const rotateCredential = (id: string, key: string) =>
// Sessions — the durable runs.
export const getSessions = (
- params: { agent?: string; status?: string; limit?: number; cursor?: string } = {},
+ params: {
+ agent?: string
+ status?: string
+ limit?: number
+ cursor?: string
+ } = {},
) => {
const q = new URLSearchParams()
if (params.agent) q.set('agent', params.agent)
@@ -741,11 +830,9 @@ export const getSessionEvents = (id: string, level?: string) =>
// Turns — the per-submission execution records behind a session (state, timing,
// usage, error). Read-only; powers the submission-health panel. Newest first.
export const getSessionTurns = (id: string) =>
- apiFetch(
- `/v3/sessions/${id}/turns`,
- {},
- S.SessionTurnListSchema,
- ).then((r) => r.data)
+ apiFetch(`/v3/sessions/${id}/turns`, {}, S.SessionTurnListSchema).then(
+ (r) => r.data,
+ )
// The latest turn + its result event (if the turn produced one).
export const getSessionResult = (id: string) =>
diff --git a/web/src/api/mock.ts b/web/src/api/mock.ts
index 31173625..e4feca9c 100644
--- a/web/src/api/mock.ts
+++ b/web/src/api/mock.ts
@@ -472,6 +472,37 @@ const agents = [
revision: 1,
created_at: at(6),
},
+ {
+ id: 'agt_flue_demo',
+ name: 'Issue Fixer',
+ prompt: null,
+ prompt_hash: null,
+ model: 'anthropic/claude-haiku-4-5',
+ runtime: 'flue',
+ credential_id: 'managed',
+ revision: 4,
+ created_at: at(2),
+ },
+]
+
+const flueConfig = {
+ vars: { LOG_LEVEL: 'info', PUBLIC_MODE: 'careful' },
+ egress_allowlist: ['api.github.com', '*.linear.app'],
+}
+
+const flueSecrets = [
+ {
+ name: 'LINEAR_API_KEY',
+ last4: '8fa2',
+ updated_at: at(1),
+ sync_status: 'synced',
+ },
+ {
+ name: 'SENTRY_DSN',
+ last4: '91bc',
+ updated_at: at(3),
+ sync_status: 'pending_deploy',
+ },
]
// ── Deploy from GitHub (admin) ───────────────────────────────────────────────
@@ -806,7 +837,10 @@ const sessionTurns = [
completed_at: at(0, 2),
active_seconds: 2.1,
usage: {},
- error: { code: 'provision_infra', message: 'brain sandbox failed to start' },
+ error: {
+ code: 'provision_infra',
+ message: 'brain sandbox failed to start',
+ },
},
]
@@ -923,6 +957,8 @@ const ROUTES: Array<[RegExp, Handler]> = [
[/^\/agents$/, () => []],
// Durable Agent Sessions — lists return the { data: [...] } envelope.
[/^\/v3\/agents\/[^/]+\/slack$/, () => slackConnection],
+ [/^\/v3\/agents\/[^/]+\/config$/, () => flueConfig],
+ [/^\/v3\/agents\/[^/]+\/secrets$/, () => ({ data: flueSecrets })],
[/^\/v3\/github\/deploy-app$/, () => deployApp],
[
/^\/v3\/agents\/[^/]+\/deployment-source$/,
@@ -932,6 +968,7 @@ const ROUTES: Array<[RegExp, Handler]> = [
[/^\/v3\/agents\/[^/]+\/deploys$/, () => ({ data: agentDeploys })],
[/^\/v3\/agents\/[^/]+\/revisions$/, () => ({ data: agentRevisions })],
[/^\/v3\/agents\/[^/]+\/skills$/, () => agentSkills],
+ [/^\/v3\/agents\/agt_flue_demo$/, () => agents[2]],
[/^\/v3\/agents\/[^/]+$/, () => agents[0]],
[/^\/v3\/agents$/, () => ({ data: agents })],
[/^\/v3\/credentials$/, () => ({ data: credentials })],
@@ -959,6 +996,19 @@ const ROUTES: Array<[RegExp, Handler]> = [
// Mutations the preview needs to echo something parseable (e.g. the Slack
// wizard's POST …/slack/manifest → manifest+steps). Everything else 204-ish.
const POST_ROUTES: [RegExp, () => unknown][] = [
+ [
+ /^\/v3\/agents\/[^/]+\/config$/,
+ () => ({ ...flueConfig, deployment_required: true }),
+ ],
+ [
+ /^\/v3\/agents\/[^/]+\/secrets\/[^/]+$/,
+ () => ({
+ name: 'NEW_SECRET',
+ last4: 'cdef',
+ updated_at: at(0),
+ sync_status: 'synced',
+ }),
+ ],
[/^\/v3\/agents\/[^/]+\/slack\/manifest$/, () => slackManifest],
[
/^\/v3\/agents\/[^/]+\/slack$/,
diff --git a/web/src/api/schemas.ts b/web/src/api/schemas.ts
index 661890bc..d9abfbb9 100644
--- a/web/src/api/schemas.ts
+++ b/web/src/api/schemas.ts
@@ -345,6 +345,23 @@ export const AgentListSchema = z.object({
next_cursor: z.string().nullish(),
})
+// Flue Worker bindings. Vars are intentionally plain/readable; secret values
+// are write-only and only their metadata crosses back into the dashboard.
+export const FlueAgentConfigSchema = z.object({
+ vars: z.record(z.string(), z.string()),
+ egress_allowlist: z.array(z.string()),
+ deployment_required: z.boolean().optional(),
+})
+export const FlueAgentSecretSchema = z.object({
+ name: z.string(),
+ last4: z.string(),
+ updated_at: z.string(),
+ sync_status: z.string(),
+})
+export const FlueAgentSecretListSchema = z.object({
+ data: z.array(FlueAgentSecretSchema),
+})
+
// 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({
@@ -542,7 +559,9 @@ export const SessionEventSchema = z.object({
// `body` is absent/partial, `content_ref` points at the blob, `body_bytes` is the size.
content_ref: z.string().nullish(),
body_truncated: z.boolean().nullish(),
- body_bytes: z.number().nullish(),
+ // PostgreSQL bigint values are serialized as strings by the sessions API.
+ // Coerce here so spilled event bodies remain visible in the live timeline.
+ body_bytes: z.coerce.number().nullish(),
refs: record.nullish(),
source: z.string().optional(),
turn_id: z.string().nullable().optional(),
@@ -603,6 +622,8 @@ export const DeliverySchema = z.object({
})
export type Agent = z.infer<typeof AgentSchema>
+export type FlueAgentConfig = z.infer<typeof FlueAgentConfigSchema>
+export type FlueAgentSecret = z.infer<typeof FlueAgentSecretSchema>
export type AgentRevision = z.infer<typeof AgentRevisionSchema>
export type AgentSkills = z.infer<typeof AgentSkillsSchema>
export type SkillItem = z.infer<typeof SkillItemSchema>
diff --git a/web/src/components/agent-flue-config.tsx b/web/src/components/agent-flue-config.tsx
new file mode 100644
index 00000000..e8247564
--- /dev/null
+++ b/web/src/components/agent-flue-config.tsx
@@ -0,0 +1,500 @@
+import { useState } from 'react'
+import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query'
+import { Plus, Trash2 } from 'lucide-react'
+import {
+ deleteFlueAgentSecret,
+ getFlueAgentConfig,
+ getFlueAgentSecrets,
+ putFlueAgentConfig,
+ putFlueAgentSecret,
+ type FlueAgentConfig,
+ type FlueAgentSecret,
+} from '@/api/client'
+import { ConfirmDialog } from '@/components/confirm-dialog'
+import { Field, FieldError, Input, Textarea } from '@/components/form'
+import {
+ Panel,
+ PanelContent,
+ PanelDescription,
+ PanelHeader,
+ PanelTitle,
+} from '@/components/panel'
+import { Badge } from '@/components/ui/badge'
+import { Button } from '@/components/ui/button'
+import { Skeleton } from '@/components/ui/skeleton'
+import { notifyError, notifySuccess } from '@/lib/errors'
+import { cn } from '@/lib/utils'
+
+const BINDING_NAME = /^[A-Z][A-Z0-9_]{0,63}$/
+
+type BindingRow = { id: string; name: string; value: string }
+
+const bindingRows = (vars: Record<string, string>): BindingRow[] =>
+ Object.entries(vars)
+ .sort(([a], [b]) => a.localeCompare(b))
+ .map(([name, value]) => ({ id: crypto.randomUUID(), name, value }))
+
+function normalizedHosts(value: string): string[] {
+ return [
+ ...new Set(
+ value
+ .split(/[,\n]/)
+ .map((host) => host.trim().toLowerCase())
+ .filter(Boolean),
+ ),
+ ].sort()
+}
+
+function validHost(value: string): boolean {
+ const host = value.startsWith('*.') ? value.slice(2) : value
+ return (
+ value.length <= 253 &&
+ !value.includes('://') &&
+ !value.includes('/') &&
+ !value.includes(':') &&
+ /^[a-z0-9](?:[a-z0-9.-]*[a-z0-9])?$/.test(host) &&
+ host.includes('.')
+ )
+}
+
+function payloadFor(rows: BindingRow[], egress: string) {
+ const vars: Record<string, string> = {}
+ for (const row of rows) {
+ const name = row.name.trim()
+ if (name) vars[name] = row.value
+ }
+ return { vars, egress_allowlist: normalizedHosts(egress) }
+}
+
+function configIssue(rows: BindingRow[], egress: string): string | null {
+ const populated = rows.filter((row) => row.name.trim() || row.value)
+ const names = populated.map((row) => row.name.trim())
+ if (names.some((name) => !name)) return 'Every value needs a variable name.'
+ const invalid = names.find(
+ (name) =>
+ !BINDING_NAME.test(name) ||
+ name.startsWith('OC_') ||
+ name.startsWith('FLUE_'),
+ )
+ if (invalid)
+ return `${invalid} is invalid or reserved. Use uppercase letters, numbers, and underscores.`
+ if (new Set(names).size !== names.length)
+ return 'Variable names must be unique.'
+ const badHost = normalizedHosts(egress).find((host) => !validHost(host))
+ if (badHost) return `${badHost} is not a valid hostname.`
+ return null
+}
+
+export function AgentFlueConfig({ agentId }: { agentId: string }) {
+ const config = useQuery({
+ queryKey: ['agent-flue-config', agentId],
+ queryFn: () => getFlueAgentConfig(agentId),
+ })
+ const secrets = useQuery({
+ queryKey: ['agent-flue-secrets', agentId],
+ queryFn: () => getFlueAgentSecrets(agentId),
+ })
+
+ if (config.isLoading || secrets.isLoading) {
+ return (
+ <div className="space-y-6" aria-label="Loading Worker configuration">
+ <Skeleton className="h-72 w-full" />
+ <Skeleton className="h-56 w-full" />
+ </div>
+ )
+ }
+
+ return (
+ <>
+ {config.data ? (
+ <ConfigEditor agentId={agentId} config={config.data} />
+ ) : (
+ <LoadFailure
+ label="Worker configuration"
+ retry={() => void config.refetch()}
+ />
+ )}
+ {secrets.data ? (
+ <SecretEditor agentId={agentId} secrets={secrets.data} />
+ ) : (
+ <LoadFailure
+ label="Worker secrets"
+ retry={() => void secrets.refetch()}
+ />
+ )}
+ </>
+ )
+}
+
+function ConfigEditor({
+ agentId,
+ config,
+}: {
+ agentId: string
+ config: FlueAgentConfig
+}) {
+ const queryClient = useQueryClient()
+ const [rows, setRows] = useState<BindingRow[]>(() => bindingRows(config.vars))
+ const [egress, setEgress] = useState(() => config.egress_allowlist.join('\n'))
+ const issue = configIssue(rows, egress)
+ const payload = payloadFor(rows, egress)
+ const current = payloadFor(
+ bindingRows(config.vars),
+ config.egress_allowlist.join('\n'),
+ )
+ const dirty = JSON.stringify(payload) !== JSON.stringify(current)
+
+ const save = useMutation({
+ mutationFn: () => putFlueAgentConfig(agentId, payload),
+ onSuccess: (saved) => {
+ queryClient.setQueryData(['agent-flue-config', agentId], saved)
+ notifySuccess(
+ 'Worker configuration saved.',
+ 'Variables apply on the next deploy. Outbound policy updates shortly.',
+ )
+ },
+ onError: (error) =>
+ notifyError("Couldn't save Worker configuration.", error),
+ })
+
+ return (
+ <Panel>
+ <PanelHeader>
+ <div className="space-y-1">
+ <PanelTitle>Worker environment</PanelTitle>
+ <PanelDescription>
+ Non-secret bindings and the hosts this agent may call over HTTPS.
+ </PanelDescription>
+ </div>
+ </PanelHeader>
+ <PanelContent className="space-y-6">
+ <section aria-labelledby="flue-vars-heading" className="space-y-3">
+ <div className="flex flex-wrap items-start justify-between gap-3">
+ <div className="space-y-1">
+ <h3 id="flue-vars-heading" className="text-sm font-medium">
+ Variables
+ </h3>
+ <p className="text-muted-foreground max-w-2xl text-xs">
+ These values are readable configuration. Put credentials and
+ tokens in Worker secrets below.
+ </p>
+ </div>
+ <Button
+ type="button"
+ variant="outline"
+ size="sm"
+ onClick={() =>
+ setRows((old) => [
+ ...old,
+ { id: crypto.randomUUID(), name: '', value: '' },
+ ])
+ }
+ >
+ <Plus aria-hidden />
+ Add variable
+ </Button>
+ </div>
+
+ {rows.length ? (
+ <div className="space-y-2">
+ {rows.map((row, index) => (
+ <div
+ key={row.id}
+ className="flex flex-col gap-2 sm:flex-row sm:items-center"
+ >
+ <Input
+ aria-label={`Variable ${index + 1} name`}
+ value={row.name}
+ onChange={(event) =>
+ setRows((old) =>
+ old.map((item) =>
+ item.id === row.id
+ ? {
+ ...item,
+ name: event.target.value.toUpperCase(),
+ }
+ : item,
+ ),
+ )
+ }
+ placeholder="VARIABLE_NAME"
+ className="font-mono sm:w-2/5"
+ autoCapitalize="characters"
+ autoCorrect="off"
+ spellCheck={false}
+ />
+ <Input
+ aria-label={`Variable ${index + 1} value`}
+ value={row.value}
+ onChange={(event) =>
+ setRows((old) =>
+ old.map((item) =>
+ item.id === row.id
+ ? { ...item, value: event.target.value }
+ : item,
+ ),
+ )
+ }
+ placeholder="Value"
+ className="font-mono sm:flex-1"
+ spellCheck={false}
+ />
+ <Button
+ type="button"
+ variant="ghost"
+ size="icon-sm"
+ className="self-end sm:self-auto"
+ aria-label={`Remove ${row.name || `variable ${index + 1}`}`}
+ onClick={() =>
+ setRows((old) => old.filter((item) => item.id !== row.id))
+ }
+ >
+ <Trash2 aria-hidden />
+ </Button>
+ </div>
+ ))}
+ </div>
+ ) : (
+ <p className="border-border text-muted-foreground rounded-md border border-dashed px-3 py-4 text-sm">
+ No variables. This Worker receives only OpenComputer-managed
+ bindings and secrets.
+ </p>
+ )}
+ </section>
+
+ <Field
+ label="Allowed outbound hosts"
+ htmlFor="flue-egress-hosts"
+ description="One hostname per line. Wildcards such as *.example.com include subdomains. Other external hosts are blocked."
+ >
+ <Textarea
+ id="flue-egress-hosts"
+ value={egress}
+ onChange={(event) => setEgress(event.target.value)}
+ placeholder={'api.example.com\n*.example.net'}
+ className="min-h-24 font-mono"
+ autoCapitalize="none"
+ autoCorrect="off"
+ spellCheck={false}
+ />
+ </Field>
+
+ {issue ? <FieldError>{issue}</FieldError> : null}
+ <div className="flex flex-wrap items-center justify-between gap-3 border-t pt-4">
+ <p className="text-muted-foreground text-xs">
+ Variable changes are included in the next deployment.
+ </p>
+ <Button
+ type="button"
+ size="sm"
+ disabled={!dirty || !!issue || save.isPending}
+ onClick={() => save.mutate()}
+ >
+ {save.isPending ? 'Saving…' : 'Save configuration'}
+ </Button>
+ </div>
+ </PanelContent>
+ </Panel>
+ )
+}
+
+function SecretEditor({
+ agentId,
+ secrets,
+}: {
+ agentId: string
+ secrets: FlueAgentSecret[]
+}) {
+ const queryClient = useQueryClient()
+ const [name, setName] = useState('')
+ const [value, setValue] = useState('')
+ const [deleting, setDeleting] = useState<string | null>(null)
+ const normalizedName = name.trim().toUpperCase()
+ const nameIssue =
+ normalizedName &&
+ (!BINDING_NAME.test(normalizedName) ||
+ normalizedName.startsWith('OC_') ||
+ normalizedName.startsWith('FLUE_'))
+ ? 'Use an uppercase, non-reserved environment variable name.'
+ : null
+
+ const refresh = () =>
+ queryClient.invalidateQueries({ queryKey: ['agent-flue-secrets', agentId] })
+ const setSecret = useMutation({
+ mutationFn: () => putFlueAgentSecret(agentId, normalizedName, value),
+ onSuccess: (saved) => {
+ setName('')
+ setValue('')
+ void refresh()
+ notifySuccess(
+ `${saved.name} saved.`,
+ saved.sync_status === 'synced'
+ ? 'The deployed Worker was updated.'
+ : 'It will be included in the next deployment.',
+ )
+ },
+ onError: (error) => {
+ void refresh()
+ notifyError("Couldn't finish updating the Worker secret.", error)
+ },
+ })
+ const removeSecret = useMutation({
+ mutationFn: (secretName: string) =>
+ deleteFlueAgentSecret(agentId, secretName),
+ onSuccess: (_result, secretName) => {
+ setDeleting(null)
+ void refresh()
+ notifySuccess(`${secretName} deleted.`)
+ },
+ onError: (error) =>
+ notifyError("Couldn't delete the Worker secret.", error),
+ })
+
+ return (
+ <Panel>
+ <PanelHeader>
+ <div className="space-y-1">
+ <PanelTitle>Worker secrets</PanelTitle>
+ <PanelDescription>
+ Values are encrypted and write-only. Only the last four characters
+ are shown after saving.
+ </PanelDescription>
+ </div>
+ </PanelHeader>
+ <PanelContent className="space-y-5">
+ <form
+ className="grid gap-3 sm:grid-cols-[minmax(0,0.8fr)_minmax(0,1.2fr)_auto] sm:items-start"
+ onSubmit={(event) => {
+ event.preventDefault()
+ if (normalizedName && value && !nameIssue) setSecret.mutate()
+ }}
+ >
+ <Field label="Name" htmlFor="flue-secret-name" error={nameIssue}>
+ <Input
+ id="flue-secret-name"
+ value={name}
+ onChange={(event) => setName(event.target.value.toUpperCase())}
+ placeholder="API_TOKEN"
+ className="font-mono"
+ autoCapitalize="characters"
+ autoCorrect="off"
+ spellCheck={false}
+ />
+ </Field>
+ <Field label="Value" htmlFor="flue-secret-value">
+ <Input
+ id="flue-secret-value"
+ type="password"
+ value={value}
+ onChange={(event) => setValue(event.target.value)}
+ placeholder="Paste a new value"
+ className="font-mono"
+ autoComplete="new-password"
+ spellCheck={false}
+ />
+ </Field>
+ <Button
+ type="submit"
+ size="sm"
+ className="sm:mt-6"
+ disabled={
+ !normalizedName || !value || !!nameIssue || setSecret.isPending
+ }
+ >
+ {setSecret.isPending ? 'Saving…' : 'Set secret'}
+ </Button>
+ </form>
+
+ <div className="border-t">
+ {secrets.length ? (
+ secrets.map((secret) => (
+ <div
+ key={secret.name}
+ className="flex flex-wrap items-center gap-x-3 gap-y-2 border-b py-3 last:border-b-0"
+ >
+ <div className="min-w-0 flex-1">
+ <p className="truncate font-mono text-sm font-medium">
+ {secret.name}
+ </p>
+ <p className="text-muted-foreground mt-0.5 text-xs">
+ ends in <span className="font-mono">{secret.last4}</span> ·
+ updated {new Date(secret.updated_at).toLocaleDateString()}
+ </p>
+ </div>
+ <SecretSyncStatus value={secret.sync_status} />
+ <Button
+ type="button"
+ variant="destructive"
+ size="sm"
+ onClick={() => setDeleting(secret.name)}
+ >
+ <Trash2 aria-hidden />
+ Delete
+ </Button>
+ </div>
+ ))
+ ) : (
+ <p className="text-muted-foreground py-5 text-sm">
+ No Worker secrets have been set.
+ </p>
+ )}
+ </div>
+ </PanelContent>
+
+ <ConfirmDialog
+ open={!!deleting}
+ onOpenChange={(open) => {
+ if (!open) setDeleting(null)
+ }}
+ title={`Delete ${deleting ?? 'secret'}?`}
+ description="The binding will be removed from the deployed Worker. Requests that depend on it may fail immediately."
+ confirmLabel="Delete secret"
+ destructive
+ pending={removeSecret.isPending}
+ onConfirm={() => {
+ if (deleting) removeSecret.mutate(deleting)
+ }}
+ />
+ </Panel>
+ )
+}
+
+function SecretSyncStatus({ value }: { value: string }) {
+ const pending = value === 'pending_deploy'
+ const error = value === 'error'
+ return (
+ <Badge
+ variant={error ? 'destructive' : 'outline'}
+ className={cn(
+ pending &&
+ 'bg-status-pending-bg text-status-pending border-transparent',
+ value === 'synced' &&
+ 'bg-status-running-bg text-status-running border-transparent',
+ )}
+ >
+ {value === 'pending_deploy'
+ ? 'Pending deploy'
+ : value === 'synced'
+ ? 'Synced'
+ : 'Sync error'}
+ </Badge>
+ )
+}
+
+function LoadFailure({ label, retry }: { label: string; retry: () => void }) {
+ return (
+ <Panel>
+ <PanelContent className="flex flex-wrap items-center justify-between gap-3">
+ <div>
+ <p className="text-sm font-medium">{label} could not be loaded.</p>
+ <p className="text-muted-foreground mt-1 text-xs">
+ Existing Worker state was not changed.
+ </p>
+ </div>
+ <Button type="button" variant="outline" size="sm" onClick={retry}>
+ Try again
+ </Button>
+ </PanelContent>
+ </Panel>
+ )
+}
diff --git a/web/src/components/api-hint.tsx b/web/src/components/api-hint.tsx
index 0724fdcb..bbfd717c 100644
--- a/web/src/components/api-hint.tsx
+++ b/web/src/components/api-hint.tsx
@@ -14,9 +14,9 @@ export type ApiRef = {
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">
+ <div className="text-muted-foreground/70 flex min-w-0 flex-wrap items-center gap-x-2.5 gap-y-1 overflow-hidden pt-1 text-xs">
{path ? (
- <span className="font-mono">
+ <span className="max-w-full truncate font-mono">
{method ? (
<span className="text-muted-foreground/50">{method} </span>
) : null}
@@ -24,7 +24,7 @@ export function ApiHint({ method, path, sdk, docs }: ApiRef) {
</span>
) : null}
{sdk ? (
- <span className="text-muted-foreground/50 font-mono">
+ <span className="text-muted-foreground/50 max-w-full truncate font-mono">
{path ? '· ' : ''}
{sdk}
</span>
diff --git a/web/src/pages/AgentDetail.tsx b/web/src/pages/AgentDetail.tsx
index 71cb0f00..7874d30e 100644
--- a/web/src/pages/AgentDetail.tsx
+++ b/web/src/pages/AgentDetail.tsx
@@ -32,12 +32,18 @@ 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 { AgentFlueConfig } from '@/components/agent-flue-config'
import {
WorkingRepoField,
type WorkingRepo,
} from '@/components/working-repo-field'
import { ApiHint, type ApiRef } from '@/components/api-hint'
-import { getRuntime, keyFieldFor, providerForModel, withModelGroups } from '@/lib/runtimes'
+import {
+ getRuntime,
+ keyFieldFor,
+ providerForModel,
+ withModelGroups,
+} from '@/lib/runtimes'
const DOCS = 'https://docs.opencomputer.dev/agent-sessions'
@@ -66,11 +72,36 @@ export default function AgentDetail() {
// 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` },
- 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` },
- settings: { method: 'PATCH', path: `/v3/agents/${agentId}`, sdk: 'oc.agents.update(id, …)', docs: `${DOCS}/agents` },
+ overview: {
+ method: 'GET',
+ path: `/v3/agents/${agentId}`,
+ sdk: 'oc.agents.get(id)',
+ docs: `${DOCS}/agents`,
+ },
+ 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`,
+ },
+ settings: {
+ method: 'PATCH',
+ path: `/v3/agents/${agentId}`,
+ sdk: 'oc.agents.update(id, …)',
+ docs: `${DOCS}/agents`,
+ },
}
const {
@@ -129,8 +160,8 @@ export default function AgentDetail() {
const location = useLocation()
const [task, setTask] = useState(
() =>
- (location.state as { composerPrefill?: string } | null)?.composerPrefill ??
- '',
+ (location.state as { composerPrefill?: string } | null)
+ ?.composerPrefill ?? '',
)
// Optional working repo — the repo the agent checks out + opens PRs from. Explicitly chosen,
// never derived from the connected/config repo (design 010 §2).
@@ -292,7 +323,7 @@ export default function AgentDetail() {
<BackLink />
{/* Sticky header: identity + status + primary action, with the tab bar. */}
- <div className="bg-background sticky top-0 z-20 border-b">
+ <div className="bg-background sticky top-0 z-20 min-w-0 border-b">
<div className="flex flex-wrap items-start justify-between gap-3 pb-3">
<div className="min-w-0 space-y-1.5">
<h1 className="text-foreground truncate text-lg font-semibold">
@@ -312,7 +343,7 @@ export default function AgentDetail() {
</Link>
</Button>
</div>
- <nav className="-mb-px flex gap-1">
+ <nav className="-mb-px flex max-w-full gap-1 overflow-x-auto">
<TabLink to={base} label="Overview" current={active === 'overview'} />
<TabLink
to={`${base}/revisions`}
@@ -596,6 +627,9 @@ export default function AgentDetail() {
</p>
</PanelContent>
</Panel>
+ {agent.runtime === 'flue' ? (
+ <AgentFlueConfig agentId={agent.id} />
+ ) : null}
</div>
)}
</div>