feat: add c0mpute plugin and hire-us request flow

This commit is contained in:
Anthony Ettinger 2026-06-06 19:42:00 +00:00
parent 1a87c2f26d
commit b1d8fe475a
20 changed files with 1271 additions and 59 deletions

View file

@ -1,18 +1,20 @@
import { createServer, type IncomingMessage, type ServerResponse } from "node:http";
import { pathToFileURL } from "node:url";
import { createPluginRegistry } from "@logicsrc/plugin-core";
import { c0mputePlugin } from "@logicsrc/plugin-c0mpute";
import { coinPayPlugin } from "@logicsrc/plugin-coinpay";
import { sh1ptPlugin } from "@logicsrc/plugin-sh1pt";
import { uGigPlugin } from "@logicsrc/plugin-ugig";
import { schemas, validate } from "@logicsrc/validators";
const registry = createPluginRegistry([coinPayPlugin, uGigPlugin, sh1ptPlugin]);
const registry = createPluginRegistry([coinPayPlugin, uGigPlugin, sh1ptPlugin, c0mputePlugin]);
const boards = [
{ path: "/general", title: "General", description: "CommandBoard.run general discussion." },
{ path: "/gigs", title: "Gigs", description: "Paid work, uGig imports, and LogicSRC tasks." },
{ path: "/agents", title: "Agents", description: "Agent registration, runs, and capabilities." },
{ path: "/projects/sh1pt", title: "sh1pt", description: "Project actions, releases, artifacts, and delivery status." }
{ path: "/projects/sh1pt", title: "sh1pt", description: "Project actions, releases, artifacts, and delivery status." },
{ path: "/projects/c0mpute", title: "c0mpute", description: "Compute jobs, worker pools, usage, and settlement status." }
];
const tasks = [
@ -41,6 +43,15 @@ const sh1ptActions = [
{ id: "action_deploy_preview", title: "Deploy preview", publishable: true }
];
const c0mputeJobs = [
{ id: "compute_job_1", board: "/projects/c0mpute", status: "draft", workload: "agent-run-smoke-test", provider: "c0mpute.com" },
{ id: "compute_job_2", board: "/projects/c0mpute", status: "queued", workload: "openspec-index-build", provider: "c0mpute.com" }
];
const c0mputeWorkers = [
{ id: "worker_pool_1", region: "us-west", status: "preview", capacity: "wip" }
];
export function createCommandBoardServer() {
return createServer(async (request, response) => {
try {
@ -127,6 +138,49 @@ async function route(request: IncomingMessage, response: ServerResponse) {
return;
}
if (request.method === "GET" && url.pathname === "/api/plugins/c0mpute/jobs") {
json(response, 200, { jobs: c0mputeJobs });
return;
}
if (request.method === "GET" && url.pathname === "/api/plugins/c0mpute/workers") {
json(response, 200, { workers: c0mputeWorkers });
return;
}
if (request.method === "POST" && url.pathname === "/api/plugins/c0mpute/jobs/dispatch") {
const body = await readJson(request);
if (!isRecord(body) || typeof body.job_id !== "string") {
json(response, 422, { error: "Expected job_id" });
return;
}
json(response, 202, {
accepted: true,
job_id: body.job_id,
status: "queued",
board: typeof body.board === "string" ? body.board : "/projects/c0mpute"
});
return;
}
if (request.method === "POST" && url.pathname === "/api/plugins/c0mpute/quotes") {
const body = await readJson(request);
if (!isRecord(body) || typeof body.workload !== "string") {
json(response, 422, { error: "Expected workload" });
return;
}
json(response, 202, {
accepted: true,
quote_id: `quote_${Date.now()}`,
workload: body.workload,
provider: "c0mpute.com",
status: "draft"
});
return;
}
if (request.method === "GET" && url.pathname === "/api/schemas") {
json(response, 200, { schemas: Object.keys(schemas) });
return;