@termix-ssh/plugin-sdk 1.0.22 → 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 (30) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/PLUGIN-GUIDE.md +69 -1
  3. package/dist/backend.d.ts +107 -0
  4. package/dist/capabilities.js +3 -0
  5. package/dist/host/{PluginsTab-CM2B33BD.js → PluginsTab-MNQU5OJ3.js} +4 -4
  6. package/dist/host/{chunk-P26QKKU5.js → chunk-6WLECSNB.js} +35 -5
  7. package/dist/host/{chunk-TK3Y437H.js → chunk-BP42N374.js} +1 -1
  8. package/dist/host/{chunk-ROB2SH5Q.js → chunk-C52NRTA6.js} +9 -5
  9. package/dist/host/{chunk-VKNGNEF3.js → chunk-DN6YKMFJ.js} +1 -1
  10. package/dist/host/{chunk-I5F2PSMR.js → chunk-GBBKHJRQ.js} +9 -9
  11. package/dist/host/{chunk-JRV2HIDK.js → chunk-GRH7GSKG.js} +1 -1
  12. package/dist/host/{chunk-7J4QNGFM.js → chunk-IMPLAAUM.js} +1 -1
  13. package/dist/host/{chunk-HQ6NNFSX.js → chunk-X65V7ZRW.js} +15 -3
  14. package/dist/host/core-classes.json +1 -1
  15. package/dist/host/frame-host.css +1 -1
  16. package/dist/host/frame-host.js +5 -5
  17. package/dist/host/{linked-server-J5G457OA.js → linked-server-YCAJ2NX3.js} +1 -1
  18. package/dist/host/{rbac-api-PY22W5UY.js → rbac-api-A64TXDL5.js} +1 -1
  19. package/dist/host/testing-host.js +6 -6
  20. package/dist/host/types/src/ui/lib/db-health-monitor.d.ts +5 -0
  21. package/dist/host/ui.js +9 -9
  22. package/dist/host/{use-permissions-EWRI3WLT.js → use-permissions-FLQAN6I7.js} +1 -1
  23. package/dist/manifest.d.ts +6 -1
  24. package/dist/manifest.js +7 -1
  25. package/dist/operations.d.ts +222 -0
  26. package/dist/operations.js +650 -0
  27. package/dist/testing.d.ts +9 -1
  28. package/dist/testing.js +45 -0
  29. package/package.json +5 -1
  30. package/schema/manifest.schema.json +25 -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.22",
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"
@@ -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": {