pub trait PluginCallbackService {
// Required methods
async fn register(&self, reg: PluginRegistration);
async fn server_request(&self, req: Request) -> Response;
async fn output_delta(&self, tool_call_id: String, text: String);
}Expand description
Methods the plugin calls on the server.
The server serves this trait; the plugin holds a generated
PluginCallbackClient over a DuplexClientHalf<_, _, …, PluginCallbackRequest, PluginCallbackResponse> bound to
PLUGIN_CALLBACK_API_ID.
output_delta deserves a note: the existing protocol fires it
one-way (no reply expected) at up to ~200 events/sec during a long
bash command. Myelin’s RPC model is request/response, so we keep it
as a ()-returning RPC and do await it. This costs an extra
response frame per delta but bounds in-flight deltas at the slot
pool size, preserving the protocol’s flow-control properties. A
future myelin streaming feature could collapse this to a true
fire-and-forget notification.
Required Methods§
Sourceasync fn register(&self, reg: PluginRegistration)
async fn register(&self, reg: PluginRegistration)
Plugin registration. Sent once at startup before serving any
PluginCalledByServer methods. The server waits for this call
before considering the plugin ready.
Sourceasync fn server_request(&self, req: Request) -> Response
async fn server_request(&self, req: Request) -> Response
Forward a Request from the plugin to the server’s main
request handler (the same one the TUI/CLI talks to).
Sourceasync fn output_delta(&self, tool_call_id: String, text: String)
async fn output_delta(&self, tool_call_id: String, text: String)
Streaming tool output delta. Plugin → server, fire-then-await.
See trait-level note on the () return.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.