Skip to content

feat: add support for custom host calls and branding information in W… - #10

Merged
pikann merged 1 commit into
masterfrom
feature/support-host-call-and-brand-function
Aug 18, 2026
Merged

pikann merged 1 commit into
masterfrom
feature/support-host-call-and-brand-function

Conversation

@pikann

@pikann pikann commented Aug 18, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Adds two new host capabilities plugins can use: a generic escape hatch for custom host functions, and live workspace branding lookup.

  • custom_host_call.go (wasip1): CallHostFunction(hostFn, request, response) — a low-level escape hatch for a plugin that needs a host capability beyond what this SDK exposes directly (e.g. an SMTP-sending mail plugin's outbound socket access), gated behind a manifest permission the plugin declares for itself. The plugin author still declares their own //go:wasmimport binding using the (reqPtr, reqLen, resPtrPtr, resLenPtr int64) calling convention (CustomHostImport); CallHostFunction handles the JSON marshal/unmarshal and WASM linear-memory pointer plumbing this SDK already uses internally for Fetch/DB/etc., so plugin authors don't have to hand-roll unsafe pointer arithmetic.
  • wasm_imports.go / wasm_backends.go: new paca.settings_get host import and GetBranding() wrapper. Returns BrandingInfo (logo URL, brand name, light/dark primary colors) mirroring the workspace's public GET /branding endpoint. Meant to be called at render/send time rather than cached, so a branding change is reflected immediately in anything a plugin renders afterward (e.g. an email template).
  • native_backends.go: matching native (non-WASM) stubs for BrandingInfo, GetBranding, CustomHostImport, and CallHostFunction, all returning errNotWASM, so plugin code compiles and runs the same way under go test as it does under wasip1.

Deliberately not added: an email.send-style SDK function. Sending mail is specific to one class of plugin (SMTP, and later SES/SendGrid/Mailgun), not a general-purpose capability every plugin needs — a mail plugin instead declares its own private send_email go:wasmimport binding and drives it through CallHostFunction.

Test plan

  • go build ./..., go vet ./... clean (native)
  • GOOS=wasip1 GOARCH=wasm go build ./... clean

@pikann
pikann merged commit 2df7d42 into master Aug 18, 2026
4 checks passed
@pikann
pikann deleted the feature/support-host-call-and-brand-function branch August 18, 2026 10:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant