BEIJING — For all the bonhomie on display between Xi Jinping and Kim Jong-un during the first state visit to Beijing by a leader of a nuclear-armed North Korea since 1982, tense undercurrents run through the relationship.Beijing's only formal treaty ally, North Korea is of unique importance to China, not only as a buffer to US-allied South Korea, but also as leverage in its dealings with Washington, Tokyo and Seoul. For much of North Korea's his…