@fish-under-sea/dsh-ssh-fish 1.0.2 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/NOTICE +1 -1
- package/README.en.md +7 -5
- package/README.md +7 -5
- package/README.zh.md +7 -5
- package/icon.png +0 -0
- package/lib/client.js +783 -170
- package/lib/client.js.map +1 -1
- package/lib/index.js +128 -14
- package/lib/types/client/api.d.ts +21 -0
- package/lib/types/client/locales.d.ts +13 -2
- package/lib/types/client/panel/TerminalTab.d.ts +12 -7
- package/lib/types/client/panel/controller.d.ts +185 -21
- package/lib/types/engine/connection-pool.d.ts +52 -1
- package/lib/types/engine.d.ts +7 -0
- package/lib/types/index.d.ts +10 -0
- package/lib/types/loopback.d.ts +41 -1
- package/lib/types/protocol.d.ts +18 -1
- package/lib/types/store.d.ts +7 -0
- package/lib/types/tool-surface.d.ts +1 -0
- package/lib/types/tools.d.ts +1 -0
- package/locale/en.json +6 -0
- package/locale/zh.json +6 -0
- package/package.json +25 -22
- package/src/client/api.ts +70 -0
- package/src/client/index.ts +1 -2
- package/src/client/locales.ts +26 -4
- package/src/client/panel/HostFormDialog.tsx +16 -2
- package/src/client/panel/HostsTab.tsx +3 -0
- package/src/client/panel/SshPanel.tsx +7 -15
- package/src/client/panel/TerminalTab.tsx +371 -151
- package/src/client/panel/controller.ts +370 -30
- package/src/client/panel/panel.module.css +108 -0
- package/src/client/settings-binding.ts +0 -1
- package/src/engine/connection-pool.ts +96 -4
- package/src/engine.ts +10 -0
- package/src/index.ts +16 -1
- package/src/loopback.ts +57 -1
- package/src/protocol.ts +18 -1
- package/src/routes.ts +4 -1
- package/src/store.ts +26 -0
- package/src/tool-surface.ts +1 -0
- package/src/tools.ts +9 -4
- package/icon.svg +0 -3
package/lib/client.js
CHANGED
|
@@ -63,6 +63,8 @@ window.__ModuleLoader__.load({
|
|
|
63
63
|
"hosts.deleteConfirm": "确定删除主机「{alias}」?将同时停止其隧道。",
|
|
64
64
|
"hosts.imported": "解析 {parsed} 个配置块,新增 {added} 台主机,跳过 {skipped} 个。",
|
|
65
65
|
"hosts.proxyBadge": "代理",
|
|
66
|
+
"hosts.forwardAgentBadge": "Agent 转发",
|
|
67
|
+
"hosts.forwardAgentHint": "仅对可信主机开启:远端可用本机私钥签名(等价 ssh -A)。",
|
|
66
68
|
"import.reason.wildcard": "通配符 pattern,需手动配置",
|
|
67
69
|
"import.reason.existing": "别名已存在",
|
|
68
70
|
"import.reason.match": "Match 条件块,不支持",
|
|
@@ -85,8 +87,8 @@ window.__ModuleLoader__.load({
|
|
|
85
87
|
"form.auth.password": "密码",
|
|
86
88
|
"form.auth.agent": "SSH Agent",
|
|
87
89
|
"form.agentPath": "Agent 路径",
|
|
88
|
-
"form.agentPathHint": "留空自动检测(SSH_AUTH_SOCK
|
|
89
|
-
"form.authKeepHint": "
|
|
90
|
+
"form.agentPathHint": "留空自动检测(SSH_AUTH_SOCK;Windows 上为原生 ssh-agent 命名管道);也可填 socket 路径或 pageant",
|
|
91
|
+
"form.authKeepHint": "编辑时密码 / 私钥留空将保留已存凭据;Agent 路径留空是合法的自动检测,选「SSH Agent」即切换到 agent 认证。",
|
|
90
92
|
"form.keyPath": "私钥路径",
|
|
91
93
|
"form.keyPathHint": "如 ~/.ssh/id_ed25519",
|
|
92
94
|
"form.passphrase": "密钥口令",
|
|
@@ -97,6 +99,8 @@ window.__ModuleLoader__.load({
|
|
|
97
99
|
"form.proxyJumpHint": "逗号分隔的本地主机别名,或 [user@]host[:port] 地址,按顺序连接",
|
|
98
100
|
"form.proxyCommand": "ProxyCommand",
|
|
99
101
|
"form.proxyCommandHint": "OpenSSH ProxyCommand:%h 主机、%p 端口、%r 用户、%n 别名;留空或填 none 表示不使用。与跳板机别名互斥。",
|
|
102
|
+
"form.forwardAgent": "启用 Agent 转发",
|
|
103
|
+
"form.forwardAgentHint": "把本机 SSH Agent 转发到该主机(等价 ssh -A):远端可用本机私钥签名。仅对可信主机开启。",
|
|
100
104
|
"form.description": "备注",
|
|
101
105
|
"form.environment": "环境",
|
|
102
106
|
"form.environmentHint": "如 development / production",
|
|
@@ -121,6 +125,13 @@ window.__ModuleLoader__.load({
|
|
|
121
125
|
"terminal.auth.cancel": "取消",
|
|
122
126
|
"terminal.auth.placeholder": "请输入验证码或口令",
|
|
123
127
|
"terminal.auth.hint": "服务器请求进行交互式二次验证(输入仅本次生效,不落盘):",
|
|
128
|
+
"terminal.tabs": "终端标签",
|
|
129
|
+
"terminal.newTab": "按当前主机新开标签",
|
|
130
|
+
"terminal.closeTab": "关闭标签",
|
|
131
|
+
"terminal.authPending": "待验证",
|
|
132
|
+
"terminal.tabExited": "已退出",
|
|
133
|
+
"terminal.tabError": "出错",
|
|
134
|
+
"terminal.closeFailed": "无法确认该标签已关闭:关闭帧未送达宿主。标签已保留——可重试,或切到该标签前台,用它自己的连接关闭。",
|
|
124
135
|
"transfer.selectHost": "选择主机",
|
|
125
136
|
"transfer.remotePath": "远程路径",
|
|
126
137
|
"transfer.remotePathHint": "如 /tmp/ 或 /home/user/app.tar.gz",
|
|
@@ -219,6 +230,8 @@ window.__ModuleLoader__.load({
|
|
|
219
230
|
"hosts.deleteConfirm": "Delete host \"{alias}\"? Its tunnels will be stopped.",
|
|
220
231
|
"hosts.imported": "Parsed {parsed} blocks, added {added} hosts, skipped {skipped}.",
|
|
221
232
|
"hosts.proxyBadge": "proxy",
|
|
233
|
+
"hosts.forwardAgentBadge": "agent-fwd",
|
|
234
|
+
"hosts.forwardAgentHint": "Enable only for hosts you trust: the remote can sign with your local private keys (equivalent to ssh -A).",
|
|
222
235
|
"import.reason.wildcard": "wildcard pattern — configure it by hand",
|
|
223
236
|
"import.reason.existing": "alias already configured",
|
|
224
237
|
"import.reason.match": "Match block — not supported",
|
|
@@ -241,8 +254,8 @@ window.__ModuleLoader__.load({
|
|
|
241
254
|
"form.auth.password": "Password",
|
|
242
255
|
"form.auth.agent": "SSH Agent",
|
|
243
256
|
"form.agentPath": "Agent path",
|
|
244
|
-
"form.agentPathHint": "Leave empty to auto-detect (SSH_AUTH_SOCK
|
|
245
|
-
"form.authKeepHint": "While editing, empty
|
|
257
|
+
"form.agentPathHint": "Leave empty to auto-detect (SSH_AUTH_SOCK; the native ssh-agent named pipe on Windows), or set a socket path or \"pageant\"",
|
|
258
|
+
"form.authKeepHint": "While editing, an empty password or key field keeps the stored credential; an empty agent path is a valid auto-detect, so choosing SSH Agent switches the host to agent auth.",
|
|
246
259
|
"form.keyPath": "Private key path",
|
|
247
260
|
"form.keyPathHint": "e.g. ~/.ssh/id_ed25519",
|
|
248
261
|
"form.passphrase": "Key passphrase",
|
|
@@ -253,6 +266,8 @@ window.__ModuleLoader__.load({
|
|
|
253
266
|
"form.proxyJumpHint": "Comma-separated local aliases or [user@]host[:port] addresses, chained in order",
|
|
254
267
|
"form.proxyCommand": "ProxyCommand",
|
|
255
268
|
"form.proxyCommandHint": "OpenSSH ProxyCommand: %h host, %p port, %r user, %n alias; empty or none disables it. Mutually exclusive with the jump chain.",
|
|
269
|
+
"form.forwardAgent": "Enable agent forwarding",
|
|
270
|
+
"form.forwardAgentHint": "Forward your local SSH agent to this host (equivalent to ssh -A): the remote can sign with your private keys. Enable it only for hosts you trust.",
|
|
256
271
|
"form.description": "Description",
|
|
257
272
|
"form.environment": "Environment",
|
|
258
273
|
"form.environmentHint": "e.g. development / production",
|
|
@@ -277,6 +292,13 @@ window.__ModuleLoader__.load({
|
|
|
277
292
|
"terminal.auth.cancel": "Cancel",
|
|
278
293
|
"terminal.auth.placeholder": "Enter code or passphrase",
|
|
279
294
|
"terminal.auth.hint": "The server requested interactive 2FA (session only, never saved):",
|
|
295
|
+
"terminal.tabs": "Terminal tabs",
|
|
296
|
+
"terminal.newTab": "New tab on the current host",
|
|
297
|
+
"terminal.closeTab": "Close tab",
|
|
298
|
+
"terminal.authPending": "2FA pending",
|
|
299
|
+
"terminal.tabExited": "exited",
|
|
300
|
+
"terminal.tabError": "error",
|
|
301
|
+
"terminal.closeFailed": "Could not confirm the tab closed: the close never reached the host, so the tab was kept. Retry, or bring the tab to the front and close it over its own connection.",
|
|
280
302
|
"transfer.selectHost": "Select host",
|
|
281
303
|
"transfer.remotePath": "Remote path",
|
|
282
304
|
"transfer.remotePathHint": "e.g. /tmp/ or /home/user/app.tar.gz",
|
|
@@ -779,6 +801,78 @@ window.__ModuleLoader__.load({
|
|
|
779
801
|
rows
|
|
780
802
|
}));
|
|
781
803
|
}
|
|
804
|
+
/**
|
|
805
|
+
* End a host session this view is not attached to (closing a background
|
|
806
|
+
* tab). The session has no other handle from the browser: giving it a
|
|
807
|
+
* dedicated HTTP route would widen the host's surface for one frame, so this
|
|
808
|
+
* opens one short-lived attach instead and sends the close frame as soon as
|
|
809
|
+
* the socket is open.
|
|
810
|
+
*
|
|
811
|
+
* The answer is "is this session no longer running", which has three
|
|
812
|
+
* truthful answers and one lie to avoid:
|
|
813
|
+
* - the frame went out on an open socket: the host ends the session;
|
|
814
|
+
* - the host answered with an exit frame: an unknown id is reported as
|
|
815
|
+
* `terminal session expired` and an ended shell also exits, and in both
|
|
816
|
+
* cases nothing is running, so the tab really is closed;
|
|
817
|
+
* - the socket errored, closed before opening, or never settled inside
|
|
818
|
+
* `timeoutMs`: delivery is unproven, so the session may still be alive and
|
|
819
|
+
* the caller must keep the tab instead of claiming it closed.
|
|
820
|
+
* @param sessionId - the session id the host reported on its ready frame.
|
|
821
|
+
* @param timeoutMs - bounded wait for the delivery signal (default 5000).
|
|
822
|
+
* @returns true when the session is known to be gone.
|
|
823
|
+
*/
|
|
824
|
+
closeTerminalSession(sessionId, timeoutMs = 5e3) {
|
|
825
|
+
const target = terminalSocketUrl(window.location, query({
|
|
826
|
+
session: sessionId,
|
|
827
|
+
cols: 2,
|
|
828
|
+
rows: 1
|
|
829
|
+
}), transportStreamBaseUrl());
|
|
830
|
+
if (target === void 0) return Promise.resolve(false);
|
|
831
|
+
let socket;
|
|
832
|
+
try {
|
|
833
|
+
socket = new WebSocket(target);
|
|
834
|
+
} catch {
|
|
835
|
+
return Promise.resolve(false);
|
|
836
|
+
}
|
|
837
|
+
return new Promise((resolve) => {
|
|
838
|
+
let settled = false;
|
|
839
|
+
let timer;
|
|
840
|
+
const finish = (gone) => {
|
|
841
|
+
if (settled) return;
|
|
842
|
+
settled = true;
|
|
843
|
+
if (timer !== void 0) clearTimeout(timer);
|
|
844
|
+
try {
|
|
845
|
+
socket.close();
|
|
846
|
+
} catch {}
|
|
847
|
+
resolve(gone);
|
|
848
|
+
};
|
|
849
|
+
timer = setTimeout(() => {
|
|
850
|
+
finish(false);
|
|
851
|
+
}, timeoutMs);
|
|
852
|
+
socket.onopen = () => {
|
|
853
|
+
const closeFrame = { type: "close" };
|
|
854
|
+
try {
|
|
855
|
+
socket.send(JSON.stringify(closeFrame));
|
|
856
|
+
finish(true);
|
|
857
|
+
} catch {}
|
|
858
|
+
};
|
|
859
|
+
socket.onmessage = (event) => {
|
|
860
|
+
let frame;
|
|
861
|
+
try {
|
|
862
|
+
frame = JSON.parse(event.data);
|
|
863
|
+
} catch {
|
|
864
|
+
return;
|
|
865
|
+
}
|
|
866
|
+
if (frame.type === "exit") finish(true);
|
|
867
|
+
};
|
|
868
|
+
socket.onerror = () => {
|
|
869
|
+
finish(false);
|
|
870
|
+
};
|
|
871
|
+
socket.onclose = () => {
|
|
872
|
+
finish(false);
|
|
873
|
+
};
|
|
874
|
+
});
|
|
875
|
+
}
|
|
782
876
|
/** One terminal socket over either an alias (open) or a session id (attach). */
|
|
783
877
|
terminalSocket(search) {
|
|
784
878
|
const target = terminalSocketUrl(window.location, search, transportStreamBaseUrl());
|
|
@@ -853,20 +947,51 @@ window.__ModuleLoader__.load({
|
|
|
853
947
|
return connection;
|
|
854
948
|
}
|
|
855
949
|
};
|
|
950
|
+
/** Byte cap for the retained screen of one tab (the host buffers 256 KiB too). */
|
|
951
|
+
const MAX_RETAINED_BYTES = 256 * 1024;
|
|
952
|
+
/**
|
|
953
|
+
* UTF-8 byte length of one chunk, without node's Buffer (this half is bundled
|
|
954
|
+
* for the browser). Surrogate pairs count as the four bytes they encode to.
|
|
955
|
+
* @param text - the output chunk.
|
|
956
|
+
* @returns its UTF-8 byte length.
|
|
957
|
+
*/
|
|
958
|
+
function utf8Bytes(text) {
|
|
959
|
+
let bytes = 0;
|
|
960
|
+
for (const char of text) {
|
|
961
|
+
const code = char.codePointAt(0) ?? 0;
|
|
962
|
+
bytes += code < 128 ? 1 : code < 2048 ? 2 : code < 65536 ? 3 : 4;
|
|
963
|
+
}
|
|
964
|
+
return bytes;
|
|
965
|
+
}
|
|
856
966
|
/** The panel state owner the sidebar row and the view both read. */
|
|
857
967
|
var PanelController = class {
|
|
858
968
|
deps;
|
|
859
969
|
panelOpen = false;
|
|
860
970
|
activeTab = "hosts";
|
|
861
|
-
|
|
862
|
-
|
|
971
|
+
terminalTabs = [];
|
|
972
|
+
activeTerminalTabId;
|
|
973
|
+
draftAlias = "";
|
|
974
|
+
nextTerminalTabSeq = 0;
|
|
863
975
|
listeners = /* @__PURE__ */ new Set();
|
|
976
|
+
/**
|
|
977
|
+
* Last screen of each tab, kept outside the snapshot: terminal output must
|
|
978
|
+
* not re-render the panel on every chunk, and only the terminal view reads
|
|
979
|
+
* this (when a tab has no session left to replay from).
|
|
980
|
+
*/
|
|
981
|
+
retainedScreens = /* @__PURE__ */ new Map();
|
|
982
|
+
/**
|
|
983
|
+
* Sockets that outlived their view while still connecting. Their session id
|
|
984
|
+
* is unknown, so they cannot be detached yet; keeping them here is what
|
|
985
|
+
* prevents a host PTY with no owner.
|
|
986
|
+
*/
|
|
987
|
+
adoptedLinks = /* @__PURE__ */ new Map();
|
|
864
988
|
/** Cached so getSnapshot is referentially stable between changes. */
|
|
865
989
|
snapshot = {
|
|
866
990
|
panelOpen: false,
|
|
867
991
|
activeTab: "hosts",
|
|
868
|
-
|
|
869
|
-
|
|
992
|
+
terminalTabs: [],
|
|
993
|
+
activeTerminalTabId: void 0,
|
|
994
|
+
draftAlias: ""
|
|
870
995
|
};
|
|
871
996
|
constructor(deps = {}) {
|
|
872
997
|
this.deps = deps;
|
|
@@ -920,33 +1045,274 @@ window.__ModuleLoader__.load({
|
|
|
920
1045
|
this.activeTab = tab;
|
|
921
1046
|
this.commit();
|
|
922
1047
|
}
|
|
923
|
-
/**
|
|
1048
|
+
/**
|
|
1049
|
+
* Hand the terminal tab a host to connect to (the hosts-tab "connect"
|
|
1050
|
+
* action): the tab exists before the view does, so a panel switch during the
|
|
1051
|
+
* handshake still shows the connecting tab and adopts its socket.
|
|
1052
|
+
* @param alias - the configured host alias.
|
|
1053
|
+
*/
|
|
924
1054
|
requestConnect(alias) {
|
|
925
|
-
this.connectRequest = {
|
|
926
|
-
alias,
|
|
927
|
-
nonce: Date.now()
|
|
928
|
-
};
|
|
929
1055
|
this.activeTab = "terminal";
|
|
1056
|
+
this.openTerminalTab(alias);
|
|
1057
|
+
}
|
|
1058
|
+
/**
|
|
1059
|
+
* Add a terminal tab on the alias and make it the shown one. Several tabs
|
|
1060
|
+
* may target one alias on purpose: each owns its own host PTY.
|
|
1061
|
+
* @param alias - the configured host alias.
|
|
1062
|
+
* @returns the new tab id.
|
|
1063
|
+
*/
|
|
1064
|
+
openTerminalTab(alias) {
|
|
1065
|
+
this.nextTerminalTabSeq += 1;
|
|
1066
|
+
const id = "tab-" + String(this.nextTerminalTabSeq);
|
|
1067
|
+
this.terminalTabs = [...this.terminalTabs, {
|
|
1068
|
+
id,
|
|
1069
|
+
alias,
|
|
1070
|
+
status: "connecting"
|
|
1071
|
+
}];
|
|
1072
|
+
this.activeTerminalTabId = id;
|
|
1073
|
+
this.draftAlias = alias;
|
|
1074
|
+
this.retainedScreens.delete(id);
|
|
1075
|
+
this.commit();
|
|
1076
|
+
return id;
|
|
1077
|
+
}
|
|
1078
|
+
/**
|
|
1079
|
+
* Show an existing tab and make the toolbar follow its host, so a new tab
|
|
1080
|
+
* opens on the host the user is looking at.
|
|
1081
|
+
* @param id - the tab id.
|
|
1082
|
+
*/
|
|
1083
|
+
setActiveTerminalTab(id) {
|
|
1084
|
+
if (this.activeTerminalTabId === id) return;
|
|
1085
|
+
const tab = this.terminalTab(id);
|
|
1086
|
+
if (tab === void 0) return;
|
|
1087
|
+
this.activeTerminalTabId = id;
|
|
1088
|
+
this.draftAlias = tab.alias;
|
|
930
1089
|
this.commit();
|
|
931
1090
|
}
|
|
932
|
-
/**
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
1091
|
+
/**
|
|
1092
|
+
* Remove one tab and forget its screen. When the shown tab closes, the
|
|
1093
|
+
* neighbours decide what the xterm shows next: the tab that took its place,
|
|
1094
|
+
* else the one before it, else nothing.
|
|
1095
|
+
* @param id - the tab id.
|
|
1096
|
+
*/
|
|
1097
|
+
closeTerminalTab(id) {
|
|
1098
|
+
const index = this.terminalTabs.findIndex((tab) => tab.id === id);
|
|
1099
|
+
this.retainedScreens.delete(id);
|
|
1100
|
+
const adopted = this.adoptedLinks.get(id);
|
|
1101
|
+
if (adopted !== void 0) adopted.intent = "close";
|
|
1102
|
+
if (index < 0) return;
|
|
1103
|
+
const wasActive = this.activeTerminalTabId === id;
|
|
1104
|
+
this.terminalTabs = this.terminalTabs.filter((tab) => tab.id !== id);
|
|
1105
|
+
if (wasActive) {
|
|
1106
|
+
const neighbour = this.terminalTabs[index] ?? this.terminalTabs[index - 1];
|
|
1107
|
+
this.activeTerminalTabId = neighbour?.id;
|
|
1108
|
+
if (neighbour !== void 0) this.draftAlias = neighbour.alias;
|
|
1109
|
+
}
|
|
936
1110
|
this.commit();
|
|
937
1111
|
}
|
|
938
|
-
/**
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
1112
|
+
/** The tab record with this id, or undefined when it no longer exists. */
|
|
1113
|
+
terminalTab(id) {
|
|
1114
|
+
return this.terminalTabs.find((tab) => tab.id === id);
|
|
1115
|
+
}
|
|
1116
|
+
/**
|
|
1117
|
+
* Apply a partial update to one tab; a tab that was closed in the meantime
|
|
1118
|
+
* is left alone rather than resurrected.
|
|
1119
|
+
* @param id - the tab id.
|
|
1120
|
+
* @param patch - the fields to change.
|
|
1121
|
+
*/
|
|
1122
|
+
patchTerminalTab(id, patch) {
|
|
1123
|
+
let found = false;
|
|
1124
|
+
const next = this.terminalTabs.map((tab) => {
|
|
1125
|
+
if (tab.id !== id) return tab;
|
|
1126
|
+
found = true;
|
|
1127
|
+
return {
|
|
1128
|
+
...tab,
|
|
1129
|
+
...patch
|
|
1130
|
+
};
|
|
1131
|
+
});
|
|
1132
|
+
if (!found) return;
|
|
1133
|
+
this.terminalTabs = next;
|
|
1134
|
+
this.commit();
|
|
1135
|
+
}
|
|
1136
|
+
/**
|
|
1137
|
+
* Record the host session of a ready tab and clear the challenge it carried.
|
|
1138
|
+
* @param id - the tab id.
|
|
1139
|
+
* @param sessionId - the id the host reported on its ready frame.
|
|
1140
|
+
*/
|
|
1141
|
+
readyTerminalTab(id, sessionId) {
|
|
1142
|
+
this.patchTerminalTab(id, {
|
|
1143
|
+
status: "connected",
|
|
1144
|
+
sessionId,
|
|
1145
|
+
detail: void 0,
|
|
1146
|
+
closeError: void 0,
|
|
1147
|
+
authPrompt: void 0,
|
|
1148
|
+
authAnswers: void 0
|
|
1149
|
+
});
|
|
1150
|
+
}
|
|
1151
|
+
/**
|
|
1152
|
+
* The remote shell ended: the tab keeps its screen and its place, and the
|
|
1153
|
+
* dead session id is dropped so nothing tries to reattach to it.
|
|
1154
|
+
* @param id - the tab id.
|
|
1155
|
+
* @param detail - why it ended, when the transport said.
|
|
1156
|
+
*/
|
|
1157
|
+
exitTerminalTab(id, detail) {
|
|
1158
|
+
this.patchTerminalTab(id, {
|
|
1159
|
+
status: "exited",
|
|
1160
|
+
sessionId: void 0,
|
|
1161
|
+
detail,
|
|
1162
|
+
authPrompt: void 0,
|
|
1163
|
+
authAnswers: void 0,
|
|
1164
|
+
closeError: void 0
|
|
1165
|
+
});
|
|
1166
|
+
}
|
|
1167
|
+
/**
|
|
1168
|
+
* The connection failed. The tab stays with the reason so the user can read
|
|
1169
|
+
* it and close the tab themselves.
|
|
1170
|
+
* @param id - the tab id.
|
|
1171
|
+
* @param detail - the failure text.
|
|
1172
|
+
*/
|
|
1173
|
+
failTerminalTab(id, detail) {
|
|
1174
|
+
this.patchTerminalTab(id, {
|
|
1175
|
+
status: "error",
|
|
1176
|
+
sessionId: void 0,
|
|
1177
|
+
detail,
|
|
1178
|
+
authPrompt: void 0,
|
|
1179
|
+
authAnswers: void 0,
|
|
1180
|
+
closeError: void 0
|
|
1181
|
+
});
|
|
1182
|
+
}
|
|
1183
|
+
/**
|
|
1184
|
+
* A background close never reached the host. The tab keeps its live session
|
|
1185
|
+
* id (so a retry can still end it) and says so instead of vanishing.
|
|
1186
|
+
* @param id - the tab id.
|
|
1187
|
+
* @param reason - the reason code shown by the view.
|
|
1188
|
+
*/
|
|
1189
|
+
markTerminalCloseFailed(id, reason) {
|
|
1190
|
+
this.patchTerminalTab(id, { closeError: reason });
|
|
1191
|
+
}
|
|
1192
|
+
/**
|
|
1193
|
+
* Store the keyboard-interactive challenge this tab has to answer, with a
|
|
1194
|
+
* blank answer of this challenge's own length. A prompt on another tab never
|
|
1195
|
+
* touches this record, which is what keeps two challenges from sharing input.
|
|
1196
|
+
* @param id - the tab id.
|
|
1197
|
+
* @param prompt - the challenge the host asked for.
|
|
1198
|
+
*/
|
|
1199
|
+
setTerminalAuthPrompt(id, prompt) {
|
|
1200
|
+
this.patchTerminalTab(id, {
|
|
1201
|
+
authPrompt: prompt,
|
|
1202
|
+
authAnswers: prompt.prompts.map(() => "")
|
|
1203
|
+
});
|
|
1204
|
+
}
|
|
1205
|
+
/**
|
|
1206
|
+
* Record one character typed for this tab's challenge.
|
|
1207
|
+
* @param id - the tab id.
|
|
1208
|
+
* @param index - which prompt of the challenge.
|
|
1209
|
+
* @param value - the field's current text.
|
|
1210
|
+
*/
|
|
1211
|
+
setTerminalAuthAnswer(id, index, value) {
|
|
1212
|
+
const tab = this.terminalTab(id);
|
|
1213
|
+
if (tab === void 0 || tab.authPrompt === void 0) return;
|
|
1214
|
+
const answers = [...tab.authAnswers ?? tab.authPrompt.prompts.map(() => "")];
|
|
1215
|
+
answers[index] = value;
|
|
1216
|
+
this.patchTerminalTab(id, { authAnswers: answers });
|
|
1217
|
+
}
|
|
1218
|
+
/** Drop the challenge once it was answered, cancelled, or could not apply. */
|
|
1219
|
+
clearTerminalAuthPrompt(id) {
|
|
1220
|
+
if (this.terminalTab(id)?.authPrompt === void 0) return;
|
|
1221
|
+
this.patchTerminalTab(id, {
|
|
1222
|
+
authPrompt: void 0,
|
|
1223
|
+
authAnswers: void 0
|
|
1224
|
+
});
|
|
1225
|
+
}
|
|
1226
|
+
/** Choose the alias the next terminal tab opens on. */
|
|
1227
|
+
setDraftAlias(alias) {
|
|
1228
|
+
if (this.draftAlias === alias) return;
|
|
1229
|
+
this.draftAlias = alias;
|
|
942
1230
|
this.commit();
|
|
943
1231
|
}
|
|
1232
|
+
/** Append one output chunk to the retained screen of a tab. */
|
|
1233
|
+
appendTerminalOutput(id, chunk) {
|
|
1234
|
+
const screen = this.retainedScreens.get(id) ?? {
|
|
1235
|
+
chunks: [],
|
|
1236
|
+
bytes: 0
|
|
1237
|
+
};
|
|
1238
|
+
screen.chunks.push(chunk);
|
|
1239
|
+
screen.bytes += utf8Bytes(chunk);
|
|
1240
|
+
while (screen.bytes > MAX_RETAINED_BYTES && screen.chunks.length > 1) {
|
|
1241
|
+
const dropped = screen.chunks.shift() ?? "";
|
|
1242
|
+
screen.bytes -= utf8Bytes(dropped);
|
|
1243
|
+
}
|
|
1244
|
+
this.retainedScreens.set(id, screen);
|
|
1245
|
+
}
|
|
1246
|
+
/** The retained screen of a tab, concatenated for a redraw. */
|
|
1247
|
+
readTerminalOutput(id) {
|
|
1248
|
+
return (this.retainedScreens.get(id)?.chunks ?? []).join("");
|
|
1249
|
+
}
|
|
1250
|
+
/** Forget the retained screen (a fresh replay from the host replaces it). */
|
|
1251
|
+
clearTerminalOutput(id) {
|
|
1252
|
+
this.retainedScreens.delete(id);
|
|
1253
|
+
}
|
|
1254
|
+
/**
|
|
1255
|
+
* Keep a still-connecting socket alive after its view went away. The socket
|
|
1256
|
+
* cannot be detached yet (no session id), so the intent is applied when the
|
|
1257
|
+
* host reports it: `detach` leaves the shell for a later reattach, `close`
|
|
1258
|
+
* ends the session of a tab the user closed.
|
|
1259
|
+
* @param tabId - the tab the socket belongs to.
|
|
1260
|
+
* @param connection - the live connection.
|
|
1261
|
+
* @param intent - what to do once the session id arrives.
|
|
1262
|
+
*/
|
|
1263
|
+
adoptTerminalLink(tabId, connection, intent) {
|
|
1264
|
+
const entry = {
|
|
1265
|
+
connection,
|
|
1266
|
+
intent
|
|
1267
|
+
};
|
|
1268
|
+
this.adoptedLinks.set(tabId, entry);
|
|
1269
|
+
connection.onOutput = (data) => {
|
|
1270
|
+
if (this.terminalTab(tabId) === void 0) return;
|
|
1271
|
+
this.appendTerminalOutput(tabId, data);
|
|
1272
|
+
};
|
|
1273
|
+
connection.onAuthPrompt = (name, instructions, prompts) => {
|
|
1274
|
+
if (this.terminalTab(tabId) === void 0) return;
|
|
1275
|
+
this.setTerminalAuthPrompt(tabId, {
|
|
1276
|
+
name,
|
|
1277
|
+
instructions,
|
|
1278
|
+
prompts
|
|
1279
|
+
});
|
|
1280
|
+
};
|
|
1281
|
+
connection.onReady = (sessionId) => {
|
|
1282
|
+
const decided = this.adoptedLinks.get(tabId)?.intent ?? entry.intent;
|
|
1283
|
+
this.adoptedLinks.delete(tabId);
|
|
1284
|
+
this.readyTerminalTab(tabId, sessionId);
|
|
1285
|
+
if (decided === "close") connection.close();
|
|
1286
|
+
else connection.detach();
|
|
1287
|
+
};
|
|
1288
|
+
connection.onExit = (_code, error) => {
|
|
1289
|
+
this.adoptedLinks.delete(tabId);
|
|
1290
|
+
this.failTerminalTab(tabId, error ?? "connection closed");
|
|
1291
|
+
};
|
|
1292
|
+
}
|
|
1293
|
+
/**
|
|
1294
|
+
* Take an adopted socket back when its tab is shown again, so the host never
|
|
1295
|
+
* opens a second PTY for the same tab.
|
|
1296
|
+
* @param tabId - the tab id.
|
|
1297
|
+
* @returns the connection, or undefined when nothing was adopted.
|
|
1298
|
+
*/
|
|
1299
|
+
reclaimTerminalLink(tabId) {
|
|
1300
|
+
const adopted = this.adoptedLinks.get(tabId);
|
|
1301
|
+
if (adopted === void 0) return void 0;
|
|
1302
|
+
if (adopted.intent === "close") return void 0;
|
|
1303
|
+
this.adoptedLinks.delete(tabId);
|
|
1304
|
+
adopted.connection.onReady = void 0;
|
|
1305
|
+
adopted.connection.onExit = void 0;
|
|
1306
|
+
adopted.connection.onAuthPrompt = void 0;
|
|
1307
|
+
return adopted.connection;
|
|
1308
|
+
}
|
|
944
1309
|
commit() {
|
|
945
1310
|
this.snapshot = {
|
|
946
1311
|
panelOpen: this.panelOpen,
|
|
947
1312
|
activeTab: this.activeTab,
|
|
948
|
-
|
|
949
|
-
|
|
1313
|
+
terminalTabs: this.terminalTabs,
|
|
1314
|
+
activeTerminalTabId: this.activeTerminalTabId,
|
|
1315
|
+
draftAlias: this.draftAlias
|
|
950
1316
|
};
|
|
951
1317
|
for (const fn of [...this.listeners]) fn();
|
|
952
1318
|
}
|
|
@@ -959,7 +1325,7 @@ window.__ModuleLoader__.load({
|
|
|
959
1325
|
};
|
|
960
1326
|
//#endregion
|
|
961
1327
|
//#region \0dsh-css:packages/dsh-ssh-fish/src/client/panel/panel.module.css.mjs
|
|
962
|
-
const css = ".kVI_yq_view{height:100%;min-height:0;overflow:hidden}.kVI_yq_panel{background:var(--dsw-alias-bg-base);min-width:0;height:100%;min-height:0;color:var(--dsw-alias-label-primary);font-family:var(--dsw-font-family);flex-direction:column;gap:10px;padding:14px 16px 16px;display:flex}.kVI_yq_panelHeader{flex:none;align-items:center;gap:10px;display:flex}.kVI_yq_panelTitle{color:var(--dsw-alias-label-primary);white-space:nowrap;flex:1;margin:0;font-size:16px;font-weight:700}.kVI_yq_backButton{align-items:center;gap:4px;display:inline-flex}.kVI_yq_tabBar{border-bottom:1px solid var(--dsw-alias-border-l1);flex:none;gap:2px;display:flex}.kVI_yq_tab{color:var(--dsw-alias-label-secondary);cursor:pointer;white-space:nowrap;background:0 0;border:none;border-bottom:2px solid #0000;border-radius:6px 6px 0 0;padding:7px 14px;font-size:13px}.kVI_yq_tab:hover{color:var(--dsw-alias-label-primary);background:var(--dsw-alias-interactive-bg-hover)}.kVI_yq_tab[data-active]{color:var(--dsw-alias-label-primary);border-bottom-color:var(--dsw-alias-state-business-primary);font-weight:600}.kVI_yq_panelContent{flex-direction:column;flex:1;min-height:0;display:flex;overflow:hidden}.kVI_yq_tabBody{flex-direction:column;flex:1;gap:10px;min-height:0;display:flex;overflow-y:auto}.kVI_yq_fillBody{flex-direction:column;flex:1;gap:10px;min-height:0;display:flex;overflow:hidden}.kVI_yq_toolbar,.kVI_yq_controls{flex-wrap:wrap;flex:none;align-items:center;gap:8px;display:flex}.kVI_yq_controls .kVI_yq_input{flex:0 260px;min-width:150px}.kVI_yq_toolbarSpacer{flex:1}.kVI_yq_search{min-width:120px;color:var(--dsw-alias-label-primary);background:var(--dsw-specific-input-major);border:1px solid var(--dsw-alias-border-l2);border-radius:8px;outline:none;flex:0 260px;padding:6px 10px;font-size:13px}.kVI_yq_search::placeholder{color:var(--dsw-alias-label-tertiary)}.kVI_yq_groupBySelect{color:var(--dsw-alias-label-primary);background:var(--dsw-specific-input-major);border:1px solid var(--dsw-alias-border-l2);border-radius:8px;outline:none;padding:6px 8px;font-size:13px}.kVI_yq_groupSection+.kVI_yq_groupSection{border-top:1px solid var(--dsw-alias-border-l1)}.kVI_yq_groupHeader{background:var(--dsw-alias-bg-base,var(--dsw-specific-input-major));align-items:center;gap:8px;padding:4px 8px;display:flex;position:sticky;top:0}.kVI_yq_groupToggle{min-width:0;color:var(--dsw-alias-label-primary);cursor:pointer;text-align:left;background:0 0;border:none;border-radius:6px;flex:1;align-items:center;gap:6px;padding:4px 6px;font-size:12.5px;font-weight:500;display:flex}.kVI_yq_groupToggle:hover{background:var(--dsw-alias-interactive-bg-hover)}.kVI_yq_groupChevron{border-right:1.5px solid var(--dsw-alias-label-tertiary);border-bottom:1.5px solid var(--dsw-alias-label-tertiary);flex:none;width:7px;height:7px;margin-bottom:2px;transition:transform .12s;transform:rotate(45deg)}.kVI_yq_groupChevron[data-collapsed]{margin-bottom:0;transform:rotate(-45deg)}.kVI_yq_groupName{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.kVI_yq_groupCount{color:var(--dsw-alias-label-tertiary);flex:none;font-weight:400}.kVI_yq_tableWrap{border:1px solid var(--dsw-alias-border-l1);border-radius:10px;flex:1;min-height:0;overflow:auto}.kVI_yq_table{border-collapse:collapse;width:100%;font-size:12.5px}.kVI_yq_table th{z-index:1;text-align:left;background:var(--dsw-alias-bg-layer-2);color:var(--dsw-alias-label-secondary);border-bottom:1px solid var(--dsw-alias-border-l1);white-space:nowrap;padding:8px 10px;font-weight:600;position:sticky;top:0}.kVI_yq_table td{border-bottom:1px solid var(--dsw-alias-separator-primary);vertical-align:top;padding:7px 10px}.kVI_yq_table tbody tr:last-child td{border-bottom:none}.kVI_yq_table tbody tr:hover td{background:var(--dsw-alias-interactive-bg-hover)}.kVI_yq_mono{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace}.kVI_yq_cellMuted{color:var(--dsw-alias-label-tertiary)}.kVI_yq_actions{white-space:nowrap;align-items:center;gap:8px;display:flex}.kVI_yq_inlineTest{color:var(--dsw-alias-label-secondary);align-items:center;gap:6px;font-size:11.5px;display:inline-flex}.kVI_yq_inlineTest[data-status=ok]{color:var(--dsw-alias-state-success-primary)}.kVI_yq_inlineTest[data-status=fail]{color:var(--dsw-alias-state-error-primary)}.kVI_yq_badge{border:1px solid var(--dsw-alias-border-l2);color:var(--dsw-alias-label-secondary);white-space:nowrap;border-radius:999px;padding:1px 8px;font-size:11px;line-height:1.6;display:inline-block}.kVI_yq_badge[data-kind=key]{color:var(--dsw-alias-state-business-primary);border-color:var(--dsw-alias-state-business-primary)}.kVI_yq_badge[data-kind=password]{color:var(--dsw-alias-state-warn-primary);border-color:var(--dsw-alias-state-warn-primary)}.kVI_yq_badge[data-kind=agent]{color:var(--dsw-alias-state-success-primary);border-color:var(--dsw-alias-state-success-primary)}.kVI_yq_badge[data-kind=proxy]{color:var(--dsw-alias-state-business-primary);border-color:var(--dsw-alias-state-business-primary);margin-left:6px}.kVI_yq_badge[data-status=ok]{color:var(--dsw-alias-state-success-primary);border-color:var(--dsw-alias-state-success-primary)}.kVI_yq_badge[data-status=fail]{color:var(--dsw-alias-state-error-primary);border-color:var(--dsw-alias-state-error-primary)}.kVI_yq_badge[data-status=timeout]{color:var(--dsw-alias-state-warn-primary);border-color:var(--dsw-alias-state-warn-primary)}.kVI_yq_primaryButton{color:var(--dsw-alias-label-primary-foreground);background:var(--dsw-alias-button-info-fill);cursor:pointer;white-space:nowrap;border:none;border-radius:8px;padding:6px 14px;font-size:13px;font-weight:600}.kVI_yq_primaryButton:hover:not(:disabled){background:var(--dsw-alias-button-info-hover)}.kVI_yq_primaryButton:disabled{opacity:.5;cursor:default}.kVI_yq_ghostButton{color:var(--dsw-alias-label-primary);border:1px solid var(--dsw-alias-border-l2);cursor:pointer;white-space:nowrap;background:0 0;border-radius:8px;padding:5px 12px;font-size:12px}.kVI_yq_ghostButton:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover)}.kVI_yq_ghostButton:disabled{opacity:.45;cursor:default}.kVI_yq_iconButton{width:26px;height:26px;color:var(--dsw-alias-label-secondary);cursor:pointer;background:0 0;border:none;border-radius:6px;justify-content:center;align-items:center;padding:0;font-size:13px;display:inline-flex}.kVI_yq_iconButton:hover{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}.kVI_yq_linkButton{color:var(--dsw-alias-state-business-primary);cursor:pointer;white-space:nowrap;background:0 0;border:none;padding:0;font-size:12px}.kVI_yq_linkButton:hover:not(:disabled){text-decoration:underline}.kVI_yq_linkButton:disabled{opacity:.45;cursor:default}.kVI_yq_linkButton[data-danger]{color:var(--dsw-alias-state-error-primary)}.kVI_yq_spinner{border:2px solid var(--dsw-alias-state-business-primary);vertical-align:-1px;border-top-color:#0000;border-radius:50%;flex:none;width:11px;height:11px;animation:.8s linear infinite kVI_yq_dshSshSpin;display:inline-block}@keyframes kVI_yq_dshSshSpin{to{transform:rotate(360deg)}}.kVI_yq_banner{border:1px solid var(--dsw-alias-border-l2);color:var(--dsw-alias-label-secondary);overflow-wrap:anywhere;border-radius:8px;padding:8px 12px;font-size:12.5px;line-height:1.5}.kVI_yq_importSkips{border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-layer-2);border-radius:8px;flex-direction:column;gap:4px;margin:6px 0 0;padding:8px 12px;list-style:none;display:flex}.kVI_yq_importSkipRow{justify-content:space-between;align-items:baseline;gap:12px;font-size:12px;display:flex}.kVI_yq_banner[data-kind=ok]{color:var(--dsw-alias-state-success-primary);border-color:var(--dsw-alias-state-success-primary)}.kVI_yq_banner[data-kind=error]{color:var(--dsw-alias-state-error-primary);border-color:var(--dsw-alias-state-error-primary)}.kVI_yq_banner[data-kind=info]{color:var(--dsw-alias-state-business-primary);border-color:var(--dsw-alias-state-business-primary)}.kVI_yq_empty,.kVI_yq_loading{text-align:center;color:var(--dsw-alias-label-tertiary);padding:28px 12px;font-size:12.5px}.kVI_yq_modalBackdrop{z-index:40;background:var(--dsw-alias-bg-mask-1);justify-content:center;align-items:center;display:flex;position:fixed;inset:0}.kVI_yq_modal{background:var(--dsw-alias-bg-base);border:1px solid var(--dsw-alias-border-l2);width:min(560px,100vw - 48px);max-height:calc(100vh - 96px);box-shadow:var(--dsw-shadow-lv3);color:var(--dsw-alias-label-primary);border-radius:14px;flex-direction:column;gap:12px;padding:18px;display:flex;overflow-y:auto}.kVI_yq_modalTitle{margin:0;font-size:15px;font-weight:700}.kVI_yq_modalFooter{justify-content:flex-end;gap:10px;margin-top:4px;display:flex}.kVI_yq_formError{color:var(--dsw-alias-state-error-primary);margin:0;font-size:12px}.kVI_yq_hint{color:var(--dsw-alias-label-tertiary);font-size:11.5px}.kVI_yq_field{flex-direction:column;gap:5px;display:flex}.kVI_yq_fieldLabel{color:var(--dsw-alias-label-secondary);font-size:12px;font-weight:600}.kVI_yq_input{color:var(--dsw-alias-label-primary);background:var(--dsw-specific-input-major);border:1px solid var(--dsw-alias-border-l2);resize:vertical;border-radius:8px;outline:none;padding:7px 10px;font-family:inherit;font-size:13px}.kVI_yq_input:focus{border-color:var(--dsw-alias-state-business-primary)}.kVI_yq_input::placeholder{color:var(--dsw-alias-label-tertiary)}.kVI_yq_input:disabled{opacity:.55}.kVI_yq_formRow{grid-template-columns:repeat(auto-fit,minmax(180px,1fr));gap:10px 12px;display:grid}.kVI_yq_radioRow{align-items:center;gap:16px;display:flex}.kVI_yq_radioLabel{color:var(--dsw-alias-label-primary);cursor:pointer;align-items:center;gap:6px;font-size:13px;display:inline-flex}.kVI_yq_termBody{flex-direction:column;flex:1;gap:8px;min-height:0;display:flex;overflow:hidden}.kVI_yq_termWrap{border:1px solid var(--dsw-alias-border-l1);background:#0b0e14;border-radius:10px;flex:1;min-height:0;position:relative;overflow:hidden}.kVI_yq_termContainer{position:absolute;inset:8px 10px}.kVI_yq_termPlaceholder{z-index:2;text-align:center;color:var(--dsw-alias-label-tertiary);background:var(--dsw-alias-bg-base);justify-content:center;align-items:center;padding:0 24px;font-size:12.5px;display:flex;position:absolute;inset:0}.kVI_yq_hiddenFile{display:none}.kVI_yq_browsePanel{border:1px solid var(--dsw-alias-border-l1);border-radius:10px;flex-direction:column;flex:none;display:flex;overflow:hidden}.kVI_yq_browseHeader{background:var(--dsw-alias-bg-layer-2);border-bottom:1px solid var(--dsw-alias-border-l1);align-items:center;gap:8px;padding:8px 10px;display:flex}.kVI_yq_browsePath{text-overflow:ellipsis;white-space:nowrap;min-width:0;color:var(--dsw-alias-label-secondary);flex:1;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:12px;overflow:hidden}.kVI_yq_browseList{max-height:240px;overflow-y:auto}.kVI_yq_dirRow{text-align:left;width:100%;font:inherit;color:var(--dsw-alias-label-primary);border:none;border-bottom:1px solid var(--dsw-alias-separator-primary);cursor:pointer;background:0 0;grid-template-columns:minmax(0,1fr) auto auto;gap:12px;padding:5px 10px;font-size:12.5px;display:grid}.kVI_yq_dirRow:hover{background:var(--dsw-alias-interactive-bg-hover)}.kVI_yq_dirRow[data-type=dir] .kVI_yq_dirName{color:var(--dsw-alias-state-business-primary)}.kVI_yq_dirRow[data-up]{color:var(--dsw-alias-label-secondary)}.kVI_yq_dirName{text-overflow:ellipsis;white-space:nowrap;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;overflow:hidden}.kVI_yq_dirType{color:var(--dsw-alias-label-tertiary);white-space:nowrap}.kVI_yq_dirSize{color:var(--dsw-alias-label-tertiary);white-space:nowrap;text-align:right}.kVI_yq_transferBlock{flex-direction:column;flex:none;gap:6px;display:flex}.kVI_yq_progressMeta{color:var(--dsw-alias-label-secondary);flex-wrap:wrap;gap:12px;font-size:12px;display:flex}.kVI_yq_progressTrack{background:var(--dsw-alias-interactive-bg-hover);border-radius:999px;height:8px;overflow:hidden}.kVI_yq_progressBar{background:var(--dsw-alias-state-business-primary);border-radius:999px;height:100%;transition:width .12s linear}.kVI_yq_tunnelList{flex-direction:column;flex:none;gap:8px;display:flex}.kVI_yq_tunnelRow{background:var(--dsw-alias-bg-layer-2);border:1px solid var(--dsw-alias-border-l2);border-radius:10px;align-items:center;gap:10px;padding:8px 12px;display:flex}.kVI_yq_tunnelRow[data-state=forwarding]{border-color:var(--dsw-alias-state-success-primary)}.kVI_yq_tunnelRow[data-state=connecting]{border-color:var(--dsw-alias-state-warn-primary)}.kVI_yq_tunnelRow[data-state=failed]{border-color:var(--dsw-alias-state-error-primary)}.kVI_yq_tunnelLabel{text-overflow:ellipsis;white-space:nowrap;flex:1;min-width:0;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:12.5px;overflow:hidden}.kVI_yq_formCard{background:var(--dsw-alias-bg-layer-2);border:1px solid var(--dsw-alias-border-l1);border-radius:10px;flex-direction:column;flex:none;gap:10px;padding:12px;display:flex}.kVI_yq_clusterForm{flex-direction:column;flex:none;gap:8px;display:flex}.kVI_yq_clusterFilters{grid-template-columns:repeat(auto-fit,minmax(160px,1fr));gap:10px;display:grid}.kVI_yq_commandInput{min-height:96px;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace}.kVI_yq_cellDetails summary{cursor:pointer;color:var(--dsw-alias-label-secondary);font-size:12px}.kVI_yq_cellPre{background:var(--dsw-alias-bg-layer-2);border:1px solid var(--dsw-alias-border-l2);white-space:pre-wrap;word-break:break-all;border-radius:6px;max-height:180px;margin:4px 0 0;padding:6px 8px;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:11.5px;overflow:auto}";
|
|
1328
|
+
const css = ".kVI_yq_view{height:100%;min-height:0;overflow:hidden}.kVI_yq_panel{background:var(--dsw-alias-bg-base);min-width:0;height:100%;min-height:0;color:var(--dsw-alias-label-primary);font-family:var(--dsw-font-family);flex-direction:column;gap:10px;padding:14px 16px 16px;display:flex}.kVI_yq_panelHeader{flex:none;align-items:center;gap:10px;display:flex}.kVI_yq_panelTitle{color:var(--dsw-alias-label-primary);white-space:nowrap;flex:1;margin:0;font-size:16px;font-weight:700}.kVI_yq_backButton{align-items:center;gap:4px;display:inline-flex}.kVI_yq_tabBar{border-bottom:1px solid var(--dsw-alias-border-l1);flex:none;gap:2px;display:flex}.kVI_yq_tab{color:var(--dsw-alias-label-secondary);cursor:pointer;white-space:nowrap;background:0 0;border:none;border-bottom:2px solid #0000;border-radius:6px 6px 0 0;padding:7px 14px;font-size:13px}.kVI_yq_tab:hover{color:var(--dsw-alias-label-primary);background:var(--dsw-alias-interactive-bg-hover)}.kVI_yq_tab[data-active]{color:var(--dsw-alias-label-primary);border-bottom-color:var(--dsw-alias-state-business-primary);font-weight:600}.kVI_yq_panelContent{flex-direction:column;flex:1;min-height:0;display:flex;overflow:hidden}.kVI_yq_tabBody{flex-direction:column;flex:1;gap:10px;min-height:0;display:flex;overflow-y:auto}.kVI_yq_fillBody{flex-direction:column;flex:1;gap:10px;min-height:0;display:flex;overflow:hidden}.kVI_yq_toolbar,.kVI_yq_controls{flex-wrap:wrap;flex:none;align-items:center;gap:8px;display:flex}.kVI_yq_controls .kVI_yq_input{flex:0 260px;min-width:150px}.kVI_yq_toolbarSpacer{flex:1}.kVI_yq_search{min-width:120px;color:var(--dsw-alias-label-primary);background:var(--dsw-specific-input-major);border:1px solid var(--dsw-alias-border-l2);border-radius:8px;outline:none;flex:0 260px;padding:6px 10px;font-size:13px}.kVI_yq_search::placeholder{color:var(--dsw-alias-label-tertiary)}.kVI_yq_groupBySelect{color:var(--dsw-alias-label-primary);background:var(--dsw-specific-input-major);border:1px solid var(--dsw-alias-border-l2);border-radius:8px;outline:none;padding:6px 8px;font-size:13px}.kVI_yq_groupSection+.kVI_yq_groupSection{border-top:1px solid var(--dsw-alias-border-l1)}.kVI_yq_groupHeader{background:var(--dsw-alias-bg-base,var(--dsw-specific-input-major));align-items:center;gap:8px;padding:4px 8px;display:flex;position:sticky;top:0}.kVI_yq_groupToggle{min-width:0;color:var(--dsw-alias-label-primary);cursor:pointer;text-align:left;background:0 0;border:none;border-radius:6px;flex:1;align-items:center;gap:6px;padding:4px 6px;font-size:12.5px;font-weight:500;display:flex}.kVI_yq_groupToggle:hover{background:var(--dsw-alias-interactive-bg-hover)}.kVI_yq_groupChevron{border-right:1.5px solid var(--dsw-alias-label-tertiary);border-bottom:1.5px solid var(--dsw-alias-label-tertiary);flex:none;width:7px;height:7px;margin-bottom:2px;transition:transform .12s;transform:rotate(45deg)}.kVI_yq_groupChevron[data-collapsed]{margin-bottom:0;transform:rotate(-45deg)}.kVI_yq_groupName{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.kVI_yq_groupCount{color:var(--dsw-alias-label-tertiary);flex:none;font-weight:400}.kVI_yq_tableWrap{border:1px solid var(--dsw-alias-border-l1);border-radius:10px;flex:1;min-height:0;overflow:auto}.kVI_yq_table{border-collapse:collapse;width:100%;font-size:12.5px}.kVI_yq_table th{z-index:1;text-align:left;background:var(--dsw-alias-bg-layer-2);color:var(--dsw-alias-label-secondary);border-bottom:1px solid var(--dsw-alias-border-l1);white-space:nowrap;padding:8px 10px;font-weight:600;position:sticky;top:0}.kVI_yq_table td{border-bottom:1px solid var(--dsw-alias-separator-primary);vertical-align:top;padding:7px 10px}.kVI_yq_table tbody tr:last-child td{border-bottom:none}.kVI_yq_table tbody tr:hover td{background:var(--dsw-alias-interactive-bg-hover)}.kVI_yq_mono{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace}.kVI_yq_cellMuted{color:var(--dsw-alias-label-tertiary)}.kVI_yq_actions{white-space:nowrap;align-items:center;gap:8px;display:flex}.kVI_yq_inlineTest{color:var(--dsw-alias-label-secondary);align-items:center;gap:6px;font-size:11.5px;display:inline-flex}.kVI_yq_inlineTest[data-status=ok]{color:var(--dsw-alias-state-success-primary)}.kVI_yq_inlineTest[data-status=fail]{color:var(--dsw-alias-state-error-primary)}.kVI_yq_badge{border:1px solid var(--dsw-alias-border-l2);color:var(--dsw-alias-label-secondary);white-space:nowrap;border-radius:999px;padding:1px 8px;font-size:11px;line-height:1.6;display:inline-block}.kVI_yq_badge[data-kind=key]{color:var(--dsw-alias-state-business-primary);border-color:var(--dsw-alias-state-business-primary)}.kVI_yq_badge[data-kind=password]{color:var(--dsw-alias-state-warn-primary);border-color:var(--dsw-alias-state-warn-primary)}.kVI_yq_badge[data-kind=agent]{color:var(--dsw-alias-state-success-primary);border-color:var(--dsw-alias-state-success-primary)}.kVI_yq_badge[data-kind=proxy]{color:var(--dsw-alias-state-business-primary);border-color:var(--dsw-alias-state-business-primary);margin-left:6px}.kVI_yq_badge[data-kind=forward-agent]{color:var(--dsw-alias-state-warn-primary);border-color:var(--dsw-alias-state-warn-primary);margin-left:6px}.kVI_yq_badge[data-status=ok]{color:var(--dsw-alias-state-success-primary);border-color:var(--dsw-alias-state-success-primary)}.kVI_yq_badge[data-status=fail]{color:var(--dsw-alias-state-error-primary);border-color:var(--dsw-alias-state-error-primary)}.kVI_yq_badge[data-status=timeout]{color:var(--dsw-alias-state-warn-primary);border-color:var(--dsw-alias-state-warn-primary)}.kVI_yq_primaryButton{color:var(--dsw-alias-label-primary-foreground);background:var(--dsw-alias-button-info-fill);cursor:pointer;white-space:nowrap;border:none;border-radius:8px;padding:6px 14px;font-size:13px;font-weight:600}.kVI_yq_primaryButton:hover:not(:disabled){background:var(--dsw-alias-button-info-hover)}.kVI_yq_primaryButton:disabled{opacity:.5;cursor:default}.kVI_yq_ghostButton{color:var(--dsw-alias-label-primary);border:1px solid var(--dsw-alias-border-l2);cursor:pointer;white-space:nowrap;background:0 0;border-radius:8px;padding:5px 12px;font-size:12px}.kVI_yq_ghostButton:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover)}.kVI_yq_ghostButton:disabled{opacity:.45;cursor:default}.kVI_yq_iconButton{width:26px;height:26px;color:var(--dsw-alias-label-secondary);cursor:pointer;background:0 0;border:none;border-radius:6px;justify-content:center;align-items:center;padding:0;font-size:13px;display:inline-flex}.kVI_yq_iconButton:hover{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}.kVI_yq_linkButton{color:var(--dsw-alias-state-business-primary);cursor:pointer;white-space:nowrap;background:0 0;border:none;padding:0;font-size:12px}.kVI_yq_linkButton:hover:not(:disabled){text-decoration:underline}.kVI_yq_linkButton:disabled{opacity:.45;cursor:default}.kVI_yq_linkButton[data-danger]{color:var(--dsw-alias-state-error-primary)}.kVI_yq_spinner{border:2px solid var(--dsw-alias-state-business-primary);vertical-align:-1px;border-top-color:#0000;border-radius:50%;flex:none;width:11px;height:11px;animation:.8s linear infinite kVI_yq_dshSshSpin;display:inline-block}@keyframes kVI_yq_dshSshSpin{to{transform:rotate(360deg)}}.kVI_yq_banner{border:1px solid var(--dsw-alias-border-l2);color:var(--dsw-alias-label-secondary);overflow-wrap:anywhere;border-radius:8px;padding:8px 12px;font-size:12.5px;line-height:1.5}.kVI_yq_importSkips{border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-layer-2);border-radius:8px;flex-direction:column;gap:4px;margin:6px 0 0;padding:8px 12px;list-style:none;display:flex}.kVI_yq_importSkipRow{justify-content:space-between;align-items:baseline;gap:12px;font-size:12px;display:flex}.kVI_yq_banner[data-kind=ok]{color:var(--dsw-alias-state-success-primary);border-color:var(--dsw-alias-state-success-primary)}.kVI_yq_banner[data-kind=error]{color:var(--dsw-alias-state-error-primary);border-color:var(--dsw-alias-state-error-primary)}.kVI_yq_banner[data-kind=info]{color:var(--dsw-alias-state-business-primary);border-color:var(--dsw-alias-state-business-primary)}.kVI_yq_empty,.kVI_yq_loading{text-align:center;color:var(--dsw-alias-label-tertiary);padding:28px 12px;font-size:12.5px}.kVI_yq_modalBackdrop{z-index:40;background:var(--dsw-alias-bg-mask-1);justify-content:center;align-items:center;display:flex;position:fixed;inset:0}.kVI_yq_modal{background:var(--dsw-alias-bg-base);border:1px solid var(--dsw-alias-border-l2);width:min(560px,100vw - 48px);max-height:calc(100vh - 96px);box-shadow:var(--dsw-shadow-lv3);color:var(--dsw-alias-label-primary);border-radius:14px;flex-direction:column;gap:12px;padding:18px;display:flex;overflow-y:auto}.kVI_yq_modalTitle{margin:0;font-size:15px;font-weight:700}.kVI_yq_modalFooter{justify-content:flex-end;gap:10px;margin-top:4px;display:flex}.kVI_yq_formError{color:var(--dsw-alias-state-error-primary);margin:0;font-size:12px}.kVI_yq_hint{color:var(--dsw-alias-label-tertiary);font-size:11.5px}.kVI_yq_field{flex-direction:column;gap:5px;display:flex}.kVI_yq_fieldLabel{color:var(--dsw-alias-label-secondary);font-size:12px;font-weight:600}.kVI_yq_input{color:var(--dsw-alias-label-primary);background:var(--dsw-specific-input-major);border:1px solid var(--dsw-alias-border-l2);resize:vertical;border-radius:8px;outline:none;padding:7px 10px;font-family:inherit;font-size:13px}.kVI_yq_input:focus{border-color:var(--dsw-alias-state-business-primary)}.kVI_yq_input::placeholder{color:var(--dsw-alias-label-tertiary)}.kVI_yq_input:disabled{opacity:.55}.kVI_yq_formRow{grid-template-columns:repeat(auto-fit,minmax(180px,1fr));gap:10px 12px;display:grid}.kVI_yq_radioRow{align-items:center;gap:16px;display:flex}.kVI_yq_radioLabel{color:var(--dsw-alias-label-primary);cursor:pointer;align-items:center;gap:6px;font-size:13px;display:inline-flex}.kVI_yq_termBody{flex-direction:column;flex:1;gap:8px;min-height:0;display:flex;overflow:hidden}.kVI_yq_termTabs{scrollbar-width:thin;border-bottom:1px solid var(--dsw-alias-border-l1);flex:none;align-items:stretch;gap:2px;display:flex;overflow-x:auto}.kVI_yq_termTab{border-bottom:2px solid #0000;border-radius:6px 6px 0 0;flex:none;align-items:center;max-width:200px;display:inline-flex}.kVI_yq_termTab[data-active]{background:var(--dsw-alias-bg-layer-2);border-bottom-color:var(--dsw-alias-state-business-primary)}.kVI_yq_termTabLabel{min-width:0;color:var(--dsw-alias-label-secondary);cursor:pointer;background:0 0;border:none;align-items:baseline;gap:6px;padding:5px 4px 5px 10px;font-size:12.5px;display:inline-flex}.kVI_yq_termTab[data-active] .kVI_yq_termTabLabel{color:var(--dsw-alias-label-primary);font-weight:600}.kVI_yq_termTabAlias{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.kVI_yq_termTabState{color:var(--dsw-alias-label-tertiary);flex:none;font-size:11px;font-weight:400}.kVI_yq_termTabState[data-state=error]{color:var(--dsw-alias-state-error-primary)}.kVI_yq_termTabState[data-state=exited]{color:var(--dsw-alias-label-secondary)}.kVI_yq_termTabClose,.kVI_yq_termTabNew{width:20px;height:20px;color:var(--dsw-alias-label-tertiary);cursor:pointer;background:0 0;border:none;border-radius:5px;flex:none;justify-content:center;align-items:center;margin-right:4px;padding:0;font-size:13px;line-height:1;display:inline-flex}.kVI_yq_termTabNew{width:24px;margin:2px 0 2px 4px;font-size:15px}.kVI_yq_termTabClose:hover,.kVI_yq_termTabNew:hover:not(:disabled){color:var(--dsw-alias-label-primary);background:var(--dsw-alias-interactive-bg-hover)}.kVI_yq_termTabNew:disabled{opacity:.45;cursor:default}.kVI_yq_termWrap{border:1px solid var(--dsw-alias-border-l1);background:#0b0e14;border-radius:10px;flex:1;min-height:0;position:relative;overflow:hidden}.kVI_yq_termContainer{position:absolute;inset:8px 10px}.kVI_yq_termPlaceholder{z-index:2;text-align:center;color:var(--dsw-alias-label-tertiary);background:var(--dsw-alias-bg-base);justify-content:center;align-items:center;padding:0 24px;font-size:12.5px;display:flex;position:absolute;inset:0}.kVI_yq_hiddenFile{display:none}.kVI_yq_browsePanel{border:1px solid var(--dsw-alias-border-l1);border-radius:10px;flex-direction:column;flex:none;display:flex;overflow:hidden}.kVI_yq_browseHeader{background:var(--dsw-alias-bg-layer-2);border-bottom:1px solid var(--dsw-alias-border-l1);align-items:center;gap:8px;padding:8px 10px;display:flex}.kVI_yq_browsePath{text-overflow:ellipsis;white-space:nowrap;min-width:0;color:var(--dsw-alias-label-secondary);flex:1;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:12px;overflow:hidden}.kVI_yq_browseList{max-height:240px;overflow-y:auto}.kVI_yq_dirRow{text-align:left;width:100%;font:inherit;color:var(--dsw-alias-label-primary);border:none;border-bottom:1px solid var(--dsw-alias-separator-primary);cursor:pointer;background:0 0;grid-template-columns:minmax(0,1fr) auto auto;gap:12px;padding:5px 10px;font-size:12.5px;display:grid}.kVI_yq_dirRow:hover{background:var(--dsw-alias-interactive-bg-hover)}.kVI_yq_dirRow[data-type=dir] .kVI_yq_dirName{color:var(--dsw-alias-state-business-primary)}.kVI_yq_dirRow[data-up]{color:var(--dsw-alias-label-secondary)}.kVI_yq_dirName{text-overflow:ellipsis;white-space:nowrap;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;overflow:hidden}.kVI_yq_dirType{color:var(--dsw-alias-label-tertiary);white-space:nowrap}.kVI_yq_dirSize{color:var(--dsw-alias-label-tertiary);white-space:nowrap;text-align:right}.kVI_yq_transferBlock{flex-direction:column;flex:none;gap:6px;display:flex}.kVI_yq_progressMeta{color:var(--dsw-alias-label-secondary);flex-wrap:wrap;gap:12px;font-size:12px;display:flex}.kVI_yq_progressTrack{background:var(--dsw-alias-interactive-bg-hover);border-radius:999px;height:8px;overflow:hidden}.kVI_yq_progressBar{background:var(--dsw-alias-state-business-primary);border-radius:999px;height:100%;transition:width .12s linear}.kVI_yq_tunnelList{flex-direction:column;flex:none;gap:8px;display:flex}.kVI_yq_tunnelRow{background:var(--dsw-alias-bg-layer-2);border:1px solid var(--dsw-alias-border-l2);border-radius:10px;align-items:center;gap:10px;padding:8px 12px;display:flex}.kVI_yq_tunnelRow[data-state=forwarding]{border-color:var(--dsw-alias-state-success-primary)}.kVI_yq_tunnelRow[data-state=connecting]{border-color:var(--dsw-alias-state-warn-primary)}.kVI_yq_tunnelRow[data-state=failed]{border-color:var(--dsw-alias-state-error-primary)}.kVI_yq_tunnelLabel{text-overflow:ellipsis;white-space:nowrap;flex:1;min-width:0;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:12.5px;overflow:hidden}.kVI_yq_formCard{background:var(--dsw-alias-bg-layer-2);border:1px solid var(--dsw-alias-border-l1);border-radius:10px;flex-direction:column;flex:none;gap:10px;padding:12px;display:flex}.kVI_yq_clusterForm{flex-direction:column;flex:none;gap:8px;display:flex}.kVI_yq_clusterFilters{grid-template-columns:repeat(auto-fit,minmax(160px,1fr));gap:10px;display:grid}.kVI_yq_commandInput{min-height:96px;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace}.kVI_yq_cellDetails summary{cursor:pointer;color:var(--dsw-alias-label-secondary);font-size:12px}.kVI_yq_cellPre{background:var(--dsw-alias-bg-layer-2);border:1px solid var(--dsw-alias-border-l2);white-space:pre-wrap;word-break:break-all;border-radius:6px;max-height:180px;margin:4px 0 0;padding:6px 8px;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:11.5px;overflow:auto}";
|
|
963
1329
|
const tagId = "@fish-under-sea/dsh-ssh-fish/packages/dsh-ssh-fish/src/client/panel/panel.module.css";
|
|
964
1330
|
if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId) + "]") === null) {
|
|
965
1331
|
const tag = document.createElement("style");
|
|
@@ -1038,6 +1404,13 @@ window.__ModuleLoader__.load({
|
|
|
1038
1404
|
"termBody": "kVI_yq_termBody",
|
|
1039
1405
|
"termContainer": "kVI_yq_termContainer",
|
|
1040
1406
|
"termPlaceholder": "kVI_yq_termPlaceholder",
|
|
1407
|
+
"termTab": "kVI_yq_termTab",
|
|
1408
|
+
"termTabAlias": "kVI_yq_termTabAlias",
|
|
1409
|
+
"termTabClose": "kVI_yq_termTabClose",
|
|
1410
|
+
"termTabLabel": "kVI_yq_termTabLabel",
|
|
1411
|
+
"termTabNew": "kVI_yq_termTabNew",
|
|
1412
|
+
"termTabState": "kVI_yq_termTabState",
|
|
1413
|
+
"termTabs": "kVI_yq_termTabs",
|
|
1041
1414
|
"termWrap": "kVI_yq_termWrap",
|
|
1042
1415
|
"toolbar": "kVI_yq_toolbar",
|
|
1043
1416
|
"toolbarSpacer": "kVI_yq_toolbarSpacer",
|
|
@@ -1244,6 +1617,7 @@ window.__ModuleLoader__.load({
|
|
|
1244
1617
|
agentPath: "",
|
|
1245
1618
|
proxyJump: (editing?.proxyJump ?? []).join(", "),
|
|
1246
1619
|
proxyCommand: editing?.proxyCommand ?? "",
|
|
1620
|
+
forwardAgent: editing?.forwardAgent === true,
|
|
1247
1621
|
description: editing?.description ?? "",
|
|
1248
1622
|
environment: editing?.environment ?? "",
|
|
1249
1623
|
tags: (editing?.tags ?? []).join(", "),
|
|
@@ -1287,7 +1661,7 @@ window.__ModuleLoader__.load({
|
|
|
1287
1661
|
setError(tt("form.passwordRequired"));
|
|
1288
1662
|
return;
|
|
1289
1663
|
}
|
|
1290
|
-
const secretEmpty = form.authKind === "password" ? form.password === "" : form.authKind === "key" ? form.keyPath.trim() === "" :
|
|
1664
|
+
const secretEmpty = form.authKind === "password" ? form.password === "" : form.authKind === "key" ? form.keyPath.trim() === "" : false;
|
|
1291
1665
|
const payload = {
|
|
1292
1666
|
host,
|
|
1293
1667
|
port,
|
|
@@ -1305,6 +1679,7 @@ window.__ModuleLoader__.load({
|
|
|
1305
1679
|
},
|
|
1306
1680
|
proxyJump: splitList(form.proxyJump),
|
|
1307
1681
|
proxyCommand: form.proxyCommand.trim(),
|
|
1682
|
+
forwardAgent: form.forwardAgent,
|
|
1308
1683
|
description: form.description.trim() === "" ? void 0 : form.description.trim(),
|
|
1309
1684
|
environment: form.environment.trim() === "" ? void 0 : form.environment.trim(),
|
|
1310
1685
|
tags: splitList(form.tags),
|
|
@@ -1571,6 +1946,26 @@ window.__ModuleLoader__.load({
|
|
|
1571
1946
|
})
|
|
1572
1947
|
]
|
|
1573
1948
|
}),
|
|
1949
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
|
|
1950
|
+
className: panel_module_css_default.field,
|
|
1951
|
+
children: [
|
|
1952
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1953
|
+
className: panel_module_css_default.fieldLabel,
|
|
1954
|
+
children: tt("form.forwardAgent")
|
|
1955
|
+
}),
|
|
1956
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
1957
|
+
type: "checkbox",
|
|
1958
|
+
checked: form.forwardAgent,
|
|
1959
|
+
onChange: (event) => {
|
|
1960
|
+
set("forwardAgent", event.target.checked);
|
|
1961
|
+
}
|
|
1962
|
+
}),
|
|
1963
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1964
|
+
className: panel_module_css_default.hint,
|
|
1965
|
+
children: tt("form.forwardAgentHint")
|
|
1966
|
+
})
|
|
1967
|
+
]
|
|
1968
|
+
}),
|
|
1574
1969
|
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1575
1970
|
className: panel_module_css_default.formRow,
|
|
1576
1971
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
|
|
@@ -1831,6 +2226,12 @@ window.__ModuleLoader__.load({
|
|
|
1831
2226
|
"data-kind": "proxy",
|
|
1832
2227
|
title: host.proxyCommand,
|
|
1833
2228
|
children: tt("hosts.proxyBadge")
|
|
2229
|
+
}),
|
|
2230
|
+
host.forwardAgent === true && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
2231
|
+
className: panel_module_css_default.badge,
|
|
2232
|
+
"data-kind": "forward-agent",
|
|
2233
|
+
title: tt("hosts.forwardAgentHint"),
|
|
2234
|
+
children: tt("hosts.forwardAgentBadge")
|
|
1834
2235
|
})
|
|
1835
2236
|
]
|
|
1836
2237
|
}),
|
|
@@ -2079,7 +2480,7 @@ window.__ModuleLoader__.load({
|
|
|
2079
2480
|
});
|
|
2080
2481
|
}
|
|
2081
2482
|
//#endregion
|
|
2082
|
-
//#region ../../node_modules
|
|
2483
|
+
//#region ../../node_modules/@xterm/xterm/lib/xterm.js
|
|
2083
2484
|
var require_xterm = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
2084
2485
|
(function(e, t) {
|
|
2085
2486
|
if ("object" == typeof exports && "object" == typeof module) module.exports = t();
|
|
@@ -15077,7 +15478,7 @@ window.__ModuleLoader__.load({
|
|
|
15077
15478
|
})()));
|
|
15078
15479
|
}));
|
|
15079
15480
|
//#endregion
|
|
15080
|
-
//#region ../../node_modules
|
|
15481
|
+
//#region ../../node_modules/@xterm/addon-fit/lib/addon-fit.js
|
|
15081
15482
|
var require_addon_fit = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
15082
15483
|
(function(e, t) {
|
|
15083
15484
|
"object" == typeof exports && "object" == typeof module ? module.exports = t() : "function" == typeof define && define.amd ? define([], t) : "object" == typeof exports ? exports.FitAddon = t() : e.FitAddon = t();
|
|
@@ -15121,11 +15522,22 @@ window.__ModuleLoader__.load({
|
|
|
15121
15522
|
//#endregion
|
|
15122
15523
|
//#region src/client/panel/TerminalTab.tsx
|
|
15123
15524
|
/**
|
|
15124
|
-
* Terminal tab:
|
|
15125
|
-
*
|
|
15126
|
-
*
|
|
15127
|
-
*
|
|
15128
|
-
*
|
|
15525
|
+
* Terminal tab: ONE xterm.js view over the host's WebSocket terminal route,
|
|
15526
|
+
* with a tab strip over host-side PTY sessions.
|
|
15527
|
+
*
|
|
15528
|
+
* Session ownership stays on the Host (\`src/engine/terminal-sessions.ts\`): a
|
|
15529
|
+
* view that is not showing a session detaches its socket, and the host keeps
|
|
15530
|
+
* the shell alive plus a bounded scrollback that a reattach replays. That is
|
|
15531
|
+
* what lets the panel hold several tabs while this component keeps a single
|
|
15532
|
+
* xterm instance: switching a tab rebinds the one terminal instead of stacking
|
|
15533
|
+
* terminals, and every tab's alias, host session id, status and pending
|
|
15534
|
+
* keyboard-interactive challenge lives in the panel controller because the
|
|
15535
|
+
* layout unmounts this page whenever another panel is selected.
|
|
15536
|
+
*
|
|
15537
|
+
* A tab that has NOT reported its session id yet cannot be detached (there is
|
|
15538
|
+
* no id to reattach with), so switching away or unmounting hands the socket to
|
|
15539
|
+
* the controller, which applies "detach" or "close" the moment the id arrives.
|
|
15540
|
+
* That is the orphan-free rule: no host PTY is ever left without an owner.
|
|
15129
15541
|
*/
|
|
15130
15542
|
/** Injected-once guard for the xterm stylesheet (one tag per page load). */
|
|
15131
15543
|
let xtermCssInjected = false;
|
|
@@ -15143,20 +15555,48 @@ window.__ModuleLoader__.load({
|
|
|
15143
15555
|
get: () => void 0,
|
|
15144
15556
|
subscribe: () => () => void 0
|
|
15145
15557
|
};
|
|
15146
|
-
/**
|
|
15147
|
-
|
|
15558
|
+
/**
|
|
15559
|
+
* The state word a tab shows in the strip, or undefined when it is simply up.
|
|
15560
|
+
* A pending challenge wins over the lifecycle word: it is the one state the
|
|
15561
|
+
* user has to act on.
|
|
15562
|
+
* @param tab - the tab record.
|
|
15563
|
+
* @returns the short label, or undefined for a connected tab.
|
|
15564
|
+
*/
|
|
15565
|
+
function tabStateLabel(tab) {
|
|
15566
|
+
if (tab.authPrompt !== void 0) return tt("terminal.authPending");
|
|
15567
|
+
if (tab.status === "connecting") return tt("terminal.connecting");
|
|
15568
|
+
if (tab.status === "exited") return tt("terminal.tabExited");
|
|
15569
|
+
if (tab.closeError !== void 0) return tt("terminal.tabError");
|
|
15570
|
+
if (tab.status === "error") return tt("terminal.tabError");
|
|
15571
|
+
}
|
|
15572
|
+
/**
|
|
15573
|
+
* Whether the visible challenge form may answer on the bound socket: the form
|
|
15574
|
+
* and the socket must belong to the same tab. Both are read at submit time, and
|
|
15575
|
+
* the window between a tab switch's commit and the effect that rebinds the
|
|
15576
|
+
* socket is exactly when they can disagree.
|
|
15577
|
+
* @param linkTabId - the tab the bound socket belongs to.
|
|
15578
|
+
* @param formTabId - the tab whose challenge form is on screen.
|
|
15579
|
+
*/
|
|
15580
|
+
function challengeBelongsToLink(linkTabId, formTabId) {
|
|
15581
|
+
return linkTabId !== void 0 && linkTabId === formTabId;
|
|
15582
|
+
}
|
|
15583
|
+
/** The terminal view with its tab strip. */
|
|
15584
|
+
function TerminalTab({ api, controller, presetAlias, terminalFont }) {
|
|
15585
|
+
const { terminalTabs, activeTerminalTabId, draftAlias } = (0, react.useSyncExternalStore)((0, react.useCallback)((listener) => controller.subscribe(listener), [controller]), (0, react.useCallback)(() => controller.getSnapshot(), [controller]));
|
|
15148
15586
|
const [hosts, setHosts] = (0, react.useState)([]);
|
|
15149
|
-
const [
|
|
15150
|
-
const [status, setStatus] = (0, react.useState)({ kind: "idle" });
|
|
15151
|
-
const [authPrompt, setAuthPrompt] = (0, react.useState)(void 0);
|
|
15152
|
-
const [authInputs, setAuthInputs] = (0, react.useState)([]);
|
|
15587
|
+
const [listError, setListError] = (0, react.useState)(void 0);
|
|
15153
15588
|
const containerRef = (0, react.useRef)(null);
|
|
15154
15589
|
const termRef = (0, react.useRef)(null);
|
|
15155
15590
|
const fitRef = (0, react.useRef)(null);
|
|
15156
|
-
const
|
|
15591
|
+
const linkRef = (0, react.useRef)(null);
|
|
15157
15592
|
const dataSubRef = (0, react.useRef)(null);
|
|
15593
|
+
/** Tab whose screen the terminal currently holds. */
|
|
15594
|
+
const renderedRef = (0, react.useRef)(void 0);
|
|
15595
|
+
/** Tabs with a background close in flight, so one click cannot open two. */
|
|
15596
|
+
const closingRef = (0, react.useRef)(/* @__PURE__ */ new Set());
|
|
15158
15597
|
const fontSource = terminalFont ?? NO_FONT_SOURCE;
|
|
15159
15598
|
const fontOverride = (0, react.useSyncExternalStore)(fontSource.subscribe, fontSource.get);
|
|
15599
|
+
const activeTab = terminalTabs.find((tab) => tab.id === activeTerminalTabId);
|
|
15160
15600
|
(0, react.useEffect)(() => {
|
|
15161
15601
|
ensureXtermCss();
|
|
15162
15602
|
}, []);
|
|
@@ -15167,7 +15607,8 @@ window.__ModuleLoader__.load({
|
|
|
15167
15607
|
if (term.options.fontFamily === next) return;
|
|
15168
15608
|
term.options.fontFamily = next;
|
|
15169
15609
|
fitRef.current?.fit();
|
|
15170
|
-
|
|
15610
|
+
const link = linkRef.current;
|
|
15611
|
+
if (link !== null) link.connection.resize(term.cols, term.rows);
|
|
15171
15612
|
}, [fontOverride]);
|
|
15172
15613
|
(0, react.useEffect)(() => {
|
|
15173
15614
|
let disposed = false;
|
|
@@ -15176,10 +15617,7 @@ window.__ModuleLoader__.load({
|
|
|
15176
15617
|
const list = await api.listHosts();
|
|
15177
15618
|
if (!disposed) setHosts(list);
|
|
15178
15619
|
} catch (cause) {
|
|
15179
|
-
if (!disposed)
|
|
15180
|
-
kind: "error",
|
|
15181
|
-
detail: errorMessage(cause)
|
|
15182
|
-
});
|
|
15620
|
+
if (!disposed) setListError(errorMessage(cause));
|
|
15183
15621
|
}
|
|
15184
15622
|
})();
|
|
15185
15623
|
return () => {
|
|
@@ -15187,35 +15625,9 @@ window.__ModuleLoader__.load({
|
|
|
15187
15625
|
};
|
|
15188
15626
|
}, [api]);
|
|
15189
15627
|
(0, react.useEffect)(() => {
|
|
15190
|
-
if (presetAlias
|
|
15191
|
-
|
|
15192
|
-
|
|
15193
|
-
* Tear the view down.
|
|
15194
|
-
* @param leave - `detach` leaves the host session alive for a reattach
|
|
15195
|
-
* (panel switch, unmount); `close` ends it (the disconnect control).
|
|
15196
|
-
*/
|
|
15197
|
-
const teardown = (leave) => {
|
|
15198
|
-
setAuthPrompt(void 0);
|
|
15199
|
-
setAuthInputs([]);
|
|
15200
|
-
const connection = connRef.current;
|
|
15201
|
-
connRef.current = null;
|
|
15202
|
-
if (connection !== null) {
|
|
15203
|
-
connection.onReady = void 0;
|
|
15204
|
-
connection.onOutput = void 0;
|
|
15205
|
-
connection.onExit = void 0;
|
|
15206
|
-
connection.onAuthPrompt = void 0;
|
|
15207
|
-
if (leave === "detach") connection.detach();
|
|
15208
|
-
else connection.close();
|
|
15209
|
-
}
|
|
15210
|
-
dataSubRef.current?.dispose();
|
|
15211
|
-
dataSubRef.current = null;
|
|
15212
|
-
termRef.current?.dispose();
|
|
15213
|
-
termRef.current = null;
|
|
15214
|
-
fitRef.current = null;
|
|
15215
|
-
};
|
|
15216
|
-
(0, react.useEffect)(() => () => {
|
|
15217
|
-
teardown("detach");
|
|
15218
|
-
}, []);
|
|
15628
|
+
if (presetAlias === void 0 || presetAlias === "") return;
|
|
15629
|
+
controller.setDraftAlias(presetAlias);
|
|
15630
|
+
}, [presetAlias, controller]);
|
|
15219
15631
|
(0, react.useEffect)(() => {
|
|
15220
15632
|
let lastCols = -1;
|
|
15221
15633
|
let lastRows = -1;
|
|
@@ -15224,11 +15636,11 @@ window.__ModuleLoader__.load({
|
|
|
15224
15636
|
const fit = fitRef.current;
|
|
15225
15637
|
if (term === null || fit === null) return;
|
|
15226
15638
|
fit.fit();
|
|
15227
|
-
const
|
|
15228
|
-
if (
|
|
15639
|
+
const link = linkRef.current;
|
|
15640
|
+
if (link !== null && (term.cols !== lastCols || term.rows !== lastRows)) {
|
|
15229
15641
|
lastCols = term.cols;
|
|
15230
15642
|
lastRows = term.rows;
|
|
15231
|
-
|
|
15643
|
+
link.connection.resize(term.cols, term.rows);
|
|
15232
15644
|
}
|
|
15233
15645
|
};
|
|
15234
15646
|
window.addEventListener("resize", sync);
|
|
@@ -15245,16 +15657,16 @@ window.__ModuleLoader__.load({
|
|
|
15245
15657
|
window.removeEventListener("resize", sync);
|
|
15246
15658
|
};
|
|
15247
15659
|
}, []);
|
|
15248
|
-
/**
|
|
15249
|
-
|
|
15250
|
-
|
|
15251
|
-
|
|
15252
|
-
|
|
15660
|
+
/** Build the one xterm instance and its input subscription, once. */
|
|
15661
|
+
const ensureTerm = () => {
|
|
15662
|
+
const openTerm = termRef.current;
|
|
15663
|
+
const openFit = fitRef.current;
|
|
15664
|
+
if (openTerm !== null && openFit !== null) return {
|
|
15665
|
+
term: openTerm,
|
|
15666
|
+
fit: openFit
|
|
15667
|
+
};
|
|
15253
15668
|
const container = containerRef.current;
|
|
15254
|
-
if (container === null) return;
|
|
15255
|
-
if (status.kind === "connecting" || status.kind === "connected") return;
|
|
15256
|
-
teardown("detach");
|
|
15257
|
-
setStatus({ kind: "connecting" });
|
|
15669
|
+
if (container === null) return void 0;
|
|
15258
15670
|
const term = new import_xterm.Terminal({
|
|
15259
15671
|
convertEol: false,
|
|
15260
15672
|
cursorBlink: true,
|
|
@@ -15270,88 +15682,282 @@ window.__ModuleLoader__.load({
|
|
|
15270
15682
|
term.loadAddon(fit);
|
|
15271
15683
|
term.open(container);
|
|
15272
15684
|
fit.fit();
|
|
15273
|
-
const connection = open(term.cols, term.rows);
|
|
15274
15685
|
termRef.current = term;
|
|
15275
15686
|
fitRef.current = fit;
|
|
15276
|
-
connRef.current = connection;
|
|
15277
|
-
let settled = false;
|
|
15278
|
-
let connectedAlias = "";
|
|
15279
15687
|
dataSubRef.current = term.onData((data) => {
|
|
15280
|
-
connection.send(data);
|
|
15688
|
+
linkRef.current?.connection.send(data);
|
|
15281
15689
|
});
|
|
15690
|
+
return {
|
|
15691
|
+
term,
|
|
15692
|
+
fit
|
|
15693
|
+
};
|
|
15694
|
+
};
|
|
15695
|
+
/** Dispose the xterm and its subscription (no tabs left, or unmount). */
|
|
15696
|
+
const disposeTerm = () => {
|
|
15697
|
+
dataSubRef.current?.dispose();
|
|
15698
|
+
dataSubRef.current = null;
|
|
15699
|
+
termRef.current?.dispose();
|
|
15700
|
+
termRef.current = null;
|
|
15701
|
+
fitRef.current = null;
|
|
15702
|
+
renderedRef.current = void 0;
|
|
15703
|
+
};
|
|
15704
|
+
/** Release the bound socket: detach it, or adopt it while it connects. */
|
|
15705
|
+
const releaseLink = () => {
|
|
15706
|
+
const link = linkRef.current;
|
|
15707
|
+
linkRef.current = null;
|
|
15708
|
+
if (link === null) return;
|
|
15709
|
+
const connection = link.connection;
|
|
15710
|
+
connection.onReady = void 0;
|
|
15711
|
+
connection.onOutput = void 0;
|
|
15712
|
+
connection.onExit = void 0;
|
|
15713
|
+
connection.onAuthPrompt = void 0;
|
|
15714
|
+
const tab = controller.terminalTab(link.tabId);
|
|
15715
|
+
if (tab === void 0) {
|
|
15716
|
+
controller.adoptTerminalLink(link.tabId, connection, "close");
|
|
15717
|
+
return;
|
|
15718
|
+
}
|
|
15719
|
+
if (tab.status === "connecting") {
|
|
15720
|
+
controller.adoptTerminalLink(link.tabId, connection, "detach");
|
|
15721
|
+
return;
|
|
15722
|
+
}
|
|
15723
|
+
connection.detach();
|
|
15724
|
+
};
|
|
15725
|
+
/**
|
|
15726
|
+
* Whether the single terminal still shows another tab. A terminal that was
|
|
15727
|
+
* just created (or disposed) holds nothing, so it needs no clear; every other
|
|
15728
|
+
* rebind must start from a blank screen or the previous tab's output and
|
|
15729
|
+
* cursor stay on it.
|
|
15730
|
+
* @param tabId - the tab about to be bound.
|
|
15731
|
+
*/
|
|
15732
|
+
const needsScreenClear = (tabId) => {
|
|
15733
|
+
const rendered = renderedRef.current;
|
|
15734
|
+
return rendered !== void 0 && rendered !== tabId;
|
|
15735
|
+
};
|
|
15736
|
+
/**
|
|
15737
|
+
* Draw a retained screen the host cannot replay (adopted output, or a tab
|
|
15738
|
+
* whose session is gone) and mark the terminal as this tab's.
|
|
15739
|
+
* @param term - the single terminal.
|
|
15740
|
+
* @param tabId - the tab that owns the text.
|
|
15741
|
+
* @param retained - the text to draw; empty leaves a blank screen.
|
|
15742
|
+
*/
|
|
15743
|
+
const drawRetained = (term, tabId, retained) => {
|
|
15744
|
+
if (needsScreenClear(tabId)) term.reset();
|
|
15745
|
+
if (retained !== "") term.write(retained);
|
|
15746
|
+
renderedRef.current = tabId;
|
|
15747
|
+
};
|
|
15748
|
+
/** Bind one connection's frames onto the single terminal. */
|
|
15749
|
+
const bindConnection = (tab, connection) => {
|
|
15750
|
+
const view = ensureTerm();
|
|
15751
|
+
if (view === void 0) return;
|
|
15752
|
+
linkRef.current = {
|
|
15753
|
+
tabId: tab.id,
|
|
15754
|
+
connection
|
|
15755
|
+
};
|
|
15756
|
+
renderedRef.current = tab.id;
|
|
15757
|
+
view.term.options.disableStdin = false;
|
|
15758
|
+
connection.onReady = (sessionId) => {
|
|
15759
|
+
controller.clearTerminalAuthPrompt(tab.id);
|
|
15760
|
+
controller.readyTerminalTab(tab.id, sessionId);
|
|
15761
|
+
};
|
|
15762
|
+
connection.onOutput = (data) => {
|
|
15763
|
+
view.term.write(data);
|
|
15764
|
+
controller.appendTerminalOutput(tab.id, data);
|
|
15765
|
+
};
|
|
15282
15766
|
connection.onAuthPrompt = (name, instructions, prompts) => {
|
|
15283
|
-
|
|
15767
|
+
controller.setTerminalAuthPrompt(tab.id, {
|
|
15284
15768
|
name,
|
|
15285
15769
|
instructions,
|
|
15286
15770
|
prompts
|
|
15287
15771
|
});
|
|
15288
|
-
setAuthInputs(prompts.map(() => ""));
|
|
15289
|
-
};
|
|
15290
|
-
connection.onReady = (id, readyAlias) => {
|
|
15291
|
-
connectedAlias = readyAlias;
|
|
15292
|
-
controller.setTerminalSession(id);
|
|
15293
|
-
setAuthPrompt(void 0);
|
|
15294
|
-
setAuthInputs([]);
|
|
15295
|
-
setStatus({
|
|
15296
|
-
kind: "connected",
|
|
15297
|
-
alias: readyAlias
|
|
15298
|
-
});
|
|
15299
|
-
};
|
|
15300
|
-
connection.onOutput = (data) => {
|
|
15301
|
-
term.write(data);
|
|
15302
15772
|
};
|
|
15303
15773
|
connection.onExit = (_code, error) => {
|
|
15304
|
-
|
|
15305
|
-
|
|
15306
|
-
|
|
15307
|
-
|
|
15308
|
-
|
|
15309
|
-
|
|
15310
|
-
|
|
15311
|
-
|
|
15312
|
-
|
|
15313
|
-
|
|
15314
|
-
kind: "exited",
|
|
15315
|
-
alias: connectedAlias !== "" ? connectedAlias : alias,
|
|
15316
|
-
detail: error
|
|
15317
|
-
});
|
|
15774
|
+
const bound = linkRef.current;
|
|
15775
|
+
const wasBound = bound !== null && bound.connection === connection;
|
|
15776
|
+
if (wasBound) linkRef.current = null;
|
|
15777
|
+
connection.onReady = void 0;
|
|
15778
|
+
connection.onOutput = void 0;
|
|
15779
|
+
connection.onAuthPrompt = void 0;
|
|
15780
|
+
connection.onExit = void 0;
|
|
15781
|
+
view.term.options.disableStdin = true;
|
|
15782
|
+
if (!wasBound) return;
|
|
15783
|
+
controller.exitTerminalTab(tab.id, error);
|
|
15318
15784
|
};
|
|
15319
15785
|
};
|
|
15786
|
+
/** Bind the tab the controller says is current, without opening a second PTY. */
|
|
15787
|
+
const bindTab = (tab) => {
|
|
15788
|
+
const view = ensureTerm();
|
|
15789
|
+
if (view === void 0) return;
|
|
15790
|
+
if (tab.status === "connecting" || tab.status === "connected" && tab.sessionId !== void 0) {
|
|
15791
|
+
const adopted = controller.reclaimTerminalLink(tab.id);
|
|
15792
|
+
if (adopted !== void 0) {
|
|
15793
|
+
drawRetained(view.term, tab.id, controller.readTerminalOutput(tab.id));
|
|
15794
|
+
bindConnection(tab, adopted);
|
|
15795
|
+
return;
|
|
15796
|
+
}
|
|
15797
|
+
}
|
|
15798
|
+
if (tab.status === "connecting") {
|
|
15799
|
+
drawRetained(view.term, tab.id, "");
|
|
15800
|
+
controller.clearTerminalOutput(tab.id);
|
|
15801
|
+
bindConnection(tab, api.openTerminal(tab.alias, view.term.cols, view.term.rows));
|
|
15802
|
+
return;
|
|
15803
|
+
}
|
|
15804
|
+
if (tab.status === "connected" && tab.sessionId !== void 0) {
|
|
15805
|
+
const sessionId = tab.sessionId;
|
|
15806
|
+
if (needsScreenClear(tab.id)) {
|
|
15807
|
+
view.term.reset();
|
|
15808
|
+
controller.clearTerminalOutput(tab.id);
|
|
15809
|
+
renderedRef.current = tab.id;
|
|
15810
|
+
}
|
|
15811
|
+
bindConnection(tab, api.attachTerminal(sessionId, view.term.cols, view.term.rows));
|
|
15812
|
+
return;
|
|
15813
|
+
}
|
|
15814
|
+
view.term.options.disableStdin = true;
|
|
15815
|
+
if (renderedRef.current === tab.id) return;
|
|
15816
|
+
drawRetained(view.term, tab.id, controller.readTerminalOutput(tab.id));
|
|
15817
|
+
};
|
|
15818
|
+
(0, react.useEffect)(() => {
|
|
15819
|
+
const bound = linkRef.current;
|
|
15820
|
+
if (bound !== null && bound.tabId === activeTerminalTabId) return;
|
|
15821
|
+
releaseLink();
|
|
15822
|
+
if (activeTerminalTabId === void 0) {
|
|
15823
|
+
disposeTerm();
|
|
15824
|
+
return;
|
|
15825
|
+
}
|
|
15826
|
+
const tab = controller.terminalTab(activeTerminalTabId);
|
|
15827
|
+
if (tab === void 0) return;
|
|
15828
|
+
bindTab(tab);
|
|
15829
|
+
}, [
|
|
15830
|
+
activeTerminalTabId,
|
|
15831
|
+
activeTab?.status,
|
|
15832
|
+
activeTab?.sessionId
|
|
15833
|
+
]);
|
|
15834
|
+
(0, react.useEffect)(() => () => {
|
|
15835
|
+
releaseLink();
|
|
15836
|
+
disposeTerm();
|
|
15837
|
+
}, []);
|
|
15838
|
+
/** Open a tab on the toolbar's host (the "+"/Connect control). */
|
|
15320
15839
|
const connect = () => {
|
|
15321
|
-
const target =
|
|
15840
|
+
const target = draftAlias;
|
|
15322
15841
|
if (target === "") return;
|
|
15323
|
-
|
|
15842
|
+
controller.openTerminalTab(target);
|
|
15324
15843
|
};
|
|
15325
|
-
|
|
15326
|
-
|
|
15327
|
-
|
|
15328
|
-
|
|
15329
|
-
|
|
15330
|
-
|
|
15331
|
-
|
|
15332
|
-
|
|
15333
|
-
|
|
15334
|
-
|
|
15335
|
-
|
|
15844
|
+
/**
|
|
15845
|
+
* Close one tab. The shown one ends its session over its own socket; a
|
|
15846
|
+
* background tab is ended through one short-lived attach, and a close that
|
|
15847
|
+
* cannot be delivered keeps the tab instead of pretending it is gone.
|
|
15848
|
+
* @param tabId - the tab to close.
|
|
15849
|
+
*/
|
|
15850
|
+
const closeTab = (tabId) => {
|
|
15851
|
+
const tab = controller.terminalTab(tabId);
|
|
15852
|
+
if (tab === void 0) return;
|
|
15853
|
+
const bound = linkRef.current;
|
|
15854
|
+
if (bound !== null && bound.tabId === tabId) {
|
|
15855
|
+
linkRef.current = null;
|
|
15856
|
+
const connection = bound.connection;
|
|
15857
|
+
connection.onReady = void 0;
|
|
15858
|
+
connection.onOutput = void 0;
|
|
15859
|
+
connection.onExit = void 0;
|
|
15860
|
+
connection.onAuthPrompt = void 0;
|
|
15861
|
+
if (tab.status === "connecting") controller.adoptTerminalLink(tabId, connection, "close");
|
|
15862
|
+
else connection.close();
|
|
15863
|
+
controller.closeTerminalTab(tabId);
|
|
15864
|
+
return;
|
|
15865
|
+
}
|
|
15866
|
+
if (tab.status === "connected" && tab.sessionId !== void 0) {
|
|
15867
|
+
if (closingRef.current.has(tabId)) return;
|
|
15868
|
+
closingRef.current.add(tabId);
|
|
15869
|
+
const sessionId = tab.sessionId;
|
|
15870
|
+
(async () => {
|
|
15871
|
+
try {
|
|
15872
|
+
if (await api.closeTerminalSession(sessionId)) {
|
|
15873
|
+
controller.closeTerminalTab(tabId);
|
|
15874
|
+
return;
|
|
15875
|
+
}
|
|
15876
|
+
controller.markTerminalCloseFailed(tabId, "undelivered");
|
|
15877
|
+
} finally {
|
|
15878
|
+
closingRef.current.delete(tabId);
|
|
15879
|
+
}
|
|
15880
|
+
})();
|
|
15881
|
+
return;
|
|
15882
|
+
}
|
|
15883
|
+
controller.closeTerminalTab(tabId);
|
|
15336
15884
|
};
|
|
15337
15885
|
const submitAuth = (e) => {
|
|
15338
15886
|
e?.preventDefault();
|
|
15339
|
-
|
|
15340
|
-
|
|
15341
|
-
|
|
15887
|
+
const link = linkRef.current;
|
|
15888
|
+
const tab = activeTab;
|
|
15889
|
+
if (link === null || tab === void 0 || tab.authPrompt === void 0) return;
|
|
15890
|
+
if (!challengeBelongsToLink(link.tabId, tab.id)) return;
|
|
15891
|
+
link.connection.sendAuthResponse(tab.authAnswers ?? []);
|
|
15892
|
+
controller.clearTerminalAuthPrompt(tab.id);
|
|
15342
15893
|
};
|
|
15343
|
-
const
|
|
15894
|
+
const stateLabel = activeTab === void 0 ? void 0 : tabStateLabel(activeTab);
|
|
15344
15895
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
15345
15896
|
className: panel_module_css_default.termBody,
|
|
15346
15897
|
children: [
|
|
15898
|
+
terminalTabs.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
15899
|
+
className: panel_module_css_default.termTabs,
|
|
15900
|
+
role: "tablist",
|
|
15901
|
+
"aria-label": tt("terminal.tabs"),
|
|
15902
|
+
"data-dsh-part": "tab-bar",
|
|
15903
|
+
children: [terminalTabs.map((tab) => {
|
|
15904
|
+
const label = tabStateLabel(tab);
|
|
15905
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
15906
|
+
className: panel_module_css_default.termTab,
|
|
15907
|
+
"data-active": tab.id === activeTab?.id ? "" : void 0,
|
|
15908
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
15909
|
+
type: "button",
|
|
15910
|
+
role: "tab",
|
|
15911
|
+
className: panel_module_css_default.termTabLabel,
|
|
15912
|
+
"aria-selected": tab.id === activeTab?.id,
|
|
15913
|
+
"data-dsh-part": "tab",
|
|
15914
|
+
title: tab.alias,
|
|
15915
|
+
onClick: () => {
|
|
15916
|
+
controller.setActiveTerminalTab(tab.id);
|
|
15917
|
+
},
|
|
15918
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
15919
|
+
className: panel_module_css_default.termTabAlias,
|
|
15920
|
+
children: tab.alias
|
|
15921
|
+
}), label !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
15922
|
+
className: panel_module_css_default.termTabState,
|
|
15923
|
+
"data-state": tab.status,
|
|
15924
|
+
children: label
|
|
15925
|
+
})]
|
|
15926
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
15927
|
+
type: "button",
|
|
15928
|
+
className: panel_module_css_default.termTabClose,
|
|
15929
|
+
"aria-label": tt("terminal.closeTab"),
|
|
15930
|
+
title: tt("terminal.closeTab"),
|
|
15931
|
+
onClick: () => {
|
|
15932
|
+
closeTab(tab.id);
|
|
15933
|
+
},
|
|
15934
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
15935
|
+
"aria-hidden": "true",
|
|
15936
|
+
children: "×"
|
|
15937
|
+
})
|
|
15938
|
+
})]
|
|
15939
|
+
}, tab.id);
|
|
15940
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
15941
|
+
type: "button",
|
|
15942
|
+
className: panel_module_css_default.termTabNew,
|
|
15943
|
+
"aria-label": tt("terminal.newTab"),
|
|
15944
|
+
title: tt("terminal.newTab"),
|
|
15945
|
+
disabled: draftAlias === "",
|
|
15946
|
+
onClick: connect,
|
|
15947
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
15948
|
+
"aria-hidden": "true",
|
|
15949
|
+
children: "+"
|
|
15950
|
+
})
|
|
15951
|
+
})]
|
|
15952
|
+
}),
|
|
15347
15953
|
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
15348
15954
|
className: panel_module_css_default.controls,
|
|
15349
15955
|
children: [
|
|
15350
15956
|
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("select", {
|
|
15351
15957
|
className: panel_module_css_default.input,
|
|
15352
|
-
value:
|
|
15958
|
+
value: draftAlias,
|
|
15353
15959
|
onChange: (event) => {
|
|
15354
|
-
|
|
15960
|
+
controller.setDraftAlias(event.target.value);
|
|
15355
15961
|
},
|
|
15356
15962
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
|
|
15357
15963
|
value: "",
|
|
@@ -15369,38 +15975,50 @@ window.__ModuleLoader__.load({
|
|
|
15369
15975
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
15370
15976
|
type: "button",
|
|
15371
15977
|
className: panel_module_css_default.primaryButton,
|
|
15372
|
-
disabled:
|
|
15978
|
+
disabled: draftAlias === "",
|
|
15373
15979
|
onClick: connect,
|
|
15374
15980
|
children: tt("terminal.connect")
|
|
15375
15981
|
}),
|
|
15376
15982
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
15377
15983
|
type: "button",
|
|
15378
15984
|
className: panel_module_css_default.ghostButton,
|
|
15379
|
-
disabled:
|
|
15380
|
-
onClick:
|
|
15985
|
+
disabled: activeTab === void 0,
|
|
15986
|
+
onClick: () => {
|
|
15987
|
+
if (activeTab !== void 0) closeTab(activeTab.id);
|
|
15988
|
+
},
|
|
15381
15989
|
children: tt("terminal.disconnect")
|
|
15382
15990
|
})
|
|
15383
15991
|
]
|
|
15384
15992
|
}),
|
|
15385
|
-
status
|
|
15993
|
+
activeTab?.status === "connecting" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
15386
15994
|
className: panel_module_css_default.banner,
|
|
15387
15995
|
"data-kind": "info",
|
|
15388
15996
|
children: tt("terminal.connecting")
|
|
15389
15997
|
}),
|
|
15390
|
-
status
|
|
15998
|
+
activeTab?.status === "connected" && stateLabel === void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
15391
15999
|
className: panel_module_css_default.banner,
|
|
15392
16000
|
"data-kind": "ok",
|
|
15393
|
-
children: tt("terminal.ready", { alias:
|
|
16001
|
+
children: tt("terminal.ready", { alias: activeTab.alias })
|
|
15394
16002
|
}),
|
|
15395
|
-
status
|
|
16003
|
+
activeTab?.status === "exited" && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
15396
16004
|
className: panel_module_css_default.banner,
|
|
15397
16005
|
"data-kind": "info",
|
|
15398
|
-
children: [tt("terminal.exited", { alias:
|
|
16006
|
+
children: [tt("terminal.exited", { alias: activeTab.alias }), activeTab.detail !== void 0 ? " (" + activeTab.detail + ")" : ""]
|
|
15399
16007
|
}),
|
|
15400
|
-
status
|
|
16008
|
+
activeTab?.status === "error" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
15401
16009
|
className: panel_module_css_default.banner,
|
|
15402
16010
|
"data-kind": "error",
|
|
15403
|
-
children: tt("terminal.error", { error:
|
|
16011
|
+
children: tt("terminal.error", { error: activeTab.detail ?? "" })
|
|
16012
|
+
}),
|
|
16013
|
+
activeTab?.closeError !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
16014
|
+
className: panel_module_css_default.banner,
|
|
16015
|
+
"data-kind": "error",
|
|
16016
|
+
children: tt("terminal.closeFailed")
|
|
16017
|
+
}),
|
|
16018
|
+
listError !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
16019
|
+
className: panel_module_css_default.banner,
|
|
16020
|
+
"data-kind": "error",
|
|
16021
|
+
children: tt("terminal.error", { error: listError })
|
|
15404
16022
|
}),
|
|
15405
16023
|
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
15406
16024
|
className: panel_module_css_default.termWrap,
|
|
@@ -15410,11 +16028,11 @@ window.__ModuleLoader__.load({
|
|
|
15410
16028
|
className: panel_module_css_default.termContainer,
|
|
15411
16029
|
"data-dsh-part": "terminal"
|
|
15412
16030
|
}),
|
|
15413
|
-
|
|
16031
|
+
terminalTabs.length === 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
15414
16032
|
className: panel_module_css_default.termPlaceholder,
|
|
15415
16033
|
children: hosts.length === 0 ? tt("hosts.empty") : tt("terminal.placeholder")
|
|
15416
16034
|
}),
|
|
15417
|
-
authPrompt !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
16035
|
+
activeTab?.authPrompt !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
15418
16036
|
className: panel_module_css_default.modalBackdrop,
|
|
15419
16037
|
style: {
|
|
15420
16038
|
position: "absolute",
|
|
@@ -15429,14 +16047,14 @@ window.__ModuleLoader__.load({
|
|
|
15429
16047
|
className: panel_module_css_default.modalHeader,
|
|
15430
16048
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", {
|
|
15431
16049
|
className: panel_module_css_default.modalTitle,
|
|
15432
|
-
children: authPrompt.name || tt("terminal.auth.title")
|
|
16050
|
+
children: activeTab.authPrompt.name || tt("terminal.auth.title")
|
|
15433
16051
|
})
|
|
15434
16052
|
}),
|
|
15435
16053
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
15436
16054
|
className: panel_module_css_default.hint,
|
|
15437
|
-
children: authPrompt.instructions || tt("terminal.auth.hint")
|
|
16055
|
+
children: activeTab.authPrompt.instructions || tt("terminal.auth.hint")
|
|
15438
16056
|
}),
|
|
15439
|
-
authPrompt.prompts.map((p, idx) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
|
|
16057
|
+
activeTab.authPrompt.prompts.map((p, idx) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
|
|
15440
16058
|
className: panel_module_css_default.field,
|
|
15441
16059
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
15442
16060
|
className: panel_module_css_default.fieldLabel,
|
|
@@ -15446,11 +16064,9 @@ window.__ModuleLoader__.load({
|
|
|
15446
16064
|
className: panel_module_css_default.input,
|
|
15447
16065
|
type: p.echo ? "text" : "password",
|
|
15448
16066
|
placeholder: tt("terminal.auth.placeholder"),
|
|
15449
|
-
value:
|
|
16067
|
+
value: activeTab.authAnswers?.[idx] ?? "",
|
|
15450
16068
|
onChange: (event) => {
|
|
15451
|
-
|
|
15452
|
-
next[idx] = event.target.value;
|
|
15453
|
-
setAuthInputs(next);
|
|
16069
|
+
controller.setTerminalAuthAnswer(activeTab.id, idx, event.target.value);
|
|
15454
16070
|
}
|
|
15455
16071
|
})]
|
|
15456
16072
|
}, idx)),
|
|
@@ -15459,7 +16075,9 @@ window.__ModuleLoader__.load({
|
|
|
15459
16075
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
15460
16076
|
type: "button",
|
|
15461
16077
|
className: panel_module_css_default.ghostButton,
|
|
15462
|
-
onClick:
|
|
16078
|
+
onClick: () => {
|
|
16079
|
+
if (activeTab !== void 0) closeTab(activeTab.id);
|
|
16080
|
+
},
|
|
15463
16081
|
children: tt("terminal.auth.cancel")
|
|
15464
16082
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
15465
16083
|
type: "submit",
|
|
@@ -16109,12 +16727,11 @@ window.__ModuleLoader__.load({
|
|
|
16109
16727
|
* The SSH operations panel shell: a header with a close control, a five-tab
|
|
16110
16728
|
* bar, and the active tab's content.
|
|
16111
16729
|
*
|
|
16112
|
-
* The active tab
|
|
16113
|
-
*
|
|
16114
|
-
*
|
|
16115
|
-
*
|
|
16116
|
-
*
|
|
16117
|
-
* on activation.
|
|
16730
|
+
* The active tab and the terminal tabs live in the controller, not in
|
|
16731
|
+
* component state: the layout mounts this page only while the panel is
|
|
16732
|
+
* selected, so local state would reset the tab on every panel switch and lose
|
|
16733
|
+
* the ids the terminal tab needs to reattach its host-side sessions. Inactive
|
|
16734
|
+
* tabs unmount, so each tab fetches its own data on activation.
|
|
16118
16735
|
*/
|
|
16119
16736
|
/** The tab bar definition (labels resolved at render time). */
|
|
16120
16737
|
const TABS = [
|
|
@@ -16141,7 +16758,7 @@ window.__ModuleLoader__.load({
|
|
|
16141
16758
|
];
|
|
16142
16759
|
/** The tabbed SSH panel. */
|
|
16143
16760
|
function SshPanel({ controller, api, terminalFont }) {
|
|
16144
|
-
const { panelOpen, activeTab
|
|
16761
|
+
const { panelOpen, activeTab } = (0, react.useSyncExternalStore)((0, react.useCallback)((listener) => controller.subscribe(listener), [controller]), (0, react.useCallback)(() => controller.getSnapshot(), [controller]));
|
|
16145
16762
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
16146
16763
|
className: panel_module_css_default.panel,
|
|
16147
16764
|
"data-dsh-plugin": "ssh",
|
|
@@ -16194,9 +16811,6 @@ window.__ModuleLoader__.load({
|
|
|
16194
16811
|
activeTab === "terminal" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TerminalTab, {
|
|
16195
16812
|
api,
|
|
16196
16813
|
controller,
|
|
16197
|
-
presetAlias: connectRequest?.alias,
|
|
16198
|
-
requestId: connectRequest?.nonce,
|
|
16199
|
-
sessionId: terminalSessionId,
|
|
16200
16814
|
terminalFont
|
|
16201
16815
|
}),
|
|
16202
16816
|
activeTab === "transfer" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TransferTab, { api }),
|
|
@@ -16317,8 +16931,7 @@ window.__ModuleLoader__.load({
|
|
|
16317
16931
|
base: void 0,
|
|
16318
16932
|
user: void 0,
|
|
16319
16933
|
revision: void 0,
|
|
16320
|
-
writable: false
|
|
16321
|
-
mode: "host"
|
|
16934
|
+
writable: false
|
|
16322
16935
|
};
|
|
16323
16936
|
/** Whether one Host namespace section carries a field this plugin's schema declares. */
|
|
16324
16937
|
function carriesField(section, field) {
|