Wraith Browser

Plugins & Scripting

Extend Wraith with WASM plugins and Rhai userscripts

Wraith Browser supports two extension mechanisms: WASM plugins for compiled extensions (requires the wasm feature flag and Wasmtime), and Rhai userscripts for lightweight automation written in a simple scripting language. Both can be loaded at runtime and executed against the current page.

WASM Plugins

ToolDescriptionKey Parameters
plugin_registerRegister a WASM pluginname (required), wasm_path (required), description, domains
plugin_executeExecute a registered WASM pluginname (required), input
plugin_listList all registered WASM plugins(none)
plugin_removeUnregister a WASM pluginname (required)

Rhai Scripts

ToolDescriptionKey Parameters
script_loadLoad a Rhai userscriptname (required), source (required), trigger
script_listList all loaded Rhai userscripts(none)
script_runExecute a loaded script by namename (required)

Examples

Register and run a WASM plugin

{
  "tool": "plugin_register",
  "arguments": {
    "name": "price-tracker",
    "wasm_path": "/home/user/plugins/price-tracker.wasm",
    "description": "Extract and compare product prices",
    "domains": ["amazon.com", "ebay.com"]
  }
}
{
  "tool": "plugin_execute",
  "arguments": {
    "name": "price-tracker",
    "input": { "product_url": "https://amazon.com/dp/B0123" }
  }
}

Plugins run in a sandboxed Wasmtime environment. The domains parameter restricts which sites the plugin can operate on.

Load a Rhai userscript

{
  "tool": "script_load",
  "arguments": {
    "name": "highlight-links",
    "source": "let links = query_all(\"a\"); for link in links { set_style(link, \"border\", \"2px solid red\"); }",
    "trigger": "always"
  }
}

The trigger parameter controls when the script runs:

  • "always" -- runs on every page navigation
  • "manual" -- runs only when you call script_run
  • A URL substring (e.g., "github.com") -- runs automatically when navigating to matching pages

On this page