feat(opencode): add copilot specific provider to properly handle copilot reasoning tokens
What does this PR do?
This PR adds a copilot specific provider for the copilot completions API (there's already copilot specific code for the responses API). The code already states that this code is only meant for copilot, so I decided to rename the folder accordingly for clarity. While it would be great to not need this, I currently don't see a way to not have the copilot specifics (apart from extracting it into a separate repository).
It is similar to https://github.com/anomalyco/opencode/pull/5346, but it changes the completions code to properly store the reasoning_opaque field and send it back to the copilot API.
This PR is based on code I wrote for tidewave. I used Claude to implement the same changes based on a fresh copy of the upstream openai-compatible provider: https://github.com/vercel/ai/tree/%40ai-sdk/openai-compatible%401.0.30/packages/openai-compatible/src/chat
There are multiple small commits to make reviewing this easier and I also added tests for the important cases I encountered when handling the reasoning fields.
In the past, the Copilot API failed if the reasoning signature (reasoning_opaque) was not sent back for the Gemini 3 models. At some point GitHub seems to have changed this. Note though that the models still behave differently if the reasoning tokens are not passed back. For example, in Tidewave we've often seen Copilot's Gemini 2.5 spiral into a loop when omitting the reasoning, while it doesn't do that when including those.
How did you verify your code works?
You can chat with Gemini 2.5 Pro (3 Pro Preview is currently broken because of https://github.com/anomalyco/opencode/issues/8829, but it works in the Tidewave version of the code and all the fields are the same).
Closes https://github.com/anomalyco/opencode/issues/6864.