Extism-style host-guest plugin manifest & VKPW RPC envelope with capability allowlists, deterministic fuel quotas, and audit logs.
Extism-style multi-tenant WebAssembly 3.0 (vvm) plugin host, Ed25519 code-signing verifier, capability allowlist dispatcher, and VKPW Host-Guest RPC envelope SDK for Veko (wasm_plugin_sdk).
wasm_plugin_sdk enables Veko applications to compile, verify, and execute untrusted tenant .vk / .wasm plugins inside Veko's zero-trust Wasm 3.0 runtime (vvm) with deterministic resource quotas and audit logging:
PluginManifest & Ed25519 Verification: Declares per-plugin allowed_hosts (supporting exact domains and *.domain wildcards), confined allowed_paths, max_fuel instruction quota, max_mem_pages linear memory cap, static config map, and optional Ed25519 public key verification (crypto/x25519).VKPW Binary + JSON RPC Envelope: Length-prefixed, IEEE CRC-32-protected binary wire framing (VKPW magic + version 1 + frame kind + uint32 BE length + JSON payload + uint32 BE CRC-32) for .call, .response, .error, and .host_call frames, plus guest-side helpers (guest-read-call, guest-write-response).register-host-fn and dispatch-host-call enforce host and path allowlists before executing host callbacks and record sequential AuditEntry logs for every permitted, denied, or trapped operation.compile-vk-plugin compiles .vk plugin source directly into Wasm 3.0 .wasm modules, while invoke-plugin executes them under --wasm --allow-fs=<sandbox_dir> --fuel=<max_fuel> --mem-pages=<max_mem_pages>, deterministically terminating infinite loops or memory violations.veko pkg add wasm_plugin_sdk@1.0.0Import in .vk source files:
use [sdk = wasm_plugin_sdk]VKPW Envelope Layout| Byte Offset | Field | Width | Description |
|---|---|---|---|
0..4 | Magic | 4 bytes | ASCII 'VKPW' |
4 | Version | uint8 | Protocol version (1) |
5 | Kind | uint8 | 1 = Call, 2 = Response, 3 = Error, 4 = HostCall |
6..10 | Body Length | uint32 BE | Byte length N of UTF-8 JSON body |
10..(10+N) | JSON Body | N bytes | Marshaled input, config, output, or error |
(10+N)..(14+N) | CRC-32 | uint32 BE | IEEE 802.3 CRC-32 over bytes 0..(10+N) |
During invoke-plugin, the host creates an ephemeral per-call sandbox directory (inv_<seq>), writes in.vkpw, mounts only that directory into vvm via --allow-fs=<inv_dir>, enforces --fuel and --mem-pages, reads out.vkpw, and removes the ephemeral directory via defer.
| Symbol | Signature | Description |
|---|---|---|
PluginManifest | struct | Tenant plugin identity, host/path allowlists, fuel/memory caps, config, and Ed25519 signer |
sign-plugin-bytes | fn [seed32 bytes, wasm_bytes bytes] str | Signs .wasm bytes with a 32-byte Ed25519 seed (hex output) |
verify-plugin-bytes | fn [pubkey_hex str, wasm_bytes bytes, sig_hex str] bool | Verifies Ed25519 signature over .wasm bytes |
valid-wasm-magic? | fn [wasm_bytes bytes] bool | Checks \0asm (0x00 0x61 0x73 0x6d) binary header |
encode-rpc-call | fn [fn_name str, input any, config map] bytes | Packs a VKPW Host->Guest call envelope |
encode-rpc-response | fn [output any] bytes | Packs a VKPW Guest->Host response envelope |
encode-rpc-error | fn [error_code i64, error_msg str] bytes | Packs a VKPW Guest->Host error envelope |
encode-host-call-frame | fn [fn_name str, args map /host h str = '' /path p str = ''] bytes | Packs a VKPW host-call envelope |
decode-rpc-frame | fn [wire bytes] RpcFrame | Verifies CRC-32 and decodes a VKPW envelope |
guest-read-call / guest-write-response | Guest helpers | Reads in.vkpw / writes out.vkpw inside Wasm 3.0 guests |
new-plugin-host | fn [/work-dir dir str = ...] PluginHost | Initializes a multi-tenant plugin host |
register-host-fn | fn [mut host PluginHost, name str, handler any /cap c str = '' /check-host ch bool = false /check-path cp bool = false] enum | Registers a capability-guarded host function |
dispatch-host-call | fn [mut host PluginHost, plugin_id str, fn_name str, args map /target-host th str = '' /target-path tp str = ''] any | Enforces allowlists, runs callback, and logs AuditEntry |
compile-vk-plugin | fn [vk_source str, out_wasm_path str /veko-bin vbin str = ''] bytes | Compiles .vk source to Wasm 3.0 .wasm bytes |
register-plugin | fn [mut host PluginHost, manifest PluginManifest, wasm_path str /signature sig_hex str = ''] enum | Verifies and registers a .wasm plugin |
invoke-plugin | fn [mut host PluginHost, plugin_id str, fn_name str, input any /veko-bin vbin str = ''] InvocationResult | Executes plugin in Wasm 3.0 with fuel & memory quotas |
host-audit-log | fn [host PluginHost] block[AuditEntry] | Returns sequential security & execution audit entries |
use [sdk = wasm_plugin_sdk]
mut host = sdk/new-plugin-host
wasm_b = sdk/compile-vk-plugin 'use [sdk = wasm_plugin_sdk]\ncall = sdk/guest-read-call\n_ = sdk/guest-write-response { doubled = ((as-i64 call.input.n) * 2) }' 'dist/doubler.wasm'
_ = sdk/register-plugin mut host (sdk/PluginManifest {
plugin_id = 'doubler'
max_fuel = 250000
max_mem_pages = 32
}) 'dist/doubler.wasm'
res = sdk/invoke-plugin mut host 'doubler' 'run' { n = 21 }
println (map/get res.output 'doubled') // 42https://veko-lang.org/pkg/wasm_plugin_sdk/1.0.0.vkpa4a67d775adfafe4c086faf1befb4f32bc66cd386c17d85941ef9f49989821bce5cbce96199f6ceb5596f343b278ff176dcd0009634ff1c895480860bee1040ced25519:27406074d8681da1d4e6420f5d887cac15c313334c249ac047ba9d4e2df72b70{"name":"wasm_plugin_sdk","version":"1.0.0","tier":5.0,"tier_label":"Tier 5: Cloud-Native, Noise, IaC & Wasm","category":"Multi-Tenant Wasm 3.0 Plugin SDK","description":"Extism-style host-guest plugin manifest & VKPW RPC envelope with capability allowlists, deterministic fuel quotas, and audit logs.","modules":["wasm_plugin_sdk"],"homepage":"https://veko-lang.org/packages/wasm_plugin_sdk"}| Bundle Entry Path | Size | Leaf SHA-256 Digest |
|---|---|---|
| README.md | 5 KB | c480884b317bd1d4519b693dbd3d7d51faae8fd2e260c32d24f945a5785bd30d |
| examples/demo.vk | 6 KB | ecf75feb46048e279abc4e344468bf8af864094254d8e66c107b623b6c701cf0 |
| mod.vk | 17 KB | 18bb1b8b093475e1e913d0ca82b60ec94b8c35d45ce95750bb45d9ee5bc13fcc |