feat: auto-approve UI + session status approved
- sessions POST: look up coolifyServiceUuid, pass autoApprove:true to runner - sessions PATCH: approved added to terminal statuses (sets completed_at) - build/page.tsx: approved status, STATUS_COLORS/LABELS for "Shipped", auto-committed UI in changed files panel, bottom bar for approved state - Architecture doc: fully updated with current state Made-with: Cursor
This commit is contained in:
@@ -88,7 +88,7 @@ export async function PATCH(
|
||||
if (body.status) {
|
||||
updates.push(`status = $${idx++}`);
|
||||
values.push(body.status);
|
||||
if (body.status === "done" || body.status === "failed" || body.status === "stopped") {
|
||||
if (["done", "approved", "failed", "stopped"].includes(body.status)) {
|
||||
updates.push(`completed_at = now()`);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,17 +64,23 @@ export async function POST(
|
||||
|
||||
const giteaRepo = owns[0].data?.giteaRepo as string | undefined;
|
||||
|
||||
// Find the Coolify UUID for this specific app so the runner can trigger a deploy
|
||||
interface AppEntry { name: string; coolifyServiceUuid?: string | null; }
|
||||
const apps = (owns[0].data?.apps ?? []) as AppEntry[];
|
||||
const matchedApp = apps.find(a => a.name === appName);
|
||||
const coolifyAppUuid = matchedApp?.coolifyServiceUuid ?? undefined;
|
||||
|
||||
// Create the session row
|
||||
const rows = await query<{ id: string }>(
|
||||
`INSERT INTO agent_sessions (project_id, app_name, app_path, task, status, started_at)
|
||||
VALUES ($1::uuid, $2, $3, $4, 'running', now())
|
||||
VALUES ($1::text, $2, $3, $4, 'running', now())
|
||||
RETURNING id`,
|
||||
[projectId, appName, appPath, task.trim()]
|
||||
);
|
||||
const sessionId = rows[0].id;
|
||||
|
||||
// Fire-and-forget: call agent-runner to start the execution loop
|
||||
// The agent runner is responsible for updating the session row as it works.
|
||||
// Fire-and-forget: call agent-runner to start the execution loop.
|
||||
// autoApprove: true — agent commits + deploys automatically on completion.
|
||||
fetch(`${AGENT_RUNNER_URL}/agent/execute`, {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
@@ -83,8 +89,10 @@ export async function POST(
|
||||
projectId,
|
||||
appName,
|
||||
appPath,
|
||||
giteaRepo, // e.g. "mark/sportsy" — agent runner uses this to clone/update the repo
|
||||
giteaRepo,
|
||||
task: task.trim(),
|
||||
autoApprove: true,
|
||||
coolifyAppUuid,
|
||||
}),
|
||||
}).catch(err => {
|
||||
// Agent runner may not be wired yet — log but don't fail
|
||||
|
||||
Reference in New Issue
Block a user