import type { AgentCoreHandle } from '../core.js'; /** * Extract the bearer token from a LAP WebSocket upgrade request. * Accepts the token on either `?token=` or `Authorization: Bearer` — * query-string is the common pattern because browsers can't set * arbitrary headers on WebSocket construction. */ export declare function extractToken(req: Request): string | null; /** * Cloudflare Workers handler. Accepts a WebSocket upgrade using * `WebSocketPair`, validates the token via * `agent.acceptConnection`, and returns the 101 upgrade Response. * * Usage: * ```ts * const agent = createLluiAgentCore() * export default { * async fetch(req, env) { * const url = new URL(req.url) * if (url.pathname === '/agent/ws') return handleCloudflareUpgrade(req, agent) * return (await agent.router(req)) ?? new Response('Not Found', { status: 404 }) * }, * } * ``` */ export declare function handleCloudflareUpgrade(req: Request, agent: AgentCoreHandle): Promise; /** * Deno handler. Uses `Deno.upgradeWebSocket(req)` to produce the * response + socket pair, then plugs the socket into the registry. * * Usage: * ```ts * Deno.serve(async (req) => { * const url = new URL(req.url) * if (url.pathname === '/agent/ws') return handleDenoUpgrade(req, agent) * return (await agent.router(req)) ?? new Response('Not Found', { status: 404 }) * }) * ``` */ export declare function handleDenoUpgrade(req: Request, agent: AgentCoreHandle): Promise; //# sourceMappingURL=upgrade.d.ts.map