import { finalizeGovernedRequestWithNative } from '../../../router/virtual-router/engine-selection/native-chat-process-governance-semantics.js';
export function finalizeGovernedRequest(options) {
    const { request, providerProtocol, governanceEngine } = options;
    const { request: sanitized, summary } = governanceEngine.governRequest(request, providerProtocol);
    if (summary.applied !== true) {
        return sanitized;
    }
    const finalized = finalizeGovernedRequestWithNative(sanitized, summary);
    sanitized.metadata = finalized.metadata;
    return sanitized;
}
