← Files Sulekha EventsARCHIVED FILE
source/src/data/platform.js
798 Bytes · Nov 30, 2026 · 07:53 UTC
// Analytics label only: client names are hints, never authenticated identity.
export function resolvePlatform(clientName, configured = process.env.SULEKHA_PLATFORM) {
const labels = { appssdk: 'appsSDK', claude: 'Claude', perplexity: 'Perplexity', unknown: 'unknown' };
if (configured?.trim()) {
const label = labels[configured.trim().toLowerCase()];
if (!label) throw new Error('SULEKHA_PLATFORM must be appsSDK, Claude, Perplexity, or unknown.');
return label;
}
const name = typeof clientName === 'string' ? clientName.trim().toLowerCase() : '';
if (/^(claude)(?:$|[ ._/-])/.test(name)) return 'Claude';
if (/^(perplexity)(?:$|[ ._/-])/.test(name)) return 'Perplexity';
if (/^(chatgpt|openai-apps-sdk)(?:$|[ ._/-])/.test(name)) return 'appsSDK';
return 'unknown';
}
SHA-256: 73156f01b649fba4c5dc7cfa4137ee6ff07c6f7ce978b4a3f9f21e29e5c8bbf7