Repository navigation
feat(core): expose fetch to code mode scripts - #49235
Merged
Merged
Conversation
rekram1-node
force-pushed
the
core-fetch
branch
5 times, most recently
from
September 15, 2026 23:13
76ffbcc to
f5e7f6c
Compare
rekram1-node
force-pushed
the
core-fetch
branch
from
September 16, 2026 04:07
f5e7f6c to
7049203
Compare
jinhuang712
pushed a commit
to jinhuang712/opencode
that referenced
this pull request
Sep 26, 2026
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.
Scripts run by the
executetool can now callfetch. Built on #49196 (extensions are host functions) and #49242 (before/after hooks): one host function, plainglobalThis.fetch, closures for the response, no new runtime types.Three commits:
fetch(url, init?)takesmethod,headers, and astring/Uint8Array/URLSearchParamsbody, and resolves to{ url, status, statusText, ok, redirected, headers: { get, has, entries }, text(), json(), bytes() }. 30 s timeout. Not a tool call; not in the catalog.In the TUI, with no UI changes, a fetch appears under
executelike a nested tool call:Verified against a local server: rows appear in start order as
running, settle tocompletedorerror, and the finaltoolCallsmetadata matches.Not in this PR: permission prompting (webfetch's
Permission.assert), body size caps, origin policy.Checks:
bun run check35/35;packages/coretest/tool-execute.test.ts+test/codemode27 pass.