Add completion, browser integration, and workspace improvements
This commit is contained in:
+77
-5
@@ -61,7 +61,8 @@ A changed source requires a new review. Cancelling the review removes its tempor
|
||||
|
||||
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.
|
||||
Use Open tab or view beside New tab to open Workspace overview.
|
||||
Use Commands in the toolbar to run Show workspace overview.
|
||||
|
||||
## Uninstall with one confirmation
|
||||
|
||||
@@ -163,6 +164,28 @@ 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 |
|
||||
| --- | --- |
|
||||
| `xx` | Each new completed plugin ZIP build. The number has no two-digit limit. |
|
||||
| `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.
|
||||
Use lowercase letters for hotfix release labels, such as `0.2.11a` and `0.2.11b`.
|
||||
The current plugin packager and installer require numeric versions in `plugin.json`.
|
||||
Until that contract supports suffixes, use letters only in release labels or tags.
|
||||
Increase `xx` for each changed hotfix ZIP and record its numeric package version in the release notes.
|
||||
Keep the package and manifest versions equal. Do not bypass the host validator or overwrite an existing release ZIP.
|
||||
|
||||
## Build and release a plugin
|
||||
|
||||
Use the same package contract for in-house and community plugins.
|
||||
@@ -190,7 +213,7 @@ Use Node.js 24 or later for the packaging command. The default output folder is
|
||||
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.
|
||||
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.
|
||||
|
||||
@@ -231,6 +254,8 @@ The same duplicate-ID, enable, removal, and cleanup rules apply to local and rem
|
||||
|
||||
### 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.
|
||||
|
||||
@@ -242,8 +267,8 @@ Keep the package contract above. No repository manifest or special branch layout
|
||||
|
||||
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.
|
||||
Increase the version when building a new ZIP, before publication.
|
||||
Prerelease builds follow the same build counter. Each new ZIP gets the next numeric version and an 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.
|
||||
@@ -279,6 +304,9 @@ Run `node scripts/pluginInstall.smoke.mjs` against the development server for th
|
||||
|
||||
## 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.
|
||||
@@ -308,15 +336,24 @@ export function activate(api) {
|
||||
| `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 |
|
||||
| `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.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 |
|
||||
@@ -324,9 +361,31 @@ export function activate(api) {
|
||||
| `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` |
|
||||
|
||||
Command and view IDs must be unique within their respective plugin collections.
|
||||
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.
|
||||
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.
|
||||
@@ -388,3 +447,16 @@ Run `scripts/pluginInstall.smoke.mjs`, `scripts/plugins.smoke.mjs`, and `scripts
|
||||
|
||||
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.
|
||||
|
||||
## Browser development plugin
|
||||
|
||||
Browser development lives in `../RuneStone_WebViewer/`.
|
||||
Build `releases/runestone.browser-0.1.0.zip` there with `npm run build:plugin`.
|
||||
The plugin opens editor tabs, contributes to Settings and Bookmarks, and handles web links when selected by the user.
|
||||
A fresh browser store contains one User profile. Users can create blank profiles or duplicate an existing profile.
|
||||
|
||||
The browser requires the native browser service in this host revision.
|
||||
Build and stage the runtime from its checkout, then include `src-tauri/tauri.browser.conf.json` when building RuneStone.
|
||||
The runtime is an optional host resource, similar in purpose to the native service used by Terminal.
|
||||
Plugin ZIP files still contain JavaScript and assets. They do not install arbitrary native executables.
|
||||
See the browser checkout's README for build steps and current limits.
|
||||
|
||||
Reference in New Issue
Block a user