The wasip1 half of the ABI: bn_alloc/bn_invoke/bn_free exports with a live-pin map so the GC never frees host-visible buffers, the generic `blockninja.host_call` import (single import decided over per-family symbols; recorded in wasm-abi.md), and a dispatch table adapting an unmodified plugin.PluginRegistration to all nine v1 hooks. Panics inside plugin hooks come back as ABI_ERROR_CODE_INTERNAL — the instance stays callable; traps stay reserved for runtime corruption. DESCRIBE builds the PluginManifest from the registration's static funcs plus a capture-only Register pass (block metas via the same PluginBlockRegistry prefixing the .so loader applies, template/system/ page-template/email-wrapper keys), probes JobHandlers/ServiceHandlers/ Load with capture-only services for job types, RBAC roles, core-service bindings, and RAG fetcher types. RenderContext values are rehydrated through the exact core/blocks context keys, so existing block code reading from ctx works unchanged. Plugins build in REACTOR mode (go build -buildmode=c-shared): init() calls wasmguest.Serve (non-blocking), main is never called, and the host runs _initialize before any bn_invoke. Command mode deadlocks or exits (verified against wazero v1.12.0) — documented prominently in wasm-abi.md, which also now reconciles the import module namespace to `blockninja` and requires bn_alloc'd buffers on both directions. Dispatch/describe/context logic is buildable on every GOOS; only exports.go and hostcalls.go carry the wasip1 tag. dispatch_test.go covers describe, hook routing, envelope mismatch, decode failures, template-override resolution, panic recovery, and lifecycle hooks natively. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
BlockNinja Plugin SDK
Types, interfaces, and utilities for building BlockNinja plugins.
Package Structure
| Package | Purpose |
|---|---|
plugin/ |
PluginRegistration, CoreServices, RegisterFunc |
blocks/ |
BlockMeta, BlockFunc, BlockRegistry interface, BlockContext |
blocks/builtin/ |
Reusable block implementations (HTMLBlock) |
templates/ |
TemplateRegistry interface |
templates/bn/ |
Shared templ components (head, engagement, toolbar) |
auth/ |
Claims types, context extractors |
content/ |
Content access interface |
settings/ |
Settings access interface |
gating/ |
Access gating evaluation |
crypto/ |
Encrypt/Decrypt interface |
render/ |
Rich text rendering utilities |
video/ |
Video embed URL parsing |
ai/ |
AI tool registry interface and types |
rbac/ |
Role type definition |
Usage
import "git.dev.alexdunmow.com/ninja/core/plugin"
Description
Languages
Go
83.5%
templ
15.5%
Makefile
1%