diff --git a/server/src/__tests__/openapi-routes.test.ts b/server/src/__tests__/openapi-routes.test.ts index 52b3658780b..9736c256947 100644 --- a/server/src/__tests__/openapi-routes.test.ts +++ b/server/src/__tests__/openapi-routes.test.ts @@ -19,6 +19,7 @@ const apiPrefixes: Record = { "assets.ts": "/api", "auth.ts": "/api/auth", "board-chat.ts": "/api", + "built-in-agents.ts": "/api", "cloud-upstreams.ts": "/api", "companies.ts": "/api/companies", "company-skills.ts": "/api", diff --git a/server/src/routes/openapi.ts b/server/src/routes/openapi.ts index 8c34c562ed1..1e01468e899 100644 --- a/server/src/routes/openapi.ts +++ b/server/src/routes/openapi.ts @@ -10,6 +10,7 @@ import { updateAgentInstructionsBundleSchema, upsertAgentInstructionsFileSchema, createAgentKeySchema, + builtInAgentProvisionSchema, wakeAgentSchema, resetAgentSessionSchema, agentSkillSyncSchema, @@ -1144,6 +1145,50 @@ for (const route of [ // ─── Agents ────────────────────────────────────────────────────────────────── +registry.registerPath({ + method: "get", + path: "/api/companies/{companyId}/built-in-agents", + tags: ["agents"], + summary: "List built-in agent provisioning state", + request: { params: z.object({ companyId: z.string() }) }, + responses: { 200: r.ok(), 401: r.unauthorized, 403: r.forbidden, 404: r.notFound }, +}); + +registry.registerPath({ + method: "post", + path: "/api/companies/{companyId}/built-in-agents/{key}/provision", + tags: ["agents"], + summary: "Provision a built-in agent", + request: { + params: z.object({ companyId: z.string(), key: z.string() }), + body: jsonBody(builtInAgentProvisionSchema), + }, + responses: { + 200: r.ok(), + 202: r.ok(), + 400: r.badRequest, + 401: r.unauthorized, + 403: r.forbidden, + 404: r.notFound, + 409: r.conflict, + }, +}); + +registry.registerPath({ + method: "post", + path: "/api/companies/{companyId}/built-in-agents/{key}/reset", + tags: ["agents"], + summary: "Reset a built-in agent", + request: { params: z.object({ companyId: z.string(), key: z.string() }) }, + responses: { + 200: r.ok(), + 401: r.unauthorized, + 403: r.forbidden, + 404: r.notFound, + 409: r.conflict, + }, +}); + registry.registerPath({ method: "get", path: "/api/companies/{companyId}/agents",