@termix-ssh/plugin-sdk 1.0.0 → 1.0.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 (48) hide show
  1. package/README.md +7 -0
  2. package/cli/commands/changelog.mjs +25 -0
  3. package/cli/commands/dev.mjs +158 -0
  4. package/cli/commands/validate.mjs +16 -24
  5. package/cli/index.mjs +8 -0
  6. package/cli/lib/tmxplug.mjs +1 -1
  7. package/dist/backend.d.ts +6 -2
  8. package/dist/changelog.d.ts +67 -0
  9. package/dist/changelog.js +195 -0
  10. package/dist/frontend.d.ts +67 -1
  11. package/dist/host/{chunk-XGWE7BTJ.js → chunk-3KG44G55.js} +6 -1
  12. package/dist/host/{chunk-XH5NXL6Y.js → chunk-7GL25GFS.js} +8013 -7606
  13. package/dist/host/{chunk-F3SDZDDG.js → chunk-COGRSHKO.js} +17 -2
  14. package/dist/host/{linked-server-FZGWQW32.js → linked-server-BD573BEG.js} +1 -1
  15. package/dist/host/{rbac-api-6KDMBVDZ.js → rbac-api-7GHDJLU4.js} +1 -1
  16. package/dist/host/testing-host.js +38 -5
  17. package/dist/host/types/src/types/credential-sidebar-preferences.d.ts +12 -1
  18. package/dist/host/types/src/types/host-sidebar-preferences.d.ts +18 -1
  19. package/dist/host/types/src/types/onboarding.d.ts +29 -0
  20. package/dist/host/types/src/types/plugin-onboarding.d.ts +39 -0
  21. package/dist/host/types/src/types/ui-preferences.d.ts +13 -4
  22. package/dist/host/types/src/types/ui-types.d.ts +1 -1
  23. package/dist/host/types/src/ui/api/plugins-api.d.ts +194 -0
  24. package/dist/host/types/src/ui/components/connection/ConnectionLogPanel.d.ts +2 -1
  25. package/dist/host/types/src/ui/components/connection/ConnectionScreen.d.ts +5 -5
  26. package/dist/host/types/src/ui/components/list-kit.d.ts +102 -0
  27. package/dist/host/types/src/ui/components/panel-layout.d.ts +6 -1
  28. package/dist/host/types/src/ui/components/surface/surface-scope.d.ts +5 -1
  29. package/dist/host/types/src/ui/contexts/UiPreferencesContext.d.ts +15 -2
  30. package/dist/host/types/src/ui/hooks/use-permissions.d.ts +2 -0
  31. package/dist/host/types/src/ui/lib/embedded-frame.d.ts +14 -0
  32. package/dist/host/types/src/ui/onboarding/onboarding-registry.d.ts +49 -0
  33. package/dist/host/types/src/ui/plugin-host/sdk-ui.d.ts +1 -0
  34. package/dist/host/types/src/ui/plugins/open-plugins.d.ts +5 -0
  35. package/dist/host/types/src/ui/sidebar/host-contributions.d.ts +2 -0
  36. package/dist/host/types/src/ui/sidebar/rail-items.d.ts +10 -0
  37. package/dist/host/ui.js +982 -698
  38. package/dist/host/{use-permissions-NULZL43J.js → use-permissions-SKWXHWDJ.js} +3 -1
  39. package/dist/manifest.d.ts +10 -2
  40. package/dist/manifest.js +46 -1
  41. package/dist/testing/setup.js +8 -0
  42. package/dist/testing.d.ts +12 -0
  43. package/dist/vitest-preset.d.ts +3 -0
  44. package/dist/vitest-preset.js +6 -0
  45. package/package.json +5 -2
  46. package/schema/manifest.schema.json +6 -1
  47. package/cli/lib/changelog.mjs +0 -126
  48. 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
@@ -21,7 +21,7 @@ var inFlight = null;
21
21
  function load() {
22
22
  if (cache) return Promise.resolve(cache);
23
23
  if (inFlight) return inFlight;
24
- inFlight = import("./rbac-api-6KDMBVDZ.js").then(({ getMyPermissions }) => getMyPermissions()).then((result) => {
24
+ inFlight = import("./rbac-api-7GHDJLU4.js").then(({ getMyPermissions }) => getMyPermissions()).then((result) => {
25
25
  cache = {
26
26
  permissions: result.permissions ?? [],
27
27
  isAdmin: !!result.isAdmin
@@ -39,6 +39,10 @@ async function hasPermission(permission) {
39
39
  const { permissions, isAdmin } = await load();
40
40
  return matchesPermission(permissions, isAdmin, permission);
41
41
  }
42
+ async function loadPermissionChecker() {
43
+ const { permissions, isAdmin } = await load();
44
+ return (permission) => matchesPermission(permissions, isAdmin, permission);
45
+ }
42
46
  function preloadPermissions() {
43
47
  return load().then(() => void 0);
44
48
  }
@@ -82,6 +86,7 @@ function setPermissionsForTesting(permissions, isAdmin = false) {
82
86
 
83
87
  export {
84
88
  hasPermission,
89
+ loadPermissionChecker,
85
90
  preloadPermissions,
86
91
  notifyPermissionsChanged,
87
92
  usePermissions,