The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 21, 06:00 UTC
| 1 | import * as Cloudflare from "@alchemy.run/cloudflare"; |
| 2 | import { Stack } from "alchemy/Stack"; |
| 3 | import * as Effect from "effect/Effect"; |
| 4 | import * as HttpServerResponse from "effect/http/HttpServerResponse"; |
| 5 | |
| 6 | // #region show |
| 7 | // #region top |
| 8 | export default Cloudflare.Worker( |
| 9 | "Chat", |
| 10 | Effect.gen(function* () { |
| 11 | const { stage } = yield* Stack; |
| 12 | return { |
| 13 | main: import.meta.url, |
| 14 | // #region preview |
| 15 | preview: stage.startsWith("pr-") |
| 16 | ? { of: yield* Cloudflare.Worker.ref("Chat", { stage: "staging" }) } |
| 17 | : undefined, |
| 18 | // #endregion preview |
| 19 | }; |
| 20 | }), |
| 21 | Effect.gen(function* () { |
| 22 | // #endregion top |
| 23 | return { |
| 24 | fetch: Effect.succeed(HttpServerResponse.text("hello")), |
| 25 | }; |
| 26 | // #region bottom |
| 27 | }), |
| 28 | ); |
| 29 | // #endregion bottom |
| 30 | // #endregion show |