Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/utils/apiPreconnect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,18 @@

import { getOauthConfig } from '../constants/oauth.js'
import { isEnvTruthy } from './envUtils.js'
import { isEssentialTrafficOnly } from './privacyLevel.js'
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟑 Minor | ⚑ Quick win

Use src/* alias for this new import.

Please switch this new relative import to the configured alias form to match repo rules.

Suggested diff
-import { isEssentialTrafficOnly } from './privacyLevel.js'
+import { isEssentialTrafficOnly } from 'src/utils/privacyLevel.js'

As per coding guidelines, "Import paths must use the src/* alias (e.g., import { ... } from 'src/utils/...'); tsconfig maps src/* to ./src/*."

πŸ“ Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
import { isEssentialTrafficOnly } from './privacyLevel.js'
import { isEssentialTrafficOnly } from 'src/utils/privacyLevel.js'
πŸ€– Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/utils/apiPreconnect.ts` at line 28, The import in
src/utils/apiPreconnect.ts currently uses a relative path for
isEssentialTrafficOnly; replace the relative import ("./privacyLevel.js") with
the project alias form (e.g., import from 'src/utils/privacyLevel' or
'src/utils/privacyLevel.js' depending on codebase conventions) so it uses the
configured src/* mapping; update the import statement that references
isEssentialTrafficOnly accordingly and run a quick typecheck to ensure the alias
resolves.


let fired = false

export function preconnectAnthropicApi(): void {
if (fired) return
fired = true

// Also skip when non-essential traffic is disabled via
// CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC / DISABLE_TELEMETRY / proxy env.
if (isEssentialTrafficOnly()) return

// Skip if using a cloud provider β€” different endpoint + auth
if (
isEnvTruthy(process.env.CLAUDE_CODE_USE_BEDROCK) ||
Expand Down