Skip to content

Open-source Grok Bot alternative for named AI teammates. Local-first desktop, web, and mobile clients with per-bot tools, instructions, and memory. Independent fork of T3 Code.

680 B
Raw Blame
import * as Redacted from "effect/Redacted";

/**
 * Unwrap a distilled `SensitiveString` (`string | Redacted<string>`) into a
 * plain string, preserving `undefined`.
 *
 * The Account API marks contact fields (names, emails, phone numbers,
 * addresses) as sensitive at the wire level, so distilled returns them as
 * `string | Redacted<string>`. These are PII rather than credentials, so
 * alchemy stores them as plain strings in Attributes.
 */
export const unwrapSensitive = (
  value: string | Redacted.Redacted<string> | undefined,
): string | undefined =>
  value === undefined
    ? undefined
    : typeof value === "string"
      ? value
      : Redacted.value(value);