"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.recordReleaseExecutor = void 0;
const toolExecutor_types_1 = require("../toolExecutor-types");
const stepCapture_1 = require("../../background/capture/stepCapture");
const RELEASE_STEP_WAIT_TIME_MS = 1_000;
exports.recordReleaseExecutor = {
    needsFind: () => true,
    getStepType: () => 'release',
    execute: async (payload, stateProvider, eventHandler, logger) => {
        if (!payload.find || !payload.contextInfo) {
            logger.error('Record release executor requires find and contextInfo');
            return { success: false };
        }
        const toolParams = payload.toolCall.toolParams;
        const findEvent = payload.find;
        if (toolParams.isHtml5 ?? false) {
            findEvent.releaseArgs = { isHtml5: true };
        }
        else {
            findEvent.releaseArgs = { isHtml5: false };
        }
        return (0, toolExecutor_types_1.recordStepAndTrackResult)(() => (0, stepCapture_1.recordTrainedStep)(findEvent, payload.contextInfo, true, undefined, stateProvider, eventHandler), RELEASE_STEP_WAIT_TIME_MS, stateProvider, eventHandler, logger);
    },
};
