From a8ddf8bd565ac82131dc4ca02ecadd3b04a61197 Mon Sep 17 00:00:00 2001 From: kaitranntt Date: Wed, 4 Feb 2026 00:27:13 -0500 Subject: [PATCH] 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. --- src/ccs.ts | 7 +++++++ src/cliproxy/services/variant-settings.ts | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/src/ccs.ts b/src/ccs.ts index 6cf8140c..d1a76204 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 { 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 { // 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 { // 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 { // 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(); diff --git a/src/cliproxy/services/variant-settings.ts b/src/cliproxy/services/variant-settings.ts index 872ae910..d50c0cf2 100644 --- a/src/cliproxy/services/variant-settings.ts +++ b/src/cliproxy/services/variant-settings.ts @@ -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; }