Skip to main content

Module plugins

Module plugins 

Source
Expand description

Plugin discovery and manifest types.

Structs§

Binaries
Release-asset filename per platform. Every field is optional; declare only the platforms a plugin ships for. The wire shape is a flat JSON object — absent platforms are omitted, never serialised as null.
Manifest
Declarative metadata a plugin ships with itself. The wire shape is JSON; the on-disk convention (sibling file, embedded resource, --manifest flag, …) is deliberately out of scope of this struct and will be settled in a follow-up.
ManifestWithNameAndSource
A Manifest enriched with the plugin’s identifying name and the source it was loaded from. Used when listing or describing installed plugins, where the bare manifest fields are not enough to identify which plugin they belong to or where they came from.
ViewerRoute
One HTTP route a plugin’s viewer registers on the host viewer’s embedded axum server. The full path served is /plugin/<repository>/<self.path>; on a hit, the body is JSON-decoded and forwarded as a PluginRequest { type: self.type, value: body } event to the frontend.
WhitelistEntry
One whitelist row. Each field is a regex matched anchored against the corresponding install parameter (compiled as ^(?:pattern)$). All four fields must match for the row to allow the install.

Enums§

HttpMethod
HTTP methods supported by ViewerRoute. Serializes as upper-case ("GET", "POST", …) on the wire.
InstallError
Failures the plugin install pipeline can encounter. Shape modelled after objectiveai-api’s github::Error: split request / response / status / parse so diagnostics name what failed, plus IO variants for the local-disk side of the flow.
Platform
A supported runtime target — the cross product of OS and CPU architecture the cli knows how to install plugin binaries for. Serialized as <os>_<arch> (e.g. "linux_x86_64", "windows_aarch64"). Used as the key type in super::Manifest::binaries so a manifest can declare a distinct release-asset filename per platform. The underscore separator (vs the hyphen used by Rust target triples) keeps the names usable directly as identifiers in the cross-language SDK codegen.

Functions§

check_plugin_whitelist
Returns Ok(true) iff the quadruple matches at least one entry in whitelist. Each field is compiled as ^(?:pattern)$ so patterns like Object won’t match ObjectAttacker. Returns Err(regex::Error) if any pattern fails to compile.
default_whitelist
The hard-coded default whitelist. Single entry: any repo under the ObjectiveAI GitHub org passes; everything else requires --insecure.
raw_manifest_url
Convention: the raw-GitHub URL we’d fetch objectiveai.json from for a given (owner, repository, optional commit sha). Defaults to HEAD when no commit is supplied. Lifted out so the cli and the SDK’s own install_plugin wrapper share one source of truth.