MCPcopy Create free account
hub / github.com/AnukarOP/claude-code-leaked / getFastModeUnavailableReason

Function getFastModeUnavailableReason

source code/utils/fastMode.ts:74–142  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

72}
73
74export function getFastModeUnavailableReason(): string | null {
75 if (!isFastModeEnabled()) {
76 return 'Fast mode is not available'
77 }
78
79 const statigReason = getFeatureValue_CACHED_MAY_BE_STALE(
80 'tengu_penguins_off',
81 null,
82 )
83 // Statsig reason has priority over other reasons.
84 if (statigReason !== null) {
85 logForDebugging(`Fast mode unavailable: ${statigReason}`)
86 return statigReason
87 }
88
89 // Previously, fast mode required the native binary (bun build). This is no
90 // longer necessary, but we keep this option behind a flag just in case.
91 if (
92 !isInBundledMode() &&
93 getFeatureValue_CACHED_MAY_BE_STALE('tengu_marble_sandcastle', false)
94 ) {
95 return 'Fast mode requires the native binary · Install from: https://claude.com/product/claude-code'
96 }
97
98 // Not available in the SDK unless explicitly opted in via --settings.
99 // Assistant daemon mode is exempt — it's first-party orchestration, and
100 // kairosActive is set before this check runs (main.tsx:~1626 vs ~3249).
101 if (
102 getIsNonInteractiveSession() &&
103 preferThirdPartyAuthentication() &&
104 !getKairosActive()
105 ) {
106 const flagFastMode = getSettingsForSource('flagSettings')?.fastMode
107 if (!flagFastMode) {
108 const reason = 'Fast mode is not available in the Agent SDK'
109 logForDebugging(`Fast mode unavailable: ${reason}`)
110 return reason
111 }
112 }
113
114 // Only available for 1P (not Bedrock/Vertex/Foundry)
115 if (getAPIProvider() !== 'firstParty') {
116 const reason = 'Fast mode is not available on Bedrock, Vertex, or Foundry'
117 logForDebugging(`Fast mode unavailable: ${reason}`)
118 return reason
119 }
120
121 if (orgStatus.status === 'disabled') {
122 if (
123 orgStatus.reason === 'network_error' ||
124 orgStatus.reason === 'unknown'
125 ) {
126 // The org check can fail behind corporate proxies that block the
127 // endpoint. We add CLAUDE_CODE_SKIP_FAST_MODE_NETWORK_ERRORS=1 to
128 // bypass this check in the CC binary. This is OK since we have
129 // another check in the API to error out when disabled by org.
130 if (isEnvTruthy(process.env.CLAUDE_CODE_SKIP_FAST_MODE_NETWORK_ERRORS)) {
131 return null

Callers 4

PromptInputFunction · 0.85
isFastModeAvailableFunction · 0.85
handleFastModeShortcutFunction · 0.85
callFunction · 0.85

Calls 11

isFastModeEnabledFunction · 0.85
logForDebuggingFunction · 0.85
isInBundledModeFunction · 0.85
getKairosActiveFunction · 0.85
getSettingsForSourceFunction · 0.85
getAPIProviderFunction · 0.85
isEnvTruthyFunction · 0.85
getDisabledReasonMessageFunction · 0.85

Tested by

no test coverage detected