Plugin + FFI ABI Schemas v0.1
Schema-id contracts for typed bridge-backed host capability calls.
Purpose
The following capability families support typed request/response schema IDs:
host/plugin::commandeditor/plugin::commandhost/ffi::callhost/ffi::buffer-pinhost/ffi::buffer-unpin
When schema IDs are present:
- runtime performs deterministic preflight schema validation for request and response terms,
- per-op policy must define
allow_schema_idsand include every used schema ID.
Calls without schema IDs remain backward-compatible.
Plugin Request Schemas
genesis/plugin.request.exec.v1
Payload must be a map:
- required:
:argsvector
- optional:
:cwdstring:envmap<string,string>:stdinnil|string|bytes
genesis/plugin.request.jsonrpc.v1
Payload must be a map:
- required:
:methodnon-empty string
- optional:
:paramsterm:idnil|int|string
Plugin Response Schemas
genesis/plugin.response.result.v1
Response must be a map:
- required:
:okbool
- conditional:
- when
:okis true::errormust be absent - when
:okis false::errormap is required:error/:messagenon-empty string:error/:codestring|symbol (optional)
- when
- optional:
:resultterm
genesis/plugin.response.bytes.v1
Response must be a map:
- required:
:okbool
- conditional:
- when
:okis true::datastring|bytes is required - when
:okis false::errormap is required:error/:messagenon-empty string:error/:codestring|symbol (optional)
- when
FFI Request Schemas
genesis/ffi.request.call.v1
Payload must be a map:
- required:
:abi-idnon-empty string|symbol:librarynon-empty string|symbol:symbolnon-empty string|symbol
- optional:
:payloadterm:modestring|symbol
genesis/ffi.request.buffer-pin.v1
Payload must be a map:
- required:
:abi-idnon-empty string|symbol:bytesbytes|string
- optional:
:read-onlybool:lifetimestring|symbol:ownerstring
genesis/ffi.request.buffer-unpin.v1
Payload must be a map:
- required:
:abi-idnon-empty string|symbol:handlenon-empty string|symbol
- optional:
:reasonstring|symbol
FFI Response Schemas
genesis/ffi.response.call.v1
Response must be a map:
- required:
:okbool
- conditional:
- when
:okis true::resultis required - when
:okis false::errormap is required:error/:messagenon-empty string:error/:codestring|symbol (optional)
- when
genesis/ffi.response.buffer-handle.v1
Response must be a map:
- required:
:okbool
- conditional:
- when
:okis true::handlenon-empty string|symbol is required - when
:okis false::errormap is required:error/:messagenon-empty string:error/:codestring|symbol (optional)
- when
genesis/ffi.response.status.v1
Response must be a map:
- required:
:okbool
- conditional:
- when
:okis true::statusstring|symbol is optional - when
:okis false::errormap is required:error/:messagenon-empty string:error/:codestring|symbol (optional)
- when
FFI Safety Model
- Ownership is explicit and handle-based:
- pinned memory is represented as opaque handles returned by host bridge responses.
- raw pointers are never embedded in kernel-visible values.
- Lifetime is explicit:
host/ffi::buffer-pinadmits:lifetimeand:ownermetadata.host/ffi::buffer-unpincloses the handle lifecycle.
- Deterministic mode limits:
- replay does not re-execute host native code,
- the capability runner emits boundary envelopes with
:request-hand:result-h, - policy must bound pin payload size with
max_buffer_bytes.
Prelude Wrappers
core/plugin::typed-commandcore/plugin::typed-editor-commandcore/editor/plugin::typed-host-command
Legacy wrappers (core/plugin::command, core/plugin::editor-command, core/editor/plugin::host-command) remain valid and do not set schema IDs.