@termix-ssh/plugin-sdk 1.0.0

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 (236) hide show
  1. package/README.md +52 -0
  2. package/cli/commands/build.mjs +246 -0
  3. package/cli/commands/migrations.mjs +248 -0
  4. package/cli/commands/pack.mjs +42 -0
  5. package/cli/commands/sign.mjs +83 -0
  6. package/cli/commands/test.mjs +33 -0
  7. package/cli/commands/validate.mjs +215 -0
  8. package/cli/index.mjs +65 -0
  9. package/cli/lib/changelog.mjs +126 -0
  10. package/cli/lib/externals.mjs +46 -0
  11. package/cli/lib/plugin-dir.mjs +29 -0
  12. package/cli/lib/signing.mjs +86 -0
  13. package/cli/lib/static-url-imports.mjs +54 -0
  14. package/cli/lib/tmxplug.mjs +106 -0
  15. package/cli/patches/guacamole-common-js-flush.cjs +76 -0
  16. package/cli/patches/xterm-android-ime.cjs +130 -0
  17. package/client.d.ts +13 -0
  18. package/dist/backend.d.ts +1777 -0
  19. package/dist/backend.js +84 -0
  20. package/dist/capabilities.d.ts +38 -0
  21. package/dist/capabilities.js +71 -0
  22. package/dist/db.d.ts +112 -0
  23. package/dist/db.js +189 -0
  24. package/dist/ddl.d.ts +76 -0
  25. package/dist/ddl.js +678 -0
  26. package/dist/desktop.d.ts +346 -0
  27. package/dist/desktop.js +5 -0
  28. package/dist/frontend.d.ts +1206 -0
  29. package/dist/frontend.js +388 -0
  30. package/dist/host/chunk-F3SDZDDG.js +6017 -0
  31. package/dist/host/chunk-XGWE7BTJ.js +90 -0
  32. package/dist/host/chunk-XH5NXL6Y.js +56314 -0
  33. package/dist/host/chunk-YC2MAKSP.js +14 -0
  34. package/dist/host/linked-server-FZGWQW32.js +12 -0
  35. package/dist/host/rbac-api-6KDMBVDZ.js +52 -0
  36. package/dist/host/testing-host.js +414 -0
  37. package/dist/host/theme.css +91 -0
  38. package/dist/host/types/src/types/auth-protocols.d.ts +10 -0
  39. package/dist/host/types/src/types/connection-log.d.ts +13 -0
  40. package/dist/host/types/src/types/credential-sidebar-preferences.d.ts +38 -0
  41. package/dist/host/types/src/types/host-defaults.d.ts +60 -0
  42. package/dist/host/types/src/types/host-sidebar-preferences.d.ts +55 -0
  43. package/dist/host/types/src/types/index.d.ts +298 -0
  44. package/dist/host/types/src/types/keybindings.d.ts +27 -0
  45. package/dist/host/types/src/types/ui-preferences.d.ts +102 -0
  46. package/dist/host/types/src/types/ui-types.d.ts +260 -0
  47. package/dist/host/types/src/ui/api/admin-user-data-api.d.ts +11 -0
  48. package/dist/host/types/src/ui/api/auth-methods-api.d.ts +63 -0
  49. package/dist/host/types/src/ui/api/credential-sidebar-preferences-api.d.ts +3 -0
  50. package/dist/host/types/src/ui/api/credentials-api.d.ts +56 -0
  51. package/dist/host/types/src/ui/api/dashboard-api.d.ts +23 -0
  52. package/dist/host/types/src/ui/api/external-account-api.d.ts +8 -0
  53. package/dist/host/types/src/ui/api/host-sidebar-preferences-api.d.ts +3 -0
  54. package/dist/host/types/src/ui/api/host-status-api.d.ts +11 -0
  55. package/dist/host/types/src/ui/api/open-tabs-api.d.ts +74 -0
  56. package/dist/host/types/src/ui/api/plugins-api.d.ts +128 -0
  57. package/dist/host/types/src/ui/api/rbac-api.d.ts +167 -0
  58. package/dist/host/types/src/ui/api/settings-api.d.ts +22 -0
  59. package/dist/host/types/src/ui/api/ssh-host-management-api.d.ts +65 -0
  60. package/dist/host/types/src/ui/api/sync-api.d.ts +93 -0
  61. package/dist/host/types/src/ui/api/system-status-api.d.ts +49 -0
  62. package/dist/host/types/src/ui/api/ui-preferences-api.d.ts +8 -0
  63. package/dist/host/types/src/ui/api/user-management-api.d.ts +80 -0
  64. package/dist/host/types/src/ui/auth/Auth.d.ts +12 -0
  65. package/dist/host/types/src/ui/auth/auth-bits.d.ts +11 -0
  66. package/dist/host/types/src/ui/auth/silent-signin.d.ts +2 -0
  67. package/dist/host/types/src/ui/components/FullScreenAppWrapper.d.ts +9 -0
  68. package/dist/host/types/src/ui/components/alert-dialog.d.ts +14 -0
  69. package/dist/host/types/src/ui/components/alert.d.ts +9 -0
  70. package/dist/host/types/src/ui/components/badge.d.ts +9 -0
  71. package/dist/host/types/src/ui/components/button.d.ts +13 -0
  72. package/dist/host/types/src/ui/components/card-grid/CardGridCanvas.d.ts +22 -0
  73. package/dist/host/types/src/ui/components/card-grid/layout-utils.d.ts +26 -0
  74. package/dist/host/types/src/ui/components/card-grid/types.d.ts +29 -0
  75. package/dist/host/types/src/ui/components/card-masonry.d.ts +16 -0
  76. package/dist/host/types/src/ui/components/card.d.ts +11 -0
  77. package/dist/host/types/src/ui/components/charts/BarSeries.d.ts +16 -0
  78. package/dist/host/types/src/ui/components/charts/LineChart.d.ts +17 -0
  79. package/dist/host/types/src/ui/components/charts/RadialGauge.d.ts +18 -0
  80. package/dist/host/types/src/ui/components/charts/Sparkline.d.ts +22 -0
  81. package/dist/host/types/src/ui/components/charts/StatRow.d.ts +15 -0
  82. package/dist/host/types/src/ui/components/charts/geometry.d.ts +20 -0
  83. package/dist/host/types/src/ui/components/charts/index.d.ts +4 -0
  84. package/dist/host/types/src/ui/components/checkbox.d.ts +4 -0
  85. package/dist/host/types/src/ui/components/connection/ConnectionGate.d.ts +56 -0
  86. package/dist/host/types/src/ui/components/connection/ConnectionLogPanel.d.ts +9 -0
  87. package/dist/host/types/src/ui/components/connection/ConnectionScreen.d.ts +34 -0
  88. package/dist/host/types/src/ui/components/connection/connection-status.d.ts +1 -0
  89. package/dist/host/types/src/ui/components/data-view.d.ts +32 -0
  90. package/dist/host/types/src/ui/components/dialog.d.ts +17 -0
  91. package/dist/host/types/src/ui/components/dropdown-menu.d.ts +29 -0
  92. package/dist/host/types/src/ui/components/empty-state.d.ts +19 -0
  93. package/dist/host/types/src/ui/components/form-fields.d.ts +115 -0
  94. package/dist/host/types/src/ui/components/input.d.ts +3 -0
  95. package/dist/host/types/src/ui/components/kbd.d.ts +12 -0
  96. package/dist/host/types/src/ui/components/label.d.ts +4 -0
  97. package/dist/host/types/src/ui/components/manager-card.d.ts +25 -0
  98. package/dist/host/types/src/ui/components/meter.d.ts +14 -0
  99. package/dist/host/types/src/ui/components/metric-card.d.ts +18 -0
  100. package/dist/host/types/src/ui/components/panel-layout.d.ts +83 -0
  101. package/dist/host/types/src/ui/components/password-input.d.ts +4 -0
  102. package/dist/host/types/src/ui/components/popover.d.ts +7 -0
  103. package/dist/host/types/src/ui/components/scroll-area.d.ts +5 -0
  104. package/dist/host/types/src/ui/components/section-card.d.ts +29 -0
  105. package/dist/host/types/src/ui/components/select.d.ts +15 -0
  106. package/dist/host/types/src/ui/components/select2.d.ts +8 -0
  107. package/dist/host/types/src/ui/components/separator.d.ts +4 -0
  108. package/dist/host/types/src/ui/components/sheet.d.ts +14 -0
  109. package/dist/host/types/src/ui/components/sidebar.d.ts +69 -0
  110. package/dist/host/types/src/ui/components/skeleton.d.ts +2 -0
  111. package/dist/host/types/src/ui/components/slider.d.ts +4 -0
  112. package/dist/host/types/src/ui/components/sonner.d.ts +4 -0
  113. package/dist/host/types/src/ui/components/surface/prompt-styles.d.ts +4 -0
  114. package/dist/host/types/src/ui/components/surface/surface-scope.d.ts +79 -0
  115. package/dist/host/types/src/ui/components/switch.d.ts +4 -0
  116. package/dist/host/types/src/ui/components/tab-strip.d.ts +19 -0
  117. package/dist/host/types/src/ui/components/tabs.d.ts +7 -0
  118. package/dist/host/types/src/ui/components/textarea.d.ts +4 -0
  119. package/dist/host/types/src/ui/components/theme-provider.d.ts +14 -0
  120. package/dist/host/types/src/ui/components/tooltip.d.ts +7 -0
  121. package/dist/host/types/src/ui/contexts/BrandingContext.d.ts +15 -0
  122. package/dist/host/types/src/ui/contexts/UiPreferencesContext.d.ts +38 -0
  123. package/dist/host/types/src/ui/contexts/branding-document.d.ts +10 -0
  124. package/dist/host/types/src/ui/dashboard/dashboard-cards-registry.d.ts +30 -0
  125. package/dist/host/types/src/ui/hooks/use-action-slot.d.ts +10 -0
  126. package/dist/host/types/src/ui/hooks/use-adaptive-polling.d.ts +5 -0
  127. package/dist/host/types/src/ui/hooks/use-mobile.d.ts +1 -0
  128. package/dist/host/types/src/ui/hooks/use-permissions.d.ts +29 -0
  129. package/dist/host/types/src/ui/hooks/use-status-color-scheme.d.ts +12 -0
  130. package/dist/host/types/src/ui/hooks/use-sync-status.d.ts +4 -0
  131. package/dist/host/types/src/ui/hooks/useSshAuthProviders.d.ts +17 -0
  132. package/dist/host/types/src/ui/i18n/i18n.d.ts +52 -0
  133. package/dist/host/types/src/ui/lib/ServerStatusContext.d.ts +33 -0
  134. package/dist/host/types/src/ui/lib/adaptive-polling.d.ts +29 -0
  135. package/dist/host/types/src/ui/lib/adaptive-resource-budget.d.ts +39 -0
  136. package/dist/host/types/src/ui/lib/app-keyboard-shortcuts.d.ts +8 -0
  137. package/dist/host/types/src/ui/lib/base-path.d.ts +1 -0
  138. package/dist/host/types/src/ui/lib/clipboard-provider.d.ts +9 -0
  139. package/dist/host/types/src/ui/lib/clipboard.d.ts +20 -0
  140. package/dist/host/types/src/ui/lib/connection-origin.d.ts +47 -0
  141. package/dist/host/types/src/ui/lib/db-health-monitor.d.ts +34 -0
  142. package/dist/host/types/src/ui/lib/device-id.d.ts +1 -0
  143. package/dist/host/types/src/ui/lib/electron.d.ts +1 -0
  144. package/dist/host/types/src/ui/lib/embedded-server-status.d.ts +15 -0
  145. package/dist/host/types/src/ui/lib/error-message.d.ts +9 -0
  146. package/dist/host/types/src/ui/lib/frontend-logger.d.ts +67 -0
  147. package/dist/host/types/src/ui/lib/global-shortcut-handler.d.ts +3 -0
  148. package/dist/host/types/src/ui/lib/host-defaults-context.d.ts +48 -0
  149. package/dist/host/types/src/ui/lib/hosts-request-cache.d.ts +9 -0
  150. package/dist/host/types/src/ui/lib/keybinding-match.d.ts +3 -0
  151. package/dist/host/types/src/ui/lib/linked-server.d.ts +10 -0
  152. package/dist/host/types/src/ui/lib/local-adaptive-engine.d.ts +40 -0
  153. package/dist/host/types/src/ui/lib/permissions.d.ts +16 -0
  154. package/dist/host/types/src/ui/lib/plugin-i18n.d.ts +11 -0
  155. package/dist/host/types/src/ui/lib/plugin-icon.d.ts +11 -0
  156. package/dist/host/types/src/ui/lib/plugin-transport.d.ts +50 -0
  157. package/dist/host/types/src/ui/lib/registry.d.ts +29 -0
  158. package/dist/host/types/src/ui/lib/rem.d.ts +7 -0
  159. package/dist/host/types/src/ui/lib/remote-server-api.d.ts +11 -0
  160. package/dist/host/types/src/ui/lib/server-status-store.d.ts +37 -0
  161. package/dist/host/types/src/ui/lib/sync-events.d.ts +2 -0
  162. package/dist/host/types/src/ui/lib/sync-status.d.ts +6 -0
  163. package/dist/host/types/src/ui/lib/tab-jump-hotkey.d.ts +4 -0
  164. package/dist/host/types/src/ui/lib/theme.d.ts +21 -0
  165. package/dist/host/types/src/ui/lib/ttl-request-cache.d.ts +10 -0
  166. package/dist/host/types/src/ui/lib/usage-color.d.ts +5 -0
  167. package/dist/host/types/src/ui/lib/utils.d.ts +2 -0
  168. package/dist/host/types/src/ui/lib/visible-interval.d.ts +5 -0
  169. package/dist/host/types/src/ui/lib/widget-title.d.ts +8 -0
  170. package/dist/host/types/src/ui/lib/ws-auth.d.ts +1 -0
  171. package/dist/host/types/src/ui/main-axios.d.ts +170 -0
  172. package/dist/host/types/src/ui/plugin-host/PluginViewPlaceholder.d.ts +13 -0
  173. package/dist/host/types/src/ui/plugin-host/app.d.ts +18 -0
  174. package/dist/host/types/src/ui/plugin-host/auth-registry.d.ts +50 -0
  175. package/dist/host/types/src/ui/plugin-host/bridge.d.ts +26 -0
  176. package/dist/host/types/src/ui/plugin-host/component-registry.d.ts +24 -0
  177. package/dist/host/types/src/ui/plugin-host/desktop.d.ts +7 -0
  178. package/dist/host/types/src/ui/plugin-host/extension-registry.d.ts +16 -0
  179. package/dist/host/types/src/ui/plugin-host/host-scope.d.ts +26 -0
  180. package/dist/host/types/src/ui/plugin-host/loader.d.ts +52 -0
  181. package/dist/host/types/src/ui/plugin-host/plugin-store.d.ts +40 -0
  182. package/dist/host/types/src/ui/plugin-host/scope.d.ts +20 -0
  183. package/dist/host/types/src/ui/plugin-host/sdk-ui.d.ts +99 -0
  184. package/dist/host/types/src/ui/plugin-host/shell-bridge.d.ts +67 -0
  185. package/dist/host/types/src/ui/plugin-host/view-ownership.d.ts +31 -0
  186. package/dist/host/types/src/ui/settings/HostPluginSections.d.ts +31 -0
  187. package/dist/host/types/src/ui/settings/SettingsFields.d.ts +22 -0
  188. package/dist/host/types/src/ui/settings/host-feature-tabs.d.ts +11 -0
  189. package/dist/host/types/src/ui/settings/settings-components.d.ts +32 -0
  190. package/dist/host/types/src/ui/settings/settings-fields-util.d.ts +11 -0
  191. package/dist/host/types/src/ui/shell/ActionSlot.d.ts +41 -0
  192. package/dist/host/types/src/ui/shell/TabContext.d.ts +30 -0
  193. package/dist/host/types/src/ui/shell/action-registry.d.ts +99 -0
  194. package/dist/host/types/src/ui/shell/keybinding-registry.d.ts +62 -0
  195. package/dist/host/types/src/ui/shell/palette-registry.d.ts +55 -0
  196. package/dist/host/types/src/ui/shell/panel-registry.d.ts +24 -0
  197. package/dist/host/types/src/ui/shell/tab-registry.d.ts +92 -0
  198. package/dist/host/types/src/ui/sidebar/HostManagerTabs.d.ts +65 -0
  199. package/dist/host/types/src/ui/sidebar/host-contributions.d.ts +72 -0
  200. package/dist/host/types/src/ui/sidebar/host-defaults/catalog.d.ts +17 -0
  201. package/dist/host/types/src/ui/sidebar/host-protocols.d.ts +49 -0
  202. package/dist/host/types/src/ui/sidebar/quick-connect-host.d.ts +21 -0
  203. package/dist/host/types/src/ui/sidebar/rail-items.d.ts +103 -0
  204. package/dist/host/types/src/ui/ssh/connection-log/ConnectionLogContext.d.ts +17 -0
  205. package/dist/host/types/src/ui/ssh/dialogs/BrowserSignInDialog.d.ts +18 -0
  206. package/dist/host/types/src/ui/ssh/dialogs/HostKeyVerificationDialog.d.ts +17 -0
  207. package/dist/host/types/src/ui/ssh/dialogs/PassphraseDialog.d.ts +15 -0
  208. package/dist/host/types/src/ui/ssh/dialogs/SSHAuthDialog.d.ts +20 -0
  209. package/dist/host/types/src/ui/ssh/dialogs/TOTPDialog.d.ts +13 -0
  210. package/dist/host/ui.d.ts +1 -0
  211. package/dist/host/ui.js +31754 -0
  212. package/dist/host/use-permissions-NULZL43J.js +18 -0
  213. package/dist/host-commands.d.ts +89 -0
  214. package/dist/host-commands.js +387 -0
  215. package/dist/manifest.d.ts +461 -0
  216. package/dist/manifest.js +1499 -0
  217. package/dist/settings.d.ts +43 -0
  218. package/dist/settings.js +168 -0
  219. package/dist/ssh-certs.d.ts +25 -0
  220. package/dist/ssh-certs.js +234 -0
  221. package/dist/ssh-options.d.ts +23 -0
  222. package/dist/ssh-options.js +1 -0
  223. package/dist/table-builder.d.ts +26 -0
  224. package/dist/table-builder.js +87 -0
  225. package/dist/testing/safe-ports.d.ts +10 -0
  226. package/dist/testing/safe-ports.js +59 -0
  227. package/dist/testing/setup.d.ts +7 -0
  228. package/dist/testing/setup.js +146 -0
  229. package/dist/testing.d.ts +537 -0
  230. package/dist/testing.js +1451 -0
  231. package/dist/vitest-preset.d.ts +54 -0
  232. package/dist/vitest-preset.js +96 -0
  233. package/package.json +143 -0
  234. package/schema/changelog.schema.json +67 -0
  235. package/schema/manifest.schema.json +1160 -0
  236. package/tsconfig.plugin.json +31 -0
@@ -0,0 +1,60 @@
1
+ /**
2
+ * Host defaults: the keys a host can inherit and how their values compare.
3
+ *
4
+ * Shared by the backend (resolution, materializing, the upgrade) and the host
5
+ * editor (which fields show an inherited badge). A key is namespaced:
6
+ * "core.<key>" for core's own fields, "<pluginId>.<field>" for a plugin's host
7
+ * setting. Values are in the host API's shape, never in column form.
8
+ */
9
+ export type HostDefaultsLevel = "admin" | "user" | "folder";
10
+ export declare const HOST_DEFAULTS_LEVELS: readonly HostDefaultsLevel[];
11
+ export declare const CORE_NAMESPACE = "core";
12
+ /** Namespace -> keys the host sets itself. */
13
+ export type DefaultOverrides = Record<string, string[]>;
14
+ export interface HostDefaultSource {
15
+ level: HostDefaultsLevel | "builtin";
16
+ folderId?: number;
17
+ folderName?: string;
18
+ }
19
+ export interface ResolvedHostDefault {
20
+ value: unknown;
21
+ source: HostDefaultSource;
22
+ }
23
+ export interface HostAuthDefault {
24
+ authType: string;
25
+ credentialId: number | null;
26
+ overrideCredentialUsername: boolean;
27
+ agentSocketPath: string | null;
28
+ agentIdentity: string | null;
29
+ }
30
+ export interface HostSocks5Default {
31
+ useSocks5: boolean;
32
+ socks5Host: string | null;
33
+ socks5Port: number | null;
34
+ socks5Username: string | null;
35
+ socks5ProxyChain: unknown[] | null;
36
+ }
37
+ export interface CoreHostDefault {
38
+ key: string;
39
+ /** Levels allowed to set it. A value that points at a user's row is never admin. */
40
+ levels: readonly HostDefaultsLevel[];
41
+ /** What a host gets when no level sets it. Undefined means nothing to inherit. */
42
+ builtin: unknown;
43
+ /** One canonical form, so two spellings of the same value compare equal. */
44
+ normalize: (value: unknown) => unknown;
45
+ }
46
+ /** Auth types whose login lives on the host itself, so it cannot be a default. */
47
+ export declare const SECRET_AUTH_TYPES: string[];
48
+ export declare function normalizeAuthDefault(value: unknown): HostAuthDefault | null;
49
+ export declare function normalizeSocks5Default(value: unknown): HostSocks5Default;
50
+ export declare const CORE_HOST_DEFAULTS: readonly CoreHostDefault[];
51
+ export declare function findCoreHostDefault(key: string): CoreHostDefault | undefined;
52
+ /** "core.sshPort" -> ["core", "sshPort"]. The plugin id never has a dot. */
53
+ export declare function splitDefaultKey(fullKey: string): [string, string];
54
+ export declare function joinDefaultKey(namespace: string, key: string): string;
55
+ /** JSON with sorted object keys, so equal values stringify the same. */
56
+ export declare function stableStringify(value: unknown): string;
57
+ export declare function defaultValuesEqual(a: unknown, b: unknown): boolean;
58
+ /** A stored or sent overrides value, or null when it is not one. */
59
+ export declare function parseDefaultOverrides(raw: unknown): DefaultOverrides | null;
60
+ export declare function isDefaultOverridden(overrides: DefaultOverrides | null | undefined, namespace: string, key: string): boolean;
@@ -0,0 +1,55 @@
1
+ /**
2
+ * Host sidebar preferences model. Shared by the frontend sidebar and the
3
+ * backend preferences endpoint (no framework imports, mirrors
4
+ * ./host-metrics.ts's dependency-free convention). Replaces the ~10
5
+ * independent localStorage keys/custom events the sidebar used to manage
6
+ * individually.
7
+ *
8
+ * SortKey and StatusColorScheme are duplicated here (rather than imported
9
+ * from src/ui/sidebar/host-sort.ts / src/ui/hooks/use-status-color-scheme.ts)
10
+ * because those files use the "../ui" frontend path alias, which the backend's
11
+ * NodeNext build cannot resolve. Keep the values below in sync with those
12
+ * two files.
13
+ */
14
+ export declare const HOST_SIDEBAR_PREFS_VERSION = 1;
15
+ export type SortKey = "default" | "name-asc" | "name-desc" | "ip-asc" | "ip-desc" | "status-online" | "status-offline" | "manual";
16
+ export type StatusColorScheme = "accent" | "status";
17
+ export type HostGroupKey = "folder" | "tag" | "status" | "protocol" | "auth";
18
+ export type HostDensity = "comfortable" | "compact";
19
+ export type HostTrayTrigger = "always" | "hover" | "click" | "actionsOnly";
20
+ /** What clicking a host does when it already has an open tab. */
21
+ export type HostClickBehavior = "newTab" | "focusExisting" | "focusExistingDoubleClickNew";
22
+ export interface HostSidebarFilterState {
23
+ status: ("online" | "offline" | "pinned")[];
24
+ /** SSH auth type ids; plugins add their own. */
25
+ authType: string[];
26
+ /** "ssh" or a plugin protocol id. */
27
+ protocol: string[];
28
+ /** Plugin ids whose host switch must be on. */
29
+ features: string[];
30
+ tags: string[];
31
+ }
32
+ export interface HostSidebarDisplayPreferences {
33
+ density: HostDensity;
34
+ showTags: boolean;
35
+ trayTrigger: HostTrayTrigger;
36
+ statusColorScheme: StatusColorScheme;
37
+ /** When true, a host row needs a double click to launch its session. */
38
+ openOnDoubleClick: boolean;
39
+ /** When false, nested folders hide the parent-path breadcrumb before their name. */
40
+ showFolderPaths: boolean;
41
+ hostClickBehavior: HostClickBehavior;
42
+ }
43
+ export interface HostSidebarPreferences {
44
+ version: number;
45
+ sort: {
46
+ key: SortKey;
47
+ pinnedFirst: boolean;
48
+ };
49
+ groupKey: HostGroupKey;
50
+ filters: HostSidebarFilterState;
51
+ openFolders: string[];
52
+ display: HostSidebarDisplayPreferences;
53
+ }
54
+ export declare function defaultHostSidebarPreferences(): HostSidebarPreferences;
55
+ export declare function sanitizeHostSidebarPreferences(input: unknown): HostSidebarPreferences;
@@ -0,0 +1,298 @@
1
+ import type { HostProtocolAuthSummary, HostProtocolAuthType, HostSshOptions } from "@termix-ssh/plugin-sdk/frontend";
2
+ import type { Request } from "express";
3
+ import type { RefObject } from "react";
4
+ import type { HostAuthOverrides } from "./auth-protocols.js";
5
+ import type { DefaultOverrides } from "./host-defaults.js";
6
+ export type { AuthOverrideProtocol, HostAuthOverrideState, HostAuthOverrides, } from "./auth-protocols.js";
7
+ /**
8
+ * Core's own SSH auth types, plus whatever a plugin registers through
9
+ * ctx.auth (the owning plugin decides the name).
10
+ */
11
+ export type SSHAuthType = "password" | "key" | "credential" | "none" | "agent" | (string & {});
12
+ export type { HostProtocolAuthSummary, HostProtocolAuthType };
13
+ /** One plugin protocol's login in a host write. */
14
+ export interface HostProtocolAuthInput {
15
+ authType?: HostProtocolAuthType;
16
+ credentialId?: number | null;
17
+ username?: string | null;
18
+ /** Left out to keep the saved password. */
19
+ password?: string | null;
20
+ /** Declared credential fields; one left out keeps its value. */
21
+ fields?: Record<string, string | null>;
22
+ }
23
+ export interface JumpHost {
24
+ hostId: number;
25
+ }
26
+ export type Host = {
27
+ id: number;
28
+ name: string;
29
+ ip: string;
30
+ port: number;
31
+ username: string;
32
+ folder: string;
33
+ tags: string[];
34
+ pin: boolean;
35
+ authType: SSHAuthType;
36
+ shareSshAuth?: boolean;
37
+ password?: string;
38
+ key?: string;
39
+ keyPassword?: string;
40
+ keyType?: string;
41
+ sudoPassword?: string;
42
+ forceKeyboardInteractive?: boolean;
43
+ credentialId?: number;
44
+ overrideCredentialUsername?: boolean;
45
+ userId?: string;
46
+ jumpHosts?: JumpHost[];
47
+ statusCheckEnabled?: boolean;
48
+ /** Seconds between status checks; null follows the global setting. */
49
+ statusCheckInterval?: number | null;
50
+ terminalConfig?: HostTerminalConfig;
51
+ sshOptions?: HostSshOptions;
52
+ notes?: string;
53
+ useSocks5?: boolean;
54
+ socks5Host?: string;
55
+ socks5Port?: number;
56
+ socks5Username?: string;
57
+ socks5Password?: string;
58
+ socks5ProxyChain?: ProxyNode[];
59
+ portKnockSequence?: Array<{
60
+ port: number;
61
+ protocol?: "tcp" | "udp";
62
+ delay?: number;
63
+ }>;
64
+ /** "ssh", or the id of the plugin protocol a host without SSH uses. */
65
+ connectionType?: string;
66
+ enableSsh?: boolean;
67
+ sshPort?: number;
68
+ /** Each plugin protocol's login, secrets left out. */
69
+ protocolAuth?: Record<string, HostProtocolAuthSummary>;
70
+ /**
71
+ * Stable identity across a desktop/server sync pair. `id` is an
72
+ * autoincrement local to whichever database produced the row, so it cannot
73
+ * name the same host on both sides; this can. Absent on hosts that have
74
+ * never been part of a sync.
75
+ */
76
+ syncId?: string | null;
77
+ createdAt: string;
78
+ updatedAt: string;
79
+ sortOrder?: number | null;
80
+ connectionOrigin?: "local" | "remote" | null;
81
+ /** Assigned when a host is opened in a tab; distinguishes duplicate tabs. */
82
+ instanceId?: string;
83
+ hasKey?: boolean;
84
+ hasKeyPassword?: boolean;
85
+ hasPassword?: boolean;
86
+ hasSudoPassword?: boolean;
87
+ isShared?: boolean;
88
+ authOverrides?: HostAuthOverrides;
89
+ permissionLevel?: "connect" | "view" | "edit" | "manage";
90
+ sharedExpiresAt?: string;
91
+ ownerUsername?: string;
92
+ /** A read-only copy of a host shared with the linked account. */
93
+ sharedCopy?: boolean;
94
+ /** Desktop only: kept on this device, never synced to the server. */
95
+ localOnly?: boolean;
96
+ /** Enabled plugins' host-scope settings, keyed by plugin id. Secrets redacted. */
97
+ pluginSettings?: Record<string, Record<string, unknown>>;
98
+ /** Host default keys this host sets itself, per namespace. */
99
+ defaultOverrides?: DefaultOverrides | null;
100
+ };
101
+ export interface JumpHostData {
102
+ hostId: number;
103
+ }
104
+ export interface ProxyNode {
105
+ host: string;
106
+ port: number;
107
+ /**
108
+ * The host editor writes "socks4"/"socks5"/"http", while proxy-helper.ts
109
+ * tests for "http" and casts everything else to 4|5 before handing it to the
110
+ * socks client. The two spellings have never agreed; typed as the union of
111
+ * what is actually stored rather than pretending one side is right.
112
+ */
113
+ type: 4 | 5 | "http" | "socks4" | "socks5";
114
+ username?: string;
115
+ password?: string;
116
+ }
117
+ export interface HostData {
118
+ /** Host default keys the host sets itself, per namespace. Every other key follows its defaults. */
119
+ defaultOverrides?: DefaultOverrides | null;
120
+ name?: string;
121
+ ip: string;
122
+ port: number;
123
+ username: string;
124
+ folder?: string;
125
+ /** Sub-host nesting: mutually exclusive with folder. */
126
+ parentHostId?: number | string | null;
127
+ tags?: string[];
128
+ pin?: boolean;
129
+ authType: SSHAuthType;
130
+ shareSshAuth?: boolean;
131
+ password?: string;
132
+ key?: File | string | null;
133
+ keyPassword?: string;
134
+ keyType?: string;
135
+ sudoPassword?: string;
136
+ credentialId?: number | null;
137
+ connectionOrigin?: "local" | "remote" | null;
138
+ overrideCredentialUsername?: boolean;
139
+ forceKeyboardInteractive?: boolean;
140
+ jumpHosts?: JumpHostData[];
141
+ statusCheckEnabled?: boolean;
142
+ /** Seconds between status checks; null follows the global setting. */
143
+ statusCheckInterval?: number | null;
144
+ terminalConfig?: HostTerminalConfig;
145
+ sshOptions?: HostSshOptions;
146
+ notes?: string;
147
+ useSocks5?: boolean;
148
+ socks5Host?: string;
149
+ socks5Port?: number;
150
+ socks5Username?: string;
151
+ socks5Password?: string;
152
+ socks5ProxyChain?: ProxyNode[];
153
+ portKnockSequence?: Array<{
154
+ port: number;
155
+ protocol?: "tcp" | "udp";
156
+ delay?: number;
157
+ }>;
158
+ /** "ssh", or the id of the plugin protocol a host without SSH uses. */
159
+ connectionType?: string;
160
+ enableSsh?: boolean;
161
+ sshPort?: number;
162
+ /**
163
+ * Plugin protocol logins to write, keyed by protocol id. A key left out
164
+ * keeps its login, null removes it, and a field left out keeps its value.
165
+ */
166
+ protocolAuth?: Record<string, HostProtocolAuthInput | null>;
167
+ /** Desktop only: kept on this device, never synced to the server. */
168
+ localOnly?: boolean;
169
+ }
170
+ export type SSHHost = Host;
171
+ export type SSHHostData = HostData;
172
+ export interface SSHFolder {
173
+ id: number;
174
+ userId: string;
175
+ name: string;
176
+ color?: string;
177
+ icon?: string;
178
+ credentialId?: number | null;
179
+ sortOrder?: number | null;
180
+ /** Desktop only: the folder and its hosts stay on this device. */
181
+ localOnly?: boolean;
182
+ createdAt: string;
183
+ updatedAt: string;
184
+ }
185
+ export interface Credential {
186
+ id: number;
187
+ name: string;
188
+ description?: string;
189
+ folder?: string;
190
+ tags: string[];
191
+ authType: "password" | "key";
192
+ username?: string;
193
+ password?: string;
194
+ key?: string;
195
+ publicKey?: string;
196
+ /** CA-signed certificate file content (e.g. id_ed25519-cert.pub) */
197
+ certPublicKey?: string;
198
+ /** True when a cert is stored but certPublicKey content is redacted in list responses */
199
+ hasCertPublicKey?: boolean;
200
+ keyPassword?: string;
201
+ keyType?: string;
202
+ usageCount: number;
203
+ lastUsed?: string;
204
+ createdAt: string;
205
+ updatedAt: string;
206
+ }
207
+ export interface CredentialBackend {
208
+ id: number;
209
+ userId: string;
210
+ name: string;
211
+ description: string | null;
212
+ folder: string | null;
213
+ tags: string;
214
+ authType: "password" | "key";
215
+ username: string | null;
216
+ password: string | null;
217
+ key: string;
218
+ privateKey?: string;
219
+ publicKey?: string;
220
+ /** CA-signed certificate file content (e.g. id_ed25519-cert.pub) */
221
+ certPublicKey?: string;
222
+ keyPassword: string | null;
223
+ keyType?: string;
224
+ detectedKeyType: string;
225
+ usageCount: number;
226
+ lastUsed: string | null;
227
+ createdAt: string;
228
+ updatedAt: string;
229
+ }
230
+ /**
231
+ * What 2.8 kept in ssh_data.terminal_config. Core reads none of it any more:
232
+ * the terminal's look and behavior and the startup command are plugins' host
233
+ * settings, and the connection options have their own column (sshOptions).
234
+ */
235
+ export type HostTerminalConfig = Record<string, unknown>;
236
+ export type { HostSshOptions } from "@termix-ssh/plugin-sdk/frontend";
237
+ export interface TabContextTab {
238
+ id: number;
239
+ instanceId?: string;
240
+ /** A core tab type or one a plugin registered. */
241
+ type: string;
242
+ title: string;
243
+ hostConfig?: SSHHost;
244
+ terminalRef?: RefObject<TerminalRefHandle | null>;
245
+ initialTab?: string;
246
+ _updateTimestamp?: number;
247
+ connectionConfig?: Record<string, unknown>;
248
+ }
249
+ export interface TerminalRefHandle {
250
+ disconnect?: () => void;
251
+ reconnect?: () => void;
252
+ isConnected?: () => boolean;
253
+ fit?: () => void;
254
+ sendInput?: (data: string) => void;
255
+ subscribeOutput?: (listener: (data: string) => void) => () => void;
256
+ notifyResize?: () => void;
257
+ refresh?: () => void;
258
+ }
259
+ export interface AuthenticatedRequest extends Request {
260
+ userId: string;
261
+ sessionId?: string;
262
+ apiKeyId?: string;
263
+ actingAdminUserId?: string;
264
+ user?: {
265
+ id: string;
266
+ username: string;
267
+ isAdmin: boolean;
268
+ };
269
+ }
270
+ export interface GitHubAsset {
271
+ id: number;
272
+ name: string;
273
+ size: number;
274
+ download_count: number;
275
+ browser_download_url: string;
276
+ }
277
+ export interface GitHubRelease {
278
+ id: number;
279
+ tag_name: string;
280
+ name: string;
281
+ body: string;
282
+ published_at: string;
283
+ html_url: string;
284
+ assets: GitHubAsset[];
285
+ prerelease: boolean;
286
+ draft: boolean;
287
+ }
288
+ export interface GitHubAPIResponse<T> {
289
+ data: T;
290
+ cached: boolean;
291
+ cache_age?: number;
292
+ timestamp?: number;
293
+ }
294
+ export interface CacheEntry<T = unknown> {
295
+ data: T;
296
+ timestamp: number;
297
+ expiresAt: number;
298
+ }
@@ -0,0 +1,27 @@
1
+ export interface KeyCombo {
2
+ key: string;
3
+ isCode: boolean;
4
+ ctrl: boolean;
5
+ alt: boolean;
6
+ shift: boolean;
7
+ meta: boolean;
8
+ }
9
+ /**
10
+ * The shell's own actions (nextTab, previousTab, openCommandPalette,
11
+ * reconnectSession) or one a plugin declared in contributes.keybindingActions.
12
+ */
13
+ export type KeybindingActionType = string;
14
+ /** A bound action: its type plus the parameters its declaration lists. */
15
+ export interface KeybindingAction {
16
+ type: KeybindingActionType;
17
+ [param: string]: unknown;
18
+ }
19
+ export interface CustomKeybinding {
20
+ id: string;
21
+ combo: KeyCombo;
22
+ action: KeybindingAction;
23
+ enabled: boolean;
24
+ overridesDefaultId?: string;
25
+ createdAt: string;
26
+ updatedAt: string;
27
+ }
@@ -0,0 +1,102 @@
1
+ /**
2
+ * App-wide UI complexity preferences. Shared by the frontend UI preferences
3
+ * context and the backend preferences endpoint (no framework imports, mirrors
4
+ * ./host-sidebar-preferences.ts's dependency-free convention -- the backend's
5
+ * NodeNext build cannot resolve the "../ui" frontend path alias).
6
+ *
7
+ * The model stores the user's *intent* -- a preset plus the individual knobs
8
+ * they have deliberately changed -- not a second copy of values other stores
9
+ * already own. Areas whose knobs already live somewhere else (host sidebar
10
+ * blob, user_preferences.hiddenRailTabs, a handful of localStorage keys) are
11
+ * seeded from the preset when it changes; reads keep going to the existing
12
+ * store. See applyPresetSideEffects on the frontend.
13
+ *
14
+ * "balanced" is exactly today's behavior. Every value in PRESETS.balanced is
15
+ * transcribed from the defaults that were already in the code, so existing
16
+ * users who land on it see no change at all.
17
+ */
18
+ /** 2: the docker and host metrics areas moved to their plugins. */
19
+ export declare const UI_PREFERENCES_VERSION = 3;
20
+ /** Bump when onboarding gains steps existing users should be shown again. */
21
+ export declare const UI_ONBOARDING_VERSION = 2;
22
+ export type UiPreset = "simple" | "balanced" | "advanced" | "custom";
23
+ export type UiAreaKey = "chrome" | "hostList" | "credentialList" | "rail" | "dashboard" | "hostEditor";
24
+ export type UiDensity = "comfortable" | "compact";
25
+ export type UiTrayTrigger = "always" | "hover" | "click" | "actionsOnly";
26
+ export type UiRowActions = "essential" | "full";
27
+ export type UiEmptyStateVerbosity = "minimal" | "guided";
28
+ export type UiHostEditorMode = "simple" | "full";
29
+ export interface UiChromePreferences {
30
+ showBreadcrumbs: boolean;
31
+ showStatusBar: boolean;
32
+ emptyStateVerbosity: UiEmptyStateVerbosity;
33
+ }
34
+ export interface UiHostListPreferences {
35
+ density: UiDensity;
36
+ showTags: boolean;
37
+ showResourceBars: boolean;
38
+ showStatusStripes: boolean;
39
+ trayTrigger: UiTrayTrigger;
40
+ rowActions: UiRowActions;
41
+ }
42
+ export interface UiCredentialListPreferences {
43
+ density: UiDensity;
44
+ showTags: boolean;
45
+ }
46
+ export interface UiRailPreferences {
47
+ hiddenTabs: string[];
48
+ /**
49
+ * Also hide every plugin rail item that does not set simplePreset. Plugin
50
+ * items are only known at runtime, so the preset cannot list them.
51
+ */
52
+ hidePluginItems?: boolean;
53
+ }
54
+ export interface UiDashboardPreferences {
55
+ enabledCards: string[];
56
+ }
57
+ export interface UiHostEditorPreferences {
58
+ mode: UiHostEditorMode;
59
+ }
60
+ export interface UiAreaPreferences {
61
+ chrome: UiChromePreferences;
62
+ hostList: UiHostListPreferences;
63
+ credentialList: UiCredentialListPreferences;
64
+ rail: UiRailPreferences;
65
+ dashboard: UiDashboardPreferences;
66
+ hostEditor: UiHostEditorPreferences;
67
+ }
68
+ /** A plugin's own area, keyed "plugin:<id>", holding what it declared in contributes.uiPresets. */
69
+ export type UiPluginAreaKey = `plugin:${string}`;
70
+ export type UiOverrides = {
71
+ [A in UiAreaKey]?: Partial<UiAreaPreferences[A]>;
72
+ } & {
73
+ [key: UiPluginAreaKey]: Record<string, unknown>;
74
+ };
75
+ export interface UiOnboardingState {
76
+ /** 0 means "never completed". Compared against UI_ONBOARDING_VERSION. */
77
+ completedVersion: number;
78
+ completedAt: string | null;
79
+ skipped: boolean;
80
+ }
81
+ export interface UiPreferences {
82
+ version: number;
83
+ preset: UiPreset;
84
+ overrides: UiOverrides;
85
+ onboarding: UiOnboardingState;
86
+ }
87
+ export declare const PRESETS: Record<Exclude<UiPreset, "custom">, UiAreaPreferences>;
88
+ export declare const UI_AREA_KEYS: UiAreaKey[];
89
+ export declare function sanitizeUiOverrides(input: unknown): UiOverrides;
90
+ export declare function defaultUiPreferences(): UiPreferences;
91
+ export declare function sanitizeUiPreferences(input: unknown): UiPreferences;
92
+ /**
93
+ * Effective values for one area: preset defaults with the user's overrides
94
+ * layered on top. "custom" only labels a diverged state, so it re-bases on
95
+ * balanced rather than carrying a fourth value table.
96
+ */
97
+ export declare function resolveArea<A extends UiAreaKey>(preferences: UiPreferences, area: A): UiAreaPreferences[A];
98
+ /** The presets a plugin declares in contributes.uiPresets. */
99
+ export type UiPluginPresets = Record<Exclude<UiPreset, "custom">, Record<string, unknown>>;
100
+ /** A plugin area's values: its preset for the user's level, then overrides. */
101
+ export declare function resolvePluginArea(preferences: UiPreferences, pluginId: string, presets: UiPluginPresets | undefined): Record<string, unknown>;
102
+ export declare function hasUiOverrides(preferences: UiPreferences): boolean;