Files
open-lovable/app/api/sandbox-status/route.ts
T
Developers Digest b96d048dbd Save current v2 sandbox implementation before styling refactor
- Modified sandbox API routes for v2 implementation
- Updated sandbox providers (E2B and Vercel)
- Added styling-reference directory with Firecrawl AI-ready website
- Preparing for styling system port from Firecrawl design

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-04 10:21:28 -04:00

53 lines
1.5 KiB
TypeScript

import { NextResponse } from 'next/server';
declare global {
var activeSandboxProvider: any;
var sandboxData: any;
var existingFiles: Set<string>;
}
export async function GET() {
try {
// Check if sandbox exists
const sandboxExists = !!global.activeSandboxProvider;
let sandboxHealthy = false;
let sandboxInfo = null;
if (sandboxExists && global.activeSandboxProvider) {
try {
// Check if sandbox is healthy by calling a method that should work
sandboxHealthy = true;
sandboxInfo = {
sandboxId: global.sandboxData?.sandboxId,
url: global.sandboxData?.url,
filesTracked: global.existingFiles ? Array.from(global.existingFiles) : [],
lastHealthCheck: new Date().toISOString()
};
} catch (error) {
console.error('[sandbox-status] Health check failed:', error);
sandboxHealthy = false;
}
}
return NextResponse.json({
success: true,
active: sandboxExists,
healthy: sandboxHealthy,
sandboxData: sandboxInfo,
message: sandboxHealthy
? 'Sandbox is active and healthy'
: sandboxExists
? 'Sandbox exists but is not responding'
: 'No active sandbox'
});
} catch (error) {
console.error('[sandbox-status] Error:', error);
return NextResponse.json({
success: false,
active: false,
error: (error as Error).message
}, { status: 500 });
}
}