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

main
ts 26 lines 915 Bytes
Raw
1 import { Credentials } from "@distilled.cloud/axiom/Credentials";
2 import { ConfigError } from "@distilled.cloud/core/errors";
3 import { lazyCredentials } from "alchemy/Auth/Resolve";
4 import * as Layer from "effect/Layer";
5 import { AXIOM_AUTH_PROVIDER_NAME, type AxiomResolvedCredentials } from "./AuthProvider.ts";
6
7 export {
8 Credentials,
9 CredentialsFromEnv,
10 DEFAULT_API_BASE_URL,
11 } from "@distilled.cloud/axiom/Credentials";
12
13 /**
14 * Build a `Credentials` layer that resolves Axiom credentials via the Alchemy
15 * AuthProvider using the configured profile (defaults to "default", overridable
16 * with the current Alchemy profile).
17 */
18 export const fromAuthProvider = () =>
19 Layer.effect(
20 Credentials,
21 lazyCredentials<AxiomResolvedCredentials, ConfigError>()(AXIOM_AUTH_PROVIDER_NAME, (creds) => ({
22 apiKey: creds.apiToken,
23 apiBaseUrl: creds.apiBaseUrl,
24 orgId: creds.orgId,
25 })),
26 );