The best way to control Claude Code, Codex and more from any computer or phone
| 1 | import { |
| 2 | type ConnectMcpApprovalCall, |
| 3 | createConnectMcpApprovalCommand, |
| 4 | } from "@t3tools/client-runtime/state/connectMcpApproval"; |
| 5 | import { runAtomCommand, squashAtomCommandFailure } from "@t3tools/client-runtime/state/runtime"; |
| 6 | import type { EnvironmentId } from "@t3tools/contracts"; |
| 7 | import * as Result from "effect/Result"; |
| 8 | |
| 9 | import { connectionAtomRuntime } from "../connection/runtime"; |
| 10 | import { appAtomRegistry } from "../rpc/atomRegistry"; |
| 11 | |
| 12 | const connectMcpApproval = createConnectMcpApprovalCommand(connectionAtomRuntime); |
| 13 | |
| 14 | /** One agent sign-in call to `environmentId`, sent with this account's T3 Connect session. */ |
| 15 | export async function runConnectMcpApproval( |
| 16 | environmentId: EnvironmentId, |
| 17 | call: ConnectMcpApprovalCall, |
| 18 | ) { |
| 19 | const result = await runAtomCommand( |
| 20 | appAtomRegistry, |
| 21 | connectMcpApproval, |
| 22 | { environmentId, call }, |
| 23 | { reportFailure: false }, |
| 24 | ); |
| 25 | return result._tag === "Success" |
| 26 | ? Result.succeed(result.value) |
| 27 | : Result.fail(squashAtomCommandFailure(result)); |
| 28 | } |