@shinobiapps/shinobi 0.3.2 → 0.4.1

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.
Files changed (32) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/README.md +3 -3
  3. package/dist/dashboard/server.d.ts.map +1 -1
  4. package/dist/dashboard/server.js +32 -0
  5. package/dist/dashboard/server.js.map +1 -1
  6. package/dist/dashboard-spa/assets/index-BjpafK0A.js +318 -0
  7. package/dist/dashboard-spa/assets/index-BjpafK0A.js.map +1 -0
  8. package/dist/dashboard-spa/assets/index-flpjYoXX.css +1 -0
  9. package/dist/dashboard-spa/index.html +2 -2
  10. package/dist/models/notes.d.ts +2 -0
  11. package/dist/models/notes.d.ts.map +1 -1
  12. package/dist/models/notes.js +5 -0
  13. package/dist/models/notes.js.map +1 -1
  14. package/dist/server/tools/notes.d.ts.map +1 -1
  15. package/dist/server/tools/notes.js +28 -2
  16. package/dist/server/tools/notes.js.map +1 -1
  17. package/dist/services/plugins/pages.d.ts +112 -0
  18. package/dist/services/plugins/pages.d.ts.map +1 -0
  19. package/dist/services/plugins/pages.js +237 -0
  20. package/dist/services/plugins/pages.js.map +1 -0
  21. package/dist/services/plugins/registry.d.ts +8 -0
  22. package/dist/services/plugins/registry.d.ts.map +1 -1
  23. package/dist/services/plugins/registry.js +12 -1
  24. package/dist/services/plugins/registry.js.map +1 -1
  25. package/dist/services/plugins/state.d.ts +1 -0
  26. package/dist/services/plugins/state.d.ts.map +1 -1
  27. package/dist/services/plugins/state.js.map +1 -1
  28. package/docs/plugin-development.md +65 -0
  29. package/package.json +1 -1
  30. package/dist/dashboard-spa/assets/index-CUJDeC3Q.js +0 -288
  31. package/dist/dashboard-spa/assets/index-CUJDeC3Q.js.map +0 -1
  32. package/dist/dashboard-spa/assets/index-zCn4MV4E.css +0 -1
@@ -4,6 +4,7 @@ import { deletePluginState, getPluginState, setPluginState, updatePluginState, }
4
4
  import { createApi } from './api.js';
5
5
  import { discoverPlugins } from './discovery.js';
6
6
  import { findPlugin, recordPlugin } from './state.js';
7
+ import { registerPluginPage } from './pages.js';
7
8
  const PLUGIN_TOOL_NAME = /^plugin_[a-z][a-z0-9_]*$/;
8
9
  /** Build a state handle bound to a single plugin's namespace. */
9
10
  export function scopedPluginState(pluginName) {
@@ -32,6 +33,9 @@ function buildPluginRegistry(pluginName, api) {
32
33
  if (info)
33
34
  info.tools_registered.push(def.name);
34
35
  },
36
+ registerPage(def) {
37
+ registerPluginPage(pluginName, def);
38
+ },
35
39
  };
36
40
  }
37
41
  /**
@@ -41,6 +45,7 @@ function buildPluginRegistry(pluginName, api) {
41
45
  */
42
46
  export function createInProcessRegistry(pluginName, api = createApi()) {
43
47
  const tools = new Map();
48
+ const pages = new Map();
44
49
  const registry = {
45
50
  state: scopedPluginState(pluginName),
46
51
  registerTool(def) {
@@ -52,6 +57,11 @@ export function createInProcessRegistry(pluginName, api = createApi()) {
52
57
  }
53
58
  tools.set(def.name, def);
54
59
  },
60
+ registerPage(def) {
61
+ if (pages.has(def.id))
62
+ throw new Error(`plugin '${pluginName}': duplicate page '${def.id}'`);
63
+ pages.set(def.id, def);
64
+ },
55
65
  };
56
66
  const call = async (name, args = {}) => {
57
67
  const def = tools.get(name);
@@ -59,7 +69,7 @@ export function createInProcessRegistry(pluginName, api = createApi()) {
59
69
  throw new Error(`no tool '${name}'`);
60
70
  return await def.handler(args, api);
61
71
  };
62
- return { registry, tools, call };
72
+ return { registry, tools, pages, call };
63
73
  }
64
74
  export async function loadDiscoveredPlugins() {
65
75
  const api = createApi();
@@ -70,6 +80,7 @@ export async function loadDiscoveredPlugins() {
70
80
  source: candidate.source,
71
81
  module_path: candidate.module_path,
72
82
  tools_registered: [],
83
+ pages_registered: [],
73
84
  error: null,
74
85
  });
75
86
  let mod;
@@ -1 +1 @@
1
- {"version":3,"file":"registry.js","sourceRoot":"","sources":["../../../src/services/plugins/registry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAA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AO,QAAQ,KAAK,UAAU,EAAE,CAAC;YACnC,MAAM,IAAI,GAAG,UAAU,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;YACxC,IAAI,IAAI;gBAAE,IAAI,CAAC,KAAK,GAAG,4BAA4B,CAAC;YACpD,SAAS;QACX,CAAC;QAED,IAAI,CAAC;YACH,MAAM,QAAQ,CAAC,mBAAmB,CAAC,SAAS,CAAC,IAAI,EAAE,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC;QAChE,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,MAAM,IAAI,GAAG,UAAU,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;YACxC,IAAI,IAAI;gBAAE,IAAI,CAAC,KAAK,GAAG,mBAAmB,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC;YAC7F,MAAM,CAAC,KAAK,CAAC,uCAAuC,SAAS,CAAC,IAAI,KAAK,IAAI,EAAE,KAAK,IAAI,CAAC,CAAC;QAC1F,CAAC;IACH,CAAC;AACH,CAAC"}
@@ -3,6 +3,7 @@ export interface PluginInfo {
3
3
  source: 'user' | 'npm';
4
4
  module_path: string;
5
5
  tools_registered: string[];
6
+ pages_registered: string[];
6
7
  error: string | null;
7
8
  }
8
9
  export declare function recordPlugin(info: PluginInfo): void;
@@ -1 +1 @@
1
- {"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../../src/services/plugins/state.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,GAAG,KAAK,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,gBAAgB,EAAE,MAAM,EAAE,CAAC;IAC3B,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CACtB;AAID,wBAAgB,YAAY,CAAC,IAAI,EAAE,UAAU,GAAG,IAAI,CAEnD;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS,CAE/D;AAED,wBAAgB,iBAAiB,IAAI,UAAU,EAAE,CAEhD;AAED,wBAAgB,gBAAgB,IAAI,IAAI,CAEvC"}
1
+ {"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../../src/services/plugins/state.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,GAAG,KAAK,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,gBAAgB,EAAE,MAAM,EAAE,CAAC;IAC3B,gBAAgB,EAAE,MAAM,EAAE,CAAC;IAC3B,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CACtB;AAID,wBAAgB,YAAY,CAAC,IAAI,EAAE,UAAU,GAAG,IAAI,CAEnD;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS,CAE/D;AAED,wBAAgB,iBAAiB,IAAI,UAAU,EAAE,CAEhD;AAED,wBAAgB,gBAAgB,IAAI,IAAI,CAEvC"}
@@ -1 +1 @@
1
- {"version":3,"file":"state.js","sourceRoot":"","sources":["../../../src/services/plugins/state.ts"],"names":[],"mappings":"AAQA,MAAM,aAAa,GAAiB,EAAE,CAAC;AAEvC,MAAM,UAAU,YAAY,CAAC,IAAgB;IAC3C,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC3B,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,IAAY;IACrC,OAAO,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;AACpD,CAAC;AAED,MAAM,UAAU,iBAAiB;IAC/B,OAAO,aAAa,CAAC,KAAK,EAAE,CAAC;AAC/B,CAAC;AAED,MAAM,UAAU,gBAAgB;IAC9B,aAAa,CAAC,MAAM,GAAG,CAAC,CAAC;AAC3B,CAAC"}
1
+ {"version":3,"file":"state.js","sourceRoot":"","sources":["../../../src/services/plugins/state.ts"],"names":[],"mappings":"AASA,MAAM,aAAa,GAAiB,EAAE,CAAC;AAEvC,MAAM,UAAU,YAAY,CAAC,IAAgB;IAC3C,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC3B,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,IAAY;IACrC,OAAO,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;AACpD,CAAC;AAED,MAAM,UAAU,iBAAiB;IAC/B,OAAO,aAAa,CAAC,KAAK,EAAE,CAAC;AAC/B,CAAC;AAED,MAAM,UAAU,gBAAgB;IAC9B,aAAa,CAAC,MAAM,GAAG,CAAC,CAAC;AAC3B,CAAC"}
@@ -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.1",
4
4
  "mcpName": "io.github.numbererikson/shinobi",
5
5
  "publishConfig": {
6
6
  "access": "public"