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