Skip to main content

Module plugins

Module plugins 

Source
Expand description

Native plugin surface.

A plugin/extension file is rolldown-bundled to QuickJS bytecode once at startup. Loading + evaluating that bytecode in a session runs its top-level defineTool(...) (and any Given/When/Then) calls, registering directly into the shared Rust ExtensionRegistry. defineTool is the only tool-registration surface — no globalThis.exports, no legacy shapes.

There is no synthesized JS and no globalThis.__*: the plugins.<name> callable is a native Rust closure that restores the handler from the registry, builds { args, page, context, request, commands } with the Object API, applies the handler and returns its promise — the exact mechanism BDD steps use (invoke_step). The commands binding and the allow.net host guard are native Rust (PluginCommandsJs, HttpClientJs::with_net); the allow-list is checked in Rust before any shell/network I/O.

Structs§

PluginBinding
One plugin file handed to the engine at install_plugins time: just its precompiled bytecode. Tool names + capabilities are read from the manifest the module registers, not carried here.
PluginCommandsJs
The commands object a plugin handler receives. Holds this tool’s declared command set (default-deny — a handler cannot reach a name its manifest did not declare, nor another tool’s) plus the session’s durable persistent-process registry.

Functions§

install_plugins
Install loaded plugins: load+evaluate each file’s bytecode (which registers its tools into the shared registry, native or legacy shape), then expose every registered tool as a native plugins.<name> callable.