g1t/apps/web/app/routes/repo/audit-live.ts
Pick any line to see why it is the way it is: the commit, the pull request and issue it came from, and what the agent was thinking.
| Agents get guardrails, run credentials, an audit log, a context hub, repository instructions and mentions; security upkeep; snake_case API | 1 | /** |
| 2 | * What a project's agent runs did, from the workspace's audit log, as | |
| 3 | * JSON: for the Agent panel on a pull request. Members only; anyone else | |
| 4 | * gets an empty list. | |
| 5 | */ | |
| 6 | import type { Route } from "./+types/audit-live"; | |
| 7 | import { runAudit } from "../../lib/audit.server"; | |
| 8 | import { getViewer } from "../../lib/session.server"; | |
| 9 | ||
| 10 | export async function loader({ params, context, request }: Route.LoaderArgs) { | |
| 11 | const viewer = getViewer(context); | |
| 12 | const runIds = new URL(request.url).searchParams | |
| 13 | .getAll("run") | |
| 14 | .map((id) => id.trim()) | |
| 15 | .filter((id) => /^[A-Za-z0-9_-]{1,64}$/.test(id)) | |
| 16 | .slice(0, 20); | |
| 17 | const entries = await runAudit(viewer, params.owner, runIds); | |
| 18 | return Response.json({ entries }, { headers: { "cache-control": "no-store" } }); | |
| 19 | } |