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

main
ts 25 lines 1.08 KB
Raw
1 import type * as Binding from "./Binding.ts";
2 import { makeBindingLayer } from "./BindingLayer.ts";
3 import { SecretKey, type SecretKeyAccessor, type SecretKeyPayload } from "./SecretKey.ts";
4
5 /** The binding value produced by calling {@link SecretKey} (declared on `env` or `yield*`-ed). */
6 export type SecretKeyBinding = Binding.Binding<SecretKey["key"], SecretKeyAccessor, SecretKey> &
7 Readonly<SecretKeyPayload>;
8
9 /**
10 * The layer that provides the Effect-native interface for the Cloudflare
11 * Workers Secret Key binding.
12 *
13 * Provide it on the Worker effect (`Effect.provide(Cloudflare.Workers.SecretKeyBinding)`)
14 * so that yielding a {@link SecretKey} binding attaches the native
15 * `secret_key` binding to the surrounding Worker at deploy time and, at
16 * runtime, resolves to a deferred {@link SecretKeyAccessor} (yield it to
17 * obtain the native `CryptoKey`).
18 */
19 export const SecretKeyBinding = makeBindingLayer<
20 SecretKey,
21 // The ambient global type, matching SecretKeyAccessor and InferEnv's
22 // SecretKeyBinding mapping.
23 CryptoKey,
24 SecretKeyAccessor
25 >(SecretKey, (raw) => raw);