Skip to main content

Module plugin_admin

Module plugin_admin 

Source
Expand description

Phase 81.33.b.real Stage 4 — daemon-side plugin admin RPC router.

Plugins declare [plugin.admin] method_prefix = "nexo/admin/<id>/" in their nexo-plugin.toml. The admin dispatcher checks the router for every incoming method; matches forward via broker JSON-RPC to the plugin’s subprocess. Replaces the previous .with_<plugin>_handle(Arc<dyn XxxHandle>) typed builder pattern.

See crate::plugin_http for the sibling HTTP router that shares this design pattern (longest-prefix-first matching + broker-RPC forwarding + reserved-prefix safety net).

Structs§

MatchInfo
Output of PluginAdminRouter::match_method. Owned strings so the caller can drop the router lock immediately and the resulting forward call does not hold the lock across an async broker round-trip.
PluginAdminResponse
Plugin reply shape. Mirrors the dispatcher’s typed AdminRpcResult so the daemon can render the right status without per-plugin parsing.
PluginAdminRouter
Longest-prefix-first matcher with interior mutability so the daemon can construct an empty router at admin-bootstrap time and populate it AFTER wire_plugin_registry returns the plugin handles.

Enums§

AdminRouteRegistrationError
Route registration error. Returned by PluginAdminRouter::register.
PluginAdminForwardError
Typed forwarder errors.

Constants§

RESERVED_ADMIN_PREFIXES
Method prefixes reserved for daemon-internal admin handlers. Plugin registrations colliding with any of these are rejected — the daemon’s agents/credentials/pairing/etc. surfaces cannot be hijacked.

Functions§

forward_request
Forward an admin method invocation to the plugin via broker JSON-RPC. Caller passes pre-parsed JSON params + parses the returned PluginAdminResponse into the typed shape.
method_to_broker_suffix
Translate the trailing portion of an admin method into the broker subject suffix. Replaces / with . so nexo/admin/whatsapp/bot/list with prefix nexo/admin/whatsapp/bot/listbot.list.