Turkey Vs. Syrian Kurds: Whose Side Are We On?

It looks very much like the US is in a proxy war with its NATO ally Turkey in Syria. The US is backing the Kurds, which are being attacked by Ankara. Both sides are using the same military base in Turkey. Does anyone have any idea what the US is doing in Syria?