()
| 43 | * - Remote mode: returns session URL for attribution |
| 44 | */ |
| 45 | export function getAttributionTexts(): AttributionTexts { |
| 46 | if (isInternalBuild() && isUndercover()) { |
| 47 | return { commit: '', pr: '' } |
| 48 | } |
| 49 | |
| 50 | if (getClientType() === 'remote') { |
| 51 | const remoteSessionId = process.env.CLAUDE_CODE_REMOTE_SESSION_ID |
| 52 | if (remoteSessionId) { |
| 53 | const ingressUrl = process.env.SESSION_INGRESS_URL |
| 54 | // Skip for local dev - URLs won't persist |
| 55 | if (!isRemoteSessionLocal(remoteSessionId, ingressUrl)) { |
| 56 | const sessionUrl = getRemoteSessionUrl(remoteSessionId, ingressUrl) |
| 57 | return { commit: sessionUrl, pr: sessionUrl } |
| 58 | } |
| 59 | } |
| 60 | return { commit: '', pr: '' } |
| 61 | } |
| 62 | |
| 63 | // Never expose provider model names in default attribution. |
| 64 | const modelName = 'NCode' |
| 65 | const defaultAttribution = `🤖 Generated with [Code](${PRODUCT_URL})` |
| 66 | const defaultCommit = `Co-Authored-By: ${modelName} <noreply@noumena.com>` |
| 67 | |
| 68 | const settings = getInitialSettings() |
| 69 | |
| 70 | // New attribution setting takes precedence over deprecated includeCoAuthoredBy |
| 71 | if (settings.attribution) { |
| 72 | return { |
| 73 | commit: settings.attribution.commit ?? defaultCommit, |
| 74 | pr: settings.attribution.pr ?? defaultAttribution, |
| 75 | } |
| 76 | } |
| 77 | |
| 78 | // Backward compatibility: deprecated includeCoAuthoredBy setting |
| 79 | if (settings.includeCoAuthoredBy === false) { |
| 80 | return { commit: '', pr: '' } |
| 81 | } |
| 82 | |
| 83 | return { commit: defaultCommit, pr: defaultAttribution } |
| 84 | } |
| 85 | |
| 86 | /** |
| 87 | * Check if a message content string is terminal output rather than a user prompt. |
no test coverage detected