Source

Docs · Plugins

Plugin API 1.0

What the frozen plugin API promises, how version numbers change, and which areas are still experimental.

The plugin API is frozen at 1.0. A plugin written for 1.0 keeps working on every 1.x version of Vaultdraw. This page says what is frozen, how changes are numbered, and what a plugin author does about it.

What 1.0 promises

CoveredWhere it is pinned
Every name, signature and type in @vaultdraw/apisdk/api/etc/api-surface.d.ts, checked by a test
Every plugin.toml key, permission and what a permission allowssdk/api/plugin.schema.json and the manifest reference
App events (vault.opened, drawing.saved and the others) and their payloadsThe same snapshot
Error codes (PluginErrorCode) a call can reject withThe same snapshot
The vaultdraw-plugin commands, options, exit codes and --json outputSDK reference

Not covered:

  • Experimental areas. See below.
  • Wording and layout of toasts, dialogs and the plugin list. Also timing, and the order of events of different kinds.
  • The list of check codes and error codes. A minor release can add one. Keep a default branch in your code.
  • Anything not in the types or the docs. If you reach it another way, you keep it working at your own risk.

Version numbers

Two numbers are in use.

NumberWhere you see itChanges
API levelapi = 1 in plugin.toml, ctx.host.api.levelOnly in a major release
API revisionctx.host.api.revision, the version of @vaultdraw/apiWith every change, by semantic versioning

The revision follows the API, not the app. Several app releases can share one revision.

ChangeExampleMeaning
Patch1.0.1A fix. No type changes.
Minor1.1.0An addition (a member, event, manifest key, permission or error code) or a deprecation. Nothing a 1.0 plugin uses stops working.
Major2.0.0Removals and incompatible changes. Only a major release removes a deprecated name.

Deprecations

A deprecated name keeps working until 2.0. Vaultdraw warns you before then:

  1. The name is tagged @deprecated in the types, with its replacement.
  2. The plugin log shows deprecated: … once per plugin and session. vaultdraw-plugin check warns where it can see the use.
  3. The name works for the rest of the 1.x line.
  4. The next major release removes it, and the API change log says so.

Deprecated today:

DeprecatedUse instead
ToastOptions.actionactions
ctx.manifest.dirAsk the host for the path it gives you
api = 0 in plugin.tomlapi = 1

Saying what your plugin needs

Three keys in plugin.toml tell the app what your plugin needs:

id = "hello-command"
name = "Hello"
version = "0.1.0"
api = 1
min_app = "0.1.0"
min_api = "1.0.0"
main = "main.js"
KeySaysWhat an older app does
api = 1The API level the plugin was written forRefuses the plugin when the level is newer than the app’s
min_api = "1.2.0"The oldest API revision the plugin usesRefuses it and says: “Needs plugin API ≥ 1.2.0”
min_app = "0.4.0"The oldest app version it runs onRefuses it and says: “Needs app ≥ 0.4.0”

Versions compare by semantic version, major number first. 1.0.0 is newer than 0.37.0.

Tip. Ask the app at run time when you can. ctx.host.has("scene.batch") is true when a member exists, so your plugin can fall back. Use min_api only when there is no sensible fallback.

A plugin from a newer API never loads half-way. The plugin list shows it as not compatible, with the reason, and nothing runs.

Experimental areas

These areas are outside the promise. They may change or go in a minor release. The types carry an @experimental tag.

AreaMembersAddedUsed by
Thumbnailsctx.thumbnails1.0The gallery plugin
Graphctx.vault.graph1.0The graph plugin
Tablectx.vault.table1.0The table plugin
Networkctx.net (permission net)1.1The ai-assistant plugin
Secretctx.secret (permission secret)1.1The ai-assistant plugin
Text foldctx.text.fold(text)1.2The graph plugin

Revisions 1.1 and 1.2 are not in a release yet. Check the API change log for the current state.

How the promise is kept

  • A test compares the public declarations with a stored snapshot. A change fails the test until the snapshot is updated.
  • The update needs a new version in sdk/api/package.json. It refuses a removal or a changed signature unless the major version rose.
  • Every version has an entry in the API change log.

SDK docs

The full developer reference is in the source repository, in sdk/docs:

ReadFor
Getting startedYour first plugin in five minutes
ManifestEvery plugin.toml key
PermissionsWhat each permission allows
ReferenceThe API and the vaultdraw-plugin tool
StabilityThe full promise, this page’s source

For the plugins that ship with the app and how to switch them off, see Plugins.