MCPcopy Create free account
hub / github.com/Noumena-Network/code / getFastModeUnavailableReason

Function getFastModeUnavailableReason

src/utils/fastMode.ts:73–141  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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

Callers 4

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

Calls 14

isEnvTruthyFunction · 0.90
isFastModeEnabledFunction · 0.85
isInBundledModeFunction · 0.85
getKairosActiveFunction · 0.85
getSettingsForSourceFunction · 0.85
getAPIProviderFunction · 0.85
getAuthRuntimeFunction · 0.85
getDisabledReasonMessageFunction · 0.85
logForDebuggingFunction · 0.70

Tested by

no test coverage detected