@termix-ssh/plugin-sdk 1.0.10 → 1.0.12

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 (123) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/PLUGIN-GUIDE.md +151 -36
  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 +37 -3
  9. package/dist/capabilities.js +2 -0
  10. package/dist/frontend.d.ts +152 -0
  11. package/dist/frontend.js +7 -0
  12. package/dist/host/PluginsTab-EV4MSGY6.js +2933 -0
  13. package/dist/host/{chunk-G346FUE4.js → chunk-AWR6FYDO.js} +8877 -11159
  14. package/dist/host/{chunk-NZG6HNQH.js → chunk-RUPLD6RF.js} +1504 -15
  15. package/dist/host/{chunk-DIOJ3KW2.js → chunk-VEWOYAMZ.js} +6 -1
  16. package/dist/host/chunk-X4QZKO5G.js +3120 -0
  17. package/dist/host/chunk-XKA3DBB2.js +10375 -0
  18. package/dist/host/chunk-YGYBM7SQ.js +58 -0
  19. package/dist/host/core-classes.json +1 -1
  20. package/dist/host/{linked-server-QAKKDBFM.js → linked-server-B4NEG4MA.js} +2 -2
  21. package/dist/host/{rbac-api-5267EMX7.js → rbac-api-OUO3LUOC.js} +2 -2
  22. package/dist/host/testing-host.js +123 -57
  23. package/dist/host/types/src/types/ui-types.d.ts +2 -1
  24. package/dist/host/types/src/ui/api/audit-log-api.d.ts +46 -0
  25. package/dist/host/types/src/ui/api/host-defaults-api.d.ts +42 -0
  26. package/dist/host/types/src/ui/api/host-tags-api.d.ts +2 -0
  27. package/dist/host/types/src/ui/api/look-api.d.ts +40 -0
  28. package/dist/host/types/src/ui/api/open-tabs-api.d.ts +4 -0
  29. package/dist/host/types/src/ui/api/plugins-api.d.ts +26 -0
  30. package/dist/host/types/src/ui/api/private-endpoints-api.d.ts +6 -0
  31. package/dist/host/types/src/ui/api/tls-api.d.ts +25 -0
  32. package/dist/host/types/src/ui/auth/ElectronLoginForm.d.ts +9 -0
  33. package/dist/host/types/src/ui/components/command.d.ts +78 -0
  34. package/dist/host/types/src/ui/components/folder-style.d.ts +16 -0
  35. package/dist/host/types/src/ui/components/theme-provider.d.ts +2 -1
  36. package/dist/host/types/src/ui/components/version-badge.d.ts +7 -0
  37. package/dist/host/types/src/ui/hooks/use-page-visible-interval.d.ts +10 -0
  38. package/dist/host/types/src/ui/lib/activity-types.d.ts +15 -0
  39. package/dist/host/types/src/ui/lib/app-version.d.ts +2 -0
  40. package/dist/host/types/src/ui/lib/apply-ui-preset.d.ts +19 -0
  41. package/dist/host/types/src/ui/lib/connection-origin.d.ts +4 -5
  42. package/dist/host/types/src/ui/lib/create-id.d.ts +2 -0
  43. package/dist/host/types/src/ui/lib/database-transfer-url.d.ts +8 -0
  44. package/dist/host/types/src/ui/lib/desktop-updates.d.ts +29 -0
  45. package/dist/host/types/src/ui/lib/electron.d.ts +5 -0
  46. package/dist/host/types/src/ui/lib/host-connection-tabs.d.ts +14 -0
  47. package/dist/host/types/src/ui/lib/host-to-ssh-host.d.ts +4 -0
  48. package/dist/host/types/src/ui/lib/issue-url.d.ts +21 -0
  49. package/dist/host/types/src/ui/lib/local-adaptive-preferences.d.ts +9 -0
  50. package/dist/host/types/src/ui/lib/pane-nav-hotkey.d.ts +7 -0
  51. package/dist/host/types/src/ui/lib/plugin-i18n.d.ts +16 -0
  52. package/dist/host/types/src/ui/lib/role-label.d.ts +3 -0
  53. package/dist/host/types/src/ui/look/LookSettings.d.ts +8 -0
  54. package/dist/host/types/src/ui/look/layout-registry.d.ts +34 -0
  55. package/dist/host/types/src/ui/look/look-store.d.ts +29 -0
  56. package/dist/host/types/src/ui/look/resolve-look.d.ts +18 -0
  57. package/dist/host/types/src/ui/look/theme-css.d.ts +7 -0
  58. package/dist/host/types/src/ui/look/theme-registry.d.ts +41 -0
  59. package/dist/host/types/src/ui/look/use-look-theme.d.ts +12 -0
  60. package/dist/host/types/src/ui/manage/manage-requests.d.ts +34 -0
  61. package/dist/host/types/src/ui/plugin-host/loader.d.ts +2 -0
  62. package/dist/host/types/src/ui/plugin-host/scope.d.ts +6 -0
  63. package/dist/host/types/src/ui/plugin-host/sdk-ui.d.ts +102 -0
  64. package/dist/host/types/src/ui/plugin-host/view-ownership.d.ts +1 -1
  65. package/dist/host/types/src/ui/plugins/PluginConsentPrompt.d.ts +20 -0
  66. package/dist/host/types/src/ui/plugins/PluginDetail.d.ts +7 -0
  67. package/dist/host/types/src/ui/plugins/PluginReleaseNotes.d.ts +14 -0
  68. package/dist/host/types/src/ui/plugins/PluginsTab.d.ts +1 -0
  69. package/dist/host/types/src/ui/plugins/RegistriesSection.d.ts +4 -0
  70. package/dist/host/types/src/ui/plugins/plugin-bits.d.ts +23 -0
  71. package/dist/host/types/src/ui/plugins/plugin-model.d.ts +116 -0
  72. package/dist/host/types/src/ui/plugins/use-plugins-manager.d.ts +75 -0
  73. package/dist/host/types/src/ui/settings/appearance/appearance-controls.d.ts +53 -0
  74. package/dist/host/types/src/ui/settings/sync/LinkServerDialog.d.ts +12 -0
  75. package/dist/host/types/src/ui/settings/sync/ProxySettingsFields.d.ts +15 -0
  76. package/dist/host/types/src/ui/settings/sync/saved-servers.d.ts +3 -0
  77. package/dist/host/types/src/ui/shell/controller/ShellControllerProvider.d.ts +20 -0
  78. package/dist/host/types/src/ui/shell/controller/plugin-shell.d.ts +7 -0
  79. package/dist/host/types/src/ui/shell/controller/shell-store.d.ts +4 -0
  80. package/dist/host/types/src/ui/shell/controller/types.d.ts +156 -0
  81. package/dist/host/types/src/ui/shell/controller/use-hosts.d.ts +10 -0
  82. package/dist/host/types/src/ui/shell/controller/use-regions.d.ts +5 -0
  83. package/dist/host/types/src/ui/shell/controller/use-shell-keybindings.d.ts +12 -0
  84. package/dist/host/types/src/ui/shell/controller/use-shell-lifecycle.d.ts +17 -0
  85. package/dist/host/types/src/ui/shell/controller/use-split.d.ts +21 -0
  86. package/dist/host/types/src/ui/shell/controller/use-tabs.d.ts +70 -0
  87. package/dist/host/types/src/ui/shell/controller/use-workspace-layout.d.ts +4 -0
  88. package/dist/host/types/src/ui/shell/reconnect-tabs.d.ts +6 -0
  89. package/dist/host/types/src/ui/shell/shell-layout.d.ts +46 -0
  90. package/dist/host/types/src/ui/shell/split/EmptyPanePicker.d.ts +32 -0
  91. package/dist/host/types/src/ui/shell/split/SplitDropOverlay.d.ts +9 -0
  92. package/dist/host/types/src/ui/shell/split/SplitLayoutMenu.d.ts +16 -0
  93. package/dist/host/types/src/ui/shell/split/SplitView.d.ts +31 -0
  94. package/dist/host/types/src/ui/shell/split/split-drag.d.ts +58 -0
  95. package/dist/host/types/src/ui/shell/split/split-presets.d.ts +28 -0
  96. package/dist/host/types/src/ui/shell/split/split-tabs.d.ts +95 -0
  97. package/dist/host/types/src/ui/shell/split/split-targets.d.ts +30 -0
  98. package/dist/host/types/src/ui/shell/split/split-tree.d.ts +89 -0
  99. package/dist/host/types/src/ui/shell/stage/TabStage.d.ts +9 -0
  100. package/dist/host/types/src/ui/shell/stage/tab-stage-store.d.ts +24 -0
  101. package/dist/host/types/src/ui/shell/tab-close-guards.d.ts +9 -0
  102. package/dist/host/types/src/ui/shell/tab-handles.d.ts +8 -0
  103. package/dist/host/types/src/ui/shell/tabUtils.d.ts +15 -0
  104. package/dist/host/types/src/ui/sidebar/AuthEnrollmentSections.d.ts +5 -0
  105. package/dist/host/types/src/ui/sidebar/HostManagerData.d.ts +4 -0
  106. package/dist/host/types/src/ui/sidebar/HostManagerTabs.d.ts +10 -4
  107. package/dist/host/types/src/ui/sidebar/build-host-tree.d.ts +25 -0
  108. package/dist/host/types/src/ui/sidebar/host-export-payload.d.ts +30 -0
  109. package/dist/host/ui.js +6238 -4054
  110. package/dist/host/{use-permissions-2P2TP6GY.js → use-permissions-6VSHHUMB.js} +2 -2
  111. package/dist/manifest.d.ts +41 -1
  112. package/dist/manifest.js +89 -1
  113. package/dist/testing/setup.js +1 -0
  114. package/dist/testing.d.ts +12 -1
  115. package/dist/testing.js +25 -1
  116. package/dist/theme-css.d.ts +11 -0
  117. package/dist/theme-css.js +142 -0
  118. package/dist/vitest-preset.d.ts +18 -0
  119. package/dist/vitest-preset.js +14 -3
  120. package/package.json +1 -1
  121. package/schema/manifest.schema.json +111 -8
  122. package/tsconfig.plugin.json +1 -0
  123. package/dist/host/chunk-YC2MAKSP.js +0 -14
@@ -1,10 +1,15 @@
1
1
  const __termixNoGlob = () => ({});
2
2
  import {
3
3
  __export,
4
- define_import_meta_env_default
5
- } from "./chunk-YC2MAKSP.js";
4
+ define_import_meta_env_default,
5
+ init_define_import_meta_env
6
+ } from "./chunk-YGYBM7SQ.js";
7
+
8
+ // src/ui/lib/linked-server.ts
9
+ init_define_import_meta_env();
6
10
 
7
11
  // src/ui/lib/electron.ts
12
+ init_define_import_meta_env();
8
13
  function isElectron() {
9
14
  if (typeof window === "undefined") return false;
10
15
  const win = window;
@@ -13,13 +18,33 @@ function isElectron() {
13
18
  const isElectronProp = win.electronAPI?.isElectron === true;
14
19
  return hasISElectron || hasElectronAPI || isElectronProp;
15
20
  }
21
+ var DEFAULT_LOCAL_BACKEND_PORT = 30001;
22
+ function localBackendPort() {
23
+ if (typeof window === "undefined") return DEFAULT_LOCAL_BACKEND_PORT;
24
+ const port = window.electronAPI?.backendPort;
25
+ return typeof port === "number" && Number.isInteger(port) && port > 0 && port < 65536 ? port : DEFAULT_LOCAL_BACKEND_PORT;
26
+ }
27
+
28
+ // src/ui/main-axios.ts
29
+ init_define_import_meta_env();
16
30
 
17
31
  // src/ui/lib/error-message.ts
32
+ init_define_import_meta_env();
18
33
  function getErrorMessage(error, fallback = "Unknown error") {
19
34
  return error instanceof Error ? error.message : fallback;
20
35
  }
21
36
 
37
+ // node_modules/axios/index.js
38
+ init_define_import_meta_env();
39
+
40
+ // node_modules/axios/lib/axios.js
41
+ init_define_import_meta_env();
42
+
43
+ // node_modules/axios/lib/utils.js
44
+ init_define_import_meta_env();
45
+
22
46
  // node_modules/axios/lib/helpers/bind.js
47
+ init_define_import_meta_env();
23
48
  function bind(fn, thisArg) {
24
49
  return function wrap() {
25
50
  return fn.apply(thisArg, arguments);
@@ -574,7 +599,26 @@ var utils_default = {
574
599
  isSafeIterable
575
600
  };
576
601
 
602
+ // node_modules/axios/lib/core/Axios.js
603
+ init_define_import_meta_env();
604
+
605
+ // node_modules/axios/lib/helpers/buildURL.js
606
+ init_define_import_meta_env();
607
+
608
+ // node_modules/axios/lib/helpers/AxiosURLSearchParams.js
609
+ init_define_import_meta_env();
610
+
611
+ // node_modules/axios/lib/helpers/toFormData.js
612
+ init_define_import_meta_env();
613
+
614
+ // node_modules/axios/lib/core/AxiosError.js
615
+ init_define_import_meta_env();
616
+
617
+ // node_modules/axios/lib/core/AxiosHeaders.js
618
+ init_define_import_meta_env();
619
+
577
620
  // node_modules/axios/lib/helpers/parseHeaders.js
621
+ init_define_import_meta_env();
578
622
  var ignoreDuplicateOf = utils_default.toObjectSet([
579
623
  "age",
580
624
  "authorization",
@@ -621,6 +665,7 @@ var parseHeaders_default = (rawHeaders) => {
621
665
  };
622
666
 
623
667
  // node_modules/axios/lib/helpers/sanitizeHeaderValue.js
668
+ init_define_import_meta_env();
624
669
  function trimSPorHTAB(str) {
625
670
  let start = 0;
626
671
  let end = str.length;
@@ -1154,6 +1199,7 @@ AxiosError.ERR_FORM_DATA_DEPTH_EXCEEDED = "ERR_FORM_DATA_DEPTH_EXCEEDED";
1154
1199
  var AxiosError_default = AxiosError;
1155
1200
 
1156
1201
  // node_modules/axios/lib/helpers/null.js
1202
+ init_define_import_meta_env();
1157
1203
  var null_default = null;
1158
1204
 
1159
1205
  // node_modules/axios/lib/helpers/toFormData.js
@@ -1364,6 +1410,7 @@ function buildURL(url, params, options) {
1364
1410
  }
1365
1411
 
1366
1412
  // node_modules/axios/lib/core/InterceptorManager.js
1413
+ init_define_import_meta_env();
1367
1414
  var $internals2 = /* @__PURE__ */ Symbol("internals");
1368
1415
  function countHandlers(handlers) {
1369
1416
  return handlers ? handlers.length : 0;
@@ -1501,7 +1548,17 @@ var InterceptorManager = class {
1501
1548
  };
1502
1549
  var InterceptorManager_default = InterceptorManager;
1503
1550
 
1551
+ // node_modules/axios/lib/core/dispatchRequest.js
1552
+ init_define_import_meta_env();
1553
+
1554
+ // node_modules/axios/lib/core/transformData.js
1555
+ init_define_import_meta_env();
1556
+
1557
+ // node_modules/axios/lib/defaults/index.js
1558
+ init_define_import_meta_env();
1559
+
1504
1560
  // node_modules/axios/lib/defaults/transitional.js
1561
+ init_define_import_meta_env();
1505
1562
  var transitional_default = {
1506
1563
  silentJSONParsing: true,
1507
1564
  forcedJSONParsing: true,
@@ -1511,13 +1568,25 @@ var transitional_default = {
1511
1568
  validateStatusUndefinedResolves: true
1512
1569
  };
1513
1570
 
1571
+ // node_modules/axios/lib/helpers/toURLEncodedForm.js
1572
+ init_define_import_meta_env();
1573
+
1574
+ // node_modules/axios/lib/platform/index.js
1575
+ init_define_import_meta_env();
1576
+
1577
+ // node_modules/axios/lib/platform/browser/index.js
1578
+ init_define_import_meta_env();
1579
+
1514
1580
  // node_modules/axios/lib/platform/browser/classes/URLSearchParams.js
1581
+ init_define_import_meta_env();
1515
1582
  var URLSearchParams_default = typeof URLSearchParams !== "undefined" ? URLSearchParams : AxiosURLSearchParams_default;
1516
1583
 
1517
1584
  // node_modules/axios/lib/platform/browser/classes/FormData.js
1585
+ init_define_import_meta_env();
1518
1586
  var FormData_default = typeof FormData !== "undefined" ? FormData : null;
1519
1587
 
1520
1588
  // node_modules/axios/lib/platform/browser/classes/Blob.js
1589
+ init_define_import_meta_env();
1521
1590
  var Blob_default = typeof Blob !== "undefined" ? Blob : null;
1522
1591
 
1523
1592
  // node_modules/axios/lib/platform/browser/index.js
@@ -1540,6 +1609,7 @@ __export(utils_exports, {
1540
1609
  navigator: () => _navigator,
1541
1610
  origin: () => origin
1542
1611
  });
1612
+ init_define_import_meta_env();
1543
1613
  var hasBrowserEnv = typeof window !== "undefined" && typeof document !== "undefined";
1544
1614
  var _navigator = typeof navigator === "object" && navigator || void 0;
1545
1615
  var hasStandardBrowserEnv = hasBrowserEnv && (!_navigator || ["ReactNative", "NativeScript", "NS"].indexOf(_navigator.product) < 0);
@@ -1570,6 +1640,7 @@ function toURLEncodedForm(data, options) {
1570
1640
  }
1571
1641
 
1572
1642
  // node_modules/axios/lib/helpers/formDataToJSON.js
1643
+ init_define_import_meta_env();
1573
1644
  var MAX_DEPTH = DEFAULT_FORM_DATA_MAX_DEPTH;
1574
1645
  function throwIfDepthExceeded(index) {
1575
1646
  if (index > MAX_DEPTH) {
@@ -1638,6 +1709,7 @@ function formDataToJSON(formData) {
1638
1709
  var formDataToJSON_default = formDataToJSON;
1639
1710
 
1640
1711
  // node_modules/axios/lib/core/methodList.js
1712
+ init_define_import_meta_env();
1641
1713
  var methodList = Object.freeze([
1642
1714
  "get",
1643
1715
  "delete",
@@ -1784,11 +1856,13 @@ function transformData(fns, response) {
1784
1856
  }
1785
1857
 
1786
1858
  // node_modules/axios/lib/cancel/isCancel.js
1859
+ init_define_import_meta_env();
1787
1860
  function isCancel(value) {
1788
1861
  return !!(value && value.__CANCEL__);
1789
1862
  }
1790
1863
 
1791
1864
  // node_modules/axios/lib/cancel/CanceledError.js
1865
+ init_define_import_meta_env();
1792
1866
  var CanceledError = class extends AxiosError_default {
1793
1867
  /**
1794
1868
  * A `CanceledError` is an object that is thrown when an operation is canceled.
@@ -1807,7 +1881,14 @@ var CanceledError = class extends AxiosError_default {
1807
1881
  };
1808
1882
  var CanceledError_default = CanceledError;
1809
1883
 
1884
+ // node_modules/axios/lib/adapters/adapters.js
1885
+ init_define_import_meta_env();
1886
+
1887
+ // node_modules/axios/lib/adapters/xhr.js
1888
+ init_define_import_meta_env();
1889
+
1810
1890
  // node_modules/axios/lib/core/settle.js
1891
+ init_define_import_meta_env();
1811
1892
  function settle(resolve, reject, response) {
1812
1893
  const validateStatus2 = response.config.validateStatus;
1813
1894
  if (!response.status || !validateStatus2 || validateStatus2(response.status)) {
@@ -1824,6 +1905,7 @@ function settle(resolve, reject, response) {
1824
1905
  }
1825
1906
 
1826
1907
  // node_modules/axios/lib/helpers/normalizeURLForProtocolCheck.js
1908
+ init_define_import_meta_env();
1827
1909
  var urlParserControlCharacters = /[\t\n\r]/g;
1828
1910
  function normalizeURLForProtocolCheck(url) {
1829
1911
  if (typeof url !== "string") {
@@ -1837,12 +1919,17 @@ function normalizeURLForProtocolCheck(url) {
1837
1919
  }
1838
1920
 
1839
1921
  // node_modules/axios/lib/helpers/parseProtocol.js
1922
+ init_define_import_meta_env();
1840
1923
  function parseProtocol(url) {
1841
1924
  const match = /^([-+\w]{1,25}):(?:\/\/)?/.exec(url);
1842
1925
  return match && match[1] || "";
1843
1926
  }
1844
1927
 
1928
+ // node_modules/axios/lib/helpers/progressEventReducer.js
1929
+ init_define_import_meta_env();
1930
+
1845
1931
  // node_modules/axios/lib/helpers/speedometer.js
1932
+ init_define_import_meta_env();
1846
1933
  function speedometer(samplesCount, min) {
1847
1934
  samplesCount = samplesCount || 10;
1848
1935
  const bytes = new Array(samplesCount);
@@ -1879,6 +1966,7 @@ function speedometer(samplesCount, min) {
1879
1966
  var speedometer_default = speedometer;
1880
1967
 
1881
1968
  // node_modules/axios/lib/helpers/throttle.js
1969
+ init_define_import_meta_env();
1882
1970
  function throttle(fn, freq) {
1883
1971
  let timestamp = 0;
1884
1972
  let threshold = 1e3 / freq;
@@ -1955,7 +2043,11 @@ var progressEventDecorator = (total, throttled) => {
1955
2043
  };
1956
2044
  var asyncDecorator = (fn, scheduler = utils_default.asap) => (...args) => scheduler(() => fn(...args));
1957
2045
 
2046
+ // node_modules/axios/lib/helpers/resolveConfig.js
2047
+ init_define_import_meta_env();
2048
+
1958
2049
  // node_modules/axios/lib/helpers/isURLSameOrigin.js
2050
+ init_define_import_meta_env();
1959
2051
  var isURLSameOrigin_default = platform_default.hasStandardBrowserEnv ? /* @__PURE__ */ ((origin2, isMSIE) => (url) => {
1960
2052
  url = new URL(url, platform_default.origin);
1961
2053
  return origin2.protocol === url.protocol && origin2.host === url.host && (isMSIE || origin2.port === url.port);
@@ -1965,6 +2057,7 @@ var isURLSameOrigin_default = platform_default.hasStandardBrowserEnv ? /* @__PUR
1965
2057
  ) : () => true;
1966
2058
 
1967
2059
  // node_modules/axios/lib/helpers/cookies.js
2060
+ init_define_import_meta_env();
1968
2061
  var cookies_default = platform_default.hasStandardBrowserEnv ? (
1969
2062
  // Standard browser envs support document.cookie
1970
2063
  {
@@ -2021,7 +2114,11 @@ var cookies_default = platform_default.hasStandardBrowserEnv ? (
2021
2114
  }
2022
2115
  );
2023
2116
 
2117
+ // node_modules/axios/lib/core/buildFullPath.js
2118
+ init_define_import_meta_env();
2119
+
2024
2120
  // node_modules/axios/lib/helpers/isAbsoluteURL.js
2121
+ init_define_import_meta_env();
2025
2122
  function isAbsoluteURL(url) {
2026
2123
  if (typeof url !== "string") {
2027
2124
  return false;
@@ -2030,6 +2127,7 @@ function isAbsoluteURL(url) {
2030
2127
  }
2031
2128
 
2032
2129
  // node_modules/axios/lib/helpers/combineURLs.js
2130
+ init_define_import_meta_env();
2033
2131
  function combineURLs(baseURL, relativeURL) {
2034
2132
  if (!relativeURL) {
2035
2133
  return baseURL;
@@ -2087,6 +2185,7 @@ function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls, config) {
2087
2185
  }
2088
2186
 
2089
2187
  // node_modules/axios/lib/core/mergeConfig.js
2188
+ init_define_import_meta_env();
2090
2189
  var headersToObject = (thing) => thing instanceof AxiosHeaders_default ? { ...thing } : thing;
2091
2190
  var ownEnumerableKeys = (thing) => {
2092
2191
  if (Object.getOwnPropertySymbols && Object.getOwnPropertyDescriptor) {
@@ -2215,6 +2314,7 @@ function mergeConfig(config1, config2) {
2215
2314
  }
2216
2315
 
2217
2316
  // node_modules/axios/lib/core/setFormDataHeaders.js
2317
+ init_define_import_meta_env();
2218
2318
  var FORM_DATA_CONTENT_HEADERS = ["content-type", "content-length"];
2219
2319
  function setFormDataHeaders(headers, formHeaders, policy) {
2220
2320
  if (policy !== "content-only") {
@@ -2457,7 +2557,11 @@ var xhr_default = isXHRAdapterSupported && function(config) {
2457
2557
  });
2458
2558
  };
2459
2559
 
2560
+ // node_modules/axios/lib/adapters/fetch.js
2561
+ init_define_import_meta_env();
2562
+
2460
2563
  // node_modules/axios/lib/helpers/composeSignals.js
2564
+ init_define_import_meta_env();
2461
2565
  var composeSignals = (signals, timeout) => {
2462
2566
  signals = signals ? signals.filter(Boolean) : [];
2463
2567
  if (!timeout && !signals.length) {
@@ -2507,6 +2611,7 @@ var composeSignals = (signals, timeout) => {
2507
2611
  var composeSignals_default = composeSignals;
2508
2612
 
2509
2613
  // node_modules/axios/lib/helpers/trackStream.js
2614
+ init_define_import_meta_env();
2510
2615
  var streamChunk = function* (chunk, chunkSize) {
2511
2616
  let len = chunk.byteLength;
2512
2617
  if (!chunkSize || len < chunkSize) {
@@ -2587,6 +2692,7 @@ var trackStream = (stream, chunkSize, onProgress, onFinish) => {
2587
2692
  };
2588
2693
 
2589
2694
  // node_modules/axios/lib/helpers/estimateDataURLDecodedBytes.js
2695
+ init_define_import_meta_env();
2590
2696
  var isHexDigit = (charCode) => charCode >= 48 && charCode <= 57 || charCode >= 65 && charCode <= 70 || charCode >= 97 && charCode <= 102;
2591
2697
  var isPercentEncodedByte = (str, i, len) => i + 2 < len && isHexDigit(str.charCodeAt(i + 1)) && isHexDigit(str.charCodeAt(i + 2));
2592
2698
  var hexValue = (charCode) => charCode <= 57 ? charCode - 48 : (charCode & 223) - 55;
@@ -2687,6 +2793,7 @@ function estimateDataURLDecodedBytes(url) {
2687
2793
  }
2688
2794
 
2689
2795
  // node_modules/axios/lib/env/data.js
2796
+ init_define_import_meta_env();
2690
2797
  var VERSION = "1.20.0";
2691
2798
 
2692
2799
  // node_modules/axios/lib/adapters/fetch.js
@@ -3263,6 +3370,7 @@ function dispatchRequest(_config) {
3263
3370
  }
3264
3371
 
3265
3372
  // node_modules/axios/lib/helpers/validator.js
3373
+ init_define_import_meta_env();
3266
3374
  var validators = {};
3267
3375
  ["object", "boolean", "number", "function", "string", "symbol"].forEach((type, i) => {
3268
3376
  validators[type] = function validator(thing) {
@@ -3548,6 +3656,7 @@ utils_default.forEach(["post", "put", "patch", "query"], function forEachMethodW
3548
3656
  var Axios_default = Axios;
3549
3657
 
3550
3658
  // node_modules/axios/lib/cancel/CancelToken.js
3659
+ init_define_import_meta_env();
3551
3660
  var CancelToken = class _CancelToken {
3552
3661
  constructor(executor) {
3553
3662
  if (typeof executor !== "function") {
@@ -3646,6 +3755,7 @@ var CancelToken = class _CancelToken {
3646
3755
  var CancelToken_default = CancelToken;
3647
3756
 
3648
3757
  // node_modules/axios/lib/helpers/spread.js
3758
+ init_define_import_meta_env();
3649
3759
  function spread(callback) {
3650
3760
  return function wrap(arr) {
3651
3761
  return callback.apply(null, arr);
@@ -3653,11 +3763,13 @@ function spread(callback) {
3653
3763
  }
3654
3764
 
3655
3765
  // node_modules/axios/lib/helpers/isAxiosError.js
3766
+ init_define_import_meta_env();
3656
3767
  function isAxiosError(payload) {
3657
3768
  return utils_default.isObject(payload) && payload.isAxiosError === true;
3658
3769
  }
3659
3770
 
3660
3771
  // node_modules/axios/lib/helpers/HttpStatusCode.js
3772
+ init_define_import_meta_env();
3661
3773
  var HttpStatusCode = {
3662
3774
  Continue: 100,
3663
3775
  SwitchingProtocols: 101,
@@ -3804,6 +3916,7 @@ import { toast } from "sonner";
3804
3916
  import i18n2 from "i18next";
3805
3917
 
3806
3918
  // src/ui/lib/base-path.ts
3919
+ init_define_import_meta_env();
3807
3920
  function getBasePath() {
3808
3921
  const runtime = document.querySelector('meta[name="termix-base-path"]')?.content.trim() || window.__TERMIX_BASE_PATH__;
3809
3922
  if (runtime) {
@@ -3814,7 +3927,14 @@ function getBasePath() {
3814
3927
  return base.endsWith("/") ? base.slice(0, -1) : base;
3815
3928
  }
3816
3929
 
3930
+ // src/ui/shell/TabContext.tsx
3931
+ init_define_import_meta_env();
3932
+
3933
+ // src/ui/shell/tab-registry.ts
3934
+ init_define_import_meta_env();
3935
+
3817
3936
  // src/ui/lib/registry.ts
3937
+ init_define_import_meta_env();
3818
3938
  import { useSyncExternalStore } from "react";
3819
3939
  function createRegistry(sort) {
3820
3940
  const items = /* @__PURE__ */ new Map();
@@ -3865,7 +3985,11 @@ function byOrderThenId(a, b) {
3865
3985
  return (a.order ?? 0) - (b.order ?? 0) || a.id.localeCompare(b.id);
3866
3986
  }
3867
3987
 
3988
+ // src/ui/plugin-host/view-ownership.ts
3989
+ init_define_import_meta_env();
3990
+
3868
3991
  // src/ui/plugin-host/plugin-store.ts
3992
+ init_define_import_meta_env();
3869
3993
  import { useSyncExternalStore as useSyncExternalStore2 } from "react";
3870
3994
  var state = { loaded: false, settled: false, records: /* @__PURE__ */ new Map() };
3871
3995
  var listeners = /* @__PURE__ */ new Set();
@@ -3925,6 +4049,9 @@ function getPluginRecord(pluginId) {
3925
4049
  function knownPluginIds() {
3926
4050
  return [...state.records.keys()];
3927
4051
  }
4052
+ function resetPluginStore() {
4053
+ commit({ loaded: false, settled: false, records: /* @__PURE__ */ new Map() });
4054
+ }
3928
4055
 
3929
4056
  // src/ui/plugin-host/view-ownership.ts
3930
4057
  function declares(record, kind, id) {
@@ -3934,6 +4061,9 @@ function declares(record, kind, id) {
3934
4061
  if (kind === "panel") {
3935
4062
  return !!contributes.panels?.some((panel) => panel.id === id) || !!contributes.tabs?.some((tab) => tab.id === id);
3936
4063
  }
4064
+ if (kind === "layout") {
4065
+ return !!contributes.layouts?.some((layout) => layout.id === id);
4066
+ }
3937
4067
  return !!contributes.dashboardCards?.some((card) => card.id === id);
3938
4068
  }
3939
4069
  function viewOwner(kind, id) {
@@ -3973,6 +4103,29 @@ var getTabType = registry.get;
3973
4103
  var listTabTypes = registry.list;
3974
4104
  var useTabTypes = registry.useList;
3975
4105
  var resetTabTypes = registry.reset;
4106
+ var CORE_PERSISTENT = /* @__PURE__ */ new Set();
4107
+ var CORE_SESSION = /* @__PURE__ */ new Set();
4108
+ var CORE_HOSTLESS = /* @__PURE__ */ new Set(["dashboard"]);
4109
+ function isOwnedButAbsent(type) {
4110
+ return !registry.get(type) && !!viewOwner("tab", type);
4111
+ }
4112
+ function isPersistentTabType(type) {
4113
+ if (CORE_PERSISTENT.has(type)) return true;
4114
+ const def = registry.get(type);
4115
+ if (def) return !!def.persistent;
4116
+ return isOwnedButAbsent(type);
4117
+ }
4118
+ function isSessionTabType(type) {
4119
+ return CORE_SESSION.has(type) || !!registry.get(type)?.session;
4120
+ }
4121
+ function isHostlessTabType(type) {
4122
+ return CORE_HOSTLESS.has(type) || !!registry.get(type)?.hostless;
4123
+ }
4124
+ function canRestoreTabType(type, host) {
4125
+ const def = registry.get(type);
4126
+ if (!host) return isHostlessTabType(type) || isOwnedButAbsent(type);
4127
+ return def?.restore ? def.restore(host) : true;
4128
+ }
3976
4129
  function tabTypeForActivity(activityType) {
3977
4130
  return registry.list().find(
3978
4131
  (def) => def.id === activityType || def.activityTypes?.includes(activityType)
@@ -4262,6 +4415,7 @@ function TabProvider({ children }) {
4262
4415
  }
4263
4416
 
4264
4417
  // src/ui/lib/frontend-logger.ts
4418
+ init_define_import_meta_env();
4265
4419
  var FrontendLogger = class {
4266
4420
  serviceName;
4267
4421
  serviceIcon;
@@ -4529,6 +4683,7 @@ function createFrontendLogger(serviceName, serviceIcon = "\u{1F9E9}", serviceCol
4529
4683
  }
4530
4684
 
4531
4685
  // src/ui/lib/db-health-monitor.ts
4686
+ init_define_import_meta_env();
4532
4687
  var DatabaseHealthMonitor = class _DatabaseHealthMonitor {
4533
4688
  static instance;
4534
4689
  listeners = /* @__PURE__ */ new Map();
@@ -4602,6 +4757,7 @@ var DatabaseHealthMonitor = class _DatabaseHealthMonitor {
4602
4757
  var dbHealthMonitor = DatabaseHealthMonitor.getInstance();
4603
4758
 
4604
4759
  // src/ui/lib/device-id.ts
4760
+ init_define_import_meta_env();
4605
4761
  var DEVICE_ID_STORAGE_KEY = "termixDeviceId";
4606
4762
  var DEVICE_ID_PATTERN = /^[a-f0-9]{64}$/;
4607
4763
  function createDeviceId() {
@@ -4623,10 +4779,18 @@ function getDeviceId() {
4623
4779
  }
4624
4780
  }
4625
4781
 
4782
+ // src/ui/api/ssh-host-management-api.ts
4783
+ init_define_import_meta_env();
4784
+
4785
+ // src/ui/lib/hosts-request-cache.ts
4786
+ init_define_import_meta_env();
4787
+
4626
4788
  // src/ui/lib/sync-events.ts
4789
+ init_define_import_meta_env();
4627
4790
  var SYNC_CHANGED_EVENT = "termix:sync-changed";
4628
4791
 
4629
4792
  // src/ui/lib/ttl-request-cache.ts
4793
+ init_define_import_meta_env();
4630
4794
  function createTtlRequestCache(ttlMs) {
4631
4795
  let cached2 = null;
4632
4796
  let inflight2 = null;
@@ -4685,6 +4849,18 @@ function getCachedSSHHosts(loader) {
4685
4849
  bindInvalidationListeners();
4686
4850
  return hostsCache.get(loader);
4687
4851
  }
4852
+ function getCachedServerStatuses(loader) {
4853
+ return statusCache.get(loader);
4854
+ }
4855
+ function invalidateServerStatusCache() {
4856
+ statusCache.invalidate();
4857
+ }
4858
+ function getCachedSSHFolders(loader) {
4859
+ return foldersCache.get(loader);
4860
+ }
4861
+ function invalidateSSHFoldersCache() {
4862
+ foldersCache.invalidate();
4863
+ }
4688
4864
  function invalidateHostsAndStatusCaches() {
4689
4865
  hostsCache.invalidate();
4690
4866
  statusCache.invalidate();
@@ -4704,8 +4880,120 @@ async function getSSHHosts() {
4704
4880
  throw handleApiError(error, "fetch SSH hosts");
4705
4881
  }
4706
4882
  }
4883
+ async function createSSHHost(hostData) {
4884
+ try {
4885
+ if (hostData.authType === "key" && hostData.key instanceof File) {
4886
+ const formData = new FormData();
4887
+ formData.append("key", hostData.key);
4888
+ const dataWithoutFile = { ...hostData, key: void 0 };
4889
+ formData.append("data", JSON.stringify(dataWithoutFile));
4890
+ const response2 = await sshHostApi.post("/db/host", formData, {
4891
+ headers: { "Content-Type": "multipart/form-data" }
4892
+ });
4893
+ invalidateHostsAndStatusCaches();
4894
+ return response2.data;
4895
+ }
4896
+ const response = await sshHostApi.post("/db/host", hostData);
4897
+ invalidateHostsAndStatusCaches();
4898
+ return response.data;
4899
+ } catch (error) {
4900
+ throw handleApiError(error, "create SSH host");
4901
+ }
4902
+ }
4903
+ async function updateSSHHost(hostId, hostData) {
4904
+ try {
4905
+ if (hostData.authType === "key" && hostData.key instanceof File) {
4906
+ const formData = new FormData();
4907
+ formData.append("key", hostData.key);
4908
+ const dataWithoutFile = { ...hostData, key: void 0 };
4909
+ formData.append("data", JSON.stringify(dataWithoutFile));
4910
+ const response2 = await sshHostApi.put(`/db/host/${hostId}`, formData, {
4911
+ headers: { "Content-Type": "multipart/form-data" }
4912
+ });
4913
+ invalidateHostsAndStatusCaches();
4914
+ return response2.data;
4915
+ }
4916
+ const response = await sshHostApi.put(`/db/host/${hostId}`, hostData);
4917
+ invalidateHostsAndStatusCaches();
4918
+ return response.data;
4919
+ } catch (error) {
4920
+ throw handleApiError(error, "update SSH host");
4921
+ }
4922
+ }
4923
+ async function bulkImportSSHHosts(hosts, overwrite = false, credentials) {
4924
+ try {
4925
+ const response = await sshHostApi.post("/bulk-import", {
4926
+ hosts,
4927
+ overwrite,
4928
+ ...credentials ? { credentials } : {}
4929
+ });
4930
+ invalidateHostsAndStatusCaches();
4931
+ return response.data;
4932
+ } catch (error) {
4933
+ handleApiError(error, "bulk import SSH hosts");
4934
+ }
4935
+ }
4936
+ async function importSSHConfigHosts(content, overwrite = false) {
4937
+ try {
4938
+ const response = await sshHostApi.post("/ssh-config-import", {
4939
+ content,
4940
+ overwrite
4941
+ });
4942
+ invalidateHostsAndStatusCaches();
4943
+ return response.data;
4944
+ } catch (error) {
4945
+ handleApiError(error, "import SSH config hosts");
4946
+ }
4947
+ }
4948
+ async function bulkUpdateSSHHosts(hostIds, updates) {
4949
+ try {
4950
+ const response = await sshHostApi.patch("/bulk-update", {
4951
+ hostIds,
4952
+ updates
4953
+ });
4954
+ invalidateHostsAndStatusCaches();
4955
+ return response.data;
4956
+ } catch (error) {
4957
+ handleApiError(error, "bulk update SSH hosts");
4958
+ }
4959
+ }
4960
+ async function reorderSSHHosts(positions) {
4961
+ try {
4962
+ const response = await sshHostApi.put("/reorder", { positions });
4963
+ invalidateHostsAndStatusCaches();
4964
+ return response.data;
4965
+ } catch (error) {
4966
+ handleApiError(error, "reorder SSH hosts");
4967
+ }
4968
+ }
4969
+ async function deleteSSHHost(hostId) {
4970
+ try {
4971
+ const response = await sshHostApi.delete(`/db/host/${hostId}`);
4972
+ invalidateHostsAndStatusCaches();
4973
+ return response.data;
4974
+ } catch (error) {
4975
+ handleApiError(error, "delete SSH host");
4976
+ }
4977
+ }
4978
+ async function exportAllSSHHosts(options) {
4979
+ try {
4980
+ const response = await sshHostApi.get(
4981
+ options?.share ? "/db/hosts/export?share=1" : "/db/hosts/export"
4982
+ );
4983
+ return response.data;
4984
+ } catch (error) {
4985
+ handleApiError(error, "export all SSH hosts");
4986
+ }
4987
+ }
4988
+
4989
+ // src/ui/api/host-status-api.ts
4990
+ init_define_import_meta_env();
4991
+
4992
+ // src/ui/lib/connection-origin.ts
4993
+ init_define_import_meta_env();
4707
4994
 
4708
4995
  // src/ui/lib/ws-auth.ts
4996
+ init_define_import_meta_env();
4709
4997
  var JWT_PROTOCOL_PREFIX = "termix.jwt.";
4710
4998
  function websocketAuthProtocols(token) {
4711
4999
  return token ? [`${JWT_PROTOCOL_PREFIX}${token}`] : [];
@@ -4759,7 +5047,416 @@ async function buildOriginWsUrl({
4759
5047
  };
4760
5048
  }
4761
5049
 
5050
+ // src/ui/api/host-status-api.ts
5051
+ var STATUS_RETRY_SCHEDULE = [
5052
+ { timeoutMs: 2e3, pauseAfterMs: 3e3 },
5053
+ { timeoutMs: 5e3, pauseAfterMs: 5e3 },
5054
+ { timeoutMs: 8e3, pauseAfterMs: null }
5055
+ ];
5056
+ function isTransientStatusError(error) {
5057
+ if (!axios_default.isAxiosError(error)) return false;
5058
+ if (error.response) {
5059
+ return false;
5060
+ }
5061
+ const code = error.code;
5062
+ if (!code) {
5063
+ return true;
5064
+ }
5065
+ return code === "ECONNABORTED" || code === "ETIMEDOUT" || code === "ERR_NETWORK" || code === "ECONNREFUSED" || code === "ECONNRESET";
5066
+ }
5067
+ async function getAllServerStatuses() {
5068
+ return getCachedServerStatuses(async () => {
5069
+ let lastError = null;
5070
+ let localStatuses = {};
5071
+ let localHostIds = null;
5072
+ let remoteHostsBySyncId = null;
5073
+ if (isElectron()) {
5074
+ const response = await sshHostApi.get("/db/host");
5075
+ const defaultOrigin = await resolveConnectionOrigin({
5076
+ connectionOrigin: null
5077
+ });
5078
+ const hosts = response.data || [];
5079
+ localHostIds = hosts.filter((host) => (host.connectionOrigin ?? defaultOrigin) === "local").map((host) => host.id);
5080
+ remoteHostsBySyncId = new Map(
5081
+ hosts.filter(
5082
+ (host) => (host.connectionOrigin ?? defaultOrigin) === "remote" && !!host.syncId
5083
+ ).map((host) => [host.syncId, host.id])
5084
+ );
5085
+ }
5086
+ for (let i = 0; i < STATUS_RETRY_SCHEDULE.length; i++) {
5087
+ const { timeoutMs, pauseAfterMs } = STATUS_RETRY_SCHEDULE[i];
5088
+ const isFinalAttempt = i === STATUS_RETRY_SCHEDULE.length - 1;
5089
+ try {
5090
+ const response = await sshHostApi.get("/status", {
5091
+ timeout: timeoutMs,
5092
+ ...localHostIds === null ? {} : { params: { hostIds: localHostIds.join(",") } },
5093
+ // Silence per-attempt interceptor logging & health-monitor side
5094
+ // effects on all attempts except the final one, so background
5095
+ // blips don't look like real outages.
5096
+ __silentRetry: !isFinalAttempt
5097
+ });
5098
+ localStatuses = response.data || {};
5099
+ lastError = null;
5100
+ break;
5101
+ } catch (error) {
5102
+ lastError = error;
5103
+ if (!isTransientStatusError(error)) {
5104
+ break;
5105
+ }
5106
+ if (pauseAfterMs === null) {
5107
+ break;
5108
+ }
5109
+ await new Promise((resolve) => setTimeout(resolve, pauseAfterMs));
5110
+ }
5111
+ }
5112
+ if (lastError) handleApiError(lastError, "fetch server statuses");
5113
+ if (remoteHostsBySyncId?.size && await getLinkedSession()) {
5114
+ try {
5115
+ const remoteResult = await getRemoteCoreApi().get(
5116
+ "/sync/v2/host-status",
5117
+ {
5118
+ timeout: 8e3,
5119
+ __silentRetry: true
5120
+ }
5121
+ );
5122
+ const merged = { ...localStatuses };
5123
+ for (const [syncId, status] of Object.entries(
5124
+ remoteResult.data || {}
5125
+ )) {
5126
+ const localId = remoteHostsBySyncId.get(syncId);
5127
+ if (localId !== void 0) merged[localId] = status;
5128
+ }
5129
+ return merged;
5130
+ } catch {
5131
+ }
5132
+ }
5133
+ return localStatuses;
5134
+ });
5135
+ }
5136
+ async function getStatusCheckSettings() {
5137
+ try {
5138
+ const response = await sshHostApi.get("/status/settings");
5139
+ return response.data;
5140
+ } catch (error) {
5141
+ handleApiError(error, "fetch status check settings");
5142
+ }
5143
+ }
5144
+ async function updateStatusCheckSettings(settings) {
5145
+ try {
5146
+ await sshHostApi.put("/status/settings", settings);
5147
+ } catch (error) {
5148
+ handleApiError(error, "update status check settings");
5149
+ }
5150
+ }
5151
+
5152
+ // src/ui/api/host-sidebar-preferences-api.ts
5153
+ init_define_import_meta_env();
5154
+
5155
+ // src/types/host-sidebar-preferences.ts
5156
+ init_define_import_meta_env();
5157
+ var HOST_SIDEBAR_PREFS_VERSION = 1;
5158
+ var HOST_ROW_FIELD_KEYS = [
5159
+ "showAddress",
5160
+ "showUsername",
5161
+ "showPort",
5162
+ "showPinIcon",
5163
+ "showSharedBadge",
5164
+ "showBadges"
5165
+ ];
5166
+ function defaultHostRowFields() {
5167
+ return {
5168
+ showAddress: true,
5169
+ showUsername: true,
5170
+ showPort: false,
5171
+ showPinIcon: true,
5172
+ showSharedBadge: true,
5173
+ showBadges: true
5174
+ };
5175
+ }
5176
+ var GROUP_KEYS = [
5177
+ "folder",
5178
+ "tag",
5179
+ "status",
5180
+ "protocol",
5181
+ "auth"
5182
+ ];
5183
+ var SORT_KEYS = [
5184
+ "default",
5185
+ "name-asc",
5186
+ "name-desc",
5187
+ "ip-asc",
5188
+ "ip-desc",
5189
+ "status-online",
5190
+ "status-offline",
5191
+ "manual"
5192
+ ];
5193
+ var DENSITIES = ["comfortable", "compact"];
5194
+ var TRAY_TRIGGERS = [
5195
+ "always",
5196
+ "hover",
5197
+ "click",
5198
+ "actionsOnly"
5199
+ ];
5200
+ var HOST_CLICK_BEHAVIORS = [
5201
+ "newTab",
5202
+ "focusExisting",
5203
+ "focusExistingDoubleClickNew"
5204
+ ];
5205
+ var STATUS_COLOR_SCHEMES = ["accent", "status"];
5206
+ var FILTER_STATUS = [
5207
+ "online",
5208
+ "offline",
5209
+ "pinned"
5210
+ ];
5211
+ var AUTH_TYPE_PATTERN = /^[a-z][a-z0-9-]{0,63}$/;
5212
+ function defaultHostSidebarPreferences() {
5213
+ return {
5214
+ version: HOST_SIDEBAR_PREFS_VERSION,
5215
+ sort: { key: "default", pinnedFirst: false },
5216
+ groupKey: "folder",
5217
+ filters: {
5218
+ status: [],
5219
+ authType: [],
5220
+ protocol: [],
5221
+ features: [],
5222
+ tags: []
5223
+ },
5224
+ openFolders: [],
5225
+ display: {
5226
+ density: "comfortable",
5227
+ showTags: true,
5228
+ trayTrigger: "always",
5229
+ statusColorScheme: "accent",
5230
+ openOnDoubleClick: false,
5231
+ showFolderPaths: true,
5232
+ hostClickBehavior: "newTab",
5233
+ closeOnOpen: false,
5234
+ barActions: {},
5235
+ ...defaultHostRowFields()
5236
+ }
5237
+ };
5238
+ }
5239
+ var ACTION_ID_PATTERN = /^[a-z0-9][a-z0-9._:-]{0,79}$/;
5240
+ function sanitizeBarActions(input) {
5241
+ if (!input || typeof input !== "object" || Array.isArray(input)) return {};
5242
+ const out = {};
5243
+ for (const [id, value] of Object.entries(input)) {
5244
+ if (ACTION_ID_PATTERN.test(id) && typeof value === "boolean") {
5245
+ out[id] = value;
5246
+ }
5247
+ }
5248
+ return out;
5249
+ }
5250
+ function sanitizeStringArray(input) {
5251
+ if (!Array.isArray(input)) return [];
5252
+ return input.filter((v) => typeof v === "string");
5253
+ }
5254
+ function sanitizeEnumArray(input, allowed) {
5255
+ if (!Array.isArray(input)) return [];
5256
+ return input.filter((v) => allowed.includes(v));
5257
+ }
5258
+ function sanitizeHostSidebarPreferences(input) {
5259
+ const defaults2 = defaultHostSidebarPreferences();
5260
+ if (!input || typeof input !== "object") return defaults2;
5261
+ const obj = input;
5262
+ const sortObj = obj.sort ?? {};
5263
+ const sort = {
5264
+ key: SORT_KEYS.includes(sortObj.key) ? sortObj.key : defaults2.sort.key,
5265
+ pinnedFirst: typeof sortObj.pinnedFirst === "boolean" ? sortObj.pinnedFirst : defaults2.sort.pinnedFirst
5266
+ };
5267
+ const groupKey = GROUP_KEYS.includes(obj.groupKey) ? obj.groupKey : defaults2.groupKey;
5268
+ const filtersObj = obj.filters ?? {};
5269
+ const filters = {
5270
+ status: sanitizeEnumArray(filtersObj.status, FILTER_STATUS),
5271
+ authType: sanitizeStringArray(filtersObj.authType).filter(
5272
+ (value) => AUTH_TYPE_PATTERN.test(value)
5273
+ ),
5274
+ protocol: sanitizeStringArray(filtersObj.protocol).filter(
5275
+ (value) => AUTH_TYPE_PATTERN.test(value)
5276
+ ),
5277
+ features: sanitizeStringArray(filtersObj.features).filter(
5278
+ (value) => AUTH_TYPE_PATTERN.test(value)
5279
+ ),
5280
+ tags: sanitizeStringArray(filtersObj.tags)
5281
+ };
5282
+ const openFolders = sanitizeStringArray(obj.openFolders);
5283
+ const displayObj = obj.display ?? {};
5284
+ const rowFields = {};
5285
+ for (const key of HOST_ROW_FIELD_KEYS) {
5286
+ rowFields[key] = typeof displayObj[key] === "boolean" ? displayObj[key] : defaults2.display[key];
5287
+ }
5288
+ const display = {
5289
+ ...rowFields,
5290
+ density: DENSITIES.includes(displayObj.density) ? displayObj.density : defaults2.display.density,
5291
+ showTags: typeof displayObj.showTags === "boolean" ? displayObj.showTags : defaults2.display.showTags,
5292
+ trayTrigger: TRAY_TRIGGERS.includes(
5293
+ displayObj.trayTrigger
5294
+ ) ? displayObj.trayTrigger : defaults2.display.trayTrigger,
5295
+ statusColorScheme: STATUS_COLOR_SCHEMES.includes(
5296
+ displayObj.statusColorScheme
5297
+ ) ? displayObj.statusColorScheme : defaults2.display.statusColorScheme,
5298
+ openOnDoubleClick: typeof displayObj.openOnDoubleClick === "boolean" ? displayObj.openOnDoubleClick : defaults2.display.openOnDoubleClick,
5299
+ showFolderPaths: typeof displayObj.showFolderPaths === "boolean" ? displayObj.showFolderPaths : defaults2.display.showFolderPaths,
5300
+ hostClickBehavior: HOST_CLICK_BEHAVIORS.includes(
5301
+ displayObj.hostClickBehavior
5302
+ ) ? displayObj.hostClickBehavior : defaults2.display.hostClickBehavior,
5303
+ closeOnOpen: typeof displayObj.closeOnOpen === "boolean" ? displayObj.closeOnOpen : defaults2.display.closeOnOpen,
5304
+ barActions: sanitizeBarActions(displayObj.barActions)
5305
+ };
5306
+ return {
5307
+ version: HOST_SIDEBAR_PREFS_VERSION,
5308
+ sort,
5309
+ groupKey,
5310
+ filters,
5311
+ openFolders,
5312
+ display
5313
+ };
5314
+ }
5315
+
5316
+ // src/ui/api/host-sidebar-preferences-api.ts
5317
+ async function getHostSidebarPreferences() {
5318
+ try {
5319
+ const response = await authApi.get("/host-sidebar/preferences");
5320
+ return sanitizeHostSidebarPreferences(response.data?.preferences);
5321
+ } catch (error) {
5322
+ handleApiError(error, "fetch host sidebar preferences");
5323
+ throw error;
5324
+ }
5325
+ }
5326
+ async function saveHostSidebarPreferences(preferences) {
5327
+ try {
5328
+ await authApi.put("/host-sidebar/preferences", preferences);
5329
+ } catch (error) {
5330
+ handleApiError(error, "save host sidebar preferences");
5331
+ throw error;
5332
+ }
5333
+ }
5334
+
5335
+ // src/ui/api/credential-sidebar-preferences-api.ts
5336
+ init_define_import_meta_env();
5337
+
5338
+ // src/types/credential-sidebar-preferences.ts
5339
+ init_define_import_meta_env();
5340
+ var CREDENTIAL_SIDEBAR_PREFS_VERSION = 1;
5341
+ var CREDENTIAL_ROW_FIELD_KEYS = [
5342
+ "showUsername",
5343
+ "showUsageCount",
5344
+ "showTypeBadge",
5345
+ "showPinIcon",
5346
+ "showSharedBadge"
5347
+ ];
5348
+ function defaultCredentialRowFields() {
5349
+ return {
5350
+ showUsername: true,
5351
+ showUsageCount: true,
5352
+ showTypeBadge: true,
5353
+ showPinIcon: true,
5354
+ showSharedBadge: true
5355
+ };
5356
+ }
5357
+ var SORT_KEYS2 = [
5358
+ "default",
5359
+ "name-asc",
5360
+ "name-desc",
5361
+ "username-asc",
5362
+ "username-desc",
5363
+ "manual"
5364
+ ];
5365
+ var DENSITIES2 = ["comfortable", "compact"];
5366
+ var TRAY_TRIGGERS2 = [
5367
+ "always",
5368
+ "hover",
5369
+ "click",
5370
+ "actionsOnly"
5371
+ ];
5372
+ var TYPE_PATTERN = /^[a-z][a-z0-9-]{0,63}$/;
5373
+ function defaultCredentialSidebarPreferences() {
5374
+ return {
5375
+ version: CREDENTIAL_SIDEBAR_PREFS_VERSION,
5376
+ sort: { key: "default", pinnedFirst: false },
5377
+ filters: {
5378
+ type: [],
5379
+ tags: []
5380
+ },
5381
+ openFolders: [],
5382
+ display: {
5383
+ density: "comfortable",
5384
+ showTags: true,
5385
+ trayTrigger: "always",
5386
+ ...defaultCredentialRowFields()
5387
+ }
5388
+ };
5389
+ }
5390
+ function sanitizeStringArray2(input) {
5391
+ if (!Array.isArray(input)) return [];
5392
+ return input.filter((v) => typeof v === "string");
5393
+ }
5394
+ function sanitizeCredentialSidebarPreferences(input) {
5395
+ const defaults2 = defaultCredentialSidebarPreferences();
5396
+ if (!input || typeof input !== "object") return defaults2;
5397
+ const obj = input;
5398
+ const sortObj = obj.sort ?? {};
5399
+ const sort = {
5400
+ key: SORT_KEYS2.includes(sortObj.key) ? sortObj.key : defaults2.sort.key,
5401
+ pinnedFirst: typeof sortObj.pinnedFirst === "boolean" ? sortObj.pinnedFirst : defaults2.sort.pinnedFirst
5402
+ };
5403
+ const filtersObj = obj.filters ?? {};
5404
+ const filters = {
5405
+ type: sanitizeStringArray2(filtersObj.type).filter(
5406
+ (value) => TYPE_PATTERN.test(value)
5407
+ ),
5408
+ tags: sanitizeStringArray2(filtersObj.tags)
5409
+ };
5410
+ const openFolders = sanitizeStringArray2(obj.openFolders);
5411
+ const displayObj = obj.display ?? {};
5412
+ const rowFields = {};
5413
+ for (const key of CREDENTIAL_ROW_FIELD_KEYS) {
5414
+ rowFields[key] = typeof displayObj[key] === "boolean" ? displayObj[key] : defaults2.display[key];
5415
+ }
5416
+ const display = {
5417
+ ...rowFields,
5418
+ density: DENSITIES2.includes(displayObj.density) ? displayObj.density : defaults2.display.density,
5419
+ showTags: typeof displayObj.showTags === "boolean" ? displayObj.showTags : defaults2.display.showTags,
5420
+ trayTrigger: TRAY_TRIGGERS2.includes(
5421
+ displayObj.trayTrigger
5422
+ ) ? displayObj.trayTrigger : defaults2.display.trayTrigger
5423
+ };
5424
+ return {
5425
+ version: CREDENTIAL_SIDEBAR_PREFS_VERSION,
5426
+ sort,
5427
+ filters,
5428
+ openFolders,
5429
+ display
5430
+ };
5431
+ }
5432
+
5433
+ // src/ui/api/credential-sidebar-preferences-api.ts
5434
+ async function getCredentialSidebarPreferences() {
5435
+ try {
5436
+ const response = await authApi.get("/credential-sidebar/preferences");
5437
+ return sanitizeCredentialSidebarPreferences(response.data?.preferences);
5438
+ } catch (error) {
5439
+ handleApiError(error, "fetch credential sidebar preferences");
5440
+ throw error;
5441
+ }
5442
+ }
5443
+ async function saveCredentialSidebarPreferences(preferences) {
5444
+ try {
5445
+ await authApi.put("/credential-sidebar/preferences", preferences);
5446
+ } catch (error) {
5447
+ handleApiError(error, "save credential sidebar preferences");
5448
+ throw error;
5449
+ }
5450
+ }
5451
+
5452
+ // src/ui/api/ui-preferences-api.ts
5453
+ init_define_import_meta_env();
5454
+
5455
+ // src/types/ui-preferences.ts
5456
+ init_define_import_meta_env();
5457
+
4762
5458
  // src/types/onboarding.ts
5459
+ init_define_import_meta_env();
4763
5460
  var LEGACY_SEEN = Object.freeze({
4764
5461
  plugins: 1,
4765
5462
  "desktop-sync": 1,
@@ -4894,17 +5591,70 @@ var AREA_SPECS = {
4894
5591
  };
4895
5592
  var UI_AREA_KEYS = Object.keys(AREA_SPECS);
4896
5593
 
4897
- // src/ui/lib/remote-server-api.ts
4898
- async function hydrateLocalSharedHostAuth(host) {
4899
- return host;
5594
+ // src/ui/api/settings-api.ts
5595
+ init_define_import_meta_env();
5596
+ async function getLogLevel() {
5597
+ try {
5598
+ const response = await authApi.get("/users/log-level");
5599
+ return response.data;
5600
+ } catch (error) {
5601
+ handleApiError(error, "fetch log level");
5602
+ }
4900
5603
  }
4901
- async function getConnectedRemoteApi() {
4902
- return await getLinkedSession() ? getRemoteCoreApi() : null;
5604
+ async function updateLogLevel(level) {
5605
+ try {
5606
+ await authApi.patch("/users/log-level", { level });
5607
+ } catch (error) {
5608
+ handleApiError(error, "update log level");
5609
+ }
4903
5610
  }
4904
- async function resolveRemoteHostId(syncId) {
4905
- if (!syncId) return null;
4906
- const api = await getConnectedRemoteApi();
4907
- if (!api) return null;
5611
+ async function getSessionTimeout() {
5612
+ try {
5613
+ const response = await authApi.get("/users/session-timeout");
5614
+ return response.data;
5615
+ } catch (error) {
5616
+ handleApiError(error, "fetch session timeout");
5617
+ }
5618
+ }
5619
+ async function updateSessionTimeout(timeoutHours) {
5620
+ try {
5621
+ await authApi.patch("/users/session-timeout", { timeoutHours });
5622
+ } catch (error) {
5623
+ handleApiError(error, "update session timeout");
5624
+ }
5625
+ }
5626
+ async function getBranding() {
5627
+ try {
5628
+ const response = await authApi.get("/users/branding");
5629
+ return response.data;
5630
+ } catch (error) {
5631
+ handleApiError(error, "fetch branding settings");
5632
+ }
5633
+ }
5634
+ async function updateBranding(update) {
5635
+ try {
5636
+ const response = await authApi.patch("/users/branding", update);
5637
+ return response.data;
5638
+ } catch (error) {
5639
+ handleApiError(error, "update branding settings");
5640
+ }
5641
+ }
5642
+
5643
+ // src/ui/api/user-management-api.ts
5644
+ init_define_import_meta_env();
5645
+
5646
+ // src/ui/lib/remote-server-api.ts
5647
+ init_define_import_meta_env();
5648
+ async function hydrateLocalSharedHostAuth(host) {
5649
+ return host;
5650
+ }
5651
+ async function getConnectedRemoteApi() {
5652
+ return await getLinkedSession() ? getRemoteCoreApi() : null;
5653
+ }
5654
+ async function resolveRemoteHostId(syncId) {
5655
+ if (!syncId) return null;
5656
+ const api = await getConnectedRemoteApi();
5657
+ if (!api) return null;
4908
5658
  try {
4909
5659
  const response = await api.get(
4910
5660
  `/sync/v2/hosts/${encodeURIComponent(syncId)}`
@@ -4916,6 +5666,190 @@ async function resolveRemoteHostId(syncId) {
4916
5666
  }
4917
5667
 
4918
5668
  // src/ui/api/user-management-api.ts
5669
+ async function getUserList(options = {}) {
5670
+ try {
5671
+ const api = await getConnectedRemoteApi() ?? authApi;
5672
+ const response = await api.get("/users/list", {
5673
+ params: {
5674
+ ...options.search ? { search: options.search } : {},
5675
+ ...options.limit ? { limit: options.limit } : {},
5676
+ ...options.offset ? { offset: options.offset } : {}
5677
+ }
5678
+ });
5679
+ return response.data;
5680
+ } catch (error) {
5681
+ handleApiError(error, "fetch user list");
5682
+ }
5683
+ }
5684
+ async function getSessions() {
5685
+ try {
5686
+ const response = await authApi.get("/users/sessions");
5687
+ return response.data;
5688
+ } catch (error) {
5689
+ handleApiError(error, "fetch sessions");
5690
+ }
5691
+ }
5692
+ async function revokeSession(sessionId) {
5693
+ try {
5694
+ const response = await authApi.delete(`/users/sessions/${sessionId}`);
5695
+ return response.data;
5696
+ } catch (error) {
5697
+ handleApiError(error, "revoke session");
5698
+ }
5699
+ }
5700
+ async function revokeAllUserSessions(userId) {
5701
+ try {
5702
+ const response = await authApi.post("/users/sessions/revoke-all", {
5703
+ targetUserId: userId,
5704
+ exceptCurrent: false
5705
+ });
5706
+ return response.data;
5707
+ } catch (error) {
5708
+ handleApiError(error, "revoke all user sessions");
5709
+ }
5710
+ }
5711
+ async function createApiKey(name, userId, expiresAt) {
5712
+ try {
5713
+ const response = await authApi.post("/users/api-keys", {
5714
+ name,
5715
+ userId,
5716
+ expiresAt: expiresAt ?? null
5717
+ });
5718
+ return response.data;
5719
+ } catch (error) {
5720
+ handleApiError(error, "create API key");
5721
+ }
5722
+ }
5723
+ async function getApiKeys() {
5724
+ try {
5725
+ const response = await authApi.get("/users/api-keys");
5726
+ return response.data;
5727
+ } catch (error) {
5728
+ handleApiError(error, "fetch API keys");
5729
+ }
5730
+ }
5731
+ async function deleteApiKey(keyId) {
5732
+ try {
5733
+ const response = await authApi.delete(`/users/api-keys/${keyId}`);
5734
+ return response.data;
5735
+ } catch (error) {
5736
+ handleApiError(error, "delete API key");
5737
+ }
5738
+ }
5739
+ async function makeUserAdmin(userId) {
5740
+ try {
5741
+ const response = await authApi.post("/users/make-admin", { userId });
5742
+ return response.data;
5743
+ } catch (error) {
5744
+ handleApiError(error, "make user admin");
5745
+ }
5746
+ }
5747
+ async function removeAdminStatus(userId) {
5748
+ try {
5749
+ const response = await authApi.post("/users/remove-admin", { userId });
5750
+ return response.data;
5751
+ } catch (error) {
5752
+ handleApiError(error, "remove admin status");
5753
+ }
5754
+ }
5755
+ async function deleteUser(username, successorUserId) {
5756
+ try {
5757
+ const response = await authApi.delete("/users/delete-user", {
5758
+ data: { username, successorUserId }
5759
+ });
5760
+ return response.data;
5761
+ } catch (error) {
5762
+ handleApiError(error, "delete user");
5763
+ }
5764
+ }
5765
+ async function deleteAccount(password) {
5766
+ try {
5767
+ const response = await authApi.delete("/users/delete-account", {
5768
+ data: { password }
5769
+ });
5770
+ return response.data;
5771
+ } catch (error) {
5772
+ handleApiError(error, "delete account");
5773
+ }
5774
+ }
5775
+ async function adminResetUserPassword(userId, newPassword, confirmDataWipe = false) {
5776
+ const response = await authApi.post("/users/admin/reset-password", {
5777
+ userId,
5778
+ newPassword,
5779
+ confirmDataWipe
5780
+ });
5781
+ return response.data;
5782
+ }
5783
+ async function adminExportUserData(userId) {
5784
+ try {
5785
+ const response = await authApi.get(
5786
+ `/users/admin/export/${encodeURIComponent(userId)}`,
5787
+ { timeout: 12e4 }
5788
+ );
5789
+ return response.data;
5790
+ } catch (error) {
5791
+ handleApiError(error, "export user data");
5792
+ }
5793
+ }
5794
+ async function updateRegistrationAllowed(allowed) {
5795
+ try {
5796
+ const response = await authApi.patch("/users/registration-allowed", {
5797
+ allowed
5798
+ });
5799
+ return response.data;
5800
+ } catch (error) {
5801
+ handleApiError(error, "update registration allowed");
5802
+ }
5803
+ }
5804
+ async function getExternalAutoProvision() {
5805
+ try {
5806
+ const response = await authApi.get("/users/external-auto-provision");
5807
+ return response.data;
5808
+ } catch (error) {
5809
+ handleApiError(error, "check OIDC auto-provision status");
5810
+ }
5811
+ }
5812
+ async function updateExternalAutoProvision(enabled) {
5813
+ try {
5814
+ const response = await authApi.patch("/users/external-auto-provision", {
5815
+ enabled
5816
+ });
5817
+ return response.data;
5818
+ } catch (error) {
5819
+ handleApiError(error, "update OIDC auto-provision");
5820
+ }
5821
+ }
5822
+ async function getSecondFactorAfterExternalLogin() {
5823
+ try {
5824
+ const response = await authApi.get(
5825
+ "/users/second-factor-after-external-login"
5826
+ );
5827
+ return response.data;
5828
+ } catch (error) {
5829
+ handleApiError(error, "check second factor after external login status");
5830
+ }
5831
+ }
5832
+ async function updateSecondFactorAfterExternalLogin(enabled) {
5833
+ try {
5834
+ const response = await authApi.patch(
5835
+ "/users/second-factor-after-external-login",
5836
+ { enabled }
5837
+ );
5838
+ return response.data;
5839
+ } catch (error) {
5840
+ handleApiError(error, "update second factor after external login");
5841
+ }
5842
+ }
5843
+ async function updatePasswordLoginAllowed(allowed) {
5844
+ try {
5845
+ const response = await authApi.patch("/users/password-login-allowed", {
5846
+ allowed
5847
+ });
5848
+ return response.data;
5849
+ } catch (error) {
5850
+ handleApiError(error, "update password login allowed");
5851
+ }
5852
+ }
4919
5853
  async function getPasswordResetAllowed() {
4920
5854
  try {
4921
5855
  const response = await authApi.get("/users/password-reset-allowed");
@@ -4924,8 +5858,148 @@ async function getPasswordResetAllowed() {
4924
5858
  handleApiError(error, "get password reset allowed");
4925
5859
  }
4926
5860
  }
5861
+ async function updatePasswordResetAllowed(allowed) {
5862
+ try {
5863
+ const response = await authApi.patch("/users/password-reset-allowed", {
5864
+ allowed
5865
+ });
5866
+ return response.data;
5867
+ } catch (error) {
5868
+ handleApiError(error, "update password reset allowed");
5869
+ }
5870
+ }
5871
+
5872
+ // src/ui/api/admin-user-data-api.ts
5873
+ init_define_import_meta_env();
5874
+ var ADMIN_TARGET_USER_HEADER = "X-Admin-Target-User";
5875
+ function adminHeaders(targetUserId) {
5876
+ return { [ADMIN_TARGET_USER_HEADER]: targetUserId };
5877
+ }
5878
+ async function adminGetUserHosts(targetUserId) {
5879
+ try {
5880
+ const response = await sshHostApi.get("/db/host", {
5881
+ headers: adminHeaders(targetUserId)
5882
+ });
5883
+ return Array.isArray(response.data) ? response.data : [];
5884
+ } catch (error) {
5885
+ throw handleApiError(error, "fetch user's hosts");
5886
+ }
5887
+ }
5888
+ async function adminCreateUserHost(targetUserId, hostData) {
5889
+ try {
5890
+ if (hostData.authType === "key" && hostData.key instanceof File) {
5891
+ const formData = new FormData();
5892
+ formData.append("key", hostData.key);
5893
+ const dataWithoutFile = { ...hostData, key: void 0 };
5894
+ formData.append("data", JSON.stringify(dataWithoutFile));
5895
+ const response2 = await sshHostApi.post("/db/host", formData, {
5896
+ headers: {
5897
+ "Content-Type": "multipart/form-data",
5898
+ ...adminHeaders(targetUserId)
5899
+ }
5900
+ });
5901
+ return response2.data;
5902
+ }
5903
+ const response = await sshHostApi.post("/db/host", hostData, {
5904
+ headers: adminHeaders(targetUserId)
5905
+ });
5906
+ return response.data;
5907
+ } catch (error) {
5908
+ throw handleApiError(error, "create host for user");
5909
+ }
5910
+ }
5911
+ async function adminUpdateUserHost(targetUserId, hostId, hostData) {
5912
+ try {
5913
+ if (hostData.authType === "key" && hostData.key instanceof File) {
5914
+ const formData = new FormData();
5915
+ formData.append("key", hostData.key);
5916
+ const dataWithoutFile = { ...hostData, key: void 0 };
5917
+ formData.append("data", JSON.stringify(dataWithoutFile));
5918
+ const response2 = await sshHostApi.put(`/db/host/${hostId}`, formData, {
5919
+ headers: {
5920
+ "Content-Type": "multipart/form-data",
5921
+ ...adminHeaders(targetUserId)
5922
+ }
5923
+ });
5924
+ return response2.data;
5925
+ }
5926
+ const response = await sshHostApi.put(`/db/host/${hostId}`, hostData, {
5927
+ headers: adminHeaders(targetUserId)
5928
+ });
5929
+ return response.data;
5930
+ } catch (error) {
5931
+ throw handleApiError(error, "update user's host");
5932
+ }
5933
+ }
5934
+ async function adminDeleteUserHost(targetUserId, hostId) {
5935
+ try {
5936
+ const response = await sshHostApi.delete(`/db/host/${hostId}`, {
5937
+ headers: adminHeaders(targetUserId)
5938
+ });
5939
+ return response.data;
5940
+ } catch (error) {
5941
+ throw handleApiError(error, "delete user's host");
5942
+ }
5943
+ }
5944
+ async function adminGetHostPassword(targetUserId, hostId, field = "password") {
5945
+ try {
5946
+ const response = await sshHostApi.get(
5947
+ `/db/host/${hostId}/password?field=${field}`,
5948
+ { headers: adminHeaders(targetUserId) }
5949
+ );
5950
+ return response.data?.value || null;
5951
+ } catch {
5952
+ return null;
5953
+ }
5954
+ }
5955
+ async function adminGetUserCredentials(targetUserId) {
5956
+ try {
5957
+ const response = await authApi.get("/credentials", {
5958
+ headers: adminHeaders(targetUserId)
5959
+ });
5960
+ return response.data;
5961
+ } catch (error) {
5962
+ throw handleApiError(error, "fetch user's credentials");
5963
+ }
5964
+ }
5965
+ async function adminCreateUserCredential(targetUserId, credentialData) {
5966
+ try {
5967
+ const response = await authApi.post("/credentials", credentialData, {
5968
+ headers: adminHeaders(targetUserId)
5969
+ });
5970
+ return response.data;
5971
+ } catch (error) {
5972
+ throw handleApiError(error, "create credential for user");
5973
+ }
5974
+ }
5975
+ async function adminUpdateUserCredential(targetUserId, credentialId, credentialData) {
5976
+ try {
5977
+ const response = await authApi.put(
5978
+ `/credentials/${credentialId}`,
5979
+ credentialData,
5980
+ { headers: adminHeaders(targetUserId) }
5981
+ );
5982
+ return response.data;
5983
+ } catch (error) {
5984
+ throw handleApiError(error, "update user's credential");
5985
+ }
5986
+ }
5987
+ async function adminDeleteUserCredential(targetUserId, credentialId) {
5988
+ try {
5989
+ const response = await authApi.delete(`/credentials/${credentialId}`, {
5990
+ headers: adminHeaders(targetUserId)
5991
+ });
5992
+ return response.data;
5993
+ } catch (error) {
5994
+ throw handleApiError(error, "delete user's credential");
5995
+ }
5996
+ }
4927
5997
 
4928
5998
  // src/ui/api/system-status-api.ts
5999
+ init_define_import_meta_env();
6000
+ function releaseUrlFrom(info) {
6001
+ return info?.latest_release?.html_url ?? "";
6002
+ }
4929
6003
  async function getVersionInfo(checkRemote = true) {
4930
6004
  try {
4931
6005
  const response = await authApi.get(
@@ -4936,6 +6010,18 @@ async function getVersionInfo(checkRemote = true) {
4936
6010
  handleApiError(error, "fetch version info");
4937
6011
  }
4938
6012
  }
6013
+ async function getUpdateChannel() {
6014
+ const response = await authApi.get("/version/channel");
6015
+ return response.data;
6016
+ }
6017
+ async function setUpdateChannel(channel) {
6018
+ const response = await authApi.put("/version/channel", { channel });
6019
+ return response.data;
6020
+ }
6021
+ async function getChannelReleases() {
6022
+ const response = await authApi.get("/version/releases");
6023
+ return response.data;
6024
+ }
4939
6025
  async function getDatabaseHealth() {
4940
6026
  try {
4941
6027
  const response = await authApi.get("/health");
@@ -4946,6 +6032,7 @@ async function getDatabaseHealth() {
4946
6032
  }
4947
6033
 
4948
6034
  // src/ui/api/credentials-api.ts
6035
+ init_define_import_meta_env();
4949
6036
  async function getCredentials() {
4950
6037
  try {
4951
6038
  const response = await authApi.get("/credentials");
@@ -4954,6 +6041,52 @@ async function getCredentials() {
4954
6041
  throw handleApiError(error, "fetch credentials");
4955
6042
  }
4956
6043
  }
6044
+ async function getCredentialDetails(credentialId) {
6045
+ try {
6046
+ const response = await authApi.get(`/credentials/${credentialId}`);
6047
+ return response.data;
6048
+ } catch (error) {
6049
+ throw handleApiError(error, "fetch credential details");
6050
+ }
6051
+ }
6052
+ async function createCredential(credentialData) {
6053
+ try {
6054
+ const response = await authApi.post("/credentials", credentialData);
6055
+ return response.data;
6056
+ } catch (error) {
6057
+ throw handleApiError(error, "create credential");
6058
+ }
6059
+ }
6060
+ async function updateCredential(credentialId, credentialData) {
6061
+ try {
6062
+ const response = await authApi.put(
6063
+ `/credentials/${credentialId}`,
6064
+ credentialData
6065
+ );
6066
+ return response.data;
6067
+ } catch (error) {
6068
+ throw handleApiError(error, "update credential");
6069
+ }
6070
+ }
6071
+ async function duplicateCredential(credentialId, data) {
6072
+ try {
6073
+ const response = await authApi.post(
6074
+ `/credentials/${credentialId}/duplicate`,
6075
+ data
6076
+ );
6077
+ return response.data;
6078
+ } catch (error) {
6079
+ throw handleApiError(error, "duplicate credential");
6080
+ }
6081
+ }
6082
+ async function deleteCredential(credentialId) {
6083
+ try {
6084
+ const response = await authApi.delete(`/credentials/${credentialId}`);
6085
+ return response.data;
6086
+ } catch (error) {
6087
+ throw handleApiError(error, "delete credential");
6088
+ }
6089
+ }
4957
6090
  async function getHostPassword(hostId, field = "password") {
4958
6091
  try {
4959
6092
  const response = await sshHostApi.get(
@@ -4964,8 +6097,167 @@ async function getHostPassword(hostId, field = "password") {
4964
6097
  return null;
4965
6098
  }
4966
6099
  }
6100
+ async function renameFolder(oldName, newName) {
6101
+ try {
6102
+ const response = await authApi.put("/host/folders/rename", {
6103
+ oldName,
6104
+ newName
6105
+ });
6106
+ invalidateSSHFoldersCache();
6107
+ return response.data;
6108
+ } catch (error) {
6109
+ handleApiError(error, "rename folder");
6110
+ }
6111
+ }
6112
+ async function getSSHFolders() {
6113
+ try {
6114
+ sshLogger.info("Fetching SSH folders", {
6115
+ operation: "fetch_ssh_folders"
6116
+ });
6117
+ const folders = await getCachedSSHFolders(async () => {
6118
+ const response = await authApi.get("/host/folders");
6119
+ return response.data;
6120
+ });
6121
+ sshLogger.success("SSH folders fetched successfully", {
6122
+ operation: "fetch_ssh_folders",
6123
+ count: folders.length
6124
+ });
6125
+ return folders;
6126
+ } catch (error) {
6127
+ sshLogger.error("Failed to fetch SSH folders", error, {
6128
+ operation: "fetch_ssh_folders"
6129
+ });
6130
+ handleApiError(error, "fetch SSH folders");
6131
+ throw error;
6132
+ }
6133
+ }
6134
+ async function updateFolderMetadata(name, color, icon, credentialId, localOnly) {
6135
+ try {
6136
+ sshLogger.info("Updating folder metadata", {
6137
+ operation: "update_folder_metadata",
6138
+ name,
6139
+ color,
6140
+ icon,
6141
+ credentialId
6142
+ });
6143
+ await authApi.put("/host/folders/metadata", {
6144
+ name,
6145
+ color,
6146
+ icon,
6147
+ credentialId,
6148
+ localOnly
6149
+ });
6150
+ invalidateSSHFoldersCache();
6151
+ sshLogger.success("Folder metadata updated successfully", {
6152
+ operation: "update_folder_metadata",
6153
+ name
6154
+ });
6155
+ } catch (error) {
6156
+ sshLogger.error("Failed to update folder metadata", error, {
6157
+ operation: "update_folder_metadata",
6158
+ name
6159
+ });
6160
+ handleApiError(error, "update folder metadata");
6161
+ throw error;
6162
+ }
6163
+ }
6164
+ async function reorderFolders(positions) {
6165
+ try {
6166
+ const response = await authApi.put("/host/folders/reorder", {
6167
+ positions
6168
+ });
6169
+ invalidateSSHFoldersCache();
6170
+ return response.data;
6171
+ } catch (error) {
6172
+ handleApiError(error, "reorder folders");
6173
+ throw error;
6174
+ }
6175
+ }
6176
+ async function deleteAllHostsInFolder(folderName) {
6177
+ try {
6178
+ sshLogger.info("Deleting all hosts in folder", {
6179
+ operation: "delete_folder_hosts",
6180
+ folderName
6181
+ });
6182
+ const response = await authApi.delete(
6183
+ `/host/folders/${encodeURIComponent(folderName)}/hosts`
6184
+ );
6185
+ invalidateHostsAndStatusCaches();
6186
+ sshLogger.success("All hosts in folder deleted successfully", {
6187
+ operation: "delete_folder_hosts",
6188
+ folderName,
6189
+ deletedCount: response.data.deletedCount
6190
+ });
6191
+ return response.data;
6192
+ } catch (error) {
6193
+ sshLogger.error("Failed to delete hosts in folder", error, {
6194
+ operation: "delete_folder_hosts",
6195
+ folderName
6196
+ });
6197
+ handleApiError(error, "delete hosts in folder");
6198
+ throw error;
6199
+ }
6200
+ }
6201
+ async function renameCredentialFolder(oldName, newName) {
6202
+ try {
6203
+ const response = await authApi.put("/credentials/folders/rename", {
6204
+ oldName,
6205
+ newName
6206
+ });
6207
+ invalidateSSHFoldersCache();
6208
+ return response.data;
6209
+ } catch (error) {
6210
+ throw handleApiError(error, "rename credential folder");
6211
+ }
6212
+ }
6213
+ async function reorderCredentials(positions) {
6214
+ try {
6215
+ const response = await authApi.put("/credentials/reorder", {
6216
+ positions
6217
+ });
6218
+ return response.data;
6219
+ } catch (error) {
6220
+ handleApiError(error, "reorder credentials");
6221
+ throw error;
6222
+ }
6223
+ }
6224
+ async function generatePublicKeyFromPrivate(privateKey, keyPassword) {
6225
+ try {
6226
+ const response = await authApi.post("/credentials/generate-public-key", {
6227
+ privateKey,
6228
+ keyPassword
6229
+ });
6230
+ return response.data;
6231
+ } catch (error) {
6232
+ throw handleApiError(error, "generate public key from private key");
6233
+ }
6234
+ }
6235
+ async function generateKeyPair(keyType, keySize, passphrase) {
6236
+ try {
6237
+ const response = await authApi.post("/credentials/generate-key-pair", {
6238
+ keyType,
6239
+ keySize,
6240
+ passphrase
6241
+ });
6242
+ return response.data;
6243
+ } catch (error) {
6244
+ throw handleApiError(error, "generate SSH key pair");
6245
+ }
6246
+ }
6247
+ async function deployCredentialToHost(credentialId, targetHostId) {
6248
+ try {
6249
+ const response = await authApi.post(
6250
+ `/credentials/${credentialId}/deploy-to-host`,
6251
+ { targetHostId }
6252
+ );
6253
+ return response.data;
6254
+ } catch (error) {
6255
+ throw handleApiError(error, "deploy credential to host");
6256
+ }
6257
+ }
4967
6258
 
4968
6259
  // src/ui/api/dashboard-api.ts
6260
+ init_define_import_meta_env();
4969
6261
  async function getUptime() {
4970
6262
  try {
4971
6263
  const response = await authApi.get("/dashboard/uptime");
@@ -4996,8 +6288,45 @@ async function logActivity(type, hostId, hostName) {
4996
6288
  throw handleApiError(error, "log activity");
4997
6289
  }
4998
6290
  }
6291
+ async function resetRecentActivity() {
6292
+ try {
6293
+ const response = await authApi.delete("/dashboard/activity/reset");
6294
+ return response.data;
6295
+ } catch (error) {
6296
+ throw handleApiError(error, "reset recent activity");
6297
+ }
6298
+ }
6299
+
6300
+ // src/ui/api/external-account-api.ts
6301
+ init_define_import_meta_env();
6302
+ async function linkExternalToPasswordAccount(externalUserId, targetUsername) {
6303
+ try {
6304
+ const response = await authApi.post("/users/link-external-to-password", {
6305
+ externalUserId,
6306
+ targetUsername
6307
+ });
6308
+ return response.data;
6309
+ } catch (error) {
6310
+ throw handleApiError(error, "link external account to password account");
6311
+ }
6312
+ }
6313
+ async function unlinkExternalFromPasswordAccount(userId) {
6314
+ try {
6315
+ const response = await authApi.post(
6316
+ "/users/unlink-external-from-password",
6317
+ { userId }
6318
+ );
6319
+ return response.data;
6320
+ } catch (error) {
6321
+ throw handleApiError(
6322
+ error,
6323
+ "unlink external sign-in from password account"
6324
+ );
6325
+ }
6326
+ }
4999
6327
 
5000
6328
  // src/ui/api/rbac-api.ts
6329
+ init_define_import_meta_env();
5001
6330
  import i18n from "i18next";
5002
6331
  async function getSharingTarget(hostId, syncId) {
5003
6332
  const api = await getConnectedRemoteApi();
@@ -5038,7 +6367,7 @@ async function updateRole(roleId, roleData) {
5038
6367
  try {
5039
6368
  const response = await rbacApi.put(`/rbac/roles/${roleId}`, roleData);
5040
6369
  if (roleData.permissions) {
5041
- const { notifyPermissionsChanged } = await import("./use-permissions-2P2TP6GY.js");
6370
+ const { notifyPermissionsChanged } = await import("./use-permissions-6VSHHUMB.js");
5042
6371
  notifyPermissionsChanged();
5043
6372
  }
5044
6373
  return response.data;
@@ -5241,14 +6570,36 @@ async function revokeCredentialAccess(credentialId, accessId) {
5241
6570
  }
5242
6571
 
5243
6572
  // src/ui/api/open-tabs-api.ts
6573
+ init_define_import_meta_env();
5244
6574
  function hasPersistableHostId(tab) {
5245
6575
  return tab.hostId == null || Number.isInteger(tab.hostId) && tab.hostId > 0;
5246
6576
  }
5247
6577
  var activeSessionsCache = createTtlRequestCache(2e3);
6578
+ async function getOpenTabs() {
6579
+ const response = await authApi.get("/open-tabs");
6580
+ return response.data;
6581
+ }
6582
+ async function deleteOpenTab(instanceId) {
6583
+ await authApi.delete(`/open-tabs/${instanceId}`);
6584
+ }
5248
6585
  async function patchOpenTab(instanceId, updates) {
5249
6586
  if (!hasPersistableHostId(updates)) return;
5250
6587
  await authApi.patch(`/open-tabs/${instanceId}`, updates);
5251
6588
  }
6589
+ async function addOpenTab(tab) {
6590
+ if (!hasPersistableHostId(tab)) return;
6591
+ await authApi.post("/open-tabs", tab);
6592
+ }
6593
+ async function getActiveSessions() {
6594
+ return activeSessionsCache.get(async () => {
6595
+ const response = await authApi.get("/open-tabs/active-sessions");
6596
+ return Array.isArray(response.data) ? response.data : [];
6597
+ });
6598
+ }
6599
+ async function getSessionTimeoutMinutes() {
6600
+ const response = await authApi.get("/open-tabs/session-timeout");
6601
+ return Number(response.data?.minutes) || 30;
6602
+ }
5252
6603
  function parseCustomKeybindings(raw) {
5253
6604
  if (!raw) return [];
5254
6605
  try {
@@ -5265,6 +6616,9 @@ async function getUserPreferences() {
5265
6616
  return response.data;
5266
6617
  });
5267
6618
  }
6619
+ async function saveUserPreferences(prefs) {
6620
+ await authApi.put("/user-preferences", prefs);
6621
+ }
5268
6622
 
5269
6623
  // src/ui/main-axios.ts
5270
6624
  var TRUST_TOKEN_KEY = "termixTrustToken";
@@ -5575,7 +6929,7 @@ function getApiUrl(path, defaultPort) {
5575
6929
  const devMode = isDev();
5576
6930
  const electronMode = isElectron();
5577
6931
  if (electronMode) {
5578
- return `http://localhost:${defaultPort}${path}`;
6932
+ return `http://localhost:${localBackendPort()}${path}`;
5579
6933
  } else if (devMode) {
5580
6934
  if (!define_import_meta_env_default.VITE_API_HOST) {
5581
6935
  return `/__termix_api/${defaultPort}${path}`;
@@ -5595,7 +6949,7 @@ function createRemoteOriginApiInstance(path) {
5595
6949
  });
5596
6950
  instance.interceptors.request.use(
5597
6951
  async (config) => {
5598
- const { getLinkedSession: getLinkedSession2 } = await import("./linked-server-QAKKDBFM.js");
6952
+ const { getLinkedSession: getLinkedSession2 } = await import("./linked-server-B4NEG4MA.js");
5599
6953
  const linked = await getLinkedSession2();
5600
6954
  config.baseURL = linked ? `${linked.serverUrl}${path}` : "http://no-server-configured";
5601
6955
  if (config.headers.set) {
@@ -5784,6 +7138,17 @@ async function registerUser(username, password) {
5784
7138
  handleApiError(error, "register user");
5785
7139
  }
5786
7140
  }
7141
+ async function adminCreateUser(username, password) {
7142
+ try {
7143
+ const response = await authApi.post("/users/admin-create", {
7144
+ username,
7145
+ password
7146
+ });
7147
+ return response.data;
7148
+ } catch (error) {
7149
+ handleApiError(error, "admin create user");
7150
+ }
7151
+ }
5787
7152
  async function loginUser(username, password, rememberMe = false) {
5788
7153
  try {
5789
7154
  const response = await authApi.post("/users/login", {
@@ -5818,6 +7183,20 @@ async function requestTrustedProxyLogin() {
5818
7183
  if (response.data.success) markUserAuthenticated();
5819
7184
  return response.data;
5820
7185
  }
7186
+ async function logoutUser() {
7187
+ try {
7188
+ const response = await authApi.post("/users/logout");
7189
+ clearClientAuthState();
7190
+ userWasAuthenticated = false;
7191
+ authInvalidationHandled = false;
7192
+ return response.data;
7193
+ } catch (error) {
7194
+ clearClientAuthState();
7195
+ userWasAuthenticated = false;
7196
+ authInvalidationHandled = false;
7197
+ handleApiError(error, "logout user");
7198
+ }
7199
+ }
5821
7200
  async function getUserInfo() {
5822
7201
  try {
5823
7202
  const response = await authApi.get("/users/me");
@@ -5919,6 +7298,17 @@ async function completePasswordReset(username, tempToken, newPassword, confirmDa
5919
7298
  handleApiError(error, "complete password reset");
5920
7299
  }
5921
7300
  }
7301
+ async function changePassword(oldPassword, newPassword) {
7302
+ try {
7303
+ const response = await authApi.post("/users/change-password", {
7304
+ oldPassword,
7305
+ newPassword
7306
+ });
7307
+ return response.data;
7308
+ } catch (error) {
7309
+ handleApiError(error, "change password");
7310
+ }
7311
+ }
5922
7312
 
5923
7313
  // src/ui/lib/linked-server.ts
5924
7314
  var CACHE_MS = 6e4;
@@ -5957,7 +7347,9 @@ export {
5957
7347
  setFrontendState,
5958
7348
  getPluginRecord,
5959
7349
  knownPluginIds,
7350
+ resetPluginStore,
5960
7351
  isElectron,
7352
+ localBackendPort,
5961
7353
  createRegistry,
5962
7354
  byOrderThenId,
5963
7355
  manifestDeclares,
@@ -5966,6 +7358,9 @@ export {
5966
7358
  getTabType,
5967
7359
  listTabTypes,
5968
7360
  useTabTypes,
7361
+ isPersistentTabType,
7362
+ isSessionTabType,
7363
+ canRestoreTabType,
5969
7364
  tabTypeForActivity,
5970
7365
  useTabs,
5971
7366
  useTabsSafe,
@@ -5976,24 +7371,107 @@ export {
5976
7371
  dbHealthMonitor,
5977
7372
  getDeviceId,
5978
7373
  SYNC_CHANGED_EVENT,
7374
+ invalidateServerStatusCache,
7375
+ invalidateHostsAndStatusCaches,
5979
7376
  getSSHHosts,
7377
+ createSSHHost,
7378
+ updateSSHHost,
7379
+ bulkImportSSHHosts,
7380
+ importSSHConfigHosts,
7381
+ bulkUpdateSSHHosts,
7382
+ reorderSSHHosts,
7383
+ deleteSSHHost,
7384
+ exportAllSSHHosts,
5980
7385
  websocketAuthProtocols,
5981
7386
  getLinkedSession,
5982
7387
  notifySyncChanged,
5983
7388
  resolveConnectionOrigin,
5984
7389
  buildOriginWsUrl,
7390
+ getAllServerStatuses,
7391
+ getStatusCheckSettings,
7392
+ updateStatusCheckSettings,
7393
+ defaultHostRowFields,
7394
+ defaultHostSidebarPreferences,
7395
+ sanitizeHostSidebarPreferences,
7396
+ getHostSidebarPreferences,
7397
+ saveHostSidebarPreferences,
7398
+ CREDENTIAL_ROW_FIELD_KEYS,
7399
+ defaultCredentialRowFields,
7400
+ defaultCredentialSidebarPreferences,
7401
+ sanitizeCredentialSidebarPreferences,
7402
+ getCredentialSidebarPreferences,
7403
+ saveCredentialSidebarPreferences,
5985
7404
  pluginStepKey,
5986
7405
  PRESETS,
7406
+ UI_AREA_KEYS,
7407
+ getLogLevel,
7408
+ updateLogLevel,
7409
+ getSessionTimeout,
7410
+ updateSessionTimeout,
7411
+ getBranding,
7412
+ updateBranding,
5987
7413
  hydrateLocalSharedHostAuth,
7414
+ getConnectedRemoteApi,
5988
7415
  resolveRemoteHostId,
7416
+ getUserList,
7417
+ getSessions,
7418
+ revokeSession,
7419
+ revokeAllUserSessions,
7420
+ createApiKey,
7421
+ getApiKeys,
7422
+ deleteApiKey,
7423
+ makeUserAdmin,
7424
+ removeAdminStatus,
7425
+ deleteUser,
7426
+ deleteAccount,
7427
+ adminResetUserPassword,
7428
+ adminExportUserData,
7429
+ updateRegistrationAllowed,
7430
+ getExternalAutoProvision,
7431
+ updateExternalAutoProvision,
7432
+ getSecondFactorAfterExternalLogin,
7433
+ updateSecondFactorAfterExternalLogin,
7434
+ updatePasswordLoginAllowed,
5989
7435
  getPasswordResetAllowed,
7436
+ updatePasswordResetAllowed,
7437
+ adminGetUserHosts,
7438
+ adminCreateUserHost,
7439
+ adminUpdateUserHost,
7440
+ adminDeleteUserHost,
7441
+ adminGetHostPassword,
7442
+ adminGetUserCredentials,
7443
+ adminCreateUserCredential,
7444
+ adminUpdateUserCredential,
7445
+ adminDeleteUserCredential,
7446
+ releaseUrlFrom,
5990
7447
  getVersionInfo,
7448
+ getUpdateChannel,
7449
+ setUpdateChannel,
7450
+ getChannelReleases,
5991
7451
  getDatabaseHealth,
5992
7452
  getCredentials,
7453
+ getCredentialDetails,
7454
+ createCredential,
7455
+ updateCredential,
7456
+ duplicateCredential,
7457
+ deleteCredential,
5993
7458
  getHostPassword,
7459
+ renameFolder,
7460
+ getSSHFolders,
7461
+ updateFolderMetadata,
7462
+ reorderFolders,
7463
+ deleteAllHostsInFolder,
7464
+ renameCredentialFolder,
7465
+ reorderCredentials,
7466
+ generatePublicKeyFromPrivate,
7467
+ generateKeyPair,
7468
+ deployCredentialToHost,
5994
7469
  getUptime,
5995
7470
  getRecentActivity,
5996
7471
  logActivity,
7472
+ resetRecentActivity,
7473
+ linkExternalToPasswordAccount,
7474
+ unlinkExternalFromPasswordAccount,
5997
7475
  getRoles,
5998
7476
  createRole,
5999
7477
  updateRole,
@@ -6017,21 +7495,31 @@ export {
6017
7495
  shareCredential,
6018
7496
  getCredentialAccess,
6019
7497
  revokeCredentialAccess,
7498
+ getOpenTabs,
7499
+ deleteOpenTab,
6020
7500
  patchOpenTab,
7501
+ addOpenTab,
7502
+ getActiveSessions,
7503
+ getSessionTimeoutMinutes,
6021
7504
  parseCustomKeybindings,
6022
7505
  getUserPreferences,
7506
+ saveUserPreferences,
6023
7507
  TRUST_TOKEN_KEY,
6024
7508
  setCookie,
6025
7509
  getCookie,
6026
7510
  markUserAuthenticated,
6027
7511
  getBackendUrl,
6028
7512
  createRemoteOriginApiInstance,
7513
+ hostApi,
7514
+ sshHostApi,
6029
7515
  authApi,
6030
7516
  rbacApi,
6031
7517
  handleApiError,
6032
7518
  registerUser,
7519
+ adminCreateUser,
6033
7520
  loginUser,
6034
7521
  requestTrustedProxyLogin,
7522
+ logoutUser,
6035
7523
  getUserInfo,
6036
7524
  getCurrentToken,
6037
7525
  getRegistrationAllowed,
@@ -6040,5 +7528,6 @@ export {
6040
7528
  requestDesktopAutoSession,
6041
7529
  initiatePasswordReset,
6042
7530
  verifyPasswordResetCode,
6043
- completePasswordReset
7531
+ completePasswordReset,
7532
+ changePassword
6044
7533
  };