export function parseClientTerminalMessage(raw) {
    try {
        const parsed = JSON.parse(raw);
        if (!parsed || typeof parsed !== 'object') {
            return null;
        }
        const message = parsed;
        if (message.type === 'input' && typeof message.terminalId === 'string' && typeof message.data === 'string') {
            return message;
        }
        if (message.type === 'refresh_cwd' && typeof message.terminalId === 'string') {
            return message;
        }
        if (message.type === 'resize' &&
            typeof message.terminalId === 'string' &&
            Number.isInteger(message.cols) &&
            Number.isInteger(message.rows)) {
            return message;
        }
        if (message.type === 'ping' && typeof message.nonce === 'string') {
            return message;
        }
        return null;
    }
    catch {
        return null;
    }
}
//# sourceMappingURL=protocol.js.map