"use strict";
/**
 * Claude Code CLI tool implementation
 * Wraps existing claude-session functionality into the ICLITool interface
 */
Object.defineProperty(exports, "__esModule", { value: true });
exports.ClaudeTool = void 0;
const base_1 = require("./base");
const claude_session_1 = require("../session/claude-session");
/**
 * Claude Code CLI tool implementation
 * Uses existing claude-session module for compatibility
 */
class ClaudeTool extends base_1.BaseCLITool {
    id = 'claude';
    name = 'Claude Code';
    command = 'claude';
    /**
     * Check if Claude CLI is installed
     * Uses existing isClaudeInstalled function for compatibility
     */
    async isInstalled() {
        return await (0, claude_session_1.isClaudeInstalled)();
    }
    /**
     * Check if Claude session is running for a worktree
     *
     * @param worktreeId - Worktree ID
     * @returns True if session is running
     */
    async isRunning(worktreeId) {
        return await (0, claude_session_1.isClaudeRunning)(worktreeId);
    }
    /**
     * Start a new Claude session for a worktree
     *
     * @param worktreeId - Worktree ID
     * @param worktreePath - Worktree path
     */
    async startSession(worktreeId, worktreePath) {
        const options = {
            worktreeId,
            worktreePath,
        };
        await (0, claude_session_1.startClaudeSession)(options);
    }
    /**
     * Send a message to Claude session
     *
     * @param worktreeId - Worktree ID
     * @param message - Message to send
     */
    async sendMessage(worktreeId, message) {
        await (0, claude_session_1.sendMessageToClaude)(worktreeId, message);
    }
    /**
     * Indicates this tool supports image attachments
     * Issue #474: IImageCapableCLITool implementation
     */
    supportsImage() {
        return true;
    }
    /**
     * Send a message with an attached image to Claude session
     * Issue #474: Appends image path as markdown reference
     *
     * @param worktreeId - Worktree ID
     * @param message - Message text
     * @param imagePath - Absolute path to the image file
     */
    async sendMessageWithImage(worktreeId, message, imagePath) {
        const imageMarkdown = `\n![](${imagePath})`;
        const fullMessage = message ? `${message}${imageMarkdown}` : imageMarkdown;
        await this.sendMessage(worktreeId, fullMessage);
    }
    /**
     * Kill Claude session
     *
     * @param worktreeId - Worktree ID
     */
    async killSession(worktreeId) {
        await (0, claude_session_1.stopClaudeSession)(worktreeId);
    }
}
exports.ClaudeTool = ClaudeTool;
