1import { CredentialsStoreLive } from "@/Auth/Credentials.ts";
2import { AwsAuth } from "@/AWS/AuthProvider.ts";
3import * as Credentials from "@/AWS/Credentials.ts";
4import * as Endpoint from "@/AWS/Endpoint.ts";
5import { Default as DefaultEnvironment } from "@/AWS/Environment.ts";
6import * as Region from "@/AWS/Region.ts";
7import * as Layer from "effect/Layer";
8
9/**
10 * TEST-ONLY: the live AWS environment chain (profile/SSO credentials,
11 * env-var region/endpoint overrides), independent of the run mode.
12 *
13 * In an `alchemy dev` run the ambient environment IS the emulator — that is
14 * the product contract, and nothing in user code should ever need to opt
15 * out of it (per-resource live access flows through `Alchemy.remote()` and
16 * the binding data-plane routing). The one legitimate exception is test
17 * FORENSICS: proving out-of-band that a resource does (or does not) exist
18 * on the real cloud. Provide this layer around exactly those probes —
19 * symmetric with the `flociContext` fixtures used to probe the emulator.
20 */
21export const liveContext = Layer.mergeAll(
22 Region.fromEnvironment,
23 Credentials.fromEnvironment,
24 Endpoint.fromEnvironment,
25).pipe(
26 Layer.provideMerge(DefaultEnvironment),
27 Layer.provideMerge(AwsAuth),
28 Layer.provideMerge(CredentialsStoreLive),
29 Layer.orDie,
30);