@devries-cameron20 / composio Mirror · read-only
Fork 0

Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.

Mirrored from https://github.com/Camo67/composio.git

Synced Nov 21, 04:45 UTC

next
ts 29 lines 1.32 KB
Raw
1 import { ConfigProvider, Effect } from 'effect';
2
3 /**
4 * `ConfigProvider.fromEnv` snapshots the environment when it is built, so a
5 * provider created at module scope never observes `vi.stubEnv` calls made
6 * inside a test. This provider re-reads the environment on every lookup.
7 */
8 export const liveEnvConfigProvider: ConfigProvider.ConfigProvider = ConfigProvider.make(
9 configPath => ConfigProvider.fromEnv().load(configPath)
10 );
11
12 // Variables a developer shell may export that would change what a test observes: every
13 // Composio setting (`APP_CONFIG`, `TELEMETRY_CONFIG`, `GITHUB_CONFIG`, the `COMPOSIO_*_DEBUG`
14 // toggles) and the developer overrides in `DEBUG_CONFIG`.
15 const MASKED_PREFIXES = ['COMPOSIO_', 'DEBUG_OVERRIDE_', 'FORCE_'];
16
17 /**
18 * The default provider of `TestLive`: the real host environment (`CI`, `VITEST`, `PATH`, the
19 * agent-host markers, ...) read live, but never the developer shell's Composio settings or
20 * `DEBUG_OVERRIDE_*` / `FORCE_*` overrides, so a test only sees the values it provides itself.
21 */
22 export const hostOnlyEnvConfigProvider: ConfigProvider.ConfigProvider = ConfigProvider.make(
23 configPath => {
24 const name = configPath.map(String).join('_');
25 return MASKED_PREFIXES.some(prefix => name.startsWith(prefix))
26 ? Effect.succeed(undefined)
27 : liveEnvConfigProvider.load(configPath);
28 }
29 );