"use strict";
/**
 * Claude launch argument helpers for first-class Image Analysis.
 *
 * Uses the same prompt injection mode as the user to avoid mixing
 * `--append-system-prompt` and `--append-system-prompt-file` in one request.
 */
Object.defineProperty(exports, "__esModule", { value: true });
exports.getImageAnalysisSteeringPrompt = exports.appendThirdPartyImageAnalysisToolArgs = void 0;
const claude_tool_args_1 = require("../claude-tool-args");
const prompt_injection_strategy_1 = require("../prompt-injection-strategy");
const claude_subcommand_detector_1 = require("../claude-subcommand-detector");
const IMAGE_ANALYSIS_STEERING_PROMPT = {
    name: 'ccs-prompt-image-analysis-tool',
    content: 'For local image or PDF files, prefer the CCS MCP tool ImageAnalysis instead of Read. Use Read for text, code, and other plain files. If the user asks a specific question about the visual, pass that question as the focus field when useful. If ImageAnalysis is unavailable or fails, you may fall back to Read.',
};
function ensureImageAnalysisSteeringPrompt(args) {
    const { optionArgs, trailingArgs } = (0, claude_tool_args_1.splitArgsAtTerminator)(args);
    if ((0, claude_tool_args_1.hasExactFlagValue)(optionArgs, prompt_injection_strategy_1.PROMPT_FLAG_INLINE, IMAGE_ANALYSIS_STEERING_PROMPT.content)) {
        return args;
    }
    if ((0, prompt_injection_strategy_1.hasManagedPromptFileArg)({ args: optionArgs, promptName: IMAGE_ANALYSIS_STEERING_PROMPT.name })) {
        return args;
    }
    const steeringArg = (0, prompt_injection_strategy_1.buildSteeringArg)({
        args: optionArgs,
        promptName: IMAGE_ANALYSIS_STEERING_PROMPT.name,
        promptContent: IMAGE_ANALYSIS_STEERING_PROMPT.content,
    });
    return [...optionArgs, ...steeringArg, ...trailingArgs];
}
function appendThirdPartyImageAnalysisToolArgs(args) {
    // Subcommands reject session-only prompt flags. Issue #1218.
    if ((0, claude_subcommand_detector_1.isClaudeSubcommandInvocation)(args))
        return args;
    return ensureImageAnalysisSteeringPrompt(args);
}
exports.appendThirdPartyImageAnalysisToolArgs = appendThirdPartyImageAnalysisToolArgs;
function getImageAnalysisSteeringPrompt() {
    return IMAGE_ANALYSIS_STEERING_PROMPT.content;
}
exports.getImageAnalysisSteeringPrompt = getImageAnalysisSteeringPrompt;
//# sourceMappingURL=claude-tool-args.js.map