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)
This commit is contained in:
kaitranntt committed 2026-01-25 20:25:01 -05:00
1 parent 242ab76453
commit 0099ab5a1c
1 file changed
+10
+10
View File
@@ -11,6 +11,7 @@ import {
installWebSearchHook, installWebSearchHook,
displayWebSearchStatus, displayWebSearchStatus,
getWebSearchHookEnv, getWebSearchHookEnv,
ensureProfileHooks,
} from './utils/websearch-manager'; } from './utils/websearch-manager';
import { getGlobalEnvConfig } from './config/unified-config-loader'; import { getGlobalEnvConfig } from './config/unified-config-loader';
import { fail, info } from './utils/ui'; import { fail, info } from './utils/ui';
@@ -518,6 +519,9 @@ async function main(): Promise<void> {
if (profileInfo.type === 'cliproxy') { if (profileInfo.type === 'cliproxy') {
// CLIPROXY FLOW: OAuth-based profiles (gemini, codex, agy, qwen) or user-defined variants // 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 provider = profileInfo.provider || (profileInfo.name as CLIProxyProvider);
const customSettingsPath = profileInfo.settingsPath; // undefined for hardcoded profiles const customSettingsPath = profileInfo.settingsPath; // undefined for hardcoded profiles
const variantPort = profileInfo.port; // variant-specific port for isolation const variantPort = profileInfo.port; // variant-specific port for isolation
@@ -527,6 +531,9 @@ async function main(): Promise<void> {
}); });
} else if (profileInfo.type === 'copilot') { } else if (profileInfo.type === 'copilot') {
// COPILOT FLOW: GitHub Copilot subscription via copilot-api proxy // 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 { executeCopilotProfile } = await import('./copilot');
const copilotConfig = profileInfo.copilotConfig; const copilotConfig = profileInfo.copilotConfig;
if (!copilotConfig) { if (!copilotConfig) {
@@ -538,6 +545,9 @@ async function main(): Promise<void> {
} else if (profileInfo.type === 'settings') { } else if (profileInfo.type === 'settings') {
// Settings-based profiles (glm, glmt, kimi) are third-party providers // Settings-based profiles (glm, glmt, kimi) are third-party providers
// WebSearch is server-side tool - third-party providers have no access // WebSearch is server-side tool - third-party providers have no access
// Inject WebSearch hook into profile settings before launch
ensureProfileHooks(profileInfo.name);
ensureMcpWebSearch(); ensureMcpWebSearch();
installWebSearchHook(); installWebSearchHook();