Files
AzerothAI/app/api/ale/status/route.ts
Richard Clark 5f0fc86cf9
Core tests / core (push) Successful in 9m57s
Full verification / application (push) Failing after 5m16s
Full verification / local-brain (push) Failing after 6m15s
Realm simulation / simulated-live-world (push) Failing after 5m32s
WoW integration lab / real-worldserver (push) Canceled after 17m23s
Import verified AzerothAI snapshot from GitHub
Source branch: feature/ai-brain-router
Source commit: c2a09e0460465201a58aaab56c71424e9a96405e
2026-09-22 13:12:54 -04:00

18 lines
836 B
TypeScript

import { env } from 'cloudflare:workers';
import { requireAleOperator,rawAleEnabled } from '@/core/ale-auth';
import { recentAleCommands,recentAleEvents } from '@/core/ale-store';
import { ALE_SURFACE } from '@/core/ale';
import type { RuntimeConfig } from '@/core/types';
export async function GET(request:Request){
const config=env as unknown as RuntimeConfig;
try{
requireAleOperator(request,config);
const [commands,events]=await Promise.all([recentAleCommands(env.DB!,50),recentAleEvents(env.DB!,100)]);
return Response.json({ok:true,rawEnabled:rawAleEnabled(config),surface:ALE_SURFACE,commands,events},{headers:{'Cache-Control':'no-store'}});
}catch(e){
const message=e instanceof Error?e.message:'ALE status failure';
return Response.json({error:message},{status:message.startsWith('Unauthorized')?401:500});
}
}