Skip to main content

Module native

Module native 

Source
Expand description

Native plugin backends: in-tree Rust that plays a plugin backend’s part inside byob’s own process, with the same message vocabulary as the JSON-lines wire format (docs/plugins-backend.md).

A manifest names one with "backend": {"native": "<id>"}; the app registers a NativeFactory under that id (byob_agent::Natives::backend). The engine’s backend host (crate::backend::Backend) runs it exactly like a process backend: made on first use, on a thread of its own (so tool calls and view requests never block the engine thread), sent the same init, event, request, cancel and shutdown messages, answering with the same reply, view, notify, notice, log, fault, subscribe, artifact and web messages through an Outbox. A panic is a crash: the host catches it, records a fault, drops the backend’s state and makes a fresh one from the factory (with the process backends’ backoff and crash limit). Reload, switch-off and removal drop it.

serve_stdio runs the same backend as a JSON-lines process instead, so one implementation can be tested (or benchmarked) against a process backend’s harness.

Structs§

Outbox
Where a native backend’s messages go (byob’s side of the wire).

Traits§

NativeBackend
A plugin backend in byob’s process (see the module docs). Calls come one at a time, in order, on the backend’s own thread.

Functions§

dispatch
Hand one message from byob to backend (the wire format’s dispatch, shared by the in-process host and serve_stdio). false after shutdown.
panic_text
A panic’s message.
serve_stdio
Serve backend as a JSON-lines process on stdin/stdout until stdin closes or byob sends shutdown.

Type Aliases§

NativeFactory
Makes a fresh backend (on every start and restart).