Skip to content

Plugin examples

Generated from the code by apps/docs/scripts/reference.mjs: edit the source, not this page.

Each is a complete plugin: its manifest passes wisp’s own check in its tests, and agents that write plugins for you are shown the same ones. Put the files in ~/.wisp/plugins/<name>/, then wisp plugin enable <id>. See Build plugins.

My plugins

Asked for: A Settings pane that lists my plugins and which are on

wisp-plugin.json

{
"wispPlugin": 1,
"id": "user.my-plugins",
"name": "My plugins",
"version": "1.0.0",
"api": "^1",
"description": "Lists the plugins this wisp has and which are on.",
"permissions": [
"plugins:read"
],
"activation": [
"onView:user.my-plugins.pane"
],
"contributes": {
"ui": [
{
"id": "user.my-plugins.pane",
"attachTo": {
"id": "shell.settings",
"input": "pane"
},
"component": "./ui.js#default",
"title": "My plugins"
}
]
}
}

ui.js

// runs in a Worker: no DOM, no network. It only describes kit components and calls wisp as itself.
const show = (rows, error) => wisp.render({ c: 'Stack', p: { gap: '2' }, k: [
{ c: 'Inline', p: { justify: 'between' }, k: [
{ c: 'Text', p: { weight: 'semibold' }, k: [`${rows.length} plugins`] },
{ c: 'Button', p: { label: 'Refresh', size: 'sm', variant: 'ghost' }, on: 'refresh' },
] },
...(error ? [{ c: 'Callout', p: { tone: 'bad', title: error } }] : []),
...rows.map((r) => ({ c: 'ListRow', p: { title: r.id, sub: `${r.version} · ${r.enabled ? 'on' : 'off'}` } })),
] });
const load = () => wisp.call('plugins.list', {}).then((rows) => show(rows), (e) => show([], e.message));
wisp.on('refresh', load);
show([]);
load();

Scratch

Asked for: A pane with a note I can type and a switch, that remembers nothing outside itself

wisp-plugin.json

{
"wispPlugin": 1,
"id": "user.scratch",
"name": "Scratch",
"version": "1.0.0",
"api": "^1",
"description": "A note and a switch, kept while the pane is open.",
"permissions": [],
"contributes": {
"ui": [
{
"id": "user.scratch.pane",
"attachTo": {
"id": "shell.settings",
"input": "pane"
},
"component": "./ui.js#default",
"title": "Scratch"
}
]
}
}

ui.js

let note = '';
let loud = false;
const draw = () => wisp.render({ c: 'Stack', p: { gap: '3' }, k: [
{ c: 'SettingsRow', p: { title: 'Loud', description: 'Shows the note as a callout', control: { c: 'Switch', p: { checked: loud }, on: 'loud' } } },
{ c: 'Input', p: { value: note, placeholder: 'A note', label: 'Note' }, on: 'note' },
loud ? { c: 'Callout', p: { tone: 'info', title: note || 'Nothing yet' } } : { c: 'Text', p: { tone: 'muted', size: 'sm' }, k: [note || 'Nothing yet'] },
] });
wisp.on('note', (v) => { note = String(v); draw(); });
wisp.on('loud', (v) => { loud = v === true; draw(); });
draw();

Focus

Asked for: A setting of my own that other things can read, with no UI

wisp-plugin.json

{
"wispPlugin": 1,
"id": "user.focus",
"name": "Focus",
"version": "1.0.0",
"api": "^1",
"description": "A focus-mode switch in Settings.",
"permissions": [],
"contributes": {
"settings": [
{
"key": "user.focus.on",
"type": "bool",
"default": false,
"title": "Focus mode"
}
]
}
}

Pink

Asked for: A theme: a pink send button, a warmer accent, and its own shade in dark mode

wisp-plugin.json

{
"wispPlugin": 1,
"id": "user.pink",
"name": "Pink",
"version": "1.0.0",
"api": "^1",
"description": "A pink send button and a warmer accent. A theme applies once you trust it: wisp plugin trust user.pink.",
"permissions": [],
"contributes": {
"partStyles": {
":root": {
"--accent": "#d6336c"
},
"composer.send": {
"background": "#d6336c",
"color": "#ffffff",
"border-radius": "999px"
},
"@dark": {
":root": {
"--accent": "#ff7aa8"
},
"composer.send": {
"background": "#ff7aa8",
"color": "#1a1a1a"
}
}
}
}
}