()
| 139 | } |
| 140 | |
| 141 | function getEmail(): string | undefined { |
| 142 | // Return cached email if available (from async initialization) |
| 143 | if (cachedEmail !== null) { |
| 144 | return cachedEmail |
| 145 | } |
| 146 | |
| 147 | // Only include OAuth email when actively using OAuth authentication |
| 148 | const analyticsSession = getCurrentAnalyticsSession() |
| 149 | if (analyticsSession?.identity.email) { |
| 150 | return analyticsSession.identity.email |
| 151 | } |
| 152 | |
| 153 | // Ant-only fallbacks below (no execSync) |
| 154 | if ((process.env.NCODE_BUILD_MODE !== 'noumena' && process.env.USER_TYPE !== 'ant')) { |
| 155 | return undefined |
| 156 | } |
| 157 | |
| 158 | if (process.env.COO_CREATOR) { |
| 159 | return `${process.env.COO_CREATOR}@anthropic.com` |
| 160 | } |
| 161 | |
| 162 | // If initUser() wasn't called, we return undefined instead of blocking |
| 163 | return undefined |
| 164 | } |
| 165 | |
| 166 | async function getEmailAsync(): Promise<string | undefined> { |
| 167 | // Only include OAuth email when actively using OAuth authentication |
no test coverage detected