Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
| 1 | import { Config, Effect } from 'effect'; |
| 2 | import * as constants from 'src/constants'; |
| 3 | import { flag, optionalString, stringWithDefault } from './env'; |
| 4 | |
| 5 | /** Opt-out switches and the PostHog target for CLI telemetry. */ |
| 6 | export const TELEMETRY_CONFIG = { |
| 7 | // Any opt-out spelling, a test run, or CI silences telemetry entirely |
| 8 | DISABLED: Config.all({ |
| 9 | cli: flag('COMPOSIO_CLI_TELEMETRY_DISABLED'), |
| 10 | composio: flag('COMPOSIO_DISABLE_TELEMETRY'), |
| 11 | generic: flag('TELEMETRY_DISABLED'), |
| 12 | ci: flag('CI'), |
| 13 | nodeEnv: optionalString('NODE_ENV'), |
| 14 | }).pipe( |
| 15 | Config.map( |
| 16 | ({ cli, composio, generic, ci, nodeEnv }) => |
| 17 | cli || composio || generic || ci || nodeEnv === 'test' |
| 18 | ) |
| 19 | ), |
| 20 | |
| 21 | // PostHog capture endpoint and public project key (the key is baked at build time) |
| 22 | POSTHOG_INGEST_URL: stringWithDefault( |
| 23 | 'COMPOSIO_POSTHOG_INGEST_URL', |
| 24 | constants.COMPOSIO_POSTHOG_INGEST_URL |
| 25 | ), |
| 26 | POSTHOG_PROJECT_API_KEY: stringWithDefault( |
| 27 | 'COMPOSIO_POSTHOG_PROJECT_API_KEY', |
| 28 | constants.COMPOSIO_POSTHOG_PROJECT_API_KEY |
| 29 | ), |
| 30 | }; |
| 31 | |
| 32 | /** Whether any opt-out spelling, a test run, or CI turns telemetry off. */ |
| 33 | export const telemetryDisabled: Effect.Effect<boolean> = Effect.orDie(TELEMETRY_CONFIG.DISABLED); |