feat(opencode): prioritize text/markdown in webfetch accept header#15899
Closed
zeke wants to merge 2 commits intoanomalyco:devfrom
Closed
feat(opencode): prioritize text/markdown in webfetch accept header#15899zeke wants to merge 2 commits intoanomalyco:devfrom
zeke wants to merge 2 commits intoanomalyco:devfrom
Conversation
a707d1a to
f70cf96
Compare
Contributor
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
Open
1 task
Contributor
|
This PR doesn't fully meet our contributing guidelines and PR template. What needs to be fixed:
Please edit this PR description to address the above within 2 hours, or it will be automatically closed. If you believe this was flagged incorrectly, please let a maintainer know. |
Contributor
|
This pull request has been automatically closed because it was not updated to meet our contributing guidelines within the 2-hour window. Feel free to open a new pull request that follows our guidelines. |
6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves: #13486
Type of change
What does this PR do?
This PR adds
text/markdownas the highest priority in the default Accept header for the webfetch tool. When a server supports content negotiation and can serve markdown directly, this avoids unnecessary HTML-to-markdown conversion on the client side.Cloudflare recently launched Markdown for Agents, which uses the
Accept: text/markdownheader to serve markdown versions of web pages at the edge. Any Cloudflare zone with this feature enabled will return markdown instead of HTML when the request includestext/markdownin the Accept header. By prioritizing this in the webfetch tool, opencode gets cleaner output with fewer tokens from any site that supports it.How did you verify your code works?
Added tests covering accept header behavior for each format option and verifying markdown passthrough vs HTML conversion. Ran the test suite in
packages/opencode.Screenshots / recordings
N/A
Checklist