Build a plugin
Begin with one useful action. Keep compatibility, authority, and runtime behavior visible as you add capabilities.
Get the template and types
The public plugin repository contains the template, the contract, the registry, and its checks. Its types/plugin-api.d.ts and types/host-capabilities.json are generated from the latest ReadAware release named in their headers: the first is the complete contract, imported as @readaware/plugin-api; the second lists each capability's version and the permissions that unlock it. Choose requires ranges from it. This site documents the development contract, which can be ahead of that release; the Explorer shows each capability's version in the latest release.
Use Bun, at the version in .bun-version. Run bun install, copy template/ to plugins/<your-plugin-id>/, and keep the directory name equal to the manifest ID.
Build with a coding agent
Give the agent a checkout of the plugin repository and point it to AGENTS.md. That single file covers the workflow, manifest rules, the sandbox, testing, a verified worked example, and the checks CI runs. The validator applies the app's install checks against the latest release, so an agent can confirm compatibility without the app.
A minimal command
This example registers a command during activation and performs its UI effect only when the user runs it.
{
"id": "hello-reader",
"name": "Hello Reader",
"version": "0.1.0",
"schemaVersion": 1,
"main": "main.js",
"requires": {
"contributions": { "commands": "^1.1.0" },
"services": { "ui": "^1.17.0" }
}
}export default {
activate(ctx) {
ctx.contributions.commands.register({
id: "hello",
title: "Say hello",
run: () => ctx.services.ui.showToast("Hello, reader!"),
});
},
};Compile the entry module to a self-contained main.js. The manifest above requires the versions in the latest release; use older ranges only after checking and testing those contracts.
Commands and shortcuts
Commands appear in the command palette and in Settings → Shortcuts, where users can bind or rebind any of them. A command may suggest a binding with defaultShortcut, a chord such as { "key": "s", "mod": true, "shift": true }; mod is ⌘ on macOS and Ctrl elsewhere. Avoid the built-in chords listed under builtInShortcuts in types/host-capabilities.json: when two shortcuts share a chord, pressing it runs neither until the user rebinds one. Shortcuts do not fire while the user is typing.
Add the smallest useful authority
Use the Explorer to find a method and copy its starting manifest fragment. A fragment declares a capability; complete the grants needed by the particular operation.
- Reading library data requires
library:read; changing it requireslibrary:write. - Settings use exact
settingsAccesspaths and operations. - Arbitrary HTTP needs
service:networkplus allowednetworkAccess.origins. - A reader-related method in a permission-free UI service may still need
reading:readorreading:write. - Book grants are selected through host consent and exposed in
ctx.grants.book; a manifest cannot give itself access to another book.
Inspect ctx.capabilities and handle absent optional namespaces. Keep ReadAware-owned data in its domains; plugin storage is for your own records, settings, and checkpoints.
Work with observations and cancellation
Release handles when you no longer need them. For supported calls, pass an AbortSignal and await the actual outcome. Cancellation does not undo a write or remote side effect that already happened.
An automatic reaction uses ctx.withEvent(delivery) for resulting work, including after an await. Give causal subscriptions a stable ruleId where the contract requires it. User-initiated actions use the original activation context. This lets the host detect loops without conflating independent actions.
Build and install locally
Run the public plugin repository's checks from its root. bun run check is what CI runs: the validator, the typecheck, the tests, and a rebuild that must match each committed main.js.
bun install
bun run build
bun run checkOpen ReadAware → Settings → Plugins → Install plugin, select the built folder, and review the consent summary. Exercise the feature in the desktop app. Rebuild and reinstall to check an update.
Version private data
schemaVersion is independent of the package version. When the stored KV or document shape changes, supply the supported upgrade and downgrade transitions through migrate(storageCtx, change).
Migration receives storage-only authority. Test a failed transition as well as success: the prior package and committed data must remain usable. Avoid adding an unnecessary schema change for ordinary code updates.
Test the boundaries your feature uses
Check its actual Worker/Tauri behavior, permission and book-scope refusals, cancellation, disable/re-enable, and failure recovery. For a UI plugin, include keyboard navigation, long text, and narrow windows. For a data-changing plugin, include concurrent edits and restart where persistence matters.
Schedules run while the app is open; durable jobs support only the host's typed plans. Neither is a general background process or arbitrary-code job runner. The API reference describes these limits.
Publish
Once the built package works with its declared minimum contracts, follow Publishing.