Extensions / plugin API v2

Programs Heresia hosts.
Not code it trusts.

An extension is a folder with a manifest and a WebAssembly module. It does its own work in its own process; Heresia hosts it, draws what it declares, and checks every call against what you granted.

Development contracts. The manifest schema, the module ABI, the service routes and the local control channel are separate interfaces, and they are not a stable external SDK yet. There is no extension store, and Heresia bundles no extension: it starts complete without any.

What an extension can add

Extensions describe pages, tabs, cards, buttons and statuses as data in their manifest, in the same toolkit-neutral items whatever the way they run. The window draws them with its own controls and checks every placement and action against the package you approved. Nothing an extension adds is named in the application itself.

Placements
PlacementWhere it appearsGrant
workspaceA tab in the main navigation, and only after you switch that page on in Settings.workspace
side-panelA panel at either edge of any view.side-panel
device-cardA selectable card, with its details, in Performance.device-card
process-columnA column of the process table.process-column
process-menuEntries in a process's context menu; the action receives that process.process-menu
inspector-tabA tab in the process inspector, following the selection.inspector-tab
statusA segment of the status strip, optionally for chosen views only.status
settings-sectionThe extension's own section in Settings → Plugins.settings-section

With hosted-page and canvas a workspace page can also receive local input and viewport events and replace a bounded canvas of rectangles, lines and circles, without any code being loaded into the window. A canvas must be declared in the manifest; consent to a plain page does not authorize a canvas added later. With app-control an extension can replace or hide host elements such as the Devices panel, a process column or a whole view, move panels between views and edges, and run host commands.

Permissions, in the host's words

These are the labels and prompts Heresia itself writes. A package cannot substitute its own permission text. Declarations grant nothing: installing, approving the exact package bytes, granting permissions and enabling are separate steps, and a workspace page also needs its own switch in Settings. Grants limit what the host does for an extension; they do not limit operating-system rights.

Host services

Everything an extension cannot do for itself it asks the host for, through a reserved provider named heresia. They are the same four generic services for every extension: an extension that needs HTTPS, executable hashing, private storage or timers uses them like any other, and the application has no code specific to one extension. Each call needs an exact import in the manifest and only the grants listed for that method.

Host methods: provider heresia, version 1
RouteGrants neededWhat it does
http.requestnetworkHTTPS GET, POST or PUT to an origin the manifest declares. A file upload also needs executable-read and a one-use confirmation.
files.sha256process-data executable-readThe SHA-256 and size of the executable of a process the extension was given; never its bytes.
storage.getstorageRead a JSON value and its revision from the extension's own namespace.
storage.putstorageWrite a value, optionally only if the revision still matches (compare and set).
storage.deletestorageDelete a key, optionally only at an expected revision.
storage.liststorageList the extension's own keys.
time.nownoneThe host's wall-clock time in milliseconds.
time.sleepnoneA timer: a reply after 1 ms to 1 hour.

Isolation

How an extension is kept apart from the application A WebAssembly extension runs inside its own worker process with a bounded interpreter. Its messages cross a gate where Heresia checks them against the permissions you granted. Heresia then draws what was admitted in its window, or performs a host service on the extension's behalf. WORKER PROCESS · ITS OWN Your extension A WebAssembly module receive and send only. No WASI. Bounded interpreter 8 MiB module · 64 MiB memory fuel and stack limits GATE grants checked on every call HERESIA · THE APPLICATION Supervisor and grants your saved choices, not the manifest The window draws what was admitted; never loads guest code HOST SERVICES http files storage time origins, quotas, deadlines How an extension is kept apart from the application A WebAssembly extension runs inside its own worker process with a bounded interpreter. Its messages cross a gate where Heresia checks them against the permissions you granted. Heresia then draws what was admitted in its window, or performs a host service on the extension's behalf. WORKER PROCESS · ITS OWN Your extension WebAssembly. receive and send only. No WASI. Bounded interpreter: 8 MiB module, 64 MiB memory, fuel and stack limits GATE grants checked on every call HERESIA · THE APPLICATION Supervisor and grants your saved choices, not the manifest The window draws what was admitted; loads no guest code HOST SERVICES http · files · storage · time origins, quotas and deadlines are enforced

Install, review, enable

  1. Install: read it, then hold

    In Settings → Plugins choose Install plugin and select the package folder or its heresia-plugin.toml. Read the outside-store notice to the end and hold Hold to agree for 2.5 seconds, then review the license and the notice and choose Accept TOS. Nothing is granted and nothing starts.

    Settings, Plugins: an install notice for a package outside the store, step 1 of 3, with Cancel and a Hold to agree button.
    Installing an extension from outside a store starts with a notice and a deliberate hold. It grants nothing and starts nothing. Capture with the project's Test extension.
  2. Review the permissions

    In Settings → Permissions expand the extension to see what it asks for and which service routes it declares. Save permissions stores exactly your choices (an empty set is valid) and does not start the extension.

    Settings, Permissions: Permissions for Test, 15 requested, not approved, with a switch and a host-written description for each permission.
    Permissions are worded by Heresia, not by the extension, and saving them does not start it.
  3. Enable it

    In Settings → Plugins, Enable starts the approved package. Disable stops it without forgetting your approval; Uninstall stops it, archives the package and removes its private storage. Each page an extension offers appears only after its own switch is on, and neither the extension nor the command line can turn it on.

    Settings, Plugins: the Test extension listed as WebAssembly and user-installed with no worker running, with Enable, Manifest, Uninstall and Review permissions buttons and a switch for each page it offers.
    Installed does not mean allowed: the extension waits for its permissions to be reviewed, and every page it offers has its own switch, off by default.

The same steps exist on the command line, with the same review:

Command line
heresia plugin-install ./my-extension     # preview: id, digest, license, notice, warning
heresia plugin-install ./my-extension --accept DIGEST --accept-outside-store-risk
heresia plugins                           # installed: requested permissions, saved grants
heresia approve-plugin ID --program DIGEST
heresia grant ID --allow storage          # replaces the grant set; none given revokes all
heresia enable-plugin ID

Build one

Rust guests depend only on heresia-api, the contract crate, which has no host dependencies. Copy the template into plugins/<id>/, set the ID in heresia-plugin.toml and the package name in Cargo.toml, then stage it. Extensions are separate programs: the application build neither includes nor builds them. They need the wasm32-unknown-unknown Rust target.

Stage a package
rustup target add wasm32-unknown-unknown
cp -r templates/hello-guest plugins/my-extension
python3 scripts/package-plugin.py plugins/my-extension

A package is a folder named for the manifest ID with the manifest, the module, and a LICENSE and a NOTICE (non-blank UTF-8 files of at most 48 KiB each). The shape of a manifest, assembled from the manifest reference and not a tested package:

heresia-plugin.toml · shape only
api_version = 2
id = "example.guest"
name = "Example"
version = "0.1.0"
capabilities = ["storage"]

[[imports]]
provider = "heresia"
service = "storage"
version = 1
methods = ["get", "put", "delete", "list"]

[service]
kind = "wasm"
abi = 1
file = "example.wasm"

An ordinary extension, as an example

The project's own example of a real extension is a VirusTotal lookup. It is installed separately like any other and adds a reputation column, a process-menu entry and an inspector tab. It asks the host for an executable's SHA-256 and sends HTTPS only to its declared VirusTotal origins, and the host attaches the API key from the credential store, so the extension never receives the key or the file bytes. Automatic column lookups are off by default and share a daily budget with manual ones. An upload needs a separate confirmation for that process, is single-use and expires after two minutes, and a missing report is never shown as clean. Heresia has no code specific to it.

VirusTotal is a service of its owner, mentioned here as an example; it implies no endorsement of Heresia by it and none of it by Heresia.

Limits worth knowing