Skip to main content

PluginCallbackServiceSync

Trait PluginCallbackServiceSync 

Source
pub trait PluginCallbackServiceSync {
    // Required methods
    fn register(&self, reg: PluginRegistration);
    fn server_request(&self, req: Request) -> Response;
    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§

Source

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.

Source

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).

Source

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.

Implementors§