This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // @ts-nocheck — plain JS port, types omitted for faithfulness. | |
| // Open the built-in Deno KV store | |
| const kv = await Deno.openKv(); | |
| // A lightweight wrapper to make Deno KV act exactly like Cloudflare KV | |
| // so we don't have to rewrite the entire bash simulation logic. | |
| const store = { | |
| async get(key) { | |
| const entry = await kv.get([key]); | |
| return entry.value ?? null; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export default { | |
| async fetch(request, env, ctx) { | |
| // 1. Handle CORS Options Pre-flight for AI Clients | |
| if (request.method === "OPTIONS") { | |
| return new Response(null, { | |
| headers: { | |
| "Access-Control-Allow-Origin": "*", | |
| "Access-Control-Allow-Methods": "GET, POST, OPTIONS", | |
| "Access-Control-Allow-Headers": "Content-Type, Authorization", | |
| }, |