Skip to content

Plugin SDK (Go): TinyGo-targeted SDK with hook surface + typed host calls + manifest generator #237

@tayebmokni

Description

@tayebmokni

Summary

Ship the official Go SDK (sdk-go) for plugin authors. TinyGo-targeted build. Provides: hook.AddAction/hook.AddFilter, typed host calls (db.Query, kv.Get, http.Fetch, ...), the hook_handler entry-point glue, msgpack codec, manifest synthesizer.

Target build command: tinygo build -target=wasi -o server/plugin.wasm ./. Bundle base size goal: ~300KB. Cold-start goal: ~10ms.

Design reference

  • docs/02-plugin-system.md §9.1, §9.4

Acceptance criteria

  • Module path github.com/gonext/sdk-go
  • hook.AddAction(name, priority, fn) / hook.AddFilter(name, priority, fn) developer surface; fn signature reflected to typed args
  • Generic hook_handler WASM export auto-generated by SDK; dispatches by name to registered handlers
  • Host-call wrappers: host.DB.Query(sql, args...) ([]Row, error), host.KV.Get/Set/Del, host.HTTP.Fetch(req) (*Response, error), host.Log.Info/Warn, host.Time.Now(), host.Secrets.Get(key), etc. — one per capability
  • Msgpack codec (TinyGo-compatible, avoid reflection-heavy libs): generates per-type pack/unpack via go:generate or use a tinygo-friendly library
  • //go:wasmexport init and func main() {} (required by TinyGo)
  • gonext manifest gen subcommand: synthesizes manifest.json from code annotations (//gonext:capability db.read core.posts) + a gonext.toml config
  • Tests via the SDK test harness (separate issue): trivial filter, action, host-call round-trip; reproducible WASM build
  • Documentation: Hello World + reference for each host API; recommended project layout

Dependencies

#85 (host ABI), #95 (hook handler)

Complexity

L

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:plugin-sdkPlugin SDK (Go/Rust/TS)phase:P4-pluginsPhase 4 — Pluginspriority:P0Critical — blocks the phaseskill:goGo programmingskill:wasmWebAssembly / wazerotype:featNew feature or implementation task

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions