"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.waitExecutor = void 0;
const utilities_1 = require("../../utilities");
const toolExecutor_types_1 = require("../toolExecutor-types");
const stepCapture_1 = require("../../background/capture/stepCapture");
const DEFAULT_WAIT_STEP_WAIT_TIME_SECONDS = 3;
exports.waitExecutor = {
    needsFind: () => false,
    getStepType: () => 'wait',
    execute: async (payload, stateProvider, eventHandler, logger) => {
        const toolParams = payload.toolCall.toolParams;
        if (toolParams.saveStep) {
            return (0, toolExecutor_types_1.recordStepAndTrackResult)(async () => (0, stepCapture_1.recordTrainedStep)({
                action: 'record',
                listener: 'wait',
                time: toolParams?.waitTime ?? DEFAULT_WAIT_STEP_WAIT_TIME_SECONDS,
            }, payload.contextInfo ?? (await stateProvider.getActiveContextInfo()), true, undefined, stateProvider, eventHandler), 0, stateProvider, eventHandler, logger);
        }
        await (0, utilities_1.sleep)((toolParams?.waitTime ?? DEFAULT_WAIT_STEP_WAIT_TIME_SECONDS) * 1000);
        return {
            success: true,
        };
    },
};
