23 KiB
Plugins
RuneStone installs JavaScript plugins from local ZIP files and experimental Gitea release downloads. Open Settings → Plug-ins to install, enable, disable, or uninstall them. Terminal and Table formulas use the same installed package system as all other plugins.
Build and install the feature packages
- Clone
RuneStone_TableFormulasbeside RuneStone and runpnpm install --frozen-lockfilein that checkout. - Run
pnpm build:pluginsfrom the RuneStone repository root for Table formulas. - In Settings → Plug-ins, choose Install plugin ZIP.
- Select the ZIP files in
plugin-packages/, then choose Install and enable.
The build creates runestone.table-formulas-0.1.0.zip.
Table formulas is a development package in its own repository.
Set RUNESTONE_TABLE_FORMULAS_ROOT to use a different checkout location.
That repository also supports pnpm package:plugin, with RUNESTONE_ROOT selecting the host packager.
The folders beside them contain build output for inspection and tests.
Use the ZIP files for installation and releases.
Terminal development lives in the separate RuneStone_Terminal repository.
In that repository, run pnpm install --frozen-lockfile, then pnpm build.
Install releases/runestone.terminal-0.1.0.zip through the same plugin ZIP installer.
Version 0.1.0 marks Terminal as a development package.
The local source folder is ../RuneStone_Terminal/ when both repositories share a parent directory.
No plugin starts automatically in a fresh installation. The application build does not include these packages. Package builds include their JavaScript dependencies and terminal styles. Build them again after source changes, then uninstall the old version and install the new ZIP. The old bundled switches no longer apply. Existing terminal appearance settings remain available after installation. Formula source stays in Markdown files when the plugin is absent, disabled, or removed. Native pseudo-terminal services remain in the desktop host. The Terminal package supplies the interface, shortcuts, and session controls.
Install a plugin
- In Settings → Plug-ins, choose Install plugin ZIP.
- Select one or more
.zipfiles, then review the packages. - Choose Install to keep them disabled, or Install and enable to run them.
Each ZIP contains one plugin, with plugin.json at its root.
You can open the ZIP with an archive tool to read its manifest, JavaScript, and other files.
You do not need to extract it before installation.
The picker accepts at most 100 ZIP files at once.
Folders and loose plugin.json files are not installation inputs.
Earlier .runestone-plugin files already used ZIP format. Rename those files to .zip before installation.
Installed plugins keep working. This change does not alter their files or saved settings.
RuneStone copies packages into its per-user application data directory. It never modifies the selected source. The review shows the author, version, source, destination, and access level.
External plugins run with RuneStone's application access. Enable only code you trust. Package metadata and hashes do not verify a publisher's identity. This version has no permission sandbox or marketplace. Scanning and installation do not execute code, install dependencies, or run installation scripts.
Plugins cannot overwrite an existing ID. Uninstall the previous package before installing another version. Each package succeeds or fails independently. The result identifies any failures. A changed source requires a new review. Cancelling the review removes its temporary copies.
Try the example with pnpm package:plugin fixtures/plugins/workspace-overview.
Install the resulting ZIP from plugin-packages/, then choose Install and enable.
Use the puzzle button in the main toolbar to run Show workspace overview or open the Workspace overview view.
Uninstall with one confirmation
- Choose Uninstall on the plugin's row.
- Check its name, author, version, folder, and deletion message, then choose Uninstall and delete files.
The dialog initially focuses Cancel. Escape cancels the uninstall flow. Cancel leaves the files and enabled state unchanged. Disable instead keeps every installed file and turns the plugin off. Each uninstall requires a new confirmation.
After confirmation, RuneStone disables the plugin in every window and waits for cleanup. It deletes only the installed package. Source downloads, plugin settings, generated data, and workspace documents remain intact. The app shows Restart required because already loaded JavaScript can remain in memory until RuneStone closes.
Cleanup failure blocks deletion and keeps the installed files. Restart RuneStone before trying again. An interrupted file deletion shows Removal incomplete. Retry cleanup continues only that previously confirmed removal. Changed files in the removal directory block further deletion. Inspect the path named in the error before retrying. Reinstallation requires a new enable decision and can reuse retained settings.
flowchart LR
installed("Installed plugin") --> confirm("Confirm file deletion")
confirm --> cleanup("Stop in all windows")
cleanup --> removed("Delete package; retain data")
Storage and recovery
RuneStone resolves the root through Tauri's app_data_dir(). Settings shows the complete path.
<application-data>/
plugins/<plugin-id>/
plugin.json
main.js
assets/
plugin-data/<plugin-id>/settings.json
plugin-state.json
plugin-staging/
plugin-removals/
Rust stores desired enable states in plugin-state.json and broadcasts changes to open windows.
The browser preview has no installed plugins unless a smoke test supplies a desktop mock.
Startup, window focus, Refresh, and a five-second poll scan installed files. Changed packages stop running and require another enable decision. Missing packages are never restored automatically. Valid packages copied directly into the managed directory appear disabled. Staging directories never participate in plugin discovery.
Each reviewed candidate belongs to one window and expires after 30 minutes. Rust checks the source and staged content hashes before publishing a complete directory. A duplicate destination blocks publication. A crash cannot enable a partial installation.
Removal plans belong to one window and expire after five minutes.
The backend accepts a single-use removal token when the user confirms deletion.
A changed package requires a new confirmation.
Runtime cleanup must complete in every window before the package moves into plugin-removals/.
A persisted record identifies that directory and the original file hashes.
Recovery deletes only unchanged remaining files from that confirmed transaction. It cannot target a newly installed copy.
Install and removal operations share one native service and serialize their state changes.
Package contract
Place plugin.json at the root of the ZIP archive:
{
"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"
}
The package API is version 1. Its interface lives in src/lib/plugins/sdk.ts.
RuneStone 0.1.5 adds optional placement: "editor" for views that belong beside documents.
These views open in the editor area with a tab. Document tabs retain their buffers when users switch views.
Closing the plugin tab or disabling the package disposes the view.
The default placement is "dialog", so existing packages keep their current behavior.
Older hosts ignore the placement field. Plugins that require editor placement need RuneStone 0.1.5 or later.
All packages use one API and the same installation, enable, disable, and removal lifecycle.
Versions use three numeric parts. Schema and API versions must match the supported version exactly.
The runestone.* prefix follows the same rules as other package IDs. It does not prove the publisher's identity.
Package names use ASCII letters, digits, dots, underscores, and hyphens, with forward slashes between directories. IDs use lowercase letters, digits, dots, and hyphens and start with a letter. Windows device names, parent traversal, absolute paths, links, junctions, and case-insensitive collisions are invalid. Limits are 5,000 entries, 100 MiB of expanded data, and 25 MiB per file. The manifest has a 64 KiB limit. The final installed path cannot exceed 240 characters.
The entry is one compiled .js or .mjs module. Bundle dependencies into it.
Relative module imports cannot resolve from its Blob URL. Read packaged assets through the API instead.
Raw TypeScript, Svelte source, native libraries, plugin dependencies, and automatic updates are unsupported.
Build and release a plugin
Use the same package contract for in-house and community plugins.
The ZIP is the release file. Its plugin.json describes the contents and is not a separate installer.
org.example.hello-1.0.0.zip
plugin.json
main.js
assets/
README.md
LICENSE
The manifest and entry module are required. Assets, a README, and a license are optional package files. Include a README with the host requirement, purpose, install steps, and help contact. Keep JavaScript readable where practical. Avoid minification and obfuscation that make inspection harder.
- Compile the plugin into a clean folder with
plugin.json, its entry module, and the required assets. - Run
pnpm package:plugin <compiled-folder> [output-folder]from the RuneStone repository. - Install the resulting ZIP in RuneStone and test its features, disable action, and uninstall action.
- Share that same ZIP as the release file.
Use Node.js 24 or later for the packaging command. The default output folder is plugin-packages/.
It checks the manifest, paths, entry module, and size limits before it writes <id>-<version>.zip.
It includes every file in the input folder. Keep dependencies, credentials, and unrelated build files outside that folder.
The output folder must be outside the input folder.
The command replaces an existing ZIP with the same ID and version. Increase the version for each published release.
Repeated runs with unchanged input produce the same archive bytes.
The native installer checks the package again before installation.
Other build tools can create the same ZIP layout. Do not add a parent folder above plugin.json.
Do not tell users to load JSON, select a build folder, rename a new release, or install dependencies.
Authors in other repositories can run node <RuneStone-path>/scripts/packagePlugin.mjs <compiled-folder> <output-folder>.
Experimental installation from a Gitea link
Gitea repository links now supply ZIP packages to the existing review and installation flow. This trial supports Gitea at the host root, including the personal Gitea server. GitHub and GitLab support remain future work. Their release APIs need separate tests.
- In Settings → Plug-ins, choose Install from Git link.
- Enter the repository root link, such as
https://git.knottywyvern.com/kwyvern-gitea/RuneStone_Terminal. - Enter a release tag for a specific version, or leave it empty for the latest release.
- For a private repository, enter a Gitea access token with repository read access.
- Choose Review release, then choose Install or Install and enable after you review the package.
The link can end in .git. SSH links, branch links, source archives, and links with credentials are not installation inputs.
Use an explicit tag for a prerelease trial. The Gitea latest-release endpoint excludes drafts and prereleases.
RuneStone clears the token after each request and when the form closes. It does not save the token.
Use HTTPS. HTTP is available for trusted local servers, but it sends the token and package without encryption.
Credentials go only to the original API origin. Redirects to another origin do not receive the token.
A release attachment on another private host needs its own access method and is outside this trial.
The downloader reads release metadata, then downloads one attached ZIP. It does not clone the repository, compile code, install dependencies, or run scripts. Downloads have size limits, time limits, and a redirect limit. The metadata limit is 2 MiB. The compressed ZIP limit is 100 MiB. The existing package limits still apply to the extracted files. HTTPS links cannot redirect or select an attachment over HTTP.
The review shows the repository, release tag, attachment link, manifest, and destination. It pins the downloaded content. Installation checks that the staged files still match the reviewed hash. Changing a remote release after review does not change the pending installation. The same duplicate-ID, enable, removal, and cleanup rules apply to local and remote packages.
Release standard for plugin writers and agents
Use one plugin repository and one standard plugin ZIP per release for this trial. Keep the package contract above. No repository manifest or special branch layout is required.
- Build the plugin from the source commit that you intend to tag.
- Run
pnpm package:plugin <compiled-folder> [output-folder]from RuneStone. - Attach the resulting
<id>-<version>.zipto a Gitea release. - Publish the release with a tag that identifies its source commit.
- Test its repository link and explicit tag in RuneStone.
Use v<version> for ordinary release tags. Use a clearly named trial tag for temporary prereleases.
Keep the manifest version and package version equal. Keep published release files unchanged.
Increase the version before publishing different package contents as an ordinary release.
A prerelease can use the same numeric manifest version while the installer uses its explicit trial tag.
The ZIP must contain plugin.json at its root, the compiled entry module, and all required assets and dependencies.
Do not attach a source ZIP as the plugin package. Gitea's automatic source archives do not count as release attachments.
The installer rejects releases with no attached ZIP or more than one attached ZIP.
Other attachments, such as checksums and release notes, can accompany the single ZIP.
The installer rejects drafts. Private repositories require read access to the metadata and attachment.
Test local ZIP installation before publication. After publication, test download, review, disabled installation, enable, disable, and removal. Check that cancellation leaves no installed package. Check that an existing plugin ID blocks another installation. Keep release notes short. State the host requirement, plugin version, changes, and known limits.
Trial checks
The four local packages passed a simulated Gitea release download and isolated native installation on October 5, 2026. The test checked the installed hashes and kept all four plugins disabled.
| Plugin | Package version |
|---|---|
| Terminal | 0.1.0 |
| Table formulas | 0.1.0 |
| PDF viewer | 0.0.1 |
| Project management | 0.2.3 |
The authenticated check of the personal Gitea server found no releases in these four repositories. Live Gitea installation still needs published release attachments. No releases or tags were created during this check. The browser smoke test covers the link form, download errors, token clearing, cancellation, focus, and disabled installation. Native tests cover URL parsing, release selection, redirects, credential boundaries, size limits, changed staging files, and invalid ZIPs.
Run the focused native checks with cargo test --manifest-path src-tauri/Cargo.toml --lib plugin.
To repeat the four-package trial, place exactly these four ZIPs in a folder and set RUNESTONE_GIT_TRIAL_PACKAGES to its absolute path.
Then run cargo test --manifest-path src-tauri/Cargo.toml --lib four_plugin_release_trial -- --ignored --nocapture.
Run node scripts/pluginInstall.smoke.mjs against the development server for the browser checks.
Plugin API
The entry exports activate(api). Activation can return a cleanup function or a promise for that function.
The runtime limits activation and each cleanup callback to five seconds.
A timeout reports an error and blocks successful cleanup until the app restarts.
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")
});
}
| API | Contract |
|---|---|
api.id |
The installed plugin ID |
api.signal |
An abort signal triggered before shutdown |
contribute(key, value) |
Register a typed terminal or table formula contribution |
registerCommand({ id, title, run }) |
Add a command to the toolbar's plugin menu |
registerView({ id, title, placement?, mount }) |
Add a view in a dialog or the editor area |
registerView({ navigation: true, icon?, ... }) |
Add an icon button to the ribbon left of the navigation pane |
registerDocumentType(type) |
Recognize document content, supply a navigation icon, and mount a document editor |
openDocument(path) |
Open a recognized document in its own tab |
renameDocument({ id, path }, name) |
Rename a recognized document and return its new workspace path. Optional API |
openView(id) |
Open one of the plugin's registered views |
onDispose(callback) |
Register synchronous or asynchronous cleanup |
workspace.list(path?) |
List a directory in this window's active workspace |
workspace.read(path) |
Read a workspace text file |
workspace.readBytes(path) |
Read workspace bytes as a Uint8Array, with a 64 MiB limit. Requires the binary document host update |
workspace.readOptional(path) |
Read text, or return null when the file is absent. Added in 0.1.6 |
workspace.create(path, contents) |
Create complete text without replacing an existing file. Added in 0.1.6 |
workspace.write(path, contents, expected) |
Save only if the file still matches the original text |
workspace.subscribe(listener) |
Receive workspace change notifications. Returns a cleanup function |
settings.read() / settings.write(value) |
Read or write retained JSON settings, with a 1 MiB limit |
assets.read(path) |
Read package bytes as a Uint8Array |
Command and view IDs must be unique within their respective plugin collections.
Document type IDs must also be unique within their collection.
Document types declare file extensions, an identify function, and a mount function.
The identify function returns a stable document ID or null. Invalid documents remain available through the text editor.
An optional creation action supplies complete file text. Creation never replaces an existing file.
Each document opens in its own editor tab. Opening the same document focuses its existing tab.
Closing one tab disposes only that mount. Disabling the plugin disposes all its mounts and removes its navigation entries.
The host rejects plugin writes when a note has unsaved editor changes.
These document APIs require the current host source. The earlier 0.1.6 installer does not include them.
The optional API method renameDocument({ id, path }, name) renames a recognized document and returns its new workspace path.
The host checks the document ID and plugin owner. It keeps the folder and extension, rejects name collisions, and updates open tabs.
Names can contain dots. Hidden names and reserved filename characters are invalid.
Unsaved text edits block plugin renames. This method requires the updated host source.
Binary document types set content: "binary". Text remains the default.
For binary types, identify(path, source) receives an empty source string and recognizes the path without reading its contents.
The mount reads bytes with workspace.readBytes(path) and reports invalid document data in its own view.
This avoids UTF-8 conversion and full file reads while the file tree identifies binary documents.
The native read command checks the active window's workspace boundary and rejects directories and files larger than 64 MiB.
Binary document support requires the updated host source. The earlier 0.1.6 installer does not include it.
Check for api.workspace.readBytes during activation and report a clear host update error when it is absent.
Navigation views appear as icon buttons in the ribbon left of the navigation pane.
The optional view icon accepts list, kanban, or puzzle. The default is puzzle.
Buttons show the view title in a tooltip on hover and keyboard focus.
The ribbon remains available when the navigation pane is closed.
Views can return asynchronous cleanup. Closing a view and disabling its plugin share the same cleanup promise. Remove timers, listeners, and other resources in cleanup. Use the abort signal to stop pending work. The SDK rejects calls after shutdown starts, but it does not isolate JavaScript with full application access. Packages activate in every RuneStone window, including standalone terminal windows.
Contribution types live in src/lib/plugins/contracts.ts.
Only one active package can own each contribution. The runtime removes contributions before cleanup starts.
Terminal controls mount into a host element and return update, command, and disposal functions.
The plugin must stop its mounted controls and native sessions in onDispose before cleanup completes.
Modules and checks
| Module | Owns |
|---|---|
src-tauri/src/plugins.rs |
Discovery, validation, installation, persistence, removal plans, and cleanup acknowledgments |
src/lib/plugins/PluginManager.svelte |
Package review, switches, and the uninstall dialog |
src/lib/plugins/sdk.ts |
External package types |
src/lib/plugins/externalSession.ts |
Activation, contributions, view disposal, and shutdown |
src/lib/plugins/external.ts |
Native state synchronization and external module loading |
src/lib/plugins/PluginTools.svelte |
External commands and views |
src/lib/plugins/registry.ts / contracts.ts |
Shared feature contributions and their types |
src/lib/plugins/TerminalSlot.svelte |
The host element for terminal controls |
../RuneStone_Terminal/src/ |
Terminal plugin source in its own repository |
../RuneStone_TableFormulas/ |
Table formulas source, unit tests, and package build |
scripts/buildPlugins.mjs |
Table formulas compilation and ZIP release in plugin-packages/ |
scripts/packagePlugin.mjs |
Shared checks and ZIP creation for plugin authors |
Run pnpm build:plugins, pnpm check, pnpm test, pnpm build, and cargo test --manifest-path src-tauri/Cargo.toml --lib --offline.
Run pnpm check, pnpm test, and pnpm build in RuneStone_Terminal for terminal checks.
Build Terminal before host browser tests. They read ../RuneStone_Terminal/dist/ by default.
Set RUNESTONE_TERMINAL_DIST to use another compiled terminal folder.
The Rust tests use real temporary files and archives. Browser tests mock desktop calls and exercise the real UI and module loader.
Run scripts/pluginInstall.smoke.mjs, scripts/plugins.smoke.mjs, and scripts/settings.smoke.mjs against the development server.
Native plugin packages and restricted permissions remain future work. The core keeps basic Markdown tables, file editing, selection, sorting, and document access when optional features stop.