@devries-cameron20 / t3code Mirror · read-only
Fork 0

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, 07:15 UTC

main
ts 37 lines 1.37 KB
Raw
1 import * as Cloudflare from "@alchemy.run/cloudflare";
2 import * as Alchemy from "alchemy";
3 import * as Effect from "effect/Effect";
4 import * as path from "pathe";
5 import type { Probe } from "./worker.ts";
6
7 /**
8 * The "Bind on an async Worker" shape from the Containers guide, exactly as
9 * issue #1321 reported it: one name for the env key, the Container's logical
10 * id AND the Durable Object class — `className` omitted, so it defaults to
11 * the env key.
12 *
13 * Distinct from `fixtures/async` (which names a class that differs from the
14 * env key): with all three names equal there is nothing left to tell the
15 * Worker's `durable_object_namespace` binding and its `containers` metadata
16 * apart, so this is the shape that collapsed under one `sid` and lost the
17 * namespace binding (see "async container bound on env" in
18 * `Container.test.ts`).
19 */
20 export const InferredClassWorker = Cloudflare.Worker("InferredClassWorker", {
21 main: path.resolve(import.meta.dirname, "worker.ts"),
22 env: {
23 Probe: Cloudflare.Container<Probe>("Probe", {
24 image: "mendhak/http-https-echo:latest",
25 }),
26 },
27 });
28
29 export default (state = Cloudflare.state()) =>
30 Alchemy.Stack(
31 "InferredClassContainerStack",
32 { providers: Cloudflare.providers(), state },
33 Effect.gen(function* () {
34 const worker = yield* InferredClassWorker;
35 return { url: worker.url.as<string>() };
36 }),
37 );