Developers
Reference
extension.json, permissions, field kinds, nbext commands, VS Code commands, error codes and limits.
extension.json
You write the top part by hand. The build adds entry, protocol, categories andactions from your attributes and writes the result next to your dll. Comments and trailing commas are allowed.
{
"id": "acme.spotify-tools",
"name": "Spotify Tools",
"version": "1.2.0",
"publisher": "Acme",
"description": "Control Spotify playback and playlists from your workflows.",
"icon": "assets/icon.png",
"homepage": "https://example.com/spotify-tools",
"engines": { "nimblio": ">=0.1.0" },
"permissions": [ "network" ],
"icons": {
"playlist": "M3.75 5.25h9M3.75 9.25h9M3.75 13.25h5.5M14.5 11v5.25M14.5 16.25a1.75 1.75 0 1 1-1.75-1.75"
}
}| Property | Rules |
|---|---|
id | Required. publisher.name: two parts of lower-case letters, digits and dashes, each up to 40 characters. Never change it. |
name | Required. Up to 60 characters. |
version | Required. A version like 1.2.0, optionally with a pre-release tag: 1.3.0-beta.1. |
publisher | Required. Your name or your company’s, as people should see it. |
description | One or two sentences for the install dialog. |
icon | A PNG inside the package, such as assets/icon.png. |
homepage | Where people can learn more or get help. |
engines.nimblio | The Nimblio versions it works with: >=0.2.0, ^1.0.0, ~1.2.0, or a range like >=1.0.0 <2.0.0. |
permissions | Names from the list below. |
icons | Your own icons by name: see Icons. |
What the build adds
You rarely need to read this part, but it’s what Nimblio, nbext validate and the MCP server see. Fieldtype is the lower-case kind; show comes from[ShowWhen] and validate from Required, Regex, Min andMax.
"entry": "bin/SpotifyTools.dll",
"protocol": 1,
"categories": [ { "id": "spotify", "name": "Spotify", "icon": "music", "color": "#1DB954" } ],
"actions": [
{
"id": "set_volume",
"name": "Set Spotify volume",
"category": "spotify",
"icon": "volume",
"summary": "Set Spotify's volume to {level}%",
"fields": [
{ "key": "level", "label": "Volume", "type": "slider", "default": "40", "min": 0, "max": 100, "unit": "%" },
{ "key": "device", "label": "Device", "type": "text", "optional": true,
"show": { "field": "level", "notEquals": "0" },
"validate": { "regex": "^[A-Za-z0-9 ]+$", "message": "Use letters, digits and spaces." } }
]
}
]Permissions
People see these lines in the install dialog. Nimblio enforces the ones it provides; for the others, declaring them is a promise to the person, so declare everything your code does.
| Name | People see | Enforced for |
|---|---|---|
network | Connect to the internet. Send and receive data from websites and online services. | Declared only |
processes | Start and stop programs. Open, control or close other apps on this PC. | Declared only |
files | Read and change your files. Open, create, change or delete files outside its own folder. | Declared only |
input | Control keyboard and mouse. Press keys, type text or move the mouse as if you did it. | Declared only |
clipboard | Use the clipboard. Read what you copied and put new text on the clipboard. | GetClipboardAsync, SetClipboardAsync |
notifications | Show notifications. Show desktop notifications while workflows run. | NotifyAsync |
system | Change Windows settings. Change things like volume, power or display settings. | Declared only |
Call context.Require(Permissions.Network) (or any other) at the start of an action to fail with a clear message when the declaration is missing, instead of doing something the person didn’t agree to.
Icons
Icon on actions and categories takes any icon name from Nimblio’s own set, such as play,music, volume, message, globe, folder,keyboard, bell or puzzle. To draw your own, add it to icons inextension.json as SVG path data on a 20 × 20 grid. Nimblio strokes it at 1.5 pixels with round ends, in your category’s colour, like its own icons. Then use its name in Icon.
nbext commands
Commands that work on a project use the current folder, or --project <folder or .csproj>.
| Command | What it does |
|---|---|
nbext new <Name> | Creates a project with one action, extension.json and VS Code settings. Options: --publisher "Name", --id publisher.name, --dir <folder>. |
nbext build | Builds in Debug (or --release) and writes extension.json next to the dll. |
nbext pack | Builds in Release and writes bin\Release\<id>-<version>.nbext. |
nbext validate <file> | Runs the checks Nimblio runs before installing, and prints what the file contains. |
nbext install <file> | Opens Nimblio’s install dialog for the file. |
nbext dev | Loads the build into Nimblio and reloads it on every save. --debug makes the host wait for a debugger; --no-watch loads once. Needs Developer mode. |
Build properties
The Nimblio.Sdk package adds these steps to your project’s build. You can set the properties in the .csproj:
NimblioPackOnBuildtruein Release by default: every Release build also writes the.nbext.NimblioPackageDir- Where the
.nbextgoes. Default:bin\<Configuration>. NimblioManifest- Your hand-written
extension.json. Default: next to the project file.
Everything in an assets folder next to the project goes into the package.
Error codes
Run history and the error panel show these codes, which help when people report a problem to you.
| Code | When |
|---|---|
| Your code | The code you pass to ActionException; ACTION_FAILED if you pass none. |
EXTENSION_ERROR | Your action threw an exception other than ActionException. The message is shown; the stack trace is in the log. |
PERMISSION_DENIED | The action used something its extension.json doesn’t declare. |
CONFIG_INVALID | A setting couldn’t be turned into its property type, such as text in a number setting. |
EXTENSION_CRASHED | The host process closed while the step ran. |
EXTENSION_START_FAILED | The host didn’t start, or ActivateAsync threw. |
EXTENSION_MISSING | The step’s extension, or this action in it, isn’t installed or is turned off. |
Limits
- A package can be up to 50 MB unpacked and contain up to 2,000 files. Paths that leave the package are refused.
- Action ids: lower-case letters, digits,
-or_, up to 48 characters. Setting keys: a letter, then letters, digits or_, up to 40. TimeoutSeconds: 1 to 43,200 (12 hours).- The extension runs on .NET 8 as a 64-bit Windows process. Target
net8.0ornet8.0-windows. - The host starts on first use, and stops after 5 idle minutes. Keep
ActivateAsyncshort: it has 30 seconds.
Where Nimblio keeps things
| What | Where |
|---|---|
| Installed extensions | %LOCALAPPDATA%\Nimblio\extensions\<id>\<version>\ |
| Which are installed and on | %LOCALAPPDATA%\Nimblio\extensions.json |
| Your extension’s data and secrets | %LOCALAPPDATA%\Nimblio\extension-data\<id>\ |
| Logs | %LOCALAPPDATA%\Nimblio\logs\extensions\<id>.log |
Environment variables
NIMBLIO_EXE- Where
nbext installfinds Nimblio when it isn’t inC:\Program Files\Nimblioand Developer mode is off. NIMBLIO_DEV_PIPE- Another name for the developer pipe, set for both Nimblio and the tools. Useful when testing against a second copy of Nimblio.
NIMBLIO_SDK_FEED- A NuGet folder or feed that
nbext newadds to the new project’snuget.config, for SDK builds that aren’t on NuGet.