export const DEFAULT_API_BASE = "https://api.cline.bot"; export const ENV_API_KEY = "CLINE_API_KEY"; export const WORKOS_TOKEN_PREFIX = "workos:"; export const PROVIDER_NAME = "cline"; /** Set to "all" to register Cline's full model catalog instead of free-tier models only. */ export const ENV_MODELS_MODE = "CLINE_MODELS"; export function resolveApiBase(env: Record = process.env): string { const base = env.CLINE_API_BASE?.trim(); if (!base) return DEFAULT_API_BASE; return base.replace(/\/+$/, ""); } const CONTROL_CHARS_RE = new RegExp( `[${String.fromCharCode(0)}-${String.fromCharCode(31)}${String.fromCharCode(127)}]`, "g", ); export function sanitizeApiKey(input: string): string { const esc = "\x1b"; return input .replaceAll(`${esc}[200~`, "") .replaceAll(`${esc}[201~`, "") .replaceAll("[200~", "") .replaceAll("[201~", "") .replace(CONTROL_CHARS_RE, "") .trim(); }