"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.requestInteractionExecutor = void 0;
const mablApi_1 = require("../../../mablApi");
const uuid_1 = require("uuid");
exports.requestInteractionExecutor = {
    needsFind: () => false,
    getStepType: (toolCall) => toolCall.toolName ?? 'request_interaction',
    execute: async (payload, stateProvider, eventHandler, _logger) => {
        const toolParams = payload.toolCall.toolParams;
        const activeSession = stateProvider.getActiveSession();
        const agentMessage = {
            role: mablApi_1.ChatMessageRoleEnum.Model,
            conversationId: activeSession?.conversationId ?? (0, uuid_1.v4)(),
            message: toolParams?.message ?? '',
            timestamp: Date.now(),
            actionRequest: toolParams.action_request ?? mablApi_1.AgentMessageActionRequestEnum.Response,
        };
        const userResponse = await eventHandler.requestHumanAction(agentMessage, payload.session.stopCondition);
        return {
            success: true,
            successDetail: {
                userResponse,
            },
        };
    },
};
