Skip to main content

Crate graphrt_plugin

Crate graphrt_plugin 

Source
Expand description

§graphrt-plugin

Plug-and-play extensions for graphrt. A plugin is a directory with a graphrt-plugin.json (or .yaml) manifest that adds node kinds and tools, implemented by:

  • process: an executable in any language speaking newline-delimited JSON-RPC 2.0 over stdio (started lazily, restarted after crashes);
  • http: a remote service receiving JSON-RPC over POST;
  • wasm (or any custom runtime): a PluginLoader registered on the host.
use graphrt_core::{Registry, tool::ToolRegistry};
use graphrt_plugin::{PluginHost, default_plugin_paths};

let mut host = PluginHost::new();
host.load_dirs(&default_plugin_paths())?;
let mut registry = Registry::with_builtins();
let mut tools = ToolRegistry::new();
host.register(&mut registry, &mut tools)?;

The protocol and manifest format are specified in docs/plugins.md.

Structs§

Connection
A live connection to a plugin.
HttpRuntime
runtime: http settings.
HttpTransport
A plugin served over HTTP.
IoTransport
A transport over an already-connected byte stream, e.g. an in-process plugin or a socket. The connection is initialized on first use.
Limits
Resource limits for plugin requests.
LoadedManifest
A manifest together with the directory it was loaded from.
LoadedPlugin
What a PluginLoader produces for one plugin.
Notification
Notification forwarded from a plugin while a request is in flight.
Permissions
What the plugin may access.
PluginHost
Loads plugins and registers them into a Registry and ToolRegistry.
PluginInfo
Summary of a loaded plugin (for plugin list style output).
PluginManifest
A parsed and validated plugin manifest.
ProcessRuntime
runtime: process settings.
ProcessTransport
Supervises one plugin process.
WasmRuntime
runtime: wasm settings.

Enums§

CallError
Failure of one protocol call.
PluginError
Error loading, installing or registering plugins.
Runtime
How the plugin is executed.

Constants§

DEFAULT_PASS_ENV
Host variables always passed to plugin processes.
MANIFEST_FILES
Manifest file names, in lookup order.
MAX_CONSECUTIVE_TIMEOUTS
Consecutive request timeouts after which a plugin process is considered wedged and is killed; the next request starts a fresh process.
PLUGIN_PATH_ENV
Environment variable listing extra plugin directories.
PROTOCOL_VERSION
Protocol version spoken by this host.

Traits§

PluginLoader
Executes plugins of a custom runtime (e.g. wasm).
Transport
A channel to one plugin.

Functions§

collect_selectors
Every selector referenced by config.
default_install_dir
~/.graphrt/plugins, if a home directory is known.
default_plugin_paths
Default plugin search paths: $GRAPHRT_PLUGIN_PATH entries, then ~/.graphrt/plugins.
discover
Find plugin manifests under paths. A path that is itself a plugin directory is returned directly; otherwise its direct subdirectories are scanned. Missing paths are skipped. Results are sorted for determinism.
install_from_dir
Copy the plugin in src into <dest_root>/<name> (replacing an existing copy) and return the installed manifest.
install_from_git
Clone a git repository (optionally at rev, a branch or tag) and install the plugin it contains. Requires the git executable.
is_valid_name
Valid plugin names: [a-z0-9_-]{1,64}.
manifest_in
The manifest file inside dir, if any.
render_config
Render config against pool. Secrets are masked unless expose_secrets.
sha256_file
Lowercase hex SHA-256 of a file, read in chunks (no whole-file buffer).
verify_checksums
Verify every checksums entry of a manifest.

Type Aliases§

NotifySink
Receives notifications for one in-flight request.