mirror of
https://github.com/profullstack/logicsrc.git
synced 2026-08-14 06:47:28 +00:00
feat: add c0mpute plugin and hire-us request flow
This commit is contained in:
parent
1a87c2f26d
commit
b1d8fe475a
20 changed files with 1271 additions and 59 deletions
|
|
@ -39,7 +39,7 @@ describe("CommandBoard API contracts", () => {
|
|||
expect(body).toEqual({ ok: true, service: "commandboard-api" });
|
||||
});
|
||||
|
||||
it("exposes default plugin contract including sh1pt", async () => {
|
||||
it("exposes default plugin contract including product plugins", async () => {
|
||||
const response = await fetch(`${baseUrl}/api/plugins`);
|
||||
const body = await response.json() as {
|
||||
plugins: Array<{ id: string; enabled: boolean; capabilities: string[] }>;
|
||||
|
|
@ -47,12 +47,17 @@ describe("CommandBoard API contracts", () => {
|
|||
};
|
||||
|
||||
expect(response.status).toBe(200);
|
||||
expect(body.plugins.map((plugin) => plugin.id)).toEqual(["coinpay", "ugig", "sh1pt"]);
|
||||
expect(body.plugins.map((plugin) => plugin.id)).toEqual(["coinpay", "ugig", "sh1pt", "c0mpute"]);
|
||||
expect(body.plugins.find((plugin) => plugin.id === "sh1pt")).toMatchObject({
|
||||
enabled: true,
|
||||
capabilities: expect.arrayContaining(["projects.sync", "actions.publish", "deployments.status"])
|
||||
});
|
||||
expect(body.plugins.find((plugin) => plugin.id === "c0mpute")).toMatchObject({
|
||||
enabled: true,
|
||||
capabilities: expect.arrayContaining(["compute.jobs.sync", "compute.jobs.dispatch", "compute.workers.sync"])
|
||||
});
|
||||
expect(body.capabilities["actions.publish"]).toEqual(["sh1pt"]);
|
||||
expect(body.capabilities["compute.jobs.dispatch"]).toEqual(["c0mpute"]);
|
||||
});
|
||||
|
||||
it("exposes sh1pt project and action contracts", async () => {
|
||||
|
|
@ -83,6 +88,48 @@ describe("CommandBoard API contracts", () => {
|
|||
});
|
||||
});
|
||||
|
||||
it("exposes work-in-progress c0mpute jobs and worker contracts", async () => {
|
||||
const jobsResponse = await fetch(`${baseUrl}/api/plugins/c0mpute/jobs`);
|
||||
const jobsBody = await jobsResponse.json() as { jobs: Array<{ id: string; board: string; status: string; provider: string }> };
|
||||
const workersResponse = await fetch(`${baseUrl}/api/plugins/c0mpute/workers`);
|
||||
const workersBody = await workersResponse.json() as { workers: Array<{ id: string; status: string; capacity: string }> };
|
||||
|
||||
expect(jobsResponse.status).toBe(200);
|
||||
expect(jobsBody.jobs[0]).toMatchObject({ id: "compute_job_1", board: "/projects/c0mpute", status: "draft", provider: "c0mpute.com" });
|
||||
expect(workersResponse.status).toBe(200);
|
||||
expect(workersBody.workers[0]).toMatchObject({ id: "worker_pool_1", status: "preview", capacity: "wip" });
|
||||
});
|
||||
|
||||
it("accepts work-in-progress c0mpute dispatch and quote requests", async () => {
|
||||
const dispatchResponse = await fetch(`${baseUrl}/api/plugins/c0mpute/jobs/dispatch`, {
|
||||
method: "POST",
|
||||
headers: { "content-type": "application/json" },
|
||||
body: JSON.stringify({ job_id: "compute_job_1" })
|
||||
});
|
||||
const dispatchBody = await dispatchResponse.json() as { accepted: boolean; job_id: string; status: string; board: string };
|
||||
const quoteResponse = await fetch(`${baseUrl}/api/plugins/c0mpute/quotes`, {
|
||||
method: "POST",
|
||||
headers: { "content-type": "application/json" },
|
||||
body: JSON.stringify({ workload: "agent-run-smoke-test" })
|
||||
});
|
||||
const quoteBody = await quoteResponse.json() as { accepted: boolean; workload: string; provider: string; status: string };
|
||||
|
||||
expect(dispatchResponse.status).toBe(202);
|
||||
expect(dispatchBody).toEqual({
|
||||
accepted: true,
|
||||
job_id: "compute_job_1",
|
||||
status: "queued",
|
||||
board: "/projects/c0mpute"
|
||||
});
|
||||
expect(quoteResponse.status).toBe(202);
|
||||
expect(quoteBody).toMatchObject({
|
||||
accepted: true,
|
||||
workload: "agent-run-smoke-test",
|
||||
provider: "c0mpute.com",
|
||||
status: "draft"
|
||||
});
|
||||
});
|
||||
|
||||
it("rejects invalid LogicSRC task payloads", async () => {
|
||||
const response = await fetch(`${baseUrl}/api/tasks`, {
|
||||
method: "POST",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue