diff --git a/lib/hooks/image-analyzer-transformer.cjs b/lib/hooks/image-analyzer-transformer.cjs index ab7d831c..daa10782 100755 --- a/lib/hooks/image-analyzer-transformer.cjs +++ b/lib/hooks/image-analyzer-transformer.cjs @@ -209,29 +209,35 @@ function analyzeViaCliProxy(base64Data, mediaType, model, timeoutMs) { } /** - * Format analysis description for Claude + * Format analysis description for Claude (matches websearch format) */ -function formatDescription(filePath, description, model) { +function formatDescription(filePath, description, model, fileSize) { + const sizeKB = fileSize ? (fileSize / 1024).toFixed(1) : '?'; return [ - `## Image Analysis: ${path.basename(filePath)}`, + `[Image Analysis via CLIProxy]`, + '', + `File: ${path.basename(filePath)} (${sizeKB} KB)`, + `Model: ${model}`, + '', + '---', '', description, '', '---', - `*Analyzed via CLIProxy (${model})*`, + '*Use this description to understand the image content.*', ].join('\n'); } /** * Output success response and exit */ -function outputSuccess(filePath, description, model) { - const formattedDescription = formatDescription(filePath, description, model); +function outputSuccess(filePath, description, model, fileSize) { + const formattedDescription = formatDescription(filePath, description, model, fileSize); const output = { decision: 'block', reason: `Image analyzed: ${path.basename(filePath)}`, - systemMessage: `[Image Analysis] ${path.basename(filePath)} analyzed via CLIProxy`, + systemMessage: `[Image Analysis] ${path.basename(filePath)} analyzed via CLIProxy (${model})`, hookSpecificOutput: { hookEventName: 'PreToolUse', permissionDecision: 'deny', @@ -378,7 +384,7 @@ async function processHook() { const description = await analyzeViaCliProxy(base64Data, mediaType, model, timeoutMs); // Output success - outputSuccess(filePath, description, model); + outputSuccess(filePath, description, model, stats.size); } catch (err) { if (process.env.CCS_DEBUG) { console.error('[CCS Hook] Error:', err.message);