import { handleApiRequestDocs as handleTriggerIndexDocs } from "./functions/route-trigger-index.js"; /** * Complete API documentation * This is an OpenAPI 3.0.1 definition for the agent's API. */ const apiDocs = { openapi: "3.0.1", info: { title: "template API", version: "1.0.0", description: "API for the template agent.", contact: { name: "API Support", email: "support@microfox.app", }, }, servers: [ { url: "https://api.microfox.com/agents/template", description: "Production server", }, ], auth: "x-auth-packages", paths: { "/index": { post: handleTriggerIndexDocs, }, }, components: { schemas: {}, "x-auth-packages": [ { packageName: "@microfox/ai-provider-anthropic", }, ], }, }; /** * GET endpoint to serve API documentation. * This function returns the OpenAPI specification in JSON format. */ export const getDocs = async () => { try { return { statusCode: 200, headers: { "Content-Type": "application/json", "Access-Control-Allow-Origin": "*", "Access-Control-Allow-Credentials": true, }, body: JSON.stringify(apiDocs, null, 2), }; } catch (error) { console.error("Error serving docs:", error); return { statusCode: 500, headers: { "Content-Type": "application/json", "Access-Control-Allow-Origin": "*", "Access-Control-Allow-Credentials": true, }, body: JSON.stringify({ error: error instanceof Error ? error.message : "Unknown error", }), }; } };