The best way to control Claude Code, Codex and more from any computer or phone

main
ts 26 lines 850 Bytes
Raw
1 import { bindFunction } from "@alchemy.run/railway/Bind";
2 import { Function } from "@alchemy.run/railway/Function";
3 import * as Effect from "effect/Effect";
4 import * as HttpServerResponse from "effect/http/HttpServerResponse";
5 import Greeter from "./rpc-greeter.ts";
6 import { Partition, Site } from "./rpc-shared.ts";
7
8 /**
9 * Tagged Function that binds {@link Greeter} and calls `.greet` over the
10 * private mesh. Public fetch is the only way a laptop can observe the
11 * trusted call.
12 */
13 export default class Caller extends Function<Caller>()(
14 "Caller",
15 {
16 project: Site,
17 environment: Partition,
18 main: import.meta.url,
19 },
20 Effect.gen(function* () {
21 const greeter = yield* bindFunction(Greeter);
22 return {
23 fetch: greeter.greet("sam").pipe(Effect.map((greeting) => HttpServerResponse.text(greeting))),
24 };
25 }),
26 ) {}