import type { Route } from "./+types/repo-agents"; import { AgentActivity, HostedAgentsPage, agentsAction, editingFrom } from "../components/hosted-agents"; import { useLive } from "../components/live"; import { found, fullName, nowSeconds, signedIn } from "../lib/session"; export const meta: Route.MetaFunction = ({ params }) => [{ title: `Agents · ${fullName(params)} · refs` }]; async function hostedAgents(context: Route.LoaderArgs["context"], name: string) { const repo = await found(signedIn(context).repo(name)); return found(repo.hostedAgents()); } export async function loader({ request, params, context }: Route.LoaderArgs) { const name = fullName(params); const repo = await found(signedIn(context).repo(name)); const open = new URL(request.url).searchParams.get("run"); const agents = await found(repo.hostedAgents()); const [list, runs] = await Promise.all([agents.list(), repo.agentRuns(open)]); return { repo: name, list, runs, open, now: nowSeconds(), canEdit: agents.canEdit, editing: editingFrom(request, list, "repo") }; } export async function action({ request, params, context }: Route.ActionArgs) { const name = fullName(params); return agentsAction(await hostedAgents(context, name), request, `/${name}/agents`); } export default function RepoAgents({ loaderData, actionData }: Route.ComponentProps) { useLive(loaderData.repo); return (
Agents that refs runs for this repository. Mention one as @handle on a pull request, or run one from CI. Shared agents come from the namespace settings; customize one to change it here only.