Stage guarded Classic migration and native bot adapter
Core tests / core (push) Successful in 29s

This commit is contained in:
Codex
2026-09-25 22:57:11 +02:00
parent 58b2019015
commit 02d21abcbd
17 changed files with 616 additions and 11 deletions
+3 -2
View File
@@ -1,3 +1,4 @@
import {classicMode} from '@/core/classic';
import { env } from 'cloudflare:workers';
import { requireAleBridge } from '@/core/ale-auth';
import { pollAleCommand } from '@/core/ale-store';
@@ -9,8 +10,8 @@ async function handlePoll(request:Request){
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}});
if(!command)return new Response(classicMode(config)?'null':'return',{status:200,headers:{'Content-Type':'text/plain; charset=utf-8','Cache-Control':'no-store'}});
return new Response(classicMode(config)?command.source: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});