Merge pull request #413 from kaitranntt/fix/websearch-hook-cliproxy

fix(cliproxy): load WebSearch hooks via --settings flag
This commit is contained in:
Kai (Tam Nhu) Tran authored and GitHub committed 2026-02-01 02:50:03 -05:00
commit 8fd2346365
1 file changed
+12 -2
+12 -2
View File
@@ -24,6 +24,7 @@ import {
getRemoteEnvVars, getRemoteEnvVars,
getProviderConfig, getProviderConfig,
ensureProviderSettings, ensureProviderSettings,
getProviderSettingsPath,
CLIPROXY_DEFAULT_PORT, CLIPROXY_DEFAULT_PORT,
getCliproxyWritablePath, getCliproxyWritablePath,
validatePort, validatePort,
@@ -973,6 +974,7 @@ export async function execClaudeWithCLIProxy(
'--incognito', '--incognito',
'--no-incognito', '--no-incognito',
'--import', '--import',
'--settings', // Block user --settings to prevent duplicate flags
// Proxy flags are handled by resolveProxyConfig, but list for documentation // Proxy flags are handled by resolveProxyConfig, but list for documentation
...PROXY_CLI_FLAGS, ...PROXY_CLI_FLAGS,
]; ];
@@ -994,9 +996,17 @@ export async function execClaudeWithCLIProxy(
const isWindows = process.platform === 'win32'; const isWindows = process.platform === 'win32';
const needsShell = isWindows && /\.(cmd|bat|ps1)$/i.test(claudeCli); const needsShell = isWindows && /\.(cmd|bat|ps1)$/i.test(claudeCli);
// Get profile settings path for hooks (WebSearch, etc.)
// Use custom settings path for CLIProxy variants, otherwise use default provider path
const settingsPath = cfg.customSettingsPath
? cfg.customSettingsPath.replace(/^~/, process.env.HOME || '')
: getProviderSettingsPath(provider);
let claude: ChildProcess; let claude: ChildProcess;
if (needsShell) { if (needsShell) {
const cmdString = [claudeCli, ...claudeArgs].map(escapeShellArg).join(' '); const cmdString = [claudeCli, '--settings', settingsPath, ...claudeArgs]
.map(escapeShellArg)
.join(' ');
claude = spawn(cmdString, { claude = spawn(cmdString, {
stdio: 'inherit', stdio: 'inherit',
windowsHide: true, windowsHide: true,
@@ -1004,7 +1014,7 @@ export async function execClaudeWithCLIProxy(
env, env,
}); });
} else { } else {
claude = spawn(claudeCli, claudeArgs, { claude = spawn(claudeCli, ['--settings', settingsPath, ...claudeArgs], {
stdio: 'inherit', stdio: 'inherit',
windowsHide: true, windowsHide: true,
env, env,