@termix-ssh/plugin-sdk 1.0.15 → 1.0.17

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 (37) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/PLUGIN-GUIDE.md +92 -72
  3. package/dist/backend.d.ts +370 -0
  4. package/dist/capabilities.js +2 -0
  5. package/dist/frontend.d.ts +45 -0
  6. package/dist/host/{PluginsTab-S33WIIGC.js → PluginsTab-YAGYRBIE.js} +3 -3
  7. package/dist/host/{chunk-57DJU2ZA.js → chunk-2MU6WNSX.js} +1 -1
  8. package/dist/host/{chunk-VFTB2RDP.js → chunk-446UEDSK.js} +4 -2
  9. package/dist/host/{chunk-3L45NNT5.js → chunk-7LEJ3HYF.js} +20 -3
  10. package/dist/host/{chunk-V44FCJBQ.js → chunk-J2AILBXM.js} +540 -400
  11. package/dist/host/{chunk-2IV3VX7F.js → chunk-LQKK2JJA.js} +5 -1
  12. package/dist/host/core-classes.json +1 -1
  13. package/dist/host/{linked-server-SCJH7DSL.js → linked-server-OUF3POT7.js} +5 -3
  14. package/dist/host/{rbac-api-KA5IPQQL.js → rbac-api-LZVENREG.js} +1 -1
  15. package/dist/host/testing-host.js +4 -4
  16. package/dist/host/types/src/types/onboarding.d.ts +0 -1
  17. package/dist/host/types/src/ui/auth/Auth.d.ts +1 -0
  18. package/dist/host/types/src/ui/lib/linked-server.d.ts +2 -0
  19. package/dist/host/types/src/ui/plugin-host/NativeView.d.ts +19 -0
  20. package/dist/host/types/src/ui/plugin-host/sdk-ui.d.ts +2 -6
  21. package/dist/host/types/src/ui/shell/CompanionFrame.d.ts +11 -0
  22. package/dist/host/types/src/ui/shell/companions.d.ts +63 -0
  23. package/dist/host/ui.js +149 -815
  24. package/dist/host/{use-permissions-LLN6TLAL.js → use-permissions-BYCDS5PD.js} +1 -1
  25. package/dist/manifest.d.ts +1 -1
  26. package/dist/manifest.js +1 -1
  27. package/dist/testing.d.ts +5 -1
  28. package/dist/testing.js +28 -0
  29. package/package.json +1 -1
  30. package/schema/manifest.schema.json +2 -0
  31. package/dist/host/types/src/ui/api/sync-api.d.ts +0 -93
  32. package/dist/host/types/src/ui/auth/ElectronLoginForm.d.ts +0 -9
  33. package/dist/host/types/src/ui/hooks/use-sync-status.d.ts +0 -4
  34. package/dist/host/types/src/ui/lib/sync-status.d.ts +0 -6
  35. package/dist/host/types/src/ui/settings/sync/LinkServerDialog.d.ts +0 -12
  36. package/dist/host/types/src/ui/settings/sync/ProxySettingsFields.d.ts +0 -15
  37. package/dist/host/types/src/ui/settings/sync/saved-servers.d.ts +0 -3
@@ -773,6 +773,43 @@ export interface SettingsComponentProps {
773
773
  setValue: (key: string, value: unknown) => void;
774
774
  running: boolean;
775
775
  }
776
+ /** What a companion starts with. Read from the plugin's own settings. */
777
+ export interface CompanionDefaults {
778
+ /** Open by itself the first time a matching tab shows. */
779
+ open?: boolean;
780
+ side?: "left" | "right" | "bottom";
781
+ /** Pixels of width, or height at the bottom. */
782
+ size?: number;
783
+ /** Show the edge button that opens and closes it. Default true. */
784
+ edgeButton?: boolean;
785
+ }
786
+ export interface CompanionProps {
787
+ /** The tab it sits beside. */
788
+ tab: PluginTabRecord;
789
+ host?: PluginHostRecord;
790
+ /** The host in the shape the connection APIs take. */
791
+ sshHost?: Record<string, unknown>;
792
+ /** The tab's surface handle (see TabHandle), read at call time. */
793
+ getHandle: () => TabHandle | null;
794
+ side: "left" | "right" | "bottom";
795
+ /** False while the tab is in the background or the panel is closed. */
796
+ isVisible: boolean;
797
+ close: () => void;
798
+ setSide: (side: "left" | "right" | "bottom") => void;
799
+ }
800
+ export interface CompanionOptions {
801
+ icon?: IconComponent;
802
+ titleKey?: string;
803
+ order?: number;
804
+ /** Tab types it applies to. Any tab with a host when empty. */
805
+ tabTypes?: string[];
806
+ when?: (tab: PluginTabRecord, host?: PluginHostRecord) => boolean;
807
+ /**
808
+ * A hook returning the starting state. It runs in the plugin's scope, so it
809
+ * can read the plugin's settings.
810
+ */
811
+ useDefaults?: () => CompanionDefaults;
812
+ }
776
813
  export type ActionHandler = (...args: never[]) => unknown;
777
814
  export interface ActionSlotDefinition {
778
815
  id: string;
@@ -1001,6 +1038,14 @@ export interface TermixApp extends TermixAppInfo {
1001
1038
  registerRailItem: (item: RailItemContribution) => Disposer;
1002
1039
  registerPanel: (id: string, component: ComponentType<PanelProps>, options?: PanelOptions) => Disposer;
1003
1040
  registerTab: (type: string, component: ComponentType<TabProps>, options?: TabOptions) => Disposer;
1041
+ /**
1042
+ * A panel that sits beside any host tab the options match (a terminal, a
1043
+ * desktop, ...), bound to that tab's host. The user opens, resizes and moves
1044
+ * it; the tab keeps running underneath.
1045
+ */
1046
+ registerCompanion: (id: string, component: ComponentType<CompanionProps>, options?: CompanionOptions) => Disposer;
1047
+ /** Opens a companion on a tab, or closes it when it is showing. */
1048
+ toggleCompanion: (tab: PluginTabRecord, id?: string) => void;
1004
1049
  registerHostEditorSection: (section: HostEditorSectionContribution) => Disposer;
1005
1050
  registerHostAction: (action: HostActionContribution) => Disposer;
1006
1051
  registerHostProtocol: (protocol: HostProtocolContribution) => Disposer;
@@ -29,7 +29,7 @@ import {
29
29
  sortPlugins,
30
30
  uploadEntry,
31
31
  youtubeEmbedUrl
32
- } from "./chunk-VFTB2RDP.js";
32
+ } from "./chunk-446UEDSK.js";
33
33
  import {
34
34
  ArrowDownWideNarrow,
35
35
  BookOpen,
@@ -107,8 +107,8 @@ import {
107
107
  updatePlugin,
108
108
  uploadPlugin,
109
109
  useConfirm
110
- } from "./chunk-2IV3VX7F.js";
111
- import "./chunk-3L45NNT5.js";
110
+ } from "./chunk-LQKK2JJA.js";
111
+ import "./chunk-7LEJ3HYF.js";
112
112
  import {
113
113
  __toESM,
114
114
  define_import_meta_env_default,
@@ -26,7 +26,7 @@ var inFlight = null;
26
26
  function load() {
27
27
  if (cache) return Promise.resolve(cache);
28
28
  if (inFlight) return inFlight;
29
- inFlight = import("./rbac-api-KA5IPQQL.js").then(({ getMyPermissions }) => getMyPermissions()).then((result) => {
29
+ inFlight = import("./rbac-api-LZVENREG.js").then(({ getMyPermissions }) => getMyPermissions()).then((result) => {
30
30
  cache = {
31
31
  permissions: result.permissions ?? [],
32
32
  isAdmin: !!result.isAdmin
@@ -7,10 +7,10 @@ import {
7
7
  Trash,
8
8
  cn,
9
9
  useAreaPreferences
10
- } from "./chunk-2IV3VX7F.js";
10
+ } from "./chunk-LQKK2JJA.js";
11
11
  import {
12
12
  isElectron
13
- } from "./chunk-3L45NNT5.js";
13
+ } from "./chunk-7LEJ3HYF.js";
14
14
  import {
15
15
  __commonJS,
16
16
  __toESM,
@@ -2383,6 +2383,8 @@ var CAPABILITY_CATALOG = [
2383
2383
  entry("db:core-refs", "high"),
2384
2384
  entry("auth:provide", "high"),
2385
2385
  entry("auth:policy", "high"),
2386
+ entry("sync:provide", "high"),
2387
+ entry("ssh:transport", "high"),
2386
2388
  entry("device:serial", "high"),
2387
2389
  entry("notify:hub", "high"),
2388
2390
  entry("ui:layout", "high"),
@@ -7,6 +7,7 @@ import {
7
7
 
8
8
  // src/ui/lib/linked-server.ts
9
9
  init_define_import_meta_env();
10
+ import { useEffect as useEffect2, useState as useState2 } from "react";
10
11
 
11
12
  // src/ui/lib/electron.ts
12
13
  init_define_import_meta_env();
@@ -5432,7 +5433,6 @@ init_define_import_meta_env();
5432
5433
  init_define_import_meta_env();
5433
5434
  var LEGACY_SEEN = Object.freeze({
5434
5435
  plugins: 1,
5435
- "desktop-sync": 1,
5436
5436
  preset: 1,
5437
5437
  appearance: 1,
5438
5438
  security: 1
@@ -6316,7 +6316,7 @@ async function updateRole(roleId, roleData) {
6316
6316
  try {
6317
6317
  const response = await rbacApi.put(`/rbac/roles/${roleId}`, roleData);
6318
6318
  if (roleData.permissions) {
6319
- const { notifyPermissionsChanged } = await import("./use-permissions-LLN6TLAL.js");
6319
+ const { notifyPermissionsChanged } = await import("./use-permissions-BYCDS5PD.js");
6320
6320
  notifyPermissionsChanged();
6321
6321
  }
6322
6322
  return response.data;
@@ -6898,7 +6898,7 @@ function createRemoteOriginApiInstance(path) {
6898
6898
  });
6899
6899
  instance.interceptors.request.use(
6900
6900
  async (config) => {
6901
- const { getLinkedSession: getLinkedSession2 } = await import("./linked-server-SCJH7DSL.js");
6901
+ const { getLinkedSession: getLinkedSession2 } = await import("./linked-server-OUF3POT7.js");
6902
6902
  const linked = await getLinkedSession2();
6903
6903
  config.baseURL = linked ? `${linked.serverUrl}${path}` : "http://no-server-configured";
6904
6904
  if (config.headers.set) {
@@ -7287,6 +7287,22 @@ function notifySyncChanged() {
7287
7287
  cached = null;
7288
7288
  window.dispatchEvent(new CustomEvent(SYNC_CHANGED_EVENT));
7289
7289
  }
7290
+ function useDesktopLinked() {
7291
+ const [linked, setLinked] = useState2(false);
7292
+ useEffect2(() => {
7293
+ let live = true;
7294
+ const read = () => void getLinkedSession().then((session) => {
7295
+ if (live) setLinked(!!session);
7296
+ });
7297
+ read();
7298
+ window.addEventListener(SYNC_CHANGED_EVENT, read);
7299
+ return () => {
7300
+ live = false;
7301
+ window.removeEventListener(SYNC_CHANGED_EVENT, read);
7302
+ };
7303
+ }, []);
7304
+ return linked;
7305
+ }
7290
7306
 
7291
7307
  export {
7292
7308
  getPluginStoreState,
@@ -7332,6 +7348,7 @@ export {
7332
7348
  websocketAuthProtocols,
7333
7349
  getLinkedSession,
7334
7350
  notifySyncChanged,
7351
+ useDesktopLinked,
7335
7352
  resolveConnectionOrigin,
7336
7353
  buildOriginWsUrl,
7337
7354
  getAllServerStatuses,