@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, 06:00 UTC

main
ts 23 lines 1.03 KB
Raw
1 import { Function } from "@alchemy.run/neon/Function";
2 import { InvokeFunction } from "@alchemy.run/neon/InvokeFunction";
3 import { InvokeFunctionHttp } from "@alchemy.run/neon/InvokeFunctionHttp";
4 import * as Effect from "effect/Effect";
5 import * as HttpServerResponse from "effect/http/HttpServerResponse";
6 import Constructor from "./function-constructor.ts";
7 import { project } from "./function-form-resources.ts";
8 export class LayerFunction extends Function<LayerFunction>()("LayerFunction") {}
9 export default LayerFunction.make(
10 Effect.gen(function* () {
11 return { project: yield* project, main: import.meta.url };
12 }),
13 Effect.gen(function* () {
14 const invoke = yield* InvokeFunction(yield* Constructor);
15 return {
16 fetch: Effect.gen(function* () {
17 const response = yield* invoke.fetch().pipe(Effect.orDie);
18 const text = yield* Effect.tryPromise(() => response.text()).pipe(Effect.orDie);
19 return HttpServerResponse.text(`layer:${text}`);
20 }),
21 };
22 }).pipe(Effect.provide(InvokeFunctionHttp)),
23 );