- Next.js app for orchestrating coding agent benchmarks (Claude Code, Codex, OpenCode) - Dockerfile installs git, gh CLI, and agent CLIs for headless execution - K8s deployment with workspace volume, sealed credentials for Claude + OpenCode - Traefik IngressRoute at harness.coreworlds.io with internal-only middleware + TLS - CI pipeline path filter for harness builds - Fix OpenCode runtime flags (subcommand-based headless mode)
46 lines
1.2 KiB
TypeScript
46 lines
1.2 KiB
TypeScript
import { NextRequest, NextResponse } from "next/server";
|
|
import { getAllTasks, createTask } from "@/lib/store";
|
|
import { getAgentConfig } from "@/lib/agents";
|
|
import { Task, TaskSpec } from "@/lib/types";
|
|
|
|
export async function GET() {
|
|
return NextResponse.json(getAllTasks());
|
|
}
|
|
|
|
export async function POST(request: NextRequest) {
|
|
const spec: TaskSpec = await request.json();
|
|
|
|
if (!spec.slug || !spec.goal) {
|
|
return NextResponse.json({ error: "slug and goal are required" }, { status: 400 });
|
|
}
|
|
|
|
if (!spec.agentId) {
|
|
return NextResponse.json({ error: "agentId is required" }, { status: 400 });
|
|
}
|
|
|
|
const agentConfig = getAgentConfig(spec.agentId);
|
|
if (!agentConfig) {
|
|
return NextResponse.json(
|
|
{ error: `Agent config not found: ${spec.agentId}` },
|
|
{ status: 400 },
|
|
);
|
|
}
|
|
|
|
const task: Task = {
|
|
id: `task-${Date.now()}`,
|
|
slug: spec.slug,
|
|
goal: spec.goal,
|
|
project: spec.project || "—",
|
|
status: "pending",
|
|
iteration: 0,
|
|
maxIterations: spec.maxIterations || 6,
|
|
startedAt: null,
|
|
evals: {},
|
|
iterations: [],
|
|
spec,
|
|
};
|
|
|
|
const created = createTask(task);
|
|
return NextResponse.json(created, { status: 201 });
|
|
}
|