The best way to control Claude Code, Codex and more from any computer or phone
| 1 | import * as Effect from "effect/Effect"; |
| 2 | import type { HttpClient } from "effect/http"; |
| 3 | import { AtomRegistry } from "effect/reactivity"; |
| 4 | |
| 5 | import { connectionAtomRuntime } from "../connection/runtime"; |
| 6 | import { appAtomRegistry } from "../rpc/atomRegistry"; |
| 7 | |
| 8 | // Relay (DPoP) environments authorize through services only the connection runtime provides. |
| 9 | export function inEnvironmentSpeechRuntime<A, E>( |
| 10 | effect: Effect.Effect<A, E, HttpClient.HttpClient>, |
| 11 | ) { |
| 12 | return AtomRegistry.getResult(appAtomRegistry, connectionAtomRuntime).pipe( |
| 13 | Effect.flatMap((context) => Effect.provide(effect, context)), |
| 14 | ); |
| 15 | } |
| 16 | |
| 17 | export function runEnvironmentSpeech<A, E>( |
| 18 | effect: Effect.Effect<A, E, HttpClient.HttpClient>, |
| 19 | options?: Effect.RunOptions, |
| 20 | ): Promise<A> { |
| 21 | return Effect.runPromise(inEnvironmentSpeechRuntime(effect), options); |
| 22 | } |