import { recordStage } from '../../../stages/utils.js';
import { sanitizeChatCompletionLikeWithNative } from '../../../../../../router/virtual-router/engine-selection/native-hub-pipeline-edge-stage-semantics.js';
export async function runRespInboundStage3SemanticMap(options) {
    const chatResponseRaw = await options.mapper.toChatCompletion(options.formatEnvelope, options.adapterContext, {
        requestSemantics: options.requestSemantics
    });
    const chatResponse = sanitizeChatCompletionLikeWithNative(chatResponseRaw);
    recordStage(options.stageRecorder, 'chat_process.resp.stage4.semantic_map_to_chat', chatResponse);
    return chatResponse;
}
