Problem
When importing Claude providers through deeplinks (ccswitch://v1/import?...), custom environment variables are silently dropped. Only the hardcoded known keys (ANTHROPIC_AUTH_TOKEN, ANTHROPIC_BASE_URL, and the four model keys) are preserved.
Root Cause
Two functions in src-tauri/src/deeplink/provider.rs cause the loss:
-
build_claude_settings (line ~226): Constructs a brand-new empty serde_json::Map and only inserts known keys. Any user-defined env fields such as ANTHROPIC_CUSTOM_HEADERS, custom proxy variables, or other provider-specific settings are never included.
-
merge_claude_config (line ~473): When an inline config is provided via the deeplink, this function reads the env object but only extracts the hardcoded known keys into the DeepLinkImportRequest. Custom env fields are discarded before build_claude_settings even runs.
Contrast with CLI/TUI Path
The CLI/TUI provider creation function build_claude_settings_config_from_prompt (in src/cli/commands/provider_input.rs, line ~3734) handles this correctly by cloning the existing settings as the base and only mutating known keys, so all sibling keys in env survive. Tests at lines 1355-1378 confirm that EXTRA_ENV is preserved.
Expected Behavior
The deeplink import path should preserve all existing environment fields from the source config, matching the behavior of the CLI/TUI provider creation flow. Unknown/custom env keys should be carried through untouched.
Problem
When importing Claude providers through deeplinks (
ccswitch://v1/import?...), custom environment variables are silently dropped. Only the hardcoded known keys (ANTHROPIC_AUTH_TOKEN,ANTHROPIC_BASE_URL, and the four model keys) are preserved.Root Cause
Two functions in
src-tauri/src/deeplink/provider.rscause the loss:build_claude_settings(line ~226): Constructs a brand-new emptyserde_json::Mapand only inserts known keys. Any user-defined env fields such asANTHROPIC_CUSTOM_HEADERS, custom proxy variables, or other provider-specific settings are never included.merge_claude_config(line ~473): When an inline config is provided via the deeplink, this function reads theenvobject but only extracts the hardcoded known keys into theDeepLinkImportRequest. Custom env fields are discarded beforebuild_claude_settingseven runs.Contrast with CLI/TUI Path
The CLI/TUI provider creation function
build_claude_settings_config_from_prompt(insrc/cli/commands/provider_input.rs, line ~3734) handles this correctly by cloning the existing settings as the base and only mutating known keys, so all sibling keys inenvsurvive. Tests at lines 1355-1378 confirm thatEXTRA_ENVis preserved.Expected Behavior
The deeplink import path should preserve all existing environment fields from the source config, matching the behavior of the CLI/TUI provider creation flow. Unknown/custom env keys should be carried through untouched.