feat: implement Fetch function and FetchResponse type for HTTP requests#3
Merged
pikann merged 3 commits intoMay 13, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds an outbound HTTP request capability for WASM plugins by introducing a new Fetch API and FetchResponse type, plus the corresponding WASM host import binding, while keeping non-WASM builds compiling via stub implementations.
Changes:
- Added
hostFetchWASM import binding for thepaca.fetchhost function. - Implemented
FetchandFetchResponseforwasip1builds with JSON request/response marshalling. - Added non-WASM stubs for
Fetch/FetchResponsethat returnerrNotWASM.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| wasm_imports.go | Adds the paca.fetch host import binding (hostFetch). |
| wasm_backends.go | Implements Fetch + FetchResponse for WASM, including host-call wiring and response decoding. |
| native_backends.go | Adds non-WASM stubs for Fetch and FetchResponse to preserve build compatibility. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Agent-Logs-Url: https://github.com/Paca-AI/plugin-sdk-go/sessions/34f8083a-e90b-40b6-8efc-1cd710463eb5 Co-authored-by: pikann <41873019+pikann@users.noreply.github.com>
Agent-Logs-Url: https://github.com/Paca-AI/plugin-sdk-go/sessions/34f8083a-e90b-40b6-8efc-1cd710463eb5 Co-authored-by: pikann <41873019+pikann@users.noreply.github.com>
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.
This pull request introduces a new outbound HTTP request capability for WASM plugins by adding a
FetchAPI, along with the supporting types and host function bindings. The changes are organized into two main themes: the implementation of theFetchAPI for WASM builds, and the addition of stubs for non-WASM builds to maintain compatibility.New Fetch API for WASM plugins:
FetchResponsestruct and aFetchfunction towasm_backends.go, enabling outbound HTTP requests from WASM plugins via thepaca.fetchhost function. The implementation includes request serialization, host call invocation, and response decoding with error handling.hostFetchfunction inwasm_imports.goto bind the WASM import for HTTP requests, allowing WASM code to call out to the host for HTTP operations.fmtpackage inwasm_backends.goto support error formatting in the newFetchimplementation.Non-WASM compatibility:
FetchResponsestruct and aFetchfunction innative_backends.gothat always returns an error, ensuring non-WASM builds compile and fail gracefully ifFetchis called.