diff --git a/src/ccs.ts b/src/ccs.ts index 1d447e48..5150ff00 100644 --- a/src/ccs.ts +++ b/src/ccs.ts @@ -14,6 +14,7 @@ import { } from './utils/websearch-manager'; import { getGlobalEnvConfig } from './config/unified-config-loader'; import { ensureProfileHooks as ensureImageAnalyzerHooks } from './utils/hooks/image-analyzer-profile-hook-injector'; +import { getImageAnalysisHookEnv } from './utils/hooks'; import { fail, info } from './utils/ui'; // Import centralized error handling @@ -165,10 +166,12 @@ async function execClaudeWithProxy( const isWindows = process.platform === 'win32'; const needsShell = isWindows && /\.(cmd|bat|ps1)$/i.test(claudeCli); const webSearchEnv = getWebSearchHookEnv(); + const imageAnalysisEnv = getImageAnalysisHookEnv(profileName); const env = { ...process.env, ...envVars, ...webSearchEnv, + ...imageAnalysisEnv, CCS_PROFILE_TYPE: 'settings', // Signal to WebSearch hook this is a third-party provider }; @@ -619,6 +622,7 @@ async function main(): Promise { // Use --settings flag (backward compatible) const expandedSettingsPath = getSettingsPath(profileInfo.name); const webSearchEnv = getWebSearchHookEnv(); + const imageAnalysisEnv = getImageAnalysisHookEnv(profileInfo.name); // Get global env vars (DISABLE_TELEMETRY, etc.) for third-party profiles const globalEnvConfig = getGlobalEnvConfig(); const globalEnv = globalEnvConfig.enabled ? globalEnvConfig.env : {}; @@ -640,6 +644,7 @@ async function main(): Promise { ...globalEnv, ...settingsEnv, // Explicitly inject all settings env vars ...webSearchEnv, + ...imageAnalysisEnv, CCS_PROFILE_TYPE: 'settings', // Signal to WebSearch hook this is a third-party provider }; execClaude(claudeCli, ['--settings', expandedSettingsPath, ...remainingArgs], envVars); diff --git a/src/copilot/copilot-executor.ts b/src/copilot/copilot-executor.ts index d2364aba..98908496 100644 --- a/src/copilot/copilot-executor.ts +++ b/src/copilot/copilot-executor.ts @@ -13,6 +13,8 @@ import { isDaemonRunning, startDaemon } from './copilot-daemon'; import { ensureCopilotApi } from './copilot-package-manager'; import { CopilotStatus } from './types'; import { fail, info, ok } from '../utils/ui'; +import { getWebSearchHookEnv } from '../utils/websearch-manager'; +import { getImageAnalysisHookEnv } from '../utils/hooks'; /** * Get full copilot status (auth + daemon). @@ -133,11 +135,16 @@ export async function executeCopilotProfile( const globalEnvConfig = getGlobalEnvConfig(); const globalEnv = globalEnvConfig.enabled ? globalEnvConfig.env : {}; - // Merge with current environment (global env first, copilot overrides) + // Merge with current environment (global env first, copilot overrides, then hook env vars) + const webSearchEnv = getWebSearchHookEnv(); + const imageAnalysisEnv = getImageAnalysisHookEnv('copilot'); const env = { ...process.env, ...globalEnv, ...copilotEnv, + ...webSearchEnv, + ...imageAnalysisEnv, + CCS_PROFILE_TYPE: 'copilot', }; console.log(info(`Using GitHub Copilot proxy (model: ${config.model})`));