@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,346 @@
1
+ /**
2
+ * The desktop app's bridge (window.electronAPI), typed for plugins. It exists
3
+ * only inside the Termix desktop app; check isElectron before calling it.
4
+ */
5
+ import type { PluginSshPromptRequest } from "./backend.js";
6
+ export interface ServerConfig {
7
+ serverUrl?: string;
8
+ allowInvalidCertificate?: boolean;
9
+ [key: string]: unknown;
10
+ }
11
+ export interface ConnectionTestResult {
12
+ success: boolean;
13
+ error?: string;
14
+ [key: string]: unknown;
15
+ }
16
+ export interface DialogOptions {
17
+ title?: string;
18
+ defaultPath?: string;
19
+ buttonLabel?: string;
20
+ filters?: Array<{
21
+ name: string;
22
+ extensions: string[];
23
+ }>;
24
+ properties?: string[];
25
+ [key: string]: unknown;
26
+ }
27
+ export interface DialogResult {
28
+ canceled: boolean;
29
+ filePath?: string;
30
+ filePaths?: string[];
31
+ [key: string]: unknown;
32
+ }
33
+ export interface LocalDirectoryResult {
34
+ success: boolean;
35
+ path: string;
36
+ parent?: string;
37
+ entries: LocalFileEntry[];
38
+ error?: string;
39
+ }
40
+ export interface LocalCollectedFile {
41
+ path: string;
42
+ name: string;
43
+ relativePath: string;
44
+ size: number;
45
+ created?: string;
46
+ modified: string;
47
+ }
48
+ export type LocalPathMutationResult = ({
49
+ success: true;
50
+ } & Partial<LocalFileEntry>) | {
51
+ success: false;
52
+ error?: string;
53
+ };
54
+ export interface ElectronAPI {
55
+ getAppVersion: () => Promise<string>;
56
+ setZoomFactor?: (factor: number) => void;
57
+ getPlatform: () => Promise<string>;
58
+ getSetting?: (key: string) => Promise<string | null | undefined>;
59
+ setSetting?: (key: string, value: string) => Promise<void>;
60
+ getServerConfig: () => Promise<ServerConfig>;
61
+ saveServerConfig: (config: ServerConfig) => Promise<{
62
+ success: boolean;
63
+ }>;
64
+ testServerConnection: (serverUrl: string, allowInvalidCertificate?: boolean) => Promise<ConnectionTestResult>;
65
+ answerC2SAuth: (id: string, answer: string | null) => Promise<boolean>;
66
+ onC2SAuthPrompt: (callback: (prompt: {
67
+ id: string;
68
+ closed?: boolean;
69
+ tunnelName?: string;
70
+ request?: PluginSshPromptRequest;
71
+ }) => void) => () => void;
72
+ getC2STunnelConfig: () => Promise<unknown[]>;
73
+ saveC2STunnelConfig: (config: unknown[]) => Promise<{
74
+ success: boolean;
75
+ error?: string;
76
+ }>;
77
+ checkLocalPortAvailable: (host: string, port: number) => Promise<{
78
+ available: boolean;
79
+ error?: string;
80
+ }>;
81
+ getC2STunnelPresetDefaultName: () => Promise<string>;
82
+ startC2STunnel: (tunnel: unknown, index: number, authToken?: string) => Promise<{
83
+ success: boolean;
84
+ tunnelName?: string;
85
+ error?: string;
86
+ code?: string;
87
+ }>;
88
+ testC2STunnel: (tunnel: unknown, index: number, authToken?: string) => Promise<{
89
+ success: boolean;
90
+ message?: string;
91
+ error?: string;
92
+ code?: string;
93
+ }>;
94
+ stopC2STunnel: (tunnelName: string) => Promise<{
95
+ success: boolean;
96
+ error?: string;
97
+ }>;
98
+ getC2STunnelStatuses: () => Promise<Record<string, unknown>>;
99
+ onC2STunnelStatuses?: (callback: (statuses: Record<string, unknown>) => void) => () => void;
100
+ startC2SAutoStartTunnels: () => Promise<{
101
+ success: boolean;
102
+ started: number;
103
+ errors: string[];
104
+ }>;
105
+ /** Where the linked server relays client tunnel streams, a /plugin-ws/ path. */
106
+ setC2SRelayPath?: (relayPath: string) => Promise<{
107
+ success: boolean;
108
+ error?: string;
109
+ }>;
110
+ onCloseActiveTab?: (callback: () => void) => () => void;
111
+ clearSessionCookies: () => Promise<void>;
112
+ getSessionCookie: (name: string, targetUrl?: string) => Promise<string | null>;
113
+ waitForSessionCookie: (name: string, targetUrl?: string, previousValue?: string | null, timeoutMs?: number) => Promise<{
114
+ success: boolean;
115
+ value?: string;
116
+ error?: string;
117
+ }>;
118
+ showSaveDialog: (options: DialogOptions) => Promise<DialogResult>;
119
+ showOpenDialog: (options: DialogOptions) => Promise<DialogResult>;
120
+ getLocalHomeDirectory?: () => Promise<string>;
121
+ listLocalDirectory?: (path?: string) => Promise<LocalDirectoryResult>;
122
+ statLocalPaths?: (paths: string[]) => Promise<Array<(LocalFileEntry & {
123
+ success: true;
124
+ }) | {
125
+ success: false;
126
+ path: string;
127
+ error?: string;
128
+ }>>;
129
+ collectLocalFiles?: (paths: string[]) => Promise<{
130
+ success: boolean;
131
+ files: LocalCollectedFile[];
132
+ truncated?: boolean;
133
+ error?: string;
134
+ }>;
135
+ createLocalFolder?: (parentPath: string, folderName: string) => Promise<LocalPathMutationResult>;
136
+ renameLocalPath?: (path: string, newName: string) => Promise<LocalPathMutationResult>;
137
+ trashLocalPath?: (path: string) => Promise<LocalPathMutationResult>;
138
+ chmodLocalPath?: (path: string, permissions: string) => Promise<LocalPathMutationResult>;
139
+ openExternalEditor: (fileData: {
140
+ fileName: string;
141
+ content: string;
142
+ encoding?: "utf8" | "base64";
143
+ editorPath?: string | null;
144
+ }) => Promise<{
145
+ success: boolean;
146
+ editId?: string;
147
+ path?: string;
148
+ error?: string;
149
+ }>;
150
+ closeExternalEditor: (editId: string) => Promise<{
151
+ success: boolean;
152
+ error?: string;
153
+ }>;
154
+ onExternalEditorSaved?: (callback: (payload: {
155
+ editId: string;
156
+ content: string;
157
+ encoding: "utf8";
158
+ path: string;
159
+ }) => void) => () => void;
160
+ onUpdateAvailable: (callback: () => void) => void;
161
+ onUpdateDownloaded: (callback: () => void) => void;
162
+ removeAllListeners: (channel: string) => void;
163
+ isElectron: boolean;
164
+ isDev: boolean;
165
+ invoke: (channel: string, ...args: unknown[]) => Promise<unknown>;
166
+ createTempFile: (fileData: {
167
+ fileName: string;
168
+ content: string;
169
+ encoding?: "base64" | "utf8";
170
+ }) => Promise<{
171
+ success: boolean;
172
+ tempId?: string;
173
+ path?: string;
174
+ error?: string;
175
+ }>;
176
+ createTempFolder: (folderData: {
177
+ folderName: string;
178
+ files: Array<{
179
+ relativePath: string;
180
+ content: string;
181
+ encoding?: "base64" | "utf8";
182
+ }>;
183
+ }) => Promise<{
184
+ success: boolean;
185
+ tempId?: string;
186
+ path?: string;
187
+ error?: string;
188
+ }>;
189
+ startDragToDesktop: (dragData: {
190
+ tempId: string;
191
+ fileName: string;
192
+ }) => Promise<{
193
+ success: boolean;
194
+ error?: string;
195
+ }>;
196
+ cleanupTempFile: (tempId: string) => Promise<{
197
+ success: boolean;
198
+ error?: string;
199
+ }>;
200
+ startLocalTerminal(dimensions: {
201
+ cols: number;
202
+ rows: number;
203
+ shell?: "default" | "wsl";
204
+ }): Promise<{
205
+ sessionId: string;
206
+ shell: string;
207
+ }>;
208
+ readyLocalTerminal(sessionId: string): Promise<boolean>;
209
+ writeLocalTerminal(sessionId: string, data: string): Promise<boolean>;
210
+ resizeLocalTerminal(sessionId: string, cols: number, rows: number): Promise<boolean>;
211
+ closeLocalTerminal(sessionId: string): Promise<boolean>;
212
+ onLocalTerminalData(sessionId: string, callback: (data: string) => void): () => void;
213
+ onLocalTerminalExit(sessionId: string, callback: (exitCode: number) => void): () => void;
214
+ /** Local disk browsing for the dual-pane file manager (desktop only). */
215
+ localFs?: {
216
+ home: () => Promise<LocalFsResult<LocalFsHomeInfo>>;
217
+ list: (dirPath: string) => Promise<LocalFsResult<LocalDirectoryListing>>;
218
+ mkdir: (parentPath: string, name: string) => Promise<LocalFsResult<{
219
+ path: string;
220
+ }>>;
221
+ createFile: (parentPath: string, name: string) => Promise<LocalFsResult<{
222
+ path: string;
223
+ }>>;
224
+ rename: (oldPath: string, newName: string) => Promise<LocalFsResult<{
225
+ path: string;
226
+ }>>;
227
+ trash: (paths: string[]) => Promise<LocalFsResult<LocalTrashResult>>;
228
+ ensureDir: (dirPath: string, rootPath?: string) => Promise<LocalFsResult<{
229
+ path: string;
230
+ }>>;
231
+ exists: (paths: string[]) => Promise<LocalFsResult<{
232
+ existing: string[];
233
+ }>>;
234
+ walk: (paths: string[]) => Promise<LocalFsResult<LocalWalkResult>>;
235
+ reveal: (targetPath: string) => Promise<LocalFsResult<unknown>>;
236
+ open: (targetPath: string) => Promise<LocalFsResult<unknown>>;
237
+ };
238
+ /** Streamed local<->remote transfers driven by the main process. */
239
+ localTransfer?: {
240
+ /** The /plugin-api/<id> path that serves the streaming routes. */
241
+ setApiPath?: (apiPath: string) => Promise<LocalFsResult<object>>;
242
+ upload: (options: LocalUploadRequest) => Promise<LocalFsResult<{
243
+ bytes: number;
244
+ }>>;
245
+ download: (options: LocalDownloadRequest) => Promise<LocalFsResult<{
246
+ path: string;
247
+ }>>;
248
+ cancel: (transferId: string) => Promise<LocalFsResult<{
249
+ cancelled: boolean;
250
+ }>>;
251
+ onProgress: (callback: (payload: LocalTransferProgress) => void) => () => void;
252
+ };
253
+ }
254
+ export type LocalFsResult<T> = ({
255
+ success: true;
256
+ } & T) | {
257
+ success: false;
258
+ error: string;
259
+ code?: string;
260
+ };
261
+ export interface LocalFsHomeInfo {
262
+ home: string;
263
+ separator: string;
264
+ platform: string;
265
+ }
266
+ export interface LocalFileEntry {
267
+ name: string;
268
+ path: string;
269
+ type: "file" | "directory" | "link" | "other";
270
+ created?: string;
271
+ modified?: string;
272
+ permissions?: string;
273
+ owner?: string;
274
+ group?: string;
275
+ size: number;
276
+ modifiedTimestamp?: number;
277
+ linkTarget?: string;
278
+ hidden: boolean;
279
+ }
280
+ export interface LocalDirectoryListing {
281
+ path: string;
282
+ parent: string | null;
283
+ entries: LocalFileEntry[];
284
+ }
285
+ export interface LocalTrashResult {
286
+ trashed: number;
287
+ failed: Array<{
288
+ path: string;
289
+ error: string;
290
+ }>;
291
+ }
292
+ export interface LocalWalkFile {
293
+ localPath: string;
294
+ /** Path relative to the drop root; "/"-separated and includes the root's own name. */
295
+ relativePath: string;
296
+ size: number;
297
+ }
298
+ export interface LocalWalkResult {
299
+ files: LocalWalkFile[];
300
+ emptyDirs: string[];
301
+ totalBytes: number;
302
+ }
303
+ /**
304
+ * Which Termix backend a transfer talks to. The main process resolves the
305
+ * actual URL and credentials for the origin; the renderer never supplies them.
306
+ */
307
+ export type LocalTransferOrigin = "local" | "remote";
308
+ export interface LocalUploadRequest {
309
+ transferId: string;
310
+ origin: LocalTransferOrigin;
311
+ fields: Record<string, string>;
312
+ localPath: string;
313
+ fileName: string;
314
+ deviceId?: string;
315
+ /** The renderer's token for the embedded backend (origin "local"); sent as a Bearer header. */
316
+ authToken?: string;
317
+ }
318
+ export interface LocalDownloadRequest {
319
+ transferId: string;
320
+ origin: LocalTransferOrigin;
321
+ body: Record<string, unknown>;
322
+ destPath: string;
323
+ /** Selected download folder; destPath must resolve strictly inside it (code EINVAL otherwise). */
324
+ rootPath: string;
325
+ expectedSize?: number;
326
+ /** Replace an existing file at destPath; otherwise the transfer is refused with code EEXIST. */
327
+ overwrite?: boolean;
328
+ deviceId?: string;
329
+ /** The renderer's token for the embedded backend (origin "local"); sent as a Bearer header. */
330
+ authToken?: string;
331
+ }
332
+ export interface LocalTransferProgress {
333
+ transferId: string;
334
+ transferred: number;
335
+ total?: number;
336
+ }
337
+ declare global {
338
+ interface Window {
339
+ electronAPI: ElectronAPI;
340
+ IS_ELECTRON: boolean;
341
+ electronClipboard?: {
342
+ writeText(text: string): Promise<boolean>;
343
+ readText(): Promise<string>;
344
+ };
345
+ }
346
+ }
@@ -0,0 +1,5 @@
1
+ /**
2
+ * The desktop app's bridge (window.electronAPI), typed for plugins. It exists
3
+ * only inside the Termix desktop app; check isElectron before calling it.
4
+ */
5
+ export {};