/**
 * Shared rug-pull checks for HTTP/SSE/streamable transports.
 */
import { applyToolFingerprintFromResult, } from './tool-fingerprint.js';
import { isClusterRugPullActive, publishRugPullAlert } from './rug-pull-cluster.js';
export async function isRugPullBlockedForCall(state, serverName, tenantId) {
    if (state.blocked)
        return true;
    return isClusterRugPullActive(serverName, tenantId);
}
export function fingerprintJsonRpcToolsList(state, payload, serverName, tenantId, logPrefix) {
    if (!payload || typeof payload !== 'object')
        return;
    const msg = payload;
    if (!msg.result)
        return;
    applyToolFingerprintFromResult(state, msg.result, {
        serverName,
        tenantId,
        logPrefix,
        onMismatch: async () => {
            void publishRugPullAlert(serverName, tenantId, state.fingerprint || '');
        },
    });
}
//# sourceMappingURL=rug-pull-transport.js.map