Americans were in pursuit of Al-Qaeda Network in Af-Pak region; they succeeded in defanging this organization in the region (primary objective of
Operation Enduring Freedom accomplished). Afghan Taliban were ousted from power for providing cover to Al-Qaeda Network (secondary objective of
Operation Enduring Freedom accomplished). Resulting power vacuum was filled by creating a new government for Afghanistan (another secondary objective of
Operation Enduring Freedom accomplished).
USA had much better access to Afghanistan via Pakistan however. Pakistan was in a good position to protect its interests in Afghanistan therefore. USA never declared Afghan Taliban a terrorist organization for instance (what does this tell you?); negotiations with Afghan Taliban were on the cards in fact. These negotiations commenced in times of Obama administration and bore fruit in times of Trump administration. These negotiations were not about release of American POW from prison camps of Afghan Taliban or the instrument of surrender of US-led forces to Afghan Taliban in Afghanistan.
These negotiations were about Afghan Taliban accepting American terms for Al-Qaeda Network in exchange for EXIT of US-led forces from Afghanistan; mutually acceptable resolution to both camps in the end. This is a political settlement and does not suggest DEFEAT of either camp.
Your statement (see
post # 1437) - gives the impression that Afghan Taliban defeated US-led forces in battlefield(s) of Afghanistan and Americans were negotiating release of American POW or something on these lines. This is patently false assertion. It would be a grave mistake to PREDICT how US-led forces would fare in conventional battle(s) with another army (or militia) in another territory on the basis of developments in Afghanistan.
Afghanistan is not politically stable to begin with; Afghan Taliban restored peace in numerous parts of the country only to fall under the spell of Al-Qaeda Network and WE know how this panned out. Pakistan is making the right call by fencing Durand Line in the present. This should have been done before but better late than never.