@termix-ssh/plugin-sdk 1.0.21 → 1.0.23

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 (45) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/PLUGIN-GUIDE.md +130 -3
  3. package/cli/commands/build.mjs +55 -36
  4. package/cli/commands/validate.mjs +4 -0
  5. package/dist/backend.d.ts +139 -7
  6. package/dist/capabilities.js +3 -0
  7. package/dist/frontend.d.ts +7 -0
  8. package/dist/host/{PluginsTab-HQGSDSHS.js → PluginsTab-MNQU5OJ3.js} +22 -14
  9. package/dist/host/{chunk-JFQGI4OD.js → chunk-6WLECSNB.js} +71 -12
  10. package/dist/host/chunk-BP42N374.js +53 -0
  11. package/dist/host/{chunk-WWFRBU2E.js → chunk-C52NRTA6.js} +82 -51
  12. package/dist/host/{chunk-GTHINW3L.js → chunk-DN6YKMFJ.js} +34650 -34968
  13. package/dist/host/chunk-GBBKHJRQ.js +1526 -0
  14. package/dist/host/{chunk-FGX27MAA.js → chunk-GRH7GSKG.js} +1 -1
  15. package/dist/host/chunk-IMPLAAUM.js +345 -0
  16. package/dist/host/{chunk-A5CULDWV.js → chunk-X65V7ZRW.js} +121 -1574
  17. package/dist/host/core-classes.json +1 -1
  18. package/dist/host/frame-host.css +2 -0
  19. package/dist/host/frame-host.js +242 -0
  20. package/dist/host/{linked-server-UDSFY3N7.js → linked-server-YCAJ2NX3.js} +1 -1
  21. package/dist/host/{rbac-api-AAAPMF52.js → rbac-api-A64TXDL5.js} +5 -1
  22. package/dist/host/testing-host.js +9 -6
  23. package/dist/host/types/src/types/host-sidebar-preferences.d.ts +2 -0
  24. package/dist/host/types/src/types/index.d.ts +8 -0
  25. package/dist/host/types/src/ui/api/plugins-api.d.ts +2 -1
  26. package/dist/host/types/src/ui/api/rbac-api.d.ts +19 -1
  27. package/dist/host/types/src/ui/components/data-view.d.ts +1 -1
  28. package/dist/host/types/src/ui/lib/db-health-monitor.d.ts +5 -0
  29. package/dist/host/types/src/ui/main-axios.d.ts +1 -1
  30. package/dist/host/types/src/ui/plugin-host/loader.d.ts +6 -0
  31. package/dist/host/types/src/ui/plugin-host/sdk-ui.d.ts +1 -1
  32. package/dist/host/types/src/ui/plugins/use-plugins-manager.d.ts +1 -1
  33. package/dist/host/types/src/ui/shell/tab-registry.d.ts +2 -0
  34. package/dist/host/ui.js +357 -370
  35. package/dist/host/{use-permissions-VAND5GEG.js → use-permissions-FLQAN6I7.js} +1 -1
  36. package/dist/host-commands.d.ts +7 -0
  37. package/dist/host-commands.js +35 -5
  38. package/dist/manifest.d.ts +33 -1
  39. package/dist/manifest.js +114 -1
  40. package/dist/operations.d.ts +222 -0
  41. package/dist/operations.js +650 -0
  42. package/dist/testing.d.ts +9 -1
  43. package/dist/testing.js +45 -0
  44. package/package.json +9 -1
  45. package/schema/manifest.schema.json +67 -0
package/dist/testing.js CHANGED
@@ -146,6 +146,8 @@ export function createFakeContext(options = {}) {
146
146
  const createdSshKeys = [];
147
147
  const notifications = [];
148
148
  const notifyHub = { current: null };
149
+ const operationHandlers = new Map();
150
+ const operationEvents = [];
149
151
  const fetches = [];
150
152
  const processRuns = [];
151
153
  const binaries = [];
@@ -855,6 +857,47 @@ export function createFakeContext(options = {}) {
855
857
  });
856
858
  },
857
859
  },
860
+ operations: {
861
+ register: (id, handler) => {
862
+ operationHandlers.set(id, handler);
863
+ },
864
+ run: async (actionId, options = {}) => {
865
+ const handler = operationHandlers.get(actionId);
866
+ if (!handler)
867
+ throw new Error(`No action "${actionId}"`);
868
+ const result = await handler.run(options.input ?? {}, {
869
+ hostId: options.hostId,
870
+ resourceKey: options.resourceKey,
871
+ runId: null,
872
+ dryRun: options.dryRun === true,
873
+ signal: new AbortController().signal,
874
+ log: () => { },
875
+ });
876
+ return { runId: null, status: "success", ...result };
877
+ },
878
+ invoke: async (actionId, options = {}) => {
879
+ const handler = operationHandlers.get(actionId);
880
+ if (!handler)
881
+ throw new Error(`No action "${actionId}"`);
882
+ const result = await handler.run(options.input ?? {}, {
883
+ hostId: options.hostId,
884
+ resourceKey: options.resourceKey,
885
+ runId: null,
886
+ dryRun: options.dryRun === true,
887
+ signal: new AbortController().signal,
888
+ log: () => { },
889
+ });
890
+ return { runId: null, status: "success", ...result };
891
+ },
892
+ list: async () => ({
893
+ actions: manifest.contributes?.operations?.actions ?? [],
894
+ }),
895
+ emit: async (eventId, payload, options) => {
896
+ operationEvents.push({ eventId, payload, hostId: options?.hostId });
897
+ },
898
+ onEvent: () => () => { },
899
+ approvals: { provide: () => () => { } },
900
+ },
858
901
  notify: {
859
902
  channels: async () => {
860
903
  if (!actor)
@@ -1016,6 +1059,8 @@ export function createFakeContext(options = {}) {
1016
1059
  createdSshKeys,
1017
1060
  notifications,
1018
1061
  notifyHub,
1062
+ operationHandlers,
1063
+ operationEvents,
1019
1064
  fetches,
1020
1065
  processRuns,
1021
1066
  binaries,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@termix-ssh/plugin-sdk",
3
- "version": "1.0.21",
3
+ "version": "1.0.23",
4
4
  "description": "The contract between Termix core and a plugin: types, the capability catalog and the manifest schema.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -61,6 +61,10 @@
61
61
  "types": "./dist/openapi.d.ts",
62
62
  "default": "./dist/openapi.js"
63
63
  },
64
+ "./operations": {
65
+ "types": "./dist/operations.d.ts",
66
+ "default": "./dist/operations.js"
67
+ },
64
68
  "./settings": {
65
69
  "types": "./dist/settings.d.ts",
66
70
  "default": "./dist/settings.js"
@@ -102,6 +106,10 @@
102
106
  "./testing-host": {
103
107
  "default": "./dist/host/testing-host.js"
104
108
  },
109
+ "./frame-host": {
110
+ "default": "./dist/host/frame-host.js"
111
+ },
112
+ "./frame-host.css": "./dist/host/frame-host.css",
105
113
  "./theme.css": "./dist/host/theme.css"
106
114
  },
107
115
  "files": [
@@ -536,6 +536,31 @@
536
536
  }
537
537
  }
538
538
  },
539
+ "hostSections": {
540
+ "type": "array",
541
+ "items": {
542
+ "type": "object",
543
+ "additionalProperties": false,
544
+ "required": ["id", "titleKey"],
545
+ "properties": {
546
+ "id": { "type": "string", "minLength": 1 },
547
+ "titleKey": { "type": "string", "minLength": 1 },
548
+ "icon": { "type": "string", "minLength": 1 }
549
+ }
550
+ }
551
+ },
552
+ "operations": {
553
+ "type": "object",
554
+ "description": "What this plugin can do. Every surface finds these on its own. See the operations section of PLUGIN-GUIDE.md.",
555
+ "additionalProperties": false,
556
+ "properties": {
557
+ "actions": { "type": "array", "items": { "type": "object" } },
558
+ "events": { "type": "array", "items": { "type": "object" } },
559
+ "resources": { "type": "array", "items": { "type": "object" } },
560
+ "signals": { "type": "array", "items": { "type": "object" } },
561
+ "invokes": { "type": "array", "items": { "type": "string" } }
562
+ }
563
+ },
539
564
  "dashboardCards": {
540
565
  "type": "array",
541
566
  "items": {
@@ -1239,6 +1264,48 @@
1239
1264
  }
1240
1265
  }
1241
1266
  }
1267
+ },
1268
+ "mobile": {
1269
+ "type": "object",
1270
+ "description": "How the plugin shows in the Termix mobile app. Needs plugin API 1.13 (Termix 26.10.6).",
1271
+ "additionalProperties": false,
1272
+ "required": ["mode"],
1273
+ "properties": {
1274
+ "mode": {
1275
+ "type": "string",
1276
+ "enum": ["webview", "native", "none"],
1277
+ "description": "webview: the app shows the plugin's UI from the server. native: the app has its own screens. none: nothing to show in the app."
1278
+ },
1279
+ "entry": {
1280
+ "type": "string",
1281
+ "pattern": "\\.js$",
1282
+ "description": "webview only. A bundle built for the app, in the same folder as the frontend bundle. Unset means the normal frontend runs in a phone sized frame."
1283
+ },
1284
+ "sizes": {
1285
+ "type": "array",
1286
+ "minItems": 1,
1287
+ "uniqueItems": true,
1288
+ "items": { "type": "string", "enum": ["phone", "tablet"] },
1289
+ "description": "webview only. Screen sizes the UI works at. Defaults to both."
1290
+ },
1291
+ "views": {
1292
+ "type": "array",
1293
+ "minItems": 1,
1294
+ "uniqueItems": true,
1295
+ "items": { "type": "string", "minLength": 1 },
1296
+ "description": "webview only. Tab, panel or card ids the app offers. Defaults to every tab."
1297
+ },
1298
+ "feature": {
1299
+ "type": "string",
1300
+ "pattern": "^[a-z][a-z0-9-]{1,39}$",
1301
+ "description": "native only. The app feature that stands in for this plugin. Defaults to the plugin id."
1302
+ },
1303
+ "note": {
1304
+ "type": "string",
1305
+ "minLength": 1,
1306
+ "description": "i18n key in the plugin's namespace, or plain text, shown in the app."
1307
+ }
1308
+ }
1242
1309
  }
1243
1310
  }
1244
1311
  },