feat(hooks): inject image analyzer hooks into all profile types

Add image analyzer hook injection alongside WebSearch hooks:
- ccs.ts: CLIProxy, Copilot, and API profile flows
- variant-settings.ts: CLIProxy variant settings

Ensures image analyzer hooks are present in profile settings.json files.
This commit is contained in:
kaitranntt
2026-02-04 00:27:13 -05:00
parent ae3eb282b4
commit a8ddf8bd56
2 changed files with 14 additions and 0 deletions
+7
View File
@@ -14,6 +14,7 @@ import {
} from './utils/websearch-manager';
import { getGlobalEnvConfig } from './config/unified-config-loader';
import { getImageReadBlockHookEnv } from './utils/hooks/image-read-block-hook-env';
import { ensureProfileHooks as ensureImageAnalyzerHooks } from './utils/hooks/image-analyzer-profile-hook-injector';
import { fail, info } from './utils/ui';
// Import centralized error handling
@@ -523,6 +524,8 @@ async function main(): Promise<void> {
// CLIPROXY FLOW: OAuth-based profiles (gemini, codex, agy, qwen) or user-defined variants
// Inject WebSearch hook into profile settings before launch
ensureProfileHooks(profileInfo.name);
// Inject Image Analyzer hook into profile settings before launch
ensureImageAnalyzerHooks(profileInfo.name);
const provider = profileInfo.provider || (profileInfo.name as CLIProxyProvider);
const customSettingsPath = profileInfo.settingsPath; // undefined for hardcoded profiles
@@ -535,6 +538,8 @@ async function main(): Promise<void> {
// COPILOT FLOW: GitHub Copilot subscription via copilot-api proxy
// Inject WebSearch hook into profile settings before launch
ensureProfileHooks(profileInfo.name);
// Inject Image Analyzer hook into profile settings before launch
ensureImageAnalyzerHooks(profileInfo.name);
const { executeCopilotProfile } = await import('./copilot');
const copilotConfig = profileInfo.copilotConfig;
@@ -549,6 +554,8 @@ async function main(): Promise<void> {
// WebSearch is server-side tool - third-party providers have no access
// Inject WebSearch hook into profile settings before launch
ensureProfileHooks(profileInfo.name);
// Inject Image Analyzer hook into profile settings before launch
ensureImageAnalyzerHooks(profileInfo.name);
ensureMcpWebSearch();
@@ -14,6 +14,7 @@ import { expandPath } from '../../utils/helpers';
import { getClaudeEnvVars, CLIPROXY_DEFAULT_PORT } from '../config-generator';
import { CLIProxyProvider } from '../types';
import { ensureProfileHooks } from '../../utils/websearch/profile-hook-injector';
import { ensureProfileHooks as ensureImageAnalyzerHooks } from '../../utils/hooks/image-analyzer-profile-hook-injector';
/** Environment settings structure */
interface SettingsEnv {
@@ -109,6 +110,9 @@ export function createSettingsFile(
// Inject WebSearch hooks into variant settings
ensureProfileHooks(`${provider}-${name}`);
// Inject Image Analyzer hooks into variant settings
ensureImageAnalyzerHooks(`${provider}-${name}`);
return settingsPath;
}
@@ -134,6 +138,9 @@ export function createSettingsFileUnified(
// Inject WebSearch hooks into variant settings
ensureProfileHooks(`${provider}-${name}`);
// Inject Image Analyzer hooks into variant settings
ensureImageAnalyzerHooks(`${provider}-${name}`);
return settingsPath;
}