From 0099ab5a1c6d3201850b44bc51b06ceb8847f1d2 Mon Sep 17 00:00:00 2001 From: kaitranntt Date: Sun, 25 Jan 2026 20:25:01 -0500 Subject: [PATCH] feat(cli): inject hooks into profile settings on launch - call ensureProfileHooks() before CLIProxy execution - call ensureProfileHooks() before Copilot execution - call ensureProfileHooks() before Settings-based execution - account-based profiles skip (use native WebSearch) --- src/ccs.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/ccs.ts b/src/ccs.ts index f56a6a43..8fce1c51 100644 --- a/src/ccs.ts +++ b/src/ccs.ts @@ -11,6 +11,7 @@ import { installWebSearchHook, displayWebSearchStatus, getWebSearchHookEnv, + ensureProfileHooks, } from './utils/websearch-manager'; import { getGlobalEnvConfig } from './config/unified-config-loader'; import { fail, info } from './utils/ui'; @@ -518,6 +519,9 @@ async function main(): Promise { if (profileInfo.type === 'cliproxy') { // CLIPROXY FLOW: OAuth-based profiles (gemini, codex, agy, qwen) or user-defined variants + // Inject WebSearch hook into profile settings before launch + ensureProfileHooks(profileInfo.name); + const provider = profileInfo.provider || (profileInfo.name as CLIProxyProvider); const customSettingsPath = profileInfo.settingsPath; // undefined for hardcoded profiles const variantPort = profileInfo.port; // variant-specific port for isolation @@ -527,6 +531,9 @@ async function main(): Promise { }); } else if (profileInfo.type === 'copilot') { // COPILOT FLOW: GitHub Copilot subscription via copilot-api proxy + // Inject WebSearch hook into profile settings before launch + ensureProfileHooks(profileInfo.name); + const { executeCopilotProfile } = await import('./copilot'); const copilotConfig = profileInfo.copilotConfig; if (!copilotConfig) { @@ -538,6 +545,9 @@ async function main(): Promise { } else if (profileInfo.type === 'settings') { // Settings-based profiles (glm, glmt, kimi) are third-party providers // WebSearch is server-side tool - third-party providers have no access + // Inject WebSearch hook into profile settings before launch + ensureProfileHooks(profileInfo.name); + ensureMcpWebSearch(); installWebSearchHook();