The new package packages/plugin-sdk (@runestone/plugin-sdk) is the one source of the public plugin types. It contains PluginApi and its members, the manifest type, API_VERSION, and feature checks (hasFeature, requireFeature, requireFeatures, missingFeatures). It also contains the action icons and the tooltip helper as DOM functions, because RuneStone has no API for them. Menus stay host-drawn through api.ui.showActionMenu, so the SDK contains only the menu types. The SDK uses the Apache License 2.0. The host imports the SDK with relative paths in src/lib/plugins/sdk.ts, src/lib/ui/actionIcons.ts, and src/lib/ui/tooltip.ts. The completion, Git, background, and contribution contract files export the SDK types. The menu files keep their types, because the Terminal plugin keeps copies of them. A unit test makes sure that those types and the SDK types are the same. The menu inventory now scans the SDK source. pnpm sdk:build compiles the SDK to dist/. pnpm release:sdk --version <v> builds it, then commits and tags v<v> in a local clone of the public repository. It never pushes, and it prints the push commands. It stops before a change in these conditions: - The clone is missing, has changes, or is not on a branch. - The tag exists, or the version is not greater than the current version. - The package has no LICENSE file, or the SDK source has changes that are not committed. A failed attempt restores the version and the clone. pnpm check type checks the SDK and the example plugin. The example plugin now has JSDoc types from the SDK. pnpm test covers the feature checks, the host and SDK parity, and the release script with temporary Git repositories. The plugin development, release, development, and completion guides describe the SDK.
34 KiB
Plugin development reference
Development · Install and manage plugins · Plugin host internals
This reference gives the package contract, the build procedure, and the API for RuneStone plugin authors.
- Install the SDK
- Package contract
- Build and package a plugin
- Build examples
- Versions and releases
- Plugin API
- Use the SDK instead of native calls
- Terminal API
- Folder grants
- Plugin services
- Git API
- Background API
Install the SDK
The plugin SDK @runestone/plugin-sdk gives the API types, the feature checks, and the RuneStone icons and tooltip.
Install it in each plugin project from a release tag of its public repository. The SDK is not on the npm registry.
pnpm add -D "git+https://git.knottywyvern.com/kwyvern/RuneStone_Plugin_SDK.git#v0.1.0"
- The repository is public. The installation needs no access token and no
.npmrcfile. - Always give a tag. To change the SDK version, change the tag in
package.json. - Bundle the SDK helpers into the entry module. A type-only import adds no code.
- Do not copy RuneStone source files into a plugin, and do not import them from a RuneStone checkout. Use the SDK types and the host APIs.
| SDK import | Contents |
|---|---|
@runestone/plugin-sdk |
PluginApi and its members, PluginManifest, API_VERSION, and the feature checks |
@runestone/plugin-sdk/icons |
actionIcons and actionIcon(name). See Commands. |
@runestone/plugin-sdk/tooltip |
attachTooltip(element, label), the tooltip of RuneStone controls |
For menus, use api.ui.showActionMenu. See Menus.
The SDK source is packages/plugin-sdk/ in this repository. For its versions and releases, see SDK releases.
The SDK README has a minimal plugin in TypeScript.
Example: fixtures/plugins/workspace-overview/main.js uses JSDoc types from the SDK and needs no compile step. pnpm check checks it with fixtures/plugins/tsconfig.json.
Package contract
A plugin is one standard .zip file with plugin.json at the archive root.
All plugins use the same package format and the same install, enable, disable, and removal lifecycle.
The manifest type is PluginManifest in the SDK.
{
"schemaVersion": 1,
"id": "org.example.hello",
"name": "Hello",
"author": "Example author",
"description": "Open a small example view.",
"version": "1.0.0",
"apiVersion": 1,
"entry": "main.js",
"access": "full-app"
}
| Field | Rule |
|---|---|
schemaVersion |
Must be 1. |
id |
Lowercase letters, digits, dots, and hyphens. Starts with a letter. At most 120 characters. Cannot end with a dot. |
name, author, description |
Required text, at most 1,000 bytes each. |
version |
Three numeric parts with an optional lowercase letter suffix, such as 1.0.0 or 0.2.28a. |
apiVersion |
Must be 1. |
entry |
Path of a compiled .js or .mjs module in the package. |
access |
Must be "full-app". |
The host rejects any other manifest field.
The runestone.* ID prefix follows the same rules as other IDs. An ID does not prove the identity of the publisher.
Paths and limits
Package paths use ASCII letters, digits, dots, underscores, and hyphens, with / between folders.
Each path segment has at most 120 characters, and the full path has at most 180 characters.
The host rejects Windows device names, . and .. segments, and segments that end with a dot.
It also rejects absolute paths, links, junctions, and paths that differ only in letter case.
| Limit | Value |
|---|---|
| Entries in the package | 5,000 |
| Expanded data | 100 MiB |
| One file | 25 MiB |
| Compressed ZIP | 100 MiB |
plugin.json |
64 KiB |
| Installed path (application data folder, plugin ID, and package path) | 240 characters |
Entry module
The entry is one compiled JavaScript module. Bundle all dependencies into it.
The host loads the module from a Blob URL, so relative imports do not resolve. Read packaged files with api.assets.read.
The host does not accept raw TypeScript, Svelte source, native libraries, dependencies on other plugins, or automatic updates.
Package files
org.example.hello-1.0.0.zip
plugin.json
main.js
assets/
README.md
LICENSE
The manifest and the entry module are required. Assets, a README, and a license are optional. In the README, give the RuneStone version that the plugin needs, its purpose, the install steps, and a help contact. Keep JavaScript readable. Do not minify or obfuscate code in a way that makes inspection difficult.
Build and package a plugin
Use this procedure for every plugin. Each plugin project defines its own compile step.
- Compile the plugin into a clean folder that contains
plugin.json, the entry module, and the assets that it needs. - From the RuneStone repository, run
pnpm package:plugin <compiled-folder> [output-folder]. - Install the ZIP in RuneStone through Settings → Plug-ins.
- Test the plugin features, then test Disable and Uninstall.
From another repository, run node <RuneStone>/scripts/packagePlugin.mjs <compiled-folder> [output-folder].
The packager needs Node.js 24 or later.
The packager (scripts/packagePlugin.mjs) does these steps:
- It applies the package contract checks to the manifest, paths, entry module, and limits.
- It adds every file in the compiled folder. Keep dependencies, credentials, and unrelated build files out of that folder.
- It writes
<id>-<version>.zip. Without an output folder, it usesreleases/in the nearest parent folder that contains apackage.jsonfile. - It stops when the output folder is inside the compiled folder.
- It writes the same bytes for the same input. It uses sorted paths, fixed timestamps, and DEFLATE compression.
- It keeps an existing ZIP with identical contents. It stops when an existing ZIP has different contents. It never overwrites a ZIP.
Keep each completed plugin ZIP in the releases/ folder of its own plugin project, also when the RuneStone repository starts the build.
Use an explicit output folder only for checks and staging.
Other build tools can make the same ZIP layout. Do not put a parent folder above plugin.json.
The native installer applies the package checks again before installation.
In user instructions, do not tell users to load JSON, select a build folder, rename a release file, or install dependencies.
Build examples
Each example is specific to one plugin. Read the package scripts of a plugin before you build it. For the RuneStone source setup, see Run from source.
Example: Terminal
Source: Terminal repository, its package.json, and its scripts/build.mjs.
| Item | Value |
|---|---|
| Prerequisites | Node.js 24 and pnpm 10. Run pnpm install --frozen-lockfile in the Terminal folder. |
| Working folder | The Terminal repository root |
| Command | pnpm build |
| Output | releases/runestone.terminal-<version>.zip in the Terminal folder |
The build compiles the Svelte interface and its dependencies into dist/ (main.js, style.css, plugin.json, and README.md). Then it makes the ZIP.
The build stops when the versions in package.json and plugin.json are different.
To compile into dist/ without a ZIP, run node scripts/build.mjs --no-package.
RuneStone supplies the native terminal sessions. The plugin supplies the interface, shortcuts, and session controls.
For use of the terminal, see the Terminal guide.
Example: Workspace overview
Source: fixtures/plugins/workspace-overview/ in this repository. It contains plugin.json and a main.js that needs no compile step.
| Item | Value |
|---|---|
| Prerequisites | Node.js 24 and the RuneStone source setup |
| Working folder | The RuneStone repository root |
| Command | pnpm package:plugin fixtures/plugins/workspace-overview <output-folder> |
| Output | <output-folder>/org.runestone-example.workspace-overview-1.0.0.zip |
Use an output folder outside the repository. Without one, the ZIP goes into the RuneStone releases/ folder, which is for installers.
After you install and enable the ZIP, open Plug-in views → Workspace overview, or run Commands → Show workspace overview.
Versions and releases
For version numbers and hotfix suffixes, see Versions. To publish a plugin ZIP, see Publish a plugin release. For the release format that Gitea-link installation accepts, see Gitea downloads.
Plugin API
The entry module exports activate(api). Activation can return a cleanup function, or a promise for one.
export function activate(api) {
api.registerView({
id: "hello",
title: "Hello",
mount(container) {
const text = document.createElement("p");
text.textContent = "Hello from a RuneStone plugin.";
container.append(text);
return () => text.remove();
}
});
api.registerCommand({
id: "show-hello",
title: "Show hello",
run: () => api.openView("hello")
});
}
Compatibility
Members marked optional can be absent on older RuneStone hosts. Before you call an optional member, make sure that it exists. If the plugin cannot work without it, show an error that tells the user to update RuneStone. The SDK feature checks do this. Their error names each missing feature and tells the user to update RuneStone.
import { hasFeature, requireFeature, requireFeatures } from "@runestone/plugin-sdk";
requireFeatures(api, ["pty", "workspace.readBytes"]);
const pty = requireFeature(api, "pty");
if (hasFeature(api, "settings.subscribe")) watchSettings();
Without the SDK, examine the member directly: if (!api.workspace.readBytes) throw new Error("Update RuneStone to use this plugin.");
Older hosts ignore unknown fields in objects that you pass to the host, such as a view icon or launch handler.
Activation and cleanup
- The host limits activation, each view mount, and each cleanup callback to five seconds. A timeout reports an error. After a cleanup timeout or failure, the user cannot enable or remove the plugin until RuneStone restarts.
- Plugins activate in every RuneStone window except browser windows.
api.signalaborts when shutdown starts. Use it to stop pending work.- After shutdown starts, every API call throws an error. Ignore results that arrive after shutdown.
- On disable, the host removes contributions, commands, views, and background frames first. Then it runs view cleanups and
onDisposecallbacks in reverse order. - Remove timers, listeners, and other resources in cleanup. Closing a view and disabling the plugin share the same cleanup promise.
- Plugins have full application access. The SDK does not isolate plugin JavaScript.
API reference
| Member | Optional | Contract |
|---|---|---|
api.id |
The installed plugin ID. | |
api.signal |
An AbortSignal that aborts when shutdown starts. |
|
onDispose(callback) |
Register synchronous or asynchronous cleanup. | |
contribute(key, value) |
Register a host feature. See Contributions. | |
registerCommand(command) |
Add a command. See Commands. | |
registerView(view) |
Add a view. See Views. | |
openView(id, options?) |
Open a view of this plugin. options is { split: "right" | "down", relativeTo }, where relativeTo is the ID of an open editor view of the same plugin. |
|
closeView(id) |
yes | Close the editor tabs of a view of this plugin. |
replaceView(currentId, nextId) |
yes | Show another editor view in the current tab. The tab keeps its position and pin state. |
replaceDocumentWithView(document, nextId) |
yes | Show an editor view in place of a document tab of this plugin. |
updateViewTitle(id, title) |
yes | Change a view title. At most 200 characters. |
updateViewIcon(id, image) |
yes | Set a tab icon from a base64 data:image/... URL (PNG, JPEG, GIF, WebP, ICO, or SVG) of at most 90,000 characters. null removes it. |
registerTabDrop(receive) |
yes | Accept a plugin tab that the user drags from another window. One receiver for each plugin. |
registerDocumentType(type) |
Recognize workspace files and open them in a plugin editor. See Document types. | |
openDocument(path) |
Open a recognized document in its own tab. Rejects when no enabled plugin recognizes the file. | |
openFile(path) |
yes | Open a workspace file in the normal RuneStone editor. |
renameDocument(document, name) |
yes | Rename a recognized document. Returns the new workspace path. |
workspace.* |
Read and write files in the active workspace. See Workspace files. | |
settings.read() |
Read the saved JSON settings of the plugin. Returns null before the first write. |
|
settings.write(value) |
Save JSON settings, at most 1 MiB. | |
settings.subscribe(listener) |
yes | Receive a call when the saved settings change in any window. Returns a cleanup function. |
assets.read(path) |
Read a package file as a Uint8Array. |
|
ui.showActionMenu(options) |
yes | Open the shared RuneStone action menu. See Menus. |
completion |
yes | Autocomplete fields and providers. See the completion API. |
git |
yes | Git operations for the active workspace. See Git API. |
pty |
yes | Terminal sessions. See Terminal API. |
files |
yes | Folders outside the workspace that the user granted to the plugin. See Folder grants. |
services |
yes | Data that one plugin offers to other plugins. See Plugin services. |
backgrounds |
yes | Background image frames. See Background API. |
Commands
api.registerCommand({ id: "next", title: "Next image", icon: "skip-forward", run: () => next() });
| Field | Rule |
|---|---|
id |
Lowercase letters, digits, dots, and hyphens. Starts with a letter. Unique among the commands of the plugin. |
title |
Required text. |
run |
Required function. Can return a promise. |
category |
"action" (default) adds the command to the Commands menu. "open" adds it to the Plug-in views menu. |
icon |
Optional. An ActionIcon name from the SDK, such as play, pause, skip-forward, or refresh, or a view icon name. |
Give each command a recognizable icon.
Views
| Field | Rule |
|---|---|
id, title |
Same rules as for commands. View IDs are unique among the views of the plugin. |
mount(container, context?) |
Required. Draws the view and can return a cleanup function or a promise. context.surface is "view" or "settings". |
placement |
"dialog" (default), "editor" for a tab in the editor area, or "sidebar" for the left pane. |
navigation |
true adds an icon button. See Navigation buttons. |
icon |
list, kanban, puzzle (default), globe, or git. |
settings |
true makes the view a configuration page in Settings. See Settings pages. |
launcher |
false keeps the view out of the Plug-in views menu. Use it for dynamic views that already have tabs. |
launch() |
Optional. Runs instead of openView when the user opens the view from a menu or a navigation button. |
pinned |
Initial pin state of an editor tab. |
tabActions({ pinned }) |
Returns extra ActionMenuItem entries for the tab menu. |
find() |
Runs when the user starts Find in this tab. |
tabDragData({ pinned }) |
Returns a string that moves with the tab to another window. The receiver is registerTabDrop. |
saveTabState() / restoreTabState(state) |
Save and restore view state when an editor tab moves to another window. |
toolbar |
Accepted. In the current host, it only removes the view from the ribbon. |
Dialog views open in a modal window. Editor views open as tabs beside documents. Document tabs keep their buffers when the user changes views. Closing an editor tab or disabling the plugin disposes the view.
A launch() handler can select a default target and call api.openView(id).
Explicit api.openView calls and restored tabs do not call launch().
Example: Project Management uses launch() to open the default board of the workspace.
Navigation buttons
- A view with
navigation: trueandplacement: "sidebar"gets a button beside Files, Search, and Bookmarks at the top of the left pane. It opens in the left pane, and the Plug-in views menu does not show it. - A view with
navigation: trueand another placement gets a button in the ribbon at the left edge of the window. The Plug-in views menu also shows it, unlesslauncherisfalse. - Each button shows the view title as a tooltip on hover and keyboard focus.
Settings pages
Register a view with settings: true to add a configuration page under the plugin name in Settings.
The host mounts that view in the Settings window with context.surface set to "settings". The view does not appear in the Plug-in views menu.
The Settings window loads enabled plugins, so the page is available there.
To react to a change from another window, call settings.subscribe(listener). Then read the new value with settings.read().
The notification contains no data. Ignore reads that finish after shutdown, and do not let an older read replace newer settings.
RuneStone translates only its own interface. It does not translate plugin text or supply a translation API.
Menus
ui.showActionMenu({ x, y, items, label?, parent? }) opens the shared action menu at a screen position. It returns { close() }.
Each item is { label, icon?, shortcut?, run?, children?, disabled?, checked?, radio?, title? } or { separator: true }. The SDK types are ActionMenuItem and ActionMenuOptions.
The menu closes on selection, outside click, resize, window blur, scroll, and plugin shutdown.
Use this menu instead of a custom menu. See the interface design reference.
Document types
A document type lets a plugin open some workspace files in its own editor.
| Field | Rule |
|---|---|
id, title |
Same rules as for views. Unique among the document types of the plugin. |
extensions |
Required list of lowercase extensions without the dot, such as ["md"]. |
identify(path, source) |
Returns { id } with a stable document ID, or null. |
mount(container, { id, path }) |
Draws the editor. Can return a cleanup function. |
icon |
"file" (default) or "kanban". The file tree shows it. |
content |
"text" (default) or "binary". |
create |
Optional { label, defaultName, extension, contents() }. extension must be in extensions. contents() returns the complete file text. |
- Files that
identifyrejects, or that cause an error, stay available in the text editor. - Each document opens in its own tab. A second open of the same document selects its tab.
- Closing a tab disposes only that mount. Disabling the plugin disposes all its mounts and removes its file tree icons.
- Creation never replaces an existing file.
- For binary types,
identifyreceives an emptysource. Identify the file from its path, then read bytes inmountwithworkspace.readBytes. Show errors about invalid data in the view.
renameDocument({ id, path }, name) renames a document that this plugin recognizes.
The host checks the document ID and the owner. It keeps the folder and the extension, rejects name conflicts, and updates open tabs.
Names can contain dots. Hidden names and reserved filename characters are invalid.
Workspace files
All paths are relative to the active workspace of the window. The host rejects paths outside the workspace.
| Member | Optional | Contract |
|---|---|---|
list(path?) |
List one folder. Returns { name, rel_path, kind } entries, where kind is "file" or "folder". |
|
listMarkdown() |
yes | Return all .md, .markdown, and .mdown paths in sorted order, in one request. Skips names that start with a dot, and links. |
read(path) |
Read a UTF-8 text file. | |
readOptional(path) |
yes | Read a text file, or return null when the file does not exist. |
readMany(paths) |
yes | Read at most 64 text files with a total of at most 16 MiB. Returns { path, source } or { path, error } for each path. |
readBytes(path) |
yes | Read a file of at most 64 MiB as a Uint8Array. |
create(path, contents) |
yes | Create a text file. Fails when the file exists. |
write(path, contents, expected) |
Save the file only if it still contains expected. expected is required. |
|
subscribe(listener) |
yes | Receive a call when a plugin or the host changes workspace files. Returns a cleanup function. |
In readMany, one failed file does not stop the other reads. More than 64 paths make the whole call fail.
write and renameDocument fail when the file is open in RuneStone with unsaved edits.
Contributions
contribute(key, value) registers a host feature. The SDK type is Contributions.
Only one enabled plugin can own each key. The host removes contributions before cleanup starts.
| Key | Purpose | Owner |
|---|---|---|
terminal |
Mounts terminal controls in a host element. Returns update, command, and dispose functions. | Terminal plugin |
git |
Supplies line blame for the editor. | Git plugin |
browser |
The built-in browser. | RuneStone |
A terminal contribution must stop its controls and native sessions before its cleanup finishes.
Use the SDK instead of native calls
Do not call invoke, listen, or other @tauri-apps/api functions from a plugin. Do not read the private files of other plugins.
Use the api members below. They check plugin shutdown, and they will stay available when a later host runs each plugin in its own isolated context.
Make sure that an optional member exists before you use it. Keep the native call only as a fallback for older hosts.
The host still accepts the native calls of released plugins. A later host can remove them.
| Plugin | Current call | Purpose | Use instead |
|---|---|---|---|
| Terminal | invoke("pty_open"), listen("pty-data"), listen("pty-exit") |
Start a shell and receive its output and exit code | api.pty.open({ ..., onData, onExit }) |
| Terminal | invoke("pty_write"), invoke("pty_resize"), invoke("pty_close") |
Send input, change the size, stop the shell | write, resize, and close of the session from api.pty.open |
| Terminal | invoke("pty_profiles") |
List the installed shells | api.pty.profiles() |
| Terminal | invoke("pty_new_window") |
Open a terminal window | api.pty.openWindow() |
| Terminal | invoke("pty_dictation") |
Start Windows voice typing | api.pty.dictation() |
| Terminal | invoke("workspace_read", { rel: ".runestone/tasks.json" }) |
Read the task list of the workspace | api.workspace.read(path) |
| Background Slideshow | api.backgrounds.chooseFolder, list, read, defaultFolder, readImageSettings, writeImageSettings |
Read images and per-image settings from a folder outside the workspace | api.files with a folder grant |
| Background Slideshow | api.workspace.readOptional(".runestone/pm/workspace.json") |
Read the board names of Project Management | A service of Project Management through api.services |
The Git, Project Management, Local Autocomplete, PDF Viewer, and CSV Viewer plugins make no native calls.
Their test scripts replace window.__TAURI_INTERNALS__ with a test double. That is test code and does not go into the package.
Terminal API
api.pty (version: 1) starts shells in pseudo terminals. The SDK types are PtyApi and PtySession.
| Member | Contract |
|---|---|
profiles() |
Returns the installed shells as { id, title, kind }. |
open(options) |
Starts a shell and returns a session. See the options below. |
openWindow() |
Opens a terminal window for the workspace of the current window. |
dictation() |
Starts Windows voice typing. Focus the terminal first. Fails on other systems. |
| Option | Rule |
|---|---|
cwd |
Required. The workspace root of the window. The start fails when the workspace changed. |
cols, rows |
Required. Positive integers. |
profile |
A profile id from profiles(). Without it, the host uses the first installed shell. |
directory |
A start folder other than the workspace root. |
onData(data) |
Required. Receives the output as a Uint8Array. A UTF-8 character can be split between two calls. |
onExit(code) |
Receives the exit code, or null. |
A session has id, write(text), resize(cols, rows), and close(). close() stops the shell, and more calls return the same promise.
Output goes only to the session that started the shell, as raw bytes.
When the plugin stops, the host stops the output, runs the plugin cleanup, and then closes the sessions that are still open.
Folder grants
api.files (version: 1) gives access to folders outside the workspace. The user selects each folder. The plugin cannot supply a path.
A grant is { id, path, name }. id is opaque. path and name are for display only.
| Member | Contract |
|---|---|
chooseFolder({ title? }) |
Opens the folder picker. Returns a grant, or null on cancel. The same folder gives the same grant again. |
pictureFolder(name) |
Creates RuneStone <name> in the Pictures folder of the user if necessary, and returns a grant for it. name has letters, digits, spaces, hyphens, and underscores, at most 64 characters. |
grants() |
Returns the grants of this plugin. |
revoke(grant) |
Removes a grant. Returns false when the plugin has no such grant. |
list(grant) |
Returns { name, size } for the ordinary files directly in the folder. Skips folders and links. |
readBytes(grant, name) |
Reads one file of at most 64 MiB as a Uint8Array. |
readSidecar(grant, name) |
Reads a sidecar file as text, or returns null when it does not exist. |
writeSidecar(grant, name, contents, expected) |
Saves a sidecar file only if it still contains expected. Use null when the file does not exist. |
Each plugin has its own grants. The host keeps them with the retained data of the plugin, so they stay after a restart, an update, or a removal.
A file name is one name without folder parts. The host rejects .., links, and files that resolve outside the granted folder.
When the granted folder is removed or becomes a link, its grant stops working. Ask the user to choose the folder again.
A sidecar is a small JSON file that the plugin keeps beside the files of the user. Its name has the form .runestone-<name>.json, where <name> has letters, digits, hyphens, and underscores.
A sidecar holds valid JSON of at most 1 MiB. The host writes no other files in a granted folder.
Store the grant id in the plugin settings. Before you use a saved grant, look for it in grants().
Plugin services
api.services (version: 1) lets a plugin offer data to other plugins in the same window. The host passes the calls, so no plugin reads the private files of another plugin.
| Member | Contract |
|---|---|
provide(name, methods) |
Offers an object of functions under a name. Returns { notify(), dispose() }. One plugin can offer each name once. |
get(plugin, name) |
Returns the methods of a service of another plugin, or null when it is not available. |
subscribe(listener) |
Calls listener(plugin, name) when a service starts, stops, or calls notify(). Returns a cleanup function. |
A service name uses lowercase letters, digits, dots, and hyphens, and starts with a letter.
Each method call returns a promise. The host copies the arguments and the result with structuredClone. Use only data that this function can copy, not functions or DOM nodes.
When the provider stops, the host removes its services and notifies the subscribers. Calls through an old service object then fail. Call get again after a notification.
Make the data of a service a documented contract of the provider. Give its name, methods, and result shapes in the documentation of the provider plugin.
Git API
api.git gives Git operations for the active workspace of the window. The host runs the git command, one operation at a time.
The SDK type is GitApi. Every method checks for plugin shutdown first.
| Method | Contract |
|---|---|
status() |
Returns { available, repository, branch, changes }. Each change has path, originalPath?, index, and worktree. |
diff(path, staged) |
Returns the diff text of one file. |
stage(paths) / unstage(paths) |
Change the index for 1 to 10,000 paths. |
commit(message) |
Commit the staged changes. The message has 1 to 65,536 bytes. |
push() / pull() |
Push or pull the current branch. |
graph() |
Returns { commits } with at most 100 commits from all refs. |
commitDetails(commit) |
Returns { id, parents, author, date, message, files } for a full commit ID. |
commitDiff(commit, path) |
Returns the diff of one file in a commit, compared to the first parent. |
blame(path, line) |
Returns { commit, author, date, summary } for one line, or null. date is ISO 8601. |
Each graph commit is { id, parents, refs, summary, author, date }. Parent IDs can refer to commits outside the 100 returned commits.
Older hosts can have git without push, pull, graph, commitDetails, or commitDiff. Make sure that a method exists before you call it.
Example: the Git plugin draws the graph from these commits.
For its native service and test setup, see the Git plugin development guide.
Background API
api.backgrounds (version: 1) lets a plugin show image frames behind the RuneStone interface.
Frames stay in the current window and do not change the saved appearance settings.
The folder methods are deprecated. They accept a folder path from the plugin. Use folder grants in new code. The host keeps them for released versions of Background Slideshow.
| Method | Optional | Contract |
|---|---|---|
chooseFolder() |
Deprecated. Use files.chooseFolder(). Open the folder picker. Returns an absolute path, or null on cancel. |
|
defaultFolder() |
yes | Deprecated. Use files.pictureFolder("Backgrounds"). Create RuneStone Backgrounds in the Pictures folder of the user and return its path. |
list(folder) |
Deprecated. Use files.list(grant). Return { name } for PNG, JPEG, GIF, and WebP files directly in the folder. |
|
read(folder, name) |
Deprecated. Use files.readBytes(grant, name). Read one image as bytes, at most 50 MiB. |
|
readImageSettings(folder) |
yes | Deprecated. Use files.readSidecar(grant, ".runestone-backgrounds.json"). Read the per-image settings file text, or null. |
writeImageSettings(folder, contents, expected) |
yes | Deprecated. Use files.writeSidecar. Save the per-image settings file. See Per-image settings. |
set(target, frame) |
Show a frame for a target. null removes the frame of this plugin. |
|
get(target) |
Return the active frame for a target, or null. |
|
subscribe(listener) |
Receive the target name when a frame changes. Returns a cleanup function. |
Folders must be absolute paths without .. segments.
The host rejects links, files with other extensions, files that are not raster images, and files over the size limit.
File access needs an enabled plugin in the current window. Pending reads fail after the plugin stops.
Targets and frames
| Target | Use |
|---|---|
app |
The host shows this frame behind the app. |
pm-all |
Read by Project Management for all boards. |
pm-board:<board UUID> |
Read by Project Management for one board. |
| Frame field | Rule |
|---|---|
url |
Required blob: URL. |
blurredUrl |
Optional blob: URL for a blurred layer. Each target scales it separately from the foreground. |
overlay |
From -1 to 1. Negative values make the image lighter. Positive values make it darker. |
position |
center, top left, top, top right, left, right, bottom left, bottom, or bottom right. |
size |
cover, contain, or auto. |
previous |
Optional earlier frame with the same fields, without previous or transitionMs. |
transitionMs |
Optional fade time from 0 to 5,000 milliseconds. |
The host fades from previous to the new frame, unless the user turns on reduced motion.
The plugin owns all frame URLs. Keep them valid until a new frame replaces them or the plugin stops, then release them.
When more than one plugin sets a frame for a target, the most recent frame is shown. When it is removed, the host shows the earlier frame or the saved background.
Disable removes the frames and subscriptions of the plugin before cleanup.
To share saved configuration across windows, use the plugin settings API.
Example: Background Slideshow sets frames from local image folders. Example: Project Management reads frames for board backgrounds.
Per-image settings
The per-image settings file is .runestone-backgrounds.json in the image folder.
It must be JSON with "schema": 1 and an images object, at most 1 MiB.
writeImageSettings compares the current file to expected (null when the file does not exist). It fails when the file changed, so external edits are not lost.
files.writeSidecar does the same comparison on the same file, but the host checks only that the text is JSON. The plugin checks the schema.
Example: the Background Slideshow image settings give the storage format and the rendering behavior.