@termix-ssh/plugin-sdk 1.0.11 → 1.0.13

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 (130) hide show
  1. package/CHANGELOG.md +37 -0
  2. package/PLUGIN-GUIDE.md +178 -54
  3. package/cli/commands/build.mjs +36 -22
  4. package/cli/commands/pack.mjs +12 -2
  5. package/cli/commands/validate.mjs +63 -3
  6. package/cli/lib/plugin-dir.mjs +11 -0
  7. package/cli/lib/tmxplug.mjs +9 -0
  8. package/dist/backend.d.ts +404 -0
  9. package/dist/capabilities.js +7 -0
  10. package/dist/db.js +1 -0
  11. package/dist/desktop.d.ts +0 -243
  12. package/dist/frontend.d.ts +175 -2
  13. package/dist/frontend.js +7 -0
  14. package/dist/host/PluginsTab-OXQQ7M4I.js +3266 -0
  15. package/dist/host/chunk-54KCK6IZ.js +3167 -0
  16. package/dist/host/chunk-CALNJCHN.js +10435 -0
  17. package/dist/host/{chunk-7RRTYD6B.js → chunk-CN5UBTBP.js} +1412 -14
  18. package/dist/host/{chunk-RLQBKJRK.js → chunk-ERGN4YW6.js} +9204 -11492
  19. package/dist/host/{chunk-LSWB3ZZV.js → chunk-T2PZWXFJ.js} +6 -1
  20. package/dist/host/chunk-YGYBM7SQ.js +58 -0
  21. package/dist/host/core-classes.json +1 -1
  22. package/dist/host/{linked-server-UCW74T2V.js → linked-server-5VFO4XQB.js} +2 -2
  23. package/dist/host/{rbac-api-6UYMFIFV.js → rbac-api-5YMBJAO5.js} +2 -2
  24. package/dist/host/testing-host.js +123 -57
  25. package/dist/host/types/src/types/onboarding.d.ts +0 -2
  26. package/dist/host/types/src/types/ui-types.d.ts +2 -1
  27. package/dist/host/types/src/ui/api/audit-log-api.d.ts +36 -0
  28. package/dist/host/types/src/ui/api/credentials-api.d.ts +0 -22
  29. package/dist/host/types/src/ui/api/host-defaults-api.d.ts +42 -0
  30. package/dist/host/types/src/ui/api/host-tags-api.d.ts +2 -0
  31. package/dist/host/types/src/ui/api/look-api.d.ts +40 -0
  32. package/dist/host/types/src/ui/api/open-tabs-api.d.ts +4 -0
  33. package/dist/host/types/src/ui/api/plugins-api.d.ts +30 -0
  34. package/dist/host/types/src/ui/api/private-endpoints-api.d.ts +6 -0
  35. package/dist/host/types/src/ui/api/settings-api.d.ts +0 -6
  36. package/dist/host/types/src/ui/api/ssh-host-management-api.d.ts +0 -28
  37. package/dist/host/types/src/ui/api/tls-api.d.ts +25 -0
  38. package/dist/host/types/src/ui/auth/ElectronLoginForm.d.ts +9 -0
  39. package/dist/host/types/src/ui/components/command.d.ts +78 -0
  40. package/dist/host/types/src/ui/components/folder-style.d.ts +16 -0
  41. package/dist/host/types/src/ui/components/theme-provider.d.ts +2 -1
  42. package/dist/host/types/src/ui/components/version-badge.d.ts +7 -0
  43. package/dist/host/types/src/ui/hooks/use-page-visible-interval.d.ts +10 -0
  44. package/dist/host/types/src/ui/lib/activity-types.d.ts +15 -0
  45. package/dist/host/types/src/ui/lib/app-version.d.ts +2 -0
  46. package/dist/host/types/src/ui/lib/apply-ui-preset.d.ts +19 -0
  47. package/dist/host/types/src/ui/lib/create-id.d.ts +2 -0
  48. package/dist/host/types/src/ui/lib/database-transfer-url.d.ts +8 -0
  49. package/dist/host/types/src/ui/lib/desktop-updates.d.ts +29 -0
  50. package/dist/host/types/src/ui/lib/host-connection-tabs.d.ts +14 -0
  51. package/dist/host/types/src/ui/lib/host-to-ssh-host.d.ts +4 -0
  52. package/dist/host/types/src/ui/lib/issue-url.d.ts +21 -0
  53. package/dist/host/types/src/ui/lib/local-adaptive-preferences.d.ts +9 -0
  54. package/dist/host/types/src/ui/lib/pane-nav-hotkey.d.ts +7 -0
  55. package/dist/host/types/src/ui/lib/plugin-i18n.d.ts +4 -3
  56. package/dist/host/types/src/ui/lib/role-label.d.ts +3 -0
  57. package/dist/host/types/src/ui/look/LookSettings.d.ts +8 -0
  58. package/dist/host/types/src/ui/look/layout-registry.d.ts +34 -0
  59. package/dist/host/types/src/ui/look/look-store.d.ts +29 -0
  60. package/dist/host/types/src/ui/look/resolve-look.d.ts +18 -0
  61. package/dist/host/types/src/ui/look/theme-css.d.ts +7 -0
  62. package/dist/host/types/src/ui/look/theme-registry.d.ts +41 -0
  63. package/dist/host/types/src/ui/look/use-look-theme.d.ts +12 -0
  64. package/dist/host/types/src/ui/main-axios.d.ts +2 -2
  65. package/dist/host/types/src/ui/manage/manage-requests.d.ts +34 -0
  66. package/dist/host/types/src/ui/onboarding/onboarding-registry.d.ts +3 -1
  67. package/dist/host/types/src/ui/plugin-host/loader.d.ts +2 -0
  68. package/dist/host/types/src/ui/plugin-host/scope.d.ts +6 -0
  69. package/dist/host/types/src/ui/plugin-host/sdk-ui.d.ts +101 -0
  70. package/dist/host/types/src/ui/plugin-host/view-ownership.d.ts +1 -1
  71. package/dist/host/types/src/ui/plugins/PluginConsentPrompt.d.ts +20 -0
  72. package/dist/host/types/src/ui/plugins/PluginDetail.d.ts +7 -0
  73. package/dist/host/types/src/ui/plugins/PluginReleaseNotes.d.ts +14 -0
  74. package/dist/host/types/src/ui/plugins/PluginsTab.d.ts +1 -0
  75. package/dist/host/types/src/ui/plugins/RegistriesSection.d.ts +4 -0
  76. package/dist/host/types/src/ui/plugins/plugin-bits.d.ts +23 -0
  77. package/dist/host/types/src/ui/plugins/plugin-model.d.ts +136 -0
  78. package/dist/host/types/src/ui/plugins/use-plugins-manager.d.ts +78 -0
  79. package/dist/host/types/src/ui/settings/appearance/appearance-controls.d.ts +53 -0
  80. package/dist/host/types/src/ui/settings/sync/LinkServerDialog.d.ts +12 -0
  81. package/dist/host/types/src/ui/settings/sync/ProxySettingsFields.d.ts +15 -0
  82. package/dist/host/types/src/ui/settings/sync/saved-servers.d.ts +3 -0
  83. package/dist/host/types/src/ui/shell/controller/ShellControllerProvider.d.ts +20 -0
  84. package/dist/host/types/src/ui/shell/controller/plugin-shell.d.ts +7 -0
  85. package/dist/host/types/src/ui/shell/controller/shell-store.d.ts +4 -0
  86. package/dist/host/types/src/ui/shell/controller/types.d.ts +156 -0
  87. package/dist/host/types/src/ui/shell/controller/use-hosts.d.ts +10 -0
  88. package/dist/host/types/src/ui/shell/controller/use-regions.d.ts +5 -0
  89. package/dist/host/types/src/ui/shell/controller/use-shell-keybindings.d.ts +12 -0
  90. package/dist/host/types/src/ui/shell/controller/use-shell-lifecycle.d.ts +17 -0
  91. package/dist/host/types/src/ui/shell/controller/use-split.d.ts +21 -0
  92. package/dist/host/types/src/ui/shell/controller/use-tabs.d.ts +70 -0
  93. package/dist/host/types/src/ui/shell/controller/use-workspace-layout.d.ts +4 -0
  94. package/dist/host/types/src/ui/shell/reconnect-tabs.d.ts +6 -0
  95. package/dist/host/types/src/ui/shell/shell-layout.d.ts +46 -0
  96. package/dist/host/types/src/ui/shell/split/EmptyPanePicker.d.ts +32 -0
  97. package/dist/host/types/src/ui/shell/split/SplitDropOverlay.d.ts +9 -0
  98. package/dist/host/types/src/ui/shell/split/SplitLayoutMenu.d.ts +16 -0
  99. package/dist/host/types/src/ui/shell/split/SplitView.d.ts +31 -0
  100. package/dist/host/types/src/ui/shell/split/split-drag.d.ts +58 -0
  101. package/dist/host/types/src/ui/shell/split/split-presets.d.ts +28 -0
  102. package/dist/host/types/src/ui/shell/split/split-tabs.d.ts +95 -0
  103. package/dist/host/types/src/ui/shell/split/split-targets.d.ts +30 -0
  104. package/dist/host/types/src/ui/shell/split/split-tree.d.ts +89 -0
  105. package/dist/host/types/src/ui/shell/stage/TabStage.d.ts +9 -0
  106. package/dist/host/types/src/ui/shell/stage/tab-stage-store.d.ts +24 -0
  107. package/dist/host/types/src/ui/shell/tab-close-guards.d.ts +9 -0
  108. package/dist/host/types/src/ui/shell/tab-handles.d.ts +8 -0
  109. package/dist/host/types/src/ui/shell/tabUtils.d.ts +15 -0
  110. package/dist/host/types/src/ui/sidebar/AuthEnrollmentSections.d.ts +5 -0
  111. package/dist/host/types/src/ui/sidebar/HostManagerData.d.ts +4 -0
  112. package/dist/host/types/src/ui/sidebar/build-host-tree.d.ts +25 -0
  113. package/dist/host/types/src/ui/sidebar/host-contributions.d.ts +10 -0
  114. package/dist/host/ui.js +6045 -4055
  115. package/dist/host/{use-permissions-GYCBY2AU.js → use-permissions-ISEDRY3J.js} +2 -2
  116. package/dist/manifest.d.ts +50 -1
  117. package/dist/manifest.js +104 -1
  118. package/dist/ssh-keys.d.ts +29 -0
  119. package/dist/ssh-keys.js +85 -0
  120. package/dist/testing/setup.js +1 -0
  121. package/dist/testing.d.ts +32 -15
  122. package/dist/testing.js +218 -1
  123. package/dist/theme-css.d.ts +11 -0
  124. package/dist/theme-css.js +142 -0
  125. package/dist/vitest-preset.d.ts +18 -0
  126. package/dist/vitest-preset.js +14 -3
  127. package/package.json +5 -1
  128. package/schema/manifest.schema.json +121 -8
  129. package/tsconfig.plugin.json +1 -0
  130. package/dist/host/chunk-YC2MAKSP.js +0 -14
package/dist/desktop.d.ts CHANGED
@@ -2,7 +2,6 @@
2
2
  * The desktop app's bridge (window.electronAPI), typed for plugins. It exists
3
3
  * only inside the Termix desktop app; check isElectron before calling it.
4
4
  */
5
- import type { PluginSshPromptRequest } from "./backend.js";
6
5
  export interface ServerConfig {
7
6
  serverUrl?: string;
8
7
  allowInvalidCertificate?: boolean;
@@ -30,27 +29,6 @@ export interface DialogResult {
30
29
  filePaths?: string[];
31
30
  [key: string]: unknown;
32
31
  }
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
32
  export interface ElectronAPI {
55
33
  getAppVersion: () => Promise<string>;
56
34
  setZoomFactor?: (factor: number) => void;
@@ -62,51 +40,6 @@ export interface ElectronAPI {
62
40
  success: boolean;
63
41
  }>;
64
42
  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
43
  onCloseActiveTab?: (callback: () => void) => () => void;
111
44
  clearSessionCookies: () => Promise<void>;
112
45
  getSessionCookie: (name: string, targetUrl?: string) => Promise<string | null>;
@@ -117,46 +50,6 @@ export interface ElectronAPI {
117
50
  }>;
118
51
  showSaveDialog: (options: DialogOptions) => Promise<DialogResult>;
119
52
  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
53
  onUpdateAvailable: (callback: () => void) => void;
161
54
  onUpdateDownloaded: (callback: () => void) => void;
162
55
  removeAllListeners: (channel: string) => void;
@@ -197,142 +90,6 @@ export interface ElectronAPI {
197
90
  success: boolean;
198
91
  error?: string;
199
92
  }>;
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
93
  }
337
94
  declare global {
338
95
  interface Window {
@@ -222,6 +222,146 @@ export interface TabsApi extends Pick<ShellApi, "openTab" | "openSingletonTab" |
222
222
  /** Called once the shell has restored its tabs after login. */
223
223
  onReady: (listener: () => void) => Disposer;
224
224
  }
225
+ /**
226
+ * A whole-app layout. Core renders the chosen one inside its providers and an
227
+ * error boundary; everything it shows comes from useShell(). Declare it in
228
+ * manifest contributes.layouts and add the ui:layout capability.
229
+ */
230
+ export interface LayoutContribution {
231
+ id: string;
232
+ /** Your own i18n key or plain text, the same as the manifest's label. */
233
+ label: string;
234
+ component: ComponentType;
235
+ /** Shown on phones and narrow windows. The desktop app never uses it. */
236
+ mobileComponent?: ComponentType;
237
+ /** Theme to start with when nobody chose one. */
238
+ defaultTheme?: string;
239
+ }
240
+ /** A tab as a layout sees it. Splits are tabs too, with a `split` field. */
241
+ export interface ShellTabState extends PluginTabRecord {
242
+ instanceId: string;
243
+ customLabel?: string;
244
+ /** Set while the tab sits in a split pane. */
245
+ parentSplitTabId?: string;
246
+ openedAt?: number;
247
+ }
248
+ /** What a dock region shows and how it is sized, in Normal-size pixels. */
249
+ export interface ShellDockState {
250
+ view: string | null;
251
+ open: boolean;
252
+ width: number;
253
+ dragging: boolean;
254
+ setView: (view: string | null) => void;
255
+ setWidth: (width: number) => void;
256
+ /** Starts a drag from the dock's edge, from a mousedown. */
257
+ startResize: (event: {
258
+ clientX: number;
259
+ preventDefault: () => void;
260
+ }) => void;
261
+ resetWidth: () => void;
262
+ }
263
+ /** The live shell: state and actions, nothing drawn. Read with useShell(). */
264
+ export interface ShellController {
265
+ tabs: {
266
+ list: ShellTabState[];
267
+ /** What a tab bar shows: tabs not sitting in a split. */
268
+ topLevel: ShellTabState[];
269
+ activeId: string;
270
+ /** True once saved tabs were restored after login. */
271
+ ready: boolean;
272
+ /** The user turned on tab numbers. */
273
+ showNumbers: boolean;
274
+ setActive: (id: string) => void;
275
+ reorder: (topLevel: ShellTabState[]) => void;
276
+ close: (id: string) => Promise<void>;
277
+ rename: (id: string, label: string) => void;
278
+ /** Reconnects or reloads a session tab. */
279
+ refresh: (id: string) => void;
280
+ reconnectAll: () => void;
281
+ openSingleton: (type: string) => string | undefined;
282
+ };
283
+ split: {
284
+ /** The split shown now, or null. */
285
+ activeId: string | null;
286
+ focusedPaneId: string | null;
287
+ /** Every split with its panes, for a split menu. */
288
+ summaries: Array<{
289
+ id: string;
290
+ label: string;
291
+ full: boolean;
292
+ panes: Array<{
293
+ id: string;
294
+ index: number;
295
+ tabId: string | null;
296
+ label: string | null;
297
+ }>;
298
+ }>;
299
+ activeFull: boolean;
300
+ /** Split a tab, apply a preset, unsplit, add to a pane. */
301
+ handleAction: (action: Record<string, unknown> & {
302
+ kind: string;
303
+ }) => void;
304
+ };
305
+ hosts: {
306
+ list: PluginHostRecord[];
307
+ loading: boolean;
308
+ loaded: boolean;
309
+ reload: () => Promise<void>;
310
+ };
311
+ regions: {
312
+ left: ShellDockState & {
313
+ view: string;
314
+ };
315
+ right: ShellDockState;
316
+ /** What a rail click does: toggles or switches the left dock. */
317
+ railClick: (view: string) => void;
318
+ openInRightDock: (view: string) => void;
319
+ toggleRightDock: () => void;
320
+ };
321
+ palette: {
322
+ isOpen: boolean;
323
+ open: () => void;
324
+ close: () => void;
325
+ };
326
+ fullscreen: {
327
+ active: boolean;
328
+ toggle: () => void;
329
+ };
330
+ /** The same callbacks tabs and panels get. */
331
+ actions: ShellApi;
332
+ env: {
333
+ isMobile: boolean;
334
+ isElectron: boolean;
335
+ user: {
336
+ username: string;
337
+ isAdmin: boolean;
338
+ };
339
+ permissions: string[];
340
+ branding: {
341
+ appName: string | null;
342
+ tagline: string | null;
343
+ logo: string | null;
344
+ };
345
+ };
346
+ /** Core registries, as hooks a layout calls while rendering. */
347
+ registries: {
348
+ useRailItems: () => ReadonlyArray<{
349
+ id: string;
350
+ } & Record<string, unknown>>;
351
+ usePanels: () => ReadonlyArray<{
352
+ id: string;
353
+ } & Record<string, unknown>>;
354
+ useTabTypes: () => ReadonlyArray<{
355
+ id: string;
356
+ } & Record<string, unknown>>;
357
+ useDashboardCards: () => ReadonlyArray<{
358
+ id: string;
359
+ } & Record<string, unknown>>;
360
+ };
361
+ logout: (options?: {
362
+ manual?: boolean;
363
+ }) => void;
364
+ }
225
365
  export interface RailItemContribution {
226
366
  /** Must be declared in manifest contributes.tabs or contributes.panels. */
227
367
  id: string;
@@ -489,7 +629,13 @@ export interface HostBadgeContribution {
489
629
  component: ComponentType<{
490
630
  host: PluginHostRecord;
491
631
  }>;
632
+ /** Lower comes first. Ties sort by id. */
633
+ order?: number;
492
634
  }
635
+ /** The dot or stripe that shows a host's status on its row. */
636
+ export type HostStatusIndicatorContribution = HostBadgeContribution;
637
+ /** A control in the host editor's toolbar. */
638
+ export type HostEditorToolbarItemContribution = HostBadgeContribution;
493
639
  export interface HostContextMenuItemContribution {
494
640
  id: string;
495
641
  titleKey: string;
@@ -655,10 +801,11 @@ export type OnboardingMode = "full" | "partial" | "rerun";
655
801
  * Where a plugin step sits in onboarding. "setup" comes right after the
656
802
  * appearance steps, for things that need doing before the feature works
657
803
  * (like pointing at a guacd server). "explore" (the default) comes after
658
- * that, "security" after the account security step. Onboarding is for
804
+ * that, "security" after the account security step. "start" comes before
805
+ * the appearance steps, for choices that shape how the rest looks. Onboarding is for
659
806
  * choices, not for explaining features.
660
807
  */
661
- export type OnboardingSection = "setup" | "explore" | "security";
808
+ export type OnboardingSection = "start" | "setup" | "explore" | "security";
662
809
  export interface OnboardingStepProps {
663
810
  /**
664
811
  * "full" is a new user's first run, "partial" shows only steps they have
@@ -699,6 +846,16 @@ export interface OnboardingStepContribution {
699
846
  permission?: string;
700
847
  section?: OnboardingSection;
701
848
  order?: number;
849
+ /**
850
+ * Exact place in the flow, 1 to 99, instead of a section. Core steps sit at
851
+ * 10 (plugins), 20, 25, 30 (preset), 40 (appearance) and 90 (security).
852
+ */
853
+ position?: number;
854
+ /**
855
+ * Older step keys this step took over, like "preset". People who already
856
+ * saw one of them are not shown this step again.
857
+ */
858
+ replaces?: string[];
702
859
  when?: (context: {
703
860
  isAdmin: boolean;
704
861
  isDesktop: boolean;
@@ -848,6 +1005,10 @@ export interface TermixApp extends TermixAppInfo {
848
1005
  registerHostAction: (action: HostActionContribution) => Disposer;
849
1006
  registerHostProtocol: (protocol: HostProtocolContribution) => Disposer;
850
1007
  registerHostBadge: (badge: HostBadgeContribution) => Disposer;
1008
+ /** Draws a host row's status. A layout renders every registered one. */
1009
+ registerHostStatusIndicator: (indicator: HostStatusIndicatorContribution) => Disposer;
1010
+ /** Adds a control to the host editor's toolbar. */
1011
+ registerHostEditorToolbarItem: (item: HostEditorToolbarItemContribution) => Disposer;
851
1012
  registerHostContextMenuItem: (item: HostContextMenuItemContribution) => Disposer;
852
1013
  registerPaletteEntry: (entry: PaletteEntryContribution) => Disposer;
853
1014
  registerPaletteGroup: (group: PaletteGroupContribution) => Disposer;
@@ -886,6 +1047,12 @@ export interface TermixApp extends TermixAppInfo {
886
1047
  registerSshAuthEditor: (editor: SshAuthEditorContribution) => Disposer;
887
1048
  registerLoginMethod: (method: LoginMethodContribution) => Disposer;
888
1049
  registerSecondFactorUI: (factor: SecondFactorContribution) => Disposer;
1050
+ /**
1051
+ * A whole-app layout. Declared in manifest contributes.layouts with the
1052
+ * ui:layout capability. Only the chosen layout's plugin is loaded, so
1053
+ * register it in activate. Needs plugin API 1.4.
1054
+ */
1055
+ registerLayout: (layout: LayoutContribution) => Disposer;
889
1056
  /**
890
1057
  * Translates a key from the plugin's own locales, for code outside a
891
1058
  * component (a toast from activate). Components use useTranslation().
@@ -993,6 +1160,7 @@ export interface PluginHostBridge {
993
1160
  useTheme: () => {
994
1161
  theme: "light" | "dark";
995
1162
  };
1163
+ useShell: () => ShellController | null;
996
1164
  toast: ToastApi;
997
1165
  getApi: (pluginId: string) => PluginApiClient;
998
1166
  getApiFor: (pluginId: string, origin: unknown) => PluginApiClient;
@@ -1154,6 +1322,11 @@ export declare function useCurrentUser(): CurrentUser | null;
1154
1322
  export declare function useTheme(): {
1155
1323
  theme: "light" | "dark";
1156
1324
  };
1325
+ /**
1326
+ * The live shell, for a layout. Null outside the signed-in app. Needs plugin
1327
+ * API 1.4.
1328
+ */
1329
+ export declare function useShell(): ShellController | null;
1157
1330
  export declare function useToast(): ToastApi;
1158
1331
  export declare function logActivity(type: string, hostId: number, hostName: string): Promise<void>;
1159
1332
  /** Tells the shell hosts were added or changed, so its lists reload. */
package/dist/frontend.js CHANGED
@@ -98,6 +98,13 @@ export function useCurrentUser() {
98
98
  export function useTheme() {
99
99
  return requireHost().useTheme();
100
100
  }
101
+ /**
102
+ * The live shell, for a layout. Null outside the signed-in app. Needs plugin
103
+ * API 1.4.
104
+ */
105
+ export function useShell() {
106
+ return requireHost().useShell();
107
+ }
101
108
  export function useToast() {
102
109
  return requireHost().toast;
103
110
  }