Skip to main content

Module abi

Module abi 

Source
Expand description

Wire format exchanged with guest modules (ABI version 1).

§Guest exports

ExportSignaturePurpose
memorymemoryLinear memory used for all buffers.
graphrt_abi_version() -> i32Must return ABI_VERSION.
graphrt_alloc(len: i32) -> i32Allocate len bytes for a host-written buffer.
graphrt_describe() -> i64Packed (ptr << 32) | len of a Manifest JSON.
graphrt_run(ptr: i32, len: i32) -> i64Run one node: reads a RunRequest JSON, returns a packed RunResponse JSON.

§Host imports (module graphrt)

ImportSignaturePurpose
log(level: i32, ptr: i32, len: i32)UTF-8 log line; level 0=trace .. 4=error.
chunk(field_ptr: i32, field_len: i32, ptr: i32, len: i32)Stream text for output field.
progress(name_ptr: i32, name_len: i32, ptr: i32, len: i32)Structured progress, JSON payload.

Guests may import any subset of these; importing anything else fails at load.

Structs§

ErrorData
Error reported by a guest.
Manifest
What a guest module offers.
PauseData
Pause request from a guest.
ResumeData
Resume data handed back to a guest that paused.
RunRequest
Input for one node run.
RunResponse
Guest result. Exactly one of outputs, pause or error is expected; a response with error or pause set is treated as such even if outputs is present.
UsageData
Token usage reported by a guest (e.g. one that proxies a model via the host in future ABIs).

Constants§

ABI_VERSION
ABI version implemented by this host.
HOST_MODULE
Module providing host imports.

Functions§

pack
Pack a pointer and length the way guests return them.
unpack
Split a packed (ptr << 32) | len return value.