Import verified AzerothAI snapshot from GitHub
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
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
Source branch: feature/ai-brain-router Source commit: c2a09e0460465201a58aaab56c71424e9a96405e
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
import { env } from 'cloudflare:workers';
|
||||
import { requireAleBridge } from '@/core/ale-auth';
|
||||
import { pollAleCommand } from '@/core/ale-store';
|
||||
import { wrapAleCommand } from '@/core/ale';
|
||||
import type { RuntimeConfig } from '@/core/types';
|
||||
|
||||
async function handlePoll(request:Request){
|
||||
const config=env as unknown as RuntimeConfig;
|
||||
try{
|
||||
requireAleBridge(request,config);
|
||||
const command=await pollAleCommand(env.DB!);
|
||||
if(!command)return new Response('return',{status:200,headers:{'Content-Type':'text/plain; charset=utf-8','Cache-Control':'no-store'}});
|
||||
return new Response(wrapAleCommand(command.id,command.source),{status:200,headers:{'Content-Type':'text/plain; charset=utf-8','Cache-Control':'no-store','X-AzerothAI-Command':command.id}});
|
||||
}catch(e){
|
||||
const message=e instanceof Error?e.message:'ALE bridge failure';
|
||||
return Response.json({error:message},{status:message.startsWith('Unauthorized')?401:500});
|
||||
}
|
||||
}
|
||||
|
||||
export async function GET(request:Request){ return handlePoll(request); }
|
||||
export async function POST(request:Request){ return handlePoll(request); }
|
||||
Reference in New Issue
Block a user