Skip to content

An open-source, faster Devin alternative

TypeScript

style: format repository deploy dashboard

Igor Zalutski55f34adc3859
diff --git a/web/src/api/client.ts b/web/src/api/client.ts
index 180aac89..cb5ac765 100644
--- a/web/src/api/client.ts
+++ b/web/src/api/client.ts
@@ -520,9 +520,11 @@ export const updateAgent = (
// 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(
@@ -570,22 +572,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}`,
@@ -593,7 +609,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) =>
@@ -602,7 +620,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)
@@ -617,16 +639,25 @@ 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)
export const inspectFlueRepository = (body: {
repo: string
@@ -664,11 +695,20 @@ export const importAgentFromGithub = (
// 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`,
@@ -677,7 +717,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).
export const deployFromGithub = (agentId: string, idempotencyKey: string) =>
@@ -810,7 +852,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)
@@ -875,11 +922,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 2ffb1cec..9513ee52 100644
--- a/web/src/api/mock.ts
+++ b/web/src/api/mock.ts
@@ -1009,7 +1009,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',
+ },
},
]
diff --git a/web/src/lib/agent-deployment-status.ts b/web/src/lib/agent-deployment-status.ts
index c9aca526..590b4a25 100644
--- a/web/src/lib/agent-deployment-status.ts
+++ b/web/src/lib/agent-deployment-status.ts
@@ -34,9 +34,7 @@ export function agentDeploymentDisplayStatus(
* intentionally unknown; that proof enables admission only and must never be
* projected as a live/verified label.
*/
-export function agentCanStartNewSession(
- agent: AgentDeploymentHealth,
-): boolean {
+export function agentCanStartNewSession(agent: AgentDeploymentHealth): boolean {
const hasActiveRevision =
!!agent.active_revision_id || (agent.revision ?? 0) > 0
if (!hasActiveRevision) return false
diff --git a/web/src/pages/AgentDetail.tsx b/web/src/pages/AgentDetail.tsx
index 4ca4890a..362351b1 100644
--- a/web/src/pages/AgentDetail.tsx
+++ b/web/src/pages/AgentDetail.tsx
@@ -42,7 +42,12 @@ import {
agentCanStartNewSession,
agentDeploymentDisplayStatus,
} from '@/lib/agent-deployment-status'
-import { getRuntime, keyFieldFor, providerForModel, withModelGroups } from '@/lib/runtimes'
+import {
+ getRuntime,
+ keyFieldFor,
+ providerForModel,
+ withModelGroups,
+} from '@/lib/runtimes'
const DOCS = 'https://docs.opencomputer.dev/agent-sessions'
@@ -79,12 +84,37 @@ 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` },
+ 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` },
- settings: { method: 'PATCH', path: `/v3/agents/${agentId}`, sdk: 'oc.agents.update(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 {
@@ -143,8 +173,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).
@@ -353,10 +383,7 @@ export default function AgentDetail() {
</Button>
)}
</div>
- <nav
- className="-mb-px flex gap-1 overflow-x-auto"
- aria-label="Agent"
- >
+ <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`}
@@ -527,9 +554,7 @@ export default function AgentDetail() {
)}
{active === 'revisions' && <AgentRevisions agentId={agent.id} />}
- {active === 'deployments' && (
- <AgentDeployments agentId={agent.id} />
- )}
+ {active === 'deployments' && <AgentDeployments agentId={agent.id} />}
{active === 'schedules' && <AgentSchedulesTab agentId={agent.id} />}
{active === 'sessions' && (
@@ -575,9 +600,7 @@ export default function AgentDetail() {
className="ml-auto"
>
<Send className="size-4" />
- {startMutation.isPending
- ? 'Starting…'
- : 'Start session'}
+ {startMutation.isPending ? 'Starting…' : 'Start session'}
</Button>
</div>
</form>