@shinobiapps/shinobi 0.3.2 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -112,6 +112,71 @@ gives you a registry that collects tools locally and exposes real, scoped
112
112
  `registry.state`, plus a `call(name, args)` helper — handy for unit tests and
113
113
  smoke harnesses without touching the global MCP tool registry.
114
114
 
115
+ ## Dashboard pages (`registry.registerPage`)
116
+
117
+ A plugin can add a page to the dashboard. It shows up in the sidebar under
118
+ **Apps**, at `/apps/<id>`. The page is **data, not code**: `render()` returns a
119
+ list of blocks and the dashboard draws them. Plugins never ship UI code, so a
120
+ page cannot run script in the dashboard, and a single-file plugin stays a
121
+ single file.
122
+
123
+ ```js
124
+ export default function register(registry) {
125
+ registry.registerTool({ name: 'plugin_music_control', /* … */ });
126
+
127
+ if (typeof registry.registerPage === 'function') { // hosts older than 0.4.0 lack it
128
+ registry.registerPage({
129
+ id: 'music', // /apps/music — lowercase, digits, dashes; unique across plugins
130
+ title: 'Music',
131
+ icon: 'music', // music | shield | dumbbell | home | chart | list | package
132
+ order: 10, // sidebar position (lower first), optional
133
+ render: async () => ({
134
+ refreshSeconds: 5, // optional auto-refresh while the page is open (min 2)
135
+ blocks: [
136
+ { type: 'stats', items: [{ label: 'Now playing', value: 'Kashmir', hint: 'Led Zeppelin' }] },
137
+ { type: 'actions', buttons: [
138
+ { label: 'Next', tool: 'plugin_music_control', args: { action: 'next' }, variant: 'primary' },
139
+ ] },
140
+ ],
141
+ }),
142
+ });
143
+ }
144
+ }
145
+ ```
146
+
147
+ `render` may return the blocks array directly, or `{ blocks, refreshSeconds }`.
148
+
149
+ | Block | Fields |
150
+ | --- | --- |
151
+ | `heading` | `text` |
152
+ | `text` | `text`, `tone?` |
153
+ | `stats` | `items: [{ label, value, hint?, tone? }]` |
154
+ | `table` | `columns: string[]`, `rows: string[][]`, `empty?` |
155
+ | `list` | `items: [{ title, subtitle?, badge?, tone? }]`, `empty?` |
156
+ | `progress` | `label`, `value`, `max`, `hint?` |
157
+ | `actions` | `buttons: [{ label, tool, args?, confirm?, variant? }]` |
158
+ | `divider` | — |
159
+
160
+ `tone` is one of `default`, `muted`, `ok`, `warn`, `error`. Button `variant`
161
+ is `default`, `primary` or `danger`. A button with `confirm` asks first.
162
+
163
+ **Rules the host enforces:**
164
+ - Everything is plain text, with lengths and counts capped. Unknown block types
165
+ and malformed fields are dropped.
166
+ - A button may only call a tool registered by **the same plugin**. Buttons
167
+ aimed at core tools or at other plugins' tools are removed. The action
168
+ endpoint refuses them too.
169
+ - `render` and button tools time out after 10 s. A `render` that throws shows
170
+ its error message on the page instead of breaking the dashboard.
171
+ - After a button press the page is re-rendered, so the new state shows at once.
172
+
173
+ Pages load in the same process that loads plugins: the Docker image, or
174
+ `shinobi dashboard` with `SHINOBI_MCP_HTTP=on`. The endpoints are
175
+ `GET /api/plugin-pages`, `GET /api/plugin-pages/:id` and
176
+ `POST /api/plugin-pages/:id/action` (`{ tool, args }`), all behind dashboard
177
+ auth. The in-process test registry (`createInProcessRegistry`) collects pages
178
+ in a `pages` map, so a plugin's `render` can be unit-tested.
179
+
115
180
  ## Async handlers
116
181
 
117
182
  Handlers may be async. Throw on invalid input; the MCP server catches and returns `isError: true` to the client.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shinobiapps/shinobi",
3
- "version": "0.3.2",
3
+ "version": "0.4.0",
4
4
  "mcpName": "io.github.numbererikson/shinobi",
5
5
  "publishConfig": {
6
6
  "access": "public"