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

main
ts 25 lines 1.05 KB
Raw
1 import * as Effect from "effect/Effect";
2 import type { HttpEffect } from "../Http.ts";
3 import type { BaseRuntimeContext } from "../RuntimeContext.ts";
4
5 export interface FunctionContext extends BaseRuntimeContext {
6 /**
7 * Register an HTTP handler. The optional `shape` payload is the user's
8 * full default-export shape — Cloudflare Workers use it to expose
9 * non-handler methods (e.g. `greet`) as RPC methods on the deployed
10 * `WorkerEntrypoint`. Other platforms (Lambda, etc.) ignore it.
11 */
12 serve<Req = never>(
13 handler: HttpEffect<Req>,
14 options?: { shape?: Record<string, unknown> },
15 ): Effect.Effect<void, never, Req>;
16 listen<A, Req = never>(handler: FunctionListener<A, Req>): Effect.Effect<void, never, Req>;
17 listen<A, Req = never, InitReq = never>(
18 effect: Effect.Effect<FunctionListener<A, Req>, never, InitReq>,
19 ): Effect.Effect<void, never, Req | InitReq>;
20 exports: Effect.Effect<Record<string, any>, never, never>;
21 }
22
23 export type FunctionListener<A = any, Req = never> = (
24 event: any,
25 ) => Effect.Effect<A, never, Req> | void;