feat(agent): event timeline API, SSE stream, Coolify DDL, env template

- Add agent_session_events table + GET/POST events + SSE stream routes
- Build Agent tab: hydrate from events + EventSource while running
- entrypoint: create agent_sessions + agent_session_events on container start
- .env.example for AGENT_RUNNER_URL, AGENT_RUNNER_SECRET, DATABASE_URL

Made-with: Cursor
This commit is contained in:
2026-04-01 11:48:55 -07:00
parent a11caafd22
commit 26429f3517
9 changed files with 497 additions and 15 deletions

View File

@@ -66,6 +66,13 @@ export async function POST(
);
const giteaRepo = proj[0]?.data?.giteaRepo as string | undefined;
// Clear persisted event timeline so SSE / replay matches the new run (no-op if table missing)
try {
await query(`DELETE FROM agent_session_events WHERE session_id = $1::uuid`, [sessionId]);
} catch {
/* table may not exist until admin migrate */
}
// Reset the session row so the frontend shows it as running again
await query(
`UPDATE agent_sessions