Add workspace links, restore tabs, and update project guides
This commit is contained in:
+88
-532
@@ -1,563 +1,119 @@
|
||||
# Plugins
|
||||
# Install and manage plugins
|
||||
|
||||
[Back to development](development.md)
|
||||
[RuneStone](../README.md) · [User guide](user-guide.md)
|
||||
|
||||
RuneStone installs JavaScript plugins from local ZIP files and experimental Gitea release downloads.
|
||||
Open Settings → Plug-ins to install, enable, disable, or uninstall them.
|
||||
See [plugin names and source folders](plugin-names.md) for display names, stable IDs, and checkout locations.
|
||||
Terminal and Table Formulas use the same installed package system as all other plugins.
|
||||
|
||||
## Build and install the feature packages
|
||||
|
||||
1. Clone `RuneStone_Table_Formulas` beside RuneStone and run `pnpm install --frozen-lockfile` in that checkout.
|
||||
2. Run `pnpm build:plugins` from the RuneStone repository root for Table Formulas.
|
||||
3. In Settings → Plug-ins, choose Install plugin ZIP.
|
||||
4. Select the ZIP files in `../RuneStone_Table_Formulas/releases/`, then choose Install and enable.
|
||||
|
||||
The build creates `runestone.table-formulas-<version>.zip` in that plugin's `releases/` folder.
|
||||
Table Formulas is a development package in its [own repository](https://git.knottywyvern.com/kwyvern-gitea/RuneStone_TableFormulas).
|
||||
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](https://git.knottywyvern.com/kwyvern-gitea/RuneStone_Terminal).
|
||||
In that repository, run `pnpm install --frozen-lockfile`, then `pnpm build`.
|
||||
Install `releases/runestone.terminal-<version>.zip` through the same plugin ZIP installer.
|
||||
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 select the new ZIP through Install plugin 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.
|
||||
Plugins add optional features such as Terminal, Table Formulas, Git, and PDF Viewer.
|
||||
Use **Settings → Plug-ins** to install, update, enable, disable, or uninstall them.
|
||||
The Browser is included with RuneStone and needs no plugin.
|
||||
|
||||
## Install a plugin
|
||||
|
||||
1. In Settings → Plug-ins, choose Install plugin ZIP.
|
||||
2. Select one or more `.zip` files, then review the packages.
|
||||
3. Choose Install to keep them disabled, or Install and enable to run them.
|
||||
Get the plugin's release ZIP. Keep the file compressed.
|
||||
Each ZIP installs one plugin. You can select up to 100 ZIPs at once.
|
||||
|
||||
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.
|
||||
1. Open **Settings → Plug-ins**.
|
||||
2. Choose **Install plugin ZIP**.
|
||||
3. Select the ZIP files.
|
||||
4. Review each plugin's name, author, version, source, destination, and access level.
|
||||
5. Choose **Install and enable** to use the plugins, or **Install** to keep them disabled.
|
||||
|
||||
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.
|
||||
For example, a Terminal package uses the filename `runestone.terminal-<version>.zip`.
|
||||
The version in the filename identifies the release. Select the actual ZIP you received.
|
||||
Use the same steps for other plugins.
|
||||
|
||||
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.
|
||||
Plugins run with RuneStone's application access. Enable only code you trust.
|
||||
The author field does not prove the publisher's identity. Plugins have no permission sandbox.
|
||||
|
||||
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.
|
||||
RuneStone copies the packages into its application data folder. It keeps your downloaded ZIPs unchanged.
|
||||
The review and installation steps do not run plugin code or installation scripts.
|
||||
Each package succeeds or fails separately. Check the result for any failed packages.
|
||||
|
||||
A package with an installed ID updates that plugin after review. Choose Apply packages to replace its files.
|
||||
The review shows the current and new versions. Updates keep plugin settings and the previous enabled state.
|
||||
RuneStone stops the plugin in every window and waits for cleanup before replacement. Cleanup failure blocks replacement.
|
||||
An interrupted update restores the old package unless the new catalog entry committed.
|
||||
Automatic repository scans remain future work.
|
||||
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.
|
||||
## Enable or disable a plugin
|
||||
|
||||
Try the example with `pnpm package:plugin fixtures/plugins/workspace-overview`.
|
||||
Install the resulting ZIP from `releases/`, then choose Install and enable.
|
||||
Use Open tab or view beside New tab to open Workspace overview.
|
||||
Use Commands in the toolbar to run Show workspace overview.
|
||||
Use the switch beside the plugin in **Settings → Plug-ins**.
|
||||
The **Enabled** or **Disabled** status shows your choice.
|
||||
That choice applies across RuneStone windows and persists after restart.
|
||||
No optional plugin starts automatically in a fresh installation.
|
||||
|
||||
## Uninstall with one confirmation
|
||||
Disabling stops the plugin and keeps its installed files, settings, and workspace documents.
|
||||
If RuneStone asks for a restart, close all RuneStone windows and open the app again.
|
||||
Some loaded code can remain in memory until the app closes.
|
||||
|
||||
1. Choose Uninstall on the plugin's row.
|
||||
2. Check its name, author, version, folder, and deletion message, then choose Uninstall and delete files.
|
||||
## Update a plugin
|
||||
|
||||
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.
|
||||
1. Get the new release ZIP for the plugin.
|
||||
2. Open **Settings → Plug-ins → Install plugin ZIP**.
|
||||
3. Select the ZIP.
|
||||
4. Review the current and new versions.
|
||||
5. Choose **Apply packages**.
|
||||
|
||||
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.
|
||||
RuneStone recognizes an update by the plugin ID.
|
||||
Updates keep the plugin's settings and its previous enabled or disabled state.
|
||||
RuneStone stops the plugin in every window before replacing its files.
|
||||
If cleanup fails, the update stops. Restart RuneStone before you try again.
|
||||
|
||||
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.
|
||||
## Uninstall a plugin
|
||||
|
||||
```mermaid
|
||||
flowchart LR
|
||||
installed("Installed plugin") --> confirm("Confirm file deletion")
|
||||
confirm --> cleanup("Stop in all windows")
|
||||
cleanup --> removed("Delete package; retain data")
|
||||
```
|
||||
1. Open **Settings → Plug-ins**.
|
||||
2. Choose **Uninstall** beside the plugin.
|
||||
3. Check the plugin details and deletion message.
|
||||
4. Choose **Uninstall and delete files**.
|
||||
|
||||
## Storage and recovery
|
||||
Uninstall removes the installed package after the plugin stops in every window.
|
||||
It keeps downloaded ZIPs, plugin settings, generated data, and workspace documents.
|
||||
For example, Table Formulas leaves formula source in your Markdown files.
|
||||
Installing the plugin again can reuse its retained settings, but you must choose whether to enable it.
|
||||
|
||||
RuneStone resolves the root through Tauri's `app_data_dir()`. Settings shows the complete path.
|
||||
**Cancel** leaves the plugin unchanged. **Disable instead** stops it and keeps the package installed.
|
||||
If RuneStone asks for a restart, close all RuneStone windows and open the app again.
|
||||
|
||||
```text
|
||||
<application-data>/
|
||||
plugins/<plugin-id>/
|
||||
plugin.json
|
||||
main.js
|
||||
assets/
|
||||
plugin-data/<plugin-id>/settings.json
|
||||
plugin-state.json
|
||||
plugin-staging/
|
||||
plugin-removals/
|
||||
```
|
||||
## Install from a Gitea link (experimental)
|
||||
|
||||
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.
|
||||
Use this route when the publisher supplies a Gitea repository link with a plugin ZIP attached to a release.
|
||||
GitHub and GitLab links are not supported.
|
||||
|
||||
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.
|
||||
1. Open **Settings → Plug-ins → Install from Git link**.
|
||||
2. Enter the repository root link supplied by the publisher.
|
||||
3. Enter a specific release tag, or leave it empty for the latest stable release.
|
||||
4. For a private repository, enter a Gitea token with repository read access.
|
||||
5. Choose **Review release**.
|
||||
|
||||
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.
|
||||
An untracked destination blocks publication. Reviewed updates pin the installed package hash and retain a recovery journal.
|
||||
A crash cannot enable a partial installation.
|
||||
Review the package, then choose **Install** or **Install and enable**.
|
||||
For an existing plugin, choose **Apply packages**.
|
||||
Use an explicit tag for a prerelease. A source archive or branch link cannot install a plugin.
|
||||
The release must contain exactly one attached plugin ZIP.
|
||||
|
||||
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.
|
||||
Use HTTPS for a remote server. RuneStone clears the token after the request and does not save it.
|
||||
RuneStone downloads a package through this route. It does not clone or build the repository.
|
||||
|
||||
## Package contract
|
||||
## Feature guides
|
||||
|
||||
Place `plugin.json` at the root of the ZIP archive:
|
||||
Use these guides for plugin features after installation:
|
||||
|
||||
```json
|
||||
{
|
||||
"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"
|
||||
}
|
||||
```
|
||||
- [Terminal sessions and shortcuts](guides/terminal.md)
|
||||
- [Git controls, push, pull, and history](../../RuneStone_Git/docs/usage.md)
|
||||
- [Background Slideshow images and board targets](../../RuneStone_Background_Slideshow/docs/usage.md)
|
||||
- [Local Autocomplete trial and settings](../../RuneStone_Local_Autocomplete/docs/trial-guide.md)
|
||||
- [Project Management tasks and boards](../../RuneStone_Project_Management/project-management.md)
|
||||
|
||||
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 with an optional lowercase hotfix suffix, such as `0.2.28a`.
|
||||
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.
|
||||
Links outside this repository require the corresponding sibling source checkout.
|
||||
For the included browser, use the [built-in browser guide](user-guide.md#use-the-built-in-browser).
|
||||
|
||||
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.
|
||||
## Plugin help
|
||||
|
||||
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.
|
||||
|
||||
## Versioning for plugin authors and agents
|
||||
|
||||
Follow the shared [RuneStone versioning policy](../AGENTS.md#versioning). RuneStone and its plugins keep independent version numbers under this policy.
|
||||
Use `zz.yy.xx` and keep routine implementation work in the current `zz.yy` series.
|
||||
|
||||
| Part | When to increase it |
|
||||
| Problem | Action |
|
||||
| --- | --- |
|
||||
| `xx` | Each new completed regular plugin ZIP build. Hotfixes increase the letter suffix. |
|
||||
| `yy` | A deliberate release ready for build testing, with user direction. Reset `xx` to zero. |
|
||||
| `zz` | A full release, with user direction. Reset `yy` and `xx` to zero. |
|
||||
|
||||
Keep the current version during source edits, fixes, improvements, documentation work, and automated checks.
|
||||
Set the next version when producing the ZIP. Intermediate compilation output does not count as a new build.
|
||||
If no build completes, restore the previous version fields. Failed attempts and retries do not consume version numbers.
|
||||
Report a new version as available only after its ZIP exists. Publishing an existing artifact does not increase its version.
|
||||
Passing automated checks alone does not authorize a `yy` or `zz` increase.
|
||||
A hotfix fixes one item or a narrowly scoped problem in an existing release.
|
||||
Use letters in the actual package version: `0.2.28` → `0.2.28a` → `0.2.28b`.
|
||||
Keep the numeric base for hotfix builds.
|
||||
Advance hotfix suffixes in this order: `a`, `b`, `c`, through `z`, then `aa`, `ab`, and later suffixes.
|
||||
The next regular build increases `xx` and removes the suffix: `0.2.28b` → `0.2.29`.
|
||||
Keep the package version, manifest version, build metadata, ZIP name, release notes, and tag consistent.
|
||||
For example, package version `0.2.28a` produces `runestone.pm-0.2.28a.zip` and uses tag `v0.2.28a`.
|
||||
The shared packager and updated native installer accept these suffixes. Older hosts with numeric-only validation reject suffixed packages.
|
||||
Do not substitute a numeric increment for a hotfix. Add suffix support or report a format blocker before building.
|
||||
Do not bypass validation or overwrite an existing release ZIP.
|
||||
|
||||
## 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.
|
||||
|
||||
```text
|
||||
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.
|
||||
|
||||
1. Compile the plugin into a clean folder with `plugin.json`, its entry module, and the required assets.
|
||||
2. Run `pnpm package:plugin <compiled-folder> [output-folder]` from the RuneStone repository.
|
||||
3. Install the resulting ZIP in RuneStone and test its features, disable action, and uninstall action.
|
||||
4. Share that same ZIP as the release file.
|
||||
|
||||
Use Node.js 24 or later for the packaging command. The default output folder is `releases/` in the project that contains the compiled folder.
|
||||
Keep plugin release ZIPs in that plugin project, including when the host calls the build.
|
||||
Explicit output folders are for temporary checks or staging. Move completed releases into the owning project's `releases/` folder.
|
||||
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 can replace an existing ZIP with the same ID and version. Use the next build version and preserve existing ZIPs.
|
||||
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.
|
||||
|
||||
1. In Settings → Plug-ins, choose Install from Git link.
|
||||
2. Enter the repository root link, such as `https://git.knottywyvern.com/kwyvern-gitea/RuneStone_Terminal`.
|
||||
3. Enter a release tag for a specific version, or leave it empty for the latest release.
|
||||
4. For a private repository, enter a Gitea access token with repository read access.
|
||||
5. 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](https://docs.gitea.com/api/operations/repo-get-latest-release/) 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
|
||||
|
||||
Apply the [shared versioning rules](#versioning-for-plugin-authors-and-agents) before choosing a release version.
|
||||
|
||||
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.
|
||||
|
||||
1. Build the plugin from the source commit that you intend to tag.
|
||||
2. Run `pnpm package:plugin <compiled-folder> [output-folder]` from RuneStone.
|
||||
3. Attach the resulting `<id>-<version>.zip` to a Gitea release.
|
||||
4. Publish the release with a tag that identifies its source commit.
|
||||
5. 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 when building a new ZIP, before publication.
|
||||
Prerelease builds follow the same version policy. Each new regular ZIP gets the next numeric build version.
|
||||
Each hotfix ZIP gets the next letter suffix. Use an explicit trial tag for prereleases.
|
||||
|
||||
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 current source adds an optional [completion API](completion.md) for local model providers and plugin-owned text fields.
|
||||
This capability is not present in the existing 0.1.7 installer.
|
||||
|
||||
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.
|
||||
|
||||
```js
|
||||
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 Commands in the toolbar |
|
||||
| `registerCommand({ category: "open", ... })` | Add a launch action to Open tab or view |
|
||||
| `registerView({ id, title, placement?, mount })` | Add a view in a dialog or the editor area |
|
||||
| `registerView({ settings: true, ... })` | Add a configuration page to Settings |
|
||||
| `registerView({ launcher: false, ... })` | Keep a dynamic view out of the launch menu |
|
||||
| `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 |
|
||||
| `openView(id, { split, relativeTo })` | Open an editor view beside another view. `split` accepts `right` or `down` |
|
||||
| `closeView(id)` | Close an editor view owned by this plugin. Optional API |
|
||||
| `registerView({ tabActions, find, pinned, ... })` | Supply tab actions, a Find handler, and the initial pin state |
|
||||
| `registerView({ tabDragData, ... })` | Supply transfer data for a tab. The callback receives its pin state |
|
||||
| `registerTabDrop(receive)` | Accept a tab from another window. Optional API |
|
||||
| `onDispose(callback)` | Register synchronous or asynchronous cleanup |
|
||||
| `workspace.list(path?)` | List a directory in this window's active workspace |
|
||||
| `workspace.listMarkdown()` | Return sorted visible Markdown paths in one native request. Optional API |
|
||||
| `workspace.read(path)` | Read a workspace text file |
|
||||
| `workspace.readMany(paths)` | Optional batched text read. Accept at most 64 paths and return a source or error for each path |
|
||||
| `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 |
|
||||
| `settings.subscribe(listener)` | Receive saved settings changes across windows. Optional API |
|
||||
| `assets.read(path)` | Read package bytes as a `Uint8Array` |
|
||||
|
||||
Check for `workspace.readMany` before calling it. Older hosts require individual reads.
|
||||
Each result contains `path` and either `source` or `error`. One failed file does not discard the remaining results.
|
||||
The native batch accepts at most 64 paths and 16 MiB of combined UTF-8 text.
|
||||
Workspace path checks and plugin shutdown checks apply to these reads.
|
||||
|
||||
Command and view IDs must be unique within their respective plugin collections.
|
||||
Plugin commands can supply an optional `icon` from the shared action icon set in `src/lib/ui/actionIcons.ts`.
|
||||
Use a recognizable action icon, such as `skip-forward` or `pause`, for each command. Older hosts can ignore this field.
|
||||
Sidebar views belong in the left navigation. Views with a direct navigation button do not repeat in the plugin launch menu.
|
||||
Plugin configuration appears in Settings under the plugin name.
|
||||
Register a view with `settings: true` to add its configuration page.
|
||||
The host mounts that view inside Settings and removes it from the launch menu.
|
||||
Settings loads enabled plugins so their configuration pages remain available in the separate settings window.
|
||||
The host calls `mount(container, context)` with `context.surface` set to `"settings"` or `"view"`.
|
||||
Older hosts can omit the context argument.
|
||||
|
||||
The language setting applies to RuneStone's interface. The host does not translate plugin interfaces or supply a plugin translation API.
|
||||
Plugin authors can manage translations within their own packages.
|
||||
|
||||
Local Autocomplete keeps temporary reference text in its editor view because that text belongs to one window.
|
||||
Open Commands → Configure Local Autocomplete in that window to use reference text.
|
||||
|
||||
The Open tab or view menu contains plugin views and commands with `category: "open"`.
|
||||
Other commands appear in Commands.
|
||||
Set `launcher: false` on dynamic views that already have tabs.
|
||||
Existing packages can omit these optional fields.
|
||||
|
||||
Plugins can call `settings.subscribe(listener)` to receive notifications when their saved settings change.
|
||||
The listener must read the new settings with `settings.read()`.
|
||||
Notifications cross window boundaries and contain only the plugin ID.
|
||||
The host removes subscriptions when the plugin stops.
|
||||
Plugins must ignore pending reads after shutdown and prevent older reads from replacing newer settings.
|
||||
Local Autocomplete uses this subscription so changes in Settings apply to the editor window.
|
||||
|
||||
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 with `placement: "sidebar"` appear beside Files, Search, and Bookmarks in the top header.
|
||||
Other 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_Table_Formulas/` | Table Formulas source, unit tests, and package build |
|
||||
| `scripts/buildPlugins.mjs` | Table Formulas compilation and ZIP release in `../RuneStone_Table_Formulas/releases/` |
|
||||
| `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.
|
||||
|
||||
## Built-in browser
|
||||
|
||||
Browser now belongs to RuneStone. The installer includes its interface and native Chromium runtime.
|
||||
Users can open browser tabs, manage profiles in Settings, and use web bookmarks without a plugin ZIP.
|
||||
The existing browser data directory stays the same. Profiles, bookmarks, cookies, and settings remain available.
|
||||
An old Browser package can be removed from Settings. The host does not load it alongside the built-in browser.
|
||||
|
||||
The interface source lives in `src/lib/browser/`. The runtime source lives in `browser-runtime/`.
|
||||
Run `pnpm browser:stage` after packaging that runtime and before creating an installer.
|
||||
The main Tauri configuration includes `src-tauri/browser-engine/` as an installer resource.
|
||||
Browser startup obtains a session token for its window. Native requests check that token, and cleanup revokes it.
|
||||
|
||||
## Git and sidebar views
|
||||
|
||||
The Git plugin adds source control to the left pane. It supports file diffs, staging, unstaging, commits, and line history.
|
||||
Git must be installed, and the workspace must be the repository root. Linked worktrees are not supported yet.
|
||||
Commit hooks still run. A failed commit keeps the message and shows the error.
|
||||
|
||||
Plugins can register `placement: "sidebar"` views with a navigation icon.
|
||||
The optional `openFile(path)` method opens a workspace file.
|
||||
The optional `git` API supplies status, diff, stage, unstage, commit, and blame operations.
|
||||
The optional `replaceView(currentId, nextId)` method changes the current tab while preserving its position and pin state.
|
||||
For document tabs, `replaceDocumentWithView(document, nextId)` supplies the same behavior.
|
||||
Both methods restrict the source and destination to the calling plugin.
|
||||
|
||||
The Git plugin also supports push, fast-forward-only pull, and a collapsible graph of the latest 100 commits.
|
||||
Changes and Graph collapse independently. The graph shows branches, tags, commit IDs, authors, dates, and commit messages.
|
||||
Push and pull use the current branch's configured upstream and existing Git authentication.
|
||||
Pull stops when local changes or diverging commits prevent a fast-forward update. The plugin does not force-push or create an upstream automatically.
|
||||
|
||||
The optional Git API adds `push()`, `pull()`, and `graph()` in the current host source.
|
||||
These methods require an updated host and remain subject to plugin shutdown checks.
|
||||
|
||||
The Git graph uses graphical commit nodes and parent links. It shows forks, merges, branches, tags, commit IDs, authors, dates, and messages.
|
||||
The host returns structured history from `git.graph()`: `{ commits: [{ id, parents, refs, summary, author, date }] }`.
|
||||
The graph keeps the latest 100 commits. Dashed links mark parents outside that history.
|
||||
The updated Git package requires the matching host build. An older host shows an update message instead of a graph.
|
||||
|
||||
## Temporary background API
|
||||
|
||||
RuneStone 0.1.25 adds optional `api.backgrounds` with `version: 1`.
|
||||
Background Slideshow uses it for local image folders and temporary backgrounds.
|
||||
Project Management 0.2.29 uses it for board backgrounds.
|
||||
|
||||
| Method | Contract |
|
||||
| --- | --- |
|
||||
| `chooseFolder()` | Open the native folder picker. Return an absolute path or null on cancellation. |
|
||||
| `defaultFolder()` | Optional. Create and return Pictures/RuneStone Backgrounds for new settings. |
|
||||
| `list(folder)` | List PNG, JPEG, GIF, and WebP filenames directly inside the folder. |
|
||||
| `read(folder, name)` | Read one raster image as bytes, with a 50 MiB limit. |
|
||||
| `set(target, frame)` | Apply a temporary frame. Pass null to remove this plugin's frame. |
|
||||
| `get(target)` | Read the active frame or null. |
|
||||
| `subscribe(listener)` | Receive the changed target. Return a cleanup function. |
|
||||
|
||||
Targets are `app`, `pm-all`, and `pm-board:<board UUID>`.
|
||||
A frame contains `url`, `overlay`, `position`, and `size`.
|
||||
It can also contain `previous` with those four fields and `transitionMs` from 0 to 5000.
|
||||
Renderers fade between these frames unless reduced motion is active. Keep both blob URLs valid until replacement or cleanup.
|
||||
Use a blob URL. The publishing plugin owns the URL and must release it after replacement or cleanup.
|
||||
Overlay ranges from -1 to 1. Negative values lighten the image, and positive values darken it.
|
||||
Position and size use the same choices as custom image settings.
|
||||
|
||||
Frames belong to the plugin activation in the current window. They do not change saved background settings.
|
||||
The last published frame wins. Removing it reveals an earlier active frame or the saved background.
|
||||
Project Management checks a temporary board frame first, then `pm-all`, then the saved board image.
|
||||
Disable removes the plugin's frames and subscriptions before cleanup.
|
||||
File access requires an active plugin lease. Pending reads fail after access is revoked.
|
||||
Image reads reject path traversal, linked files, unsupported formats, and oversized files.
|
||||
|
||||
Each window keeps its own sequence. The plugin settings API shares folder and playback settings across windows.
|
||||
|
||||
|
||||
### Per-image background settings
|
||||
|
||||
Slideshow stores per-image fit, position, and overlay in .runestone-backgrounds.json beside the images. The sidecar uses schema 1 and an images object. Settings saves compare the previous file text to preserve external changes. The sidecar has a 1 MiB limit.
|
||||
Portrait images show the full image over a blurred cover layer by default. Each target scales the foreground and blurred layer separately. The image editor shows a preview and lets users save or reset an override. Global settings remain the fallback for other images.
|
||||
The optional background API adds readImageSettings and writeImageSettings. Temporary frames can supply blurredUrl. The plugin owns all frame URLs and releases them after replacement or shutdown.
|
||||
|
||||
### View launch defaults
|
||||
|
||||
Views can supply an optional `launch()` handler for entry through the plugin launcher or navigation button.
|
||||
The handler can select a default view with `api.openView(id)`.
|
||||
Explicit `api.openView` calls and restored tabs bypass the launch handler and retain their targets.
|
||||
Views without a handler open as before. Older hosts ignore this optional field.
|
||||
Project Management uses this handler for its fixed workspace default board.
|
||||
| The ZIP fails review | Read the reported error. Get a complete release ZIP from the plugin author. |
|
||||
| You received source code or a loose manifest | Get the release ZIP. Users do not need to build the plugin. |
|
||||
| The plugin is installed but unavailable | Check its switch and any error beside it in **Settings → Plug-ins**. |
|
||||
| Changed plugin files need another enable decision | Review the changed package before enabling it again. |
|
||||
| An update or uninstall reports a cleanup failure | Restart RuneStone, then repeat the action. |
|
||||
| The plugin shows **Removal incomplete** | Choose **Retry cleanup** to finish the confirmed removal. |
|
||||
| Retry cleanup reports changed files | Check the path in the error before retrying. |
|
||||
| A Gitea release has no usable package | Check the release tag and ask the publisher for a release with one attached plugin ZIP. |
|
||||
|
||||
Use **Show files** beside a plugin to inspect its installed folder.
|
||||
Include the plugin name, version, RuneStone version, and error text when you report a problem.
|
||||
|
||||
To create a plugin, use the [plugin development reference](plugin-development.md).
|
||||
It covers build examples, package requirements, releases, and the API.
|
||||
|
||||
Reference in New Issue
Block a user