@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 23 lines 803 Bytes
Raw
1 import { Effect } from 'effect';
2 import { HOST_CONFIG } from 'src/config';
3
4 // Read once at import time, like `ui/colors.ts`: `redact` runs per formatted
5 // value, and spinning up a fiber per call to read a single environment
6 // variable is pure overhead.
7 const ciRedactionEnabled = Effect.runSync(HOST_CONFIG.CI_REDACTION_ENABLED);
8
9 /**
10 * Redact a value when running in CI (e.g., CLI recordings).
11 * Preserves a recognized prefix (e.g., "ac_" -> "ac_<REDACTED>").
12 * Returns the original value in non-CI environments.
13 */
14 export function redact<const Prefix extends string = string>({
15 value,
16 prefix,
17 }: {
18 value: string;
19 prefix?: Prefix;
20 }): `${Prefix}${string}` {
21 if (!ciRedactionEnabled) return value as `${Prefix}${string}`;
22 return `${prefix ?? ''}<REDACTED>` as `${Prefix}${string}`;
23 }