"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.visitUrlExecutor = void 0;
const toolExecutor_types_1 = require("../toolExecutor-types");
const stepCapture_1 = require("../../background/capture/stepCapture");
exports.visitUrlExecutor = {
    needsFind: () => false,
    getStepType: () => 'visit-url',
    execute: async (payload, stateProvider, eventHandler, logger) => {
        const toolParams = payload.toolCall.toolParams;
        if (!toolParams?.url) {
            logger.error('Visit URL executor requires a URL parameter');
            return {
                success: false,
                errorMessage: 'URL parameter is required',
            };
        }
        const contextInfo = payload.contextInfo ?? (await stateProvider.getActiveContextInfo());
        return (0, toolExecutor_types_1.recordStepAndTrackResult)(() => (0, stepCapture_1.recordTrainedStep)({
            action: 'record',
            listener: 'visit-url',
            url: toolParams.url,
        }, contextInfo, true, undefined, stateProvider, eventHandler), 0, stateProvider, eventHandler, logger);
    },
};
