AT A CERTAIN cost in ideological purity, the Reagan administration has worked out a sensible and pragmatic truce in the long quarrel over Taiwan. Not everyone will be entirely pleased by the statement published yesterday, and some of Mr. Reagan's closest supporters announce that they are deeply offended. But the right choice rarely gets unanimous applause in this world.

Mr. Reagan came to office trailing a long record of declarations strongly endorsing the Taiwan government's claims to American protection. Both Taiwan and the People's Republic of China have been testing him, to see how far American policy might be changed. As usual, arms sales became the great symbolic indicator of American esteem. The People's Republic, having allowed the issue to lie dormant for a couple of years, last year suddenly began challenging sales to Taiwan. For its part, Taiwan began pressing Mr. Reagan for more powerful fighter aircraft.

Early this year, Mr. Reagan vetoed the shipment of the advanced fighters. He took that decision in the context of the administration's preoccupation with Poland and the imposition of martial law there. According to the prevailing view at the White House, it was an inopportune time to start a row with Peking and take pressure off the Russians. To mollify Taiwan, the administration then promised to continue delivering the military equipment, including fighters, that it has sold in the past. That brought a severe reaction from Peking.

In May, Vice President Bush went to Peking with a message from Mr. Reagan: the United States would expect its arms shipments to Taiwan to decline as long as the People's Republic and Taiwan continued to make peaceful progress toward the unification that both profess to see somewhere far down the road. The present communiqu,e now published jointly by the United States and China upholds the same position.

The upshot of a year's pulling and hauling, among the three capitals, is rather satisfactory from the American point of view. Taiwan has learned that it can't persuade Mr. Reagan to give it anything its asks, and Peking has learned that it can't persuade Mr. Reagan to give Taiwan nothing.

Some of the Republicans in Congress will complain that the Reagan policy in that part of the world begins to look like Mr. Carter's. But then, there were Democrats who complained several years ago that Mr. Carter's policy looked like Mr. Nixon's. That was true. The logic of the relationships among China, Russia and the United States has led a succession of presidents to similar conclusions on Taiwan.