- Add EXECUTOR_SPECIFICATION.md with formal v1.0 protocol spec - Add executor-openapi.yaml (OpenAPI 3.0 specification) - Create @tpmjs/executor-test compliance test package (15 tests) - Update Railway executor to v1.0 compliance (15/15 tests pass) - Update Unsandbox executor to v1.0 compliance (15/15 tests pass) - Update Vercel executor to v1.0 compliance - Add /info endpoint with capability advertisement to all executors - Add structured error codes (PACKAGE_NOT_FOUND, TOOL_NOT_FOUND, etc.) - Add protocolVersion and implementationVersion to /health responses - Add X-TPMJS-Protocol-Version header support - Add EXECUTOR_COMPLIANCE.md with test results documentation
53 lines
1.3 KiB
TypeScript
53 lines
1.3 KiB
TypeScript
/**
|
|
* Health Check Endpoint
|
|
*
|
|
* GET /api/health
|
|
* Returns the health status of the executor
|
|
*/
|
|
|
|
import { NextResponse } from 'next/server';
|
|
|
|
export const runtime = 'nodejs';
|
|
export const dynamic = 'force-dynamic';
|
|
|
|
const PROTOCOL_VERSION = '1.0';
|
|
const IMPLEMENTATION_VERSION = '1.0.0';
|
|
|
|
interface HealthResponse {
|
|
status: 'ok';
|
|
protocolVersion: string;
|
|
implementationVersion: string;
|
|
runtime?: string;
|
|
timestamp?: string;
|
|
}
|
|
|
|
export async function GET(): Promise<NextResponse<HealthResponse>> {
|
|
return NextResponse.json(
|
|
{
|
|
status: 'ok',
|
|
protocolVersion: PROTOCOL_VERSION,
|
|
implementationVersion: IMPLEMENTATION_VERSION,
|
|
runtime: 'node',
|
|
timestamp: new Date().toISOString(),
|
|
},
|
|
{
|
|
headers: {
|
|
'Access-Control-Allow-Origin': '*',
|
|
'Access-Control-Allow-Methods': 'GET, OPTIONS',
|
|
'Access-Control-Allow-Headers': 'Content-Type, Authorization, X-TPMJS-Protocol-Version',
|
|
},
|
|
}
|
|
);
|
|
}
|
|
|
|
// Handle OPTIONS for CORS preflight
|
|
export async function OPTIONS(): Promise<NextResponse> {
|
|
return new NextResponse(null, {
|
|
status: 200,
|
|
headers: {
|
|
'Access-Control-Allow-Origin': '*',
|
|
'Access-Control-Allow-Methods': 'GET, OPTIONS',
|
|
'Access-Control-Allow-Headers': 'Content-Type, Authorization, X-TPMJS-Protocol-Version',
|
|
},
|
|
});
|
|
}
|