|
NeoGraph 0.16.0
A C++20 Graph Agent Engine Library — LangGraph for C++
|
Stable C v1 contract for externally implemented Program host bindings. More...
#include <stddef.h>#include <stdint.h>Go to the source code of this file.
Classes | |
| struct | neograph_program_native_binding_v1 |
| Versioned plugin binding supplied to the C++ Program registration surface. More... | |
| struct | neograph_program_native_byte_span_v1 |
| Borrowed, non-owning bytes. More... | |
| struct | neograph_program_native_cancellation_v1 |
| A borrowed cancellation view. More... | |
| struct | neograph_program_native_invoke_request_v1 |
| Immutable invocation input. More... | |
| struct | neograph_program_native_owned_bytes_v1 |
| Plugin-owned bytes returned through a completion callback. More... | |
| struct | neograph_program_native_result_v1 |
| One terminal completion. More... | |
Typedefs | |
| typedef struct neograph_program_native_binding_v1 | neograph_program_native_binding_v1 |
| Versioned plugin binding supplied to the C++ Program registration surface. | |
| typedef struct neograph_program_native_byte_span_v1 | neograph_program_native_byte_span_v1 |
| Borrowed, non-owning bytes. | |
| typedef void(* | neograph_program_native_cancel_v1) (void *userdata, uint64_t invocation_id) |
| Requests cancellation of one accepted invocation; it never frees userdata. | |
| typedef struct neograph_program_native_cancellation_v1 | neograph_program_native_cancellation_v1 |
| A borrowed cancellation view. | |
| typedef void(* | neograph_program_native_destroy_v1) (void *userdata) |
| Releases plugin-owned userdata exactly once after the binding and every accepted invocation have quiesced. | |
| typedef struct neograph_program_native_invoke_request_v1 | neograph_program_native_invoke_request_v1 |
| Immutable invocation input. | |
| typedef int32_t(* | neograph_program_native_invoke_v1) (void *userdata, const neograph_program_native_invoke_request_v1 *request, neograph_program_native_completion_v1 completion, void *completion_userdata) |
| Starts one invocation. | |
| typedef struct neograph_program_native_owned_bytes_v1 | neograph_program_native_owned_bytes_v1 |
| Plugin-owned bytes returned through a completion callback. | |
| typedef void(* | neograph_program_native_release_v1) (void *userdata, const uint8_t *data, size_t size) |
| Releases one output allocation. | |
| typedef struct neograph_program_native_result_v1 | neograph_program_native_result_v1 |
| One terminal completion. | |
Stable C v1 contract for externally implemented Program host bindings.
This header deliberately contains C layouts only. A plugin owns the userdata it gives to a binding and must not throw across any callback. Inputs are borrowed for the duration of invoke; a completion owns its result bytes until the host has copied them and called the supplied release hook exactly once. struct_size is the number of bytes the producer allocated for that versioned value. A consumer must reject a value whose size does not cover every field it reads, and must ignore fields beyond the known v1 prefix so a later ABI can append fields safely.
The v1 layouts are the 64-bit ones. A wasm32 build does not load plugins: NativeControlBinding::create refuses (see program/native.h).
Definition in file native_abi.h.
Borrowed, non-owning bytes.
data may be null only when size is zero.
| typedef void(* neograph_program_native_cancel_v1) (void *userdata, uint64_t invocation_id) |
Requests cancellation of one accepted invocation; it never frees userdata.
The callback may race completion and must be safe to call from any host thread that owns the invocation handle.
Definition at line 122 of file native_abi.h.
A borrowed cancellation view.
It remains valid only until the matching completion callback returns. Plugins may poll it from their own worker threads, but must synchronize those workers before returning completion and must not retain or call the view after completion.
| typedef void(* neograph_program_native_destroy_v1) (void *userdata) |
Releases plugin-owned userdata exactly once after the binding and every accepted invocation have quiesced.
A plugin must not invoke any completion after this callback. The callback may run on the thread which releases the final host-owned handle and must therefore be thread-safe with invoke, cancel, and release callbacks.
Definition at line 131 of file native_abi.h.
Immutable invocation input.
input_json is canonical JSON UTF-8.
| typedef int32_t(* neograph_program_native_invoke_v1) (void *userdata, const neograph_program_native_invoke_request_v1 *request, neograph_program_native_completion_v1 completion, void *completion_userdata) |
Starts one invocation.
The callback runs on the caller's thread and may complete synchronously. Return ACCEPTED only if the plugin will invoke the completion callback exactly once, possibly on another thread. Return REJECTED if it will not invoke completion. Cancellation may race completion; the first terminal completion wins and the host invokes cancel at most once for an invocation id. Neither path may throw across the ABI.
Definition at line 111 of file native_abi.h.
Plugin-owned bytes returned through a completion callback.
An empty payload is {NULL, 0, NULL, NULL} and has no allocation to release. A non-empty payload must have a non-null data pointer and release callback; a zero-size payload with any other field populated is malformed.
| typedef void(* neograph_program_native_release_v1) (void *userdata, const uint8_t *data, size_t size) |
Releases one output allocation.
The host calls this at most once, after it has copied the bytes, on the thread executing the completion callback. The allocation and release callback must come from the same allocator domain; neither side may apply a second allocator or free the bytes itself. The callback must not call NeoGraph or throw.
Definition at line 48 of file native_abi.h.
One terminal completion.
Successful payloads are canonical JSON values. Failure and cancellation payloads, when present, are canonical diagnostic values. The entire result is borrowed only for the completion call.