Skip to main content

Module admin

Module admin 

Source
Expand description

Step 7 of browser-multi-instance — admin RPC handlers.

Pure-fn handlers (one per verb) that operate on instance_registry + filesystem sentinel files. They take a serde_json::Value request payload and return the JSON reply.

Wiring is split:

  • Handlers (this file) — testable in-process, no broker dep.
  • Broker subscriber loop — see auto_discovery.rs + main.rs wire-up (deferred follow-up browser.auto_discovery.subscriber).

Daemon-side admin RPC nexo/admin/browser/<verb> is forwarded via the broker pattern declared in nexo-plugin.toml [plugin.admin] (Step 8).

Functions§

dispatch
Generic dispatch entry point — matches the broker topic suffix to a handler. Unknown verb ⇒ structured error.
launch_visible
nexo/admin/browser/launch_visible — request a non-headless Chrome boot for the instance so the operator can complete a manual pairing flow. Idempotent: shuts the current Chrome down (if any) so the next lazy-boot honours the one-shot headless = false override.
list_instances
nexo/admin/browser/list_instances — enumerate every declared instance with its current paired state.
mark_paired
nexo/admin/browser/mark_paired — touches the .nexo-paired sentinel inside the instance’s user_data_dir so the dashboard auth_check (Stage 6 wizard) flips green. Operator-confirmed signal; replaces fragile Chrome-internal SQLite probing.
restart
nexo/admin/browser/restart — shutdown + register intent to re-boot. The actual Chrome boot is lazy (next tool.invoke), so this verb is effectively shutdown from the runtime’s perspective.
shutdown
nexo/admin/browser/shutdown — shut down the Chrome handle for a specific instance. Idempotent. The registry entry stays so the next tool.invoke lazy-reboots Chrome.