@termix-ssh/plugin-sdk 1.0.0 → 1.0.2

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 (52) hide show
  1. package/CHANGELOG.md +54 -0
  2. package/README.md +8 -1
  3. package/cli/commands/changelog.mjs +25 -0
  4. package/cli/commands/dev.mjs +158 -0
  5. package/cli/commands/validate.mjs +16 -24
  6. package/cli/index.mjs +8 -0
  7. package/cli/lib/tmxplug.mjs +1 -1
  8. package/dist/backend.d.ts +6 -2
  9. package/dist/changelog.d.ts +62 -0
  10. package/dist/changelog.js +187 -0
  11. package/dist/frontend.d.ts +67 -1
  12. package/dist/host/{chunk-F3SDZDDG.js → chunk-LKYAVM4T.js} +17 -2
  13. package/dist/host/{chunk-XH5NXL6Y.js → chunk-SS43S6VI.js} +7816 -7344
  14. package/dist/host/{chunk-XGWE7BTJ.js → chunk-XKMRKQFN.js} +6 -1
  15. package/dist/host/{linked-server-FZGWQW32.js → linked-server-DW5P3NLZ.js} +1 -1
  16. package/dist/host/{rbac-api-6KDMBVDZ.js → rbac-api-JKISXZEP.js} +1 -1
  17. package/dist/host/testing-host.js +38 -5
  18. package/dist/host/types/src/types/credential-sidebar-preferences.d.ts +12 -1
  19. package/dist/host/types/src/types/host-sidebar-preferences.d.ts +18 -1
  20. package/dist/host/types/src/types/onboarding.d.ts +29 -0
  21. package/dist/host/types/src/types/plugin-onboarding.d.ts +39 -0
  22. package/dist/host/types/src/types/ui-preferences.d.ts +13 -4
  23. package/dist/host/types/src/types/ui-types.d.ts +1 -1
  24. package/dist/host/types/src/ui/api/plugins-api.d.ts +211 -0
  25. package/dist/host/types/src/ui/api/system-status-api.d.ts +24 -0
  26. package/dist/host/types/src/ui/components/connection/ConnectionLogPanel.d.ts +2 -1
  27. package/dist/host/types/src/ui/components/connection/ConnectionScreen.d.ts +5 -5
  28. package/dist/host/types/src/ui/components/list-kit.d.ts +102 -0
  29. package/dist/host/types/src/ui/components/panel-layout.d.ts +6 -1
  30. package/dist/host/types/src/ui/components/surface/surface-scope.d.ts +5 -1
  31. package/dist/host/types/src/ui/contexts/UiPreferencesContext.d.ts +15 -2
  32. package/dist/host/types/src/ui/hooks/use-installed-plugins.d.ts +6 -0
  33. package/dist/host/types/src/ui/hooks/use-permissions.d.ts +2 -0
  34. package/dist/host/types/src/ui/lib/embedded-frame.d.ts +14 -0
  35. package/dist/host/types/src/ui/onboarding/onboarding-registry.d.ts +49 -0
  36. package/dist/host/types/src/ui/plugin-host/sdk-ui.d.ts +1 -0
  37. package/dist/host/types/src/ui/plugins/open-plugins.d.ts +5 -0
  38. package/dist/host/types/src/ui/settings/settings-fields-util.d.ts +10 -0
  39. package/dist/host/types/src/ui/sidebar/host-contributions.d.ts +2 -0
  40. package/dist/host/types/src/ui/sidebar/rail-items.d.ts +10 -0
  41. package/dist/host/ui.js +1097 -787
  42. package/dist/host/{use-permissions-NULZL43J.js → use-permissions-5CZEA3P4.js} +3 -1
  43. package/dist/manifest.d.ts +19 -2
  44. package/dist/manifest.js +82 -1
  45. package/dist/testing/setup.js +8 -0
  46. package/dist/testing.d.ts +12 -0
  47. package/dist/vitest-preset.d.ts +3 -0
  48. package/dist/vitest-preset.js +6 -0
  49. package/package.json +7 -3
  50. package/schema/manifest.schema.json +12 -1
  51. package/cli/lib/changelog.mjs +0 -126
  52. package/schema/changelog.schema.json +0 -67
@@ -636,7 +636,11 @@ export interface ActionSlotDefinition {
636
636
  export interface SlotContribution {
637
637
  actionId: string;
638
638
  titleKey: string;
639
- /** Secondary text, for slots that show one (onboarding cards). */
639
+ /**
640
+ * Secondary text, for slots that show one. The onboarding.* slots that
641
+ * used it are deprecated: use registerOnboardingStep. The feature and
642
+ * workflow card slots are no longer shown.
643
+ */
640
644
  descriptionKey?: string;
641
645
  icon?: IconComponent;
642
646
  kind?: "button" | "component" | string;
@@ -646,6 +650,61 @@ export interface SlotContribution {
646
650
  when?: (context: Record<string, unknown>) => boolean;
647
651
  order?: number;
648
652
  }
653
+ export type OnboardingMode = "full" | "partial" | "rerun";
654
+ /**
655
+ * Where a plugin step sits in onboarding. "setup" comes right after the
656
+ * appearance steps, for things that need doing before the feature works
657
+ * (like pointing at a guacd server). "explore" (the default) comes after
658
+ * that, "security" after the account security step. Onboarding is for
659
+ * choices, not for explaining features.
660
+ */
661
+ export type OnboardingSection = "setup" | "explore" | "security";
662
+ export interface OnboardingStepProps {
663
+ /**
664
+ * "full" is a new user's first run, "partial" shows only steps they have
665
+ * not seen yet (a plugin installed later, a step whose version went up),
666
+ * "rerun" is the user running setup again from settings.
667
+ */
668
+ mode: OnboardingMode;
669
+ isAdmin: boolean;
670
+ isDesktop: boolean;
671
+ /** Blocks or allows Next. Steps can continue by default. */
672
+ setCanContinue: (ok: boolean) => void;
673
+ /**
674
+ * Runs when Next is pressed, before moving on. Return false to stay on the
675
+ * step (to show an error, say). Pass null to clear it.
676
+ */
677
+ setBeforeNext: (fn: (() => boolean | Promise<boolean>) | null) => void;
678
+ /**
679
+ * False on a first run, which shows before the app shell exists: app.tabs
680
+ * and the shell callbacks do nothing until it is true.
681
+ */
682
+ shellReady: boolean;
683
+ }
684
+ export interface OnboardingStepContribution {
685
+ /** Unique within the plugin. Lowercase letters, digits and dashes. */
686
+ id: string;
687
+ /**
688
+ * Starts at 1. Raise it when the step changes enough that people who saw
689
+ * it should see it again; they get just this step, not all of onboarding.
690
+ */
691
+ version?: number;
692
+ titleKey: string;
693
+ descriptionKey?: string;
694
+ icon?: IconComponent;
695
+ component: ComponentType<OnboardingStepProps>;
696
+ /** "admin" shows it only to users who can manage plugins. */
697
+ audience?: "all" | "admin";
698
+ /** A permission the user must hold, like registerAction's. */
699
+ permission?: string;
700
+ section?: OnboardingSection;
701
+ order?: number;
702
+ when?: (context: {
703
+ isAdmin: boolean;
704
+ isDesktop: boolean;
705
+ mode: OnboardingMode;
706
+ }) => boolean;
707
+ }
649
708
  export interface SshAuthEditorProps {
650
709
  form: Record<string, unknown>;
651
710
  setField: (key: string, value: unknown) => void;
@@ -800,6 +859,13 @@ export interface TermixApp extends TermixAppInfo {
800
859
  }) => Disposer;
801
860
  declareActionSlot: (slot: ActionSlotDefinition) => Disposer;
802
861
  registerSlotContribution: (slotId: string, contribution: SlotContribution) => Disposer;
862
+ /**
863
+ * Adds a step to onboarding. New users see it in their first run; people
864
+ * who already finished onboarding see just this step the next time they
865
+ * open Termix (or right away, if they install the plugin mid-session).
866
+ * Needs plugin API 1.1.
867
+ */
868
+ registerOnboardingStep: (step: OnboardingStepContribution) => Disposer;
803
869
  invokeAction: (id: string, ...args: unknown[]) => Promise<unknown>;
804
870
  /**
805
871
  * Offers a component to other plugins and to core by id, rendered where
@@ -4759,6 +4759,18 @@ async function buildOriginWsUrl({
4759
4759
  };
4760
4760
  }
4761
4761
 
4762
+ // src/types/onboarding.ts
4763
+ var LEGACY_SEEN = Object.freeze({
4764
+ plugins: 1,
4765
+ "desktop-sync": 1,
4766
+ preset: 1,
4767
+ appearance: 1,
4768
+ security: 1
4769
+ });
4770
+ function pluginStepKey(pluginId, id) {
4771
+ return `${pluginId}:${id}`;
4772
+ }
4773
+
4762
4774
  // src/types/ui-preferences.ts
4763
4775
  var SIMPLE_RAIL_VISIBLE = ["hosts", "credentials", "connections"];
4764
4776
  var CORE_HIDEABLE_RAIL_VIEWS = [
@@ -4870,6 +4882,7 @@ var AREA_SPECS = {
4870
4882
  },
4871
4883
  rail: {
4872
4884
  hiddenTabs: { kind: "stringArray" },
4885
+ order: { kind: "stringArray" },
4873
4886
  hidePluginItems: { kind: "bool" }
4874
4887
  },
4875
4888
  dashboard: {
@@ -5024,7 +5037,7 @@ async function updateRole(roleId, roleData) {
5024
5037
  try {
5025
5038
  const response = await rbacApi.put(`/rbac/roles/${roleId}`, roleData);
5026
5039
  if (roleData.permissions) {
5027
- const { notifyPermissionsChanged } = await import("./use-permissions-NULZL43J.js");
5040
+ const { notifyPermissionsChanged } = await import("./use-permissions-5CZEA3P4.js");
5028
5041
  notifyPermissionsChanged();
5029
5042
  }
5030
5043
  return response.data;
@@ -5574,7 +5587,7 @@ function createRemoteOriginApiInstance(path) {
5574
5587
  });
5575
5588
  instance.interceptors.request.use(
5576
5589
  async (config) => {
5577
- const { getLinkedSession: getLinkedSession2 } = await import("./linked-server-FZGWQW32.js");
5590
+ const { getLinkedSession: getLinkedSession2 } = await import("./linked-server-DW5P3NLZ.js");
5578
5591
  const linked = await getLinkedSession2();
5579
5592
  config.baseURL = linked ? `${linked.serverUrl}${path}` : "http://no-server-configured";
5580
5593
  if (config.headers.set) {
@@ -5926,6 +5939,7 @@ function notifySyncChanged() {
5926
5939
  }
5927
5940
 
5928
5941
  export {
5942
+ getPluginStoreState,
5929
5943
  usePluginStore,
5930
5944
  setPluginSummaries,
5931
5945
  markPluginsSettled,
@@ -5957,6 +5971,7 @@ export {
5957
5971
  notifySyncChanged,
5958
5972
  resolveConnectionOrigin,
5959
5973
  buildOriginWsUrl,
5974
+ pluginStepKey,
5960
5975
  PRESETS,
5961
5976
  hydrateLocalSharedHostAuth,
5962
5977
  resolveRemoteHostId,