@linxin666/dsh-ssh 0.4.22 → 0.4.23
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/README.i18n.yaml +2 -2
- package/README.md +2 -1
- package/README.zh.md +2 -1
- package/lib/client.js +244 -9
- package/lib/client.js.map +1 -1
- package/lib/index.js +39 -25
- package/lib/types/client/index.d.ts +1 -1
- package/lib/types/client/locales.d.ts +2 -0
- package/lib/types/client/native-panel.d.ts +4 -1
- package/lib/types/client/panel/SshPanel.d.ts +4 -1
- package/lib/types/client/panel/TransferTab.d.ts +4 -1
- package/lib/types/client/panel/TunnelsTab.d.ts +3 -1
- package/lib/types/client/panel/controller.d.ts +6 -0
- package/lib/types/client/panel/directory-dialog.d.ts +44 -0
- package/lib/types/client/session-activity.d.ts +34 -0
- package/lib/types/connection-trust.d.ts +2 -4
- package/lib/types/dsh-home.d.ts +13 -3
- package/lib/types/tool-surface.d.ts +6 -2
- package/package.json +25 -25
- package/src/client/index.ts +4 -2
- package/src/client/locales.ts +4 -0
- package/src/client/native-panel.tsx +37 -4
- package/src/client/panel/SshPanel.tsx +8 -3
- package/src/client/panel/TransferTab.tsx +27 -1
- package/src/client/panel/TunnelsTab.tsx +7 -1
- package/src/client/panel/controller.ts +21 -0
- package/src/client/panel/directory-dialog.ts +107 -0
- package/src/client/session-activity.tsx +168 -0
- package/src/connection-trust.ts +6 -14
- package/src/dsh-home.ts +35 -12
- package/src/engine/tunnel.ts +4 -3
- package/src/routes.ts +4 -7
- package/src/tool-surface.ts +17 -2
- package/src/tools.ts +3 -0
package/README.i18n.yaml
CHANGED
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
# side as of the last confirmed-consistent state. Both languages carry equal authority;
|
|
3
3
|
# after editing either side, bring the other along and re-record with:
|
|
4
4
|
# node scripts/verify-docs.mjs --write <dir>
|
|
5
|
-
README.md:
|
|
6
|
-
README.zh.md:
|
|
5
|
+
README.md: 09279efcc6efd500ca9e4c8218790807c0821cb1
|
|
6
|
+
README.zh.md: d68f092f9cb6cd2c318e4a08dfa9dde5967f97c8
|
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@ English | [中文](README.zh.md)
|
|
|
5
5
|
<p align="center">
|
|
6
6
|
<img src="https://img.shields.io/npm/v/@linxin666/dsh-ssh?style=flat-square" alt="Version">
|
|
7
7
|
|
|
8
|
-
<img src="https://img.shields.io/badge/DSH-%3E%3D0.2.3--alpha.
|
|
8
|
+
<img src="https://img.shields.io/badge/DSH-%3E%3D0.2.3--alpha.4-4c6ef5?style=flat-square&labelColor=454a54" alt="DSH">
|
|
9
9
|
|
|
10
10
|
<img src="https://img.shields.io/badge/license-Apache--2.0-blue?style=flat-square" alt="License">
|
|
11
11
|
</p>
|
|
@@ -56,6 +56,7 @@ The service is published only while the master switch is on, and it is withdrawn
|
|
|
56
56
|
- Before the Agent uses a tool, the host must first be configured in the GUI (or imported from ~/.ssh/config).
|
|
57
57
|
- `ssh_upload` / `ssh_download` read/write arbitrary local paths on this machine with host-process privileges (not through the bash sandbox) — same host-local-path semantics as ssh-skill, be aware of that permission surface.
|
|
58
58
|
- Agent transfer tools move files only between this machine and a remote SSH host; local-file reads and writes must use the local file tools (read / write / edit / bash), never the `ssh_*` tools.
|
|
59
|
+
- Remote execution environment declarations (DSH 0.2.3-alpha.4+): `ssh_list` declares `environment: 'independent'`, `ssh_exec` and `ssh_cluster` declare `environment: 'explicit'` (always routed to the caller-named SSH alias), while `ssh_upload`, `ssh_download`, and `ssh_tunnel` intentionally omit `environment` (local-only) so a session bound to a remote execution environment cannot confuse host `localPath` or `127.0.0.1` bindings with the remote machine.
|
|
59
60
|
- The remote output of exec / cluster is returned verbatim (not sanitized); a command like `env` may bring secrets from the remote environment back into the conversation log.
|
|
60
61
|
- `dshSsh` is a host-process service, not a network surface: any plugin loaded into this host can execute commands and transfer files on the configured hosts through it, with the same reach as the `ssh_*` tools and no per-consumer permission. What it never hands out is credential material — `hosts.list()` and `hosts.find()` return the public host fields only, with no password, passphrase, private-key path, agent path or `proxyCommand` text.
|
|
61
62
|
|
package/README.zh.md
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
<p align="center">
|
|
6
6
|
<img src="https://img.shields.io/npm/v/@linxin666/dsh-ssh?style=flat-square" alt="Version">
|
|
7
7
|
|
|
8
|
-
<img src="https://img.shields.io/badge/DSH-%3E%3D0.2.3--alpha.
|
|
8
|
+
<img src="https://img.shields.io/badge/DSH-%3E%3D0.2.3--alpha.4-4c6ef5?style=flat-square&labelColor=454a54" alt="DSH">
|
|
9
9
|
|
|
10
10
|
<img src="https://img.shields.io/badge/license-Apache--2.0-blue?style=flat-square" alt="License">
|
|
11
11
|
</p>
|
|
@@ -56,6 +56,7 @@
|
|
|
56
56
|
- Agent 使用工具前,主机需先在 GUI 中配置(或从 ~/.ssh/config 导入)。
|
|
57
57
|
- `ssh_upload` / `ssh_download` 以宿主进程权限直接读写本机任意路径(不经 bash 沙箱)——与 ssh-skill 的宿主本地路径语义一致,注意该权限面。
|
|
58
58
|
- Agent 传输工具只在本机与远程 SSH 主机之间移动文件;本机文件的读写一律使用本地文件工具(read / write / edit / bash),不要使用 `ssh_*` 工具。
|
|
59
|
+
- 远程执行环境声明(DSH 0.2.3-alpha.4+):`ssh_list` 声明 `environment: 'independent'`,`ssh_exec` 与 `ssh_cluster` 声明 `environment: 'explicit'`(始终按调用方指定的 SSH 别名路由);`ssh_upload`、`ssh_download` 与 `ssh_tunnel` 刻意不声明 `environment`(保持仅本机可用),避免绑定到远程执行环境的会话把宿主本机的 `localPath` 或 `127.0.0.1` 端口与远端主机混淆。
|
|
59
60
|
- exec / cluster 的远程输出原样返回(不脱敏),命令如 `env` 可能把远端环境中的密钥带回对话记录。
|
|
60
61
|
- `dshSsh` 是宿主进程内的服务,不是网络面:装载进本宿主的任何插件都能经它执行远程命令、传输文件,可达范围与 `ssh_*` 工具相同,且没有按消费方的权限分级。它绝不交出凭据材料——`hosts.list()` 与 `hosts.find()` 只返回主机的公开字段,不含密码、口令、私钥路径、agent 路径与 `proxyCommand` 原文。
|
|
61
62
|
|
package/lib/client.js
CHANGED
|
@@ -30,6 +30,7 @@ window.__ModuleLoader__.load({
|
|
|
30
30
|
*/
|
|
31
31
|
const zh = {
|
|
32
32
|
"entry.label": "SSH",
|
|
33
|
+
"activity.title": "SSH 连接",
|
|
33
34
|
"entry.tooltip": "远程 SSH 运维面板",
|
|
34
35
|
"panel.title": "远程 SSH",
|
|
35
36
|
"panel.backToConversation": "返回会话",
|
|
@@ -169,6 +170,7 @@ window.__ModuleLoader__.load({
|
|
|
169
170
|
"transfer.done": "完成:{bytes} 字节",
|
|
170
171
|
"transfer.failed": "传输失败:{error}",
|
|
171
172
|
"transfer.browseRemote": "浏览远程目录",
|
|
173
|
+
"transfer.pickDirectory": "选择目录…",
|
|
172
174
|
"transfer.refresh": "刷新",
|
|
173
175
|
"transfer.name": "名称",
|
|
174
176
|
"transfer.upLevel": "上级目录",
|
|
@@ -223,6 +225,7 @@ window.__ModuleLoader__.load({
|
|
|
223
225
|
};
|
|
224
226
|
const en = {
|
|
225
227
|
"entry.label": "SSH",
|
|
228
|
+
"activity.title": "SSH",
|
|
226
229
|
"entry.tooltip": "Remote SSH operations panel",
|
|
227
230
|
"panel.title": "Remote SSH",
|
|
228
231
|
"panel.backToConversation": "Back to chat",
|
|
@@ -362,6 +365,7 @@ window.__ModuleLoader__.load({
|
|
|
362
365
|
"transfer.done": "Done: {bytes} bytes",
|
|
363
366
|
"transfer.failed": "Transfer failed: {error}",
|
|
364
367
|
"transfer.browseRemote": "Browse remote",
|
|
368
|
+
"transfer.pickDirectory": "Pick folder…",
|
|
365
369
|
"transfer.refresh": "Refresh",
|
|
366
370
|
"transfer.name": "Name",
|
|
367
371
|
"transfer.upLevel": "Parent directory",
|
|
@@ -1124,6 +1128,7 @@ window.__ModuleLoader__.load({
|
|
|
1124
1128
|
terminalTabs = [];
|
|
1125
1129
|
activeTerminalTabId;
|
|
1126
1130
|
draftAlias = "";
|
|
1131
|
+
activeTunnels = [];
|
|
1127
1132
|
nextTerminalTabSeq = 0;
|
|
1128
1133
|
listeners = /* @__PURE__ */ new Set();
|
|
1129
1134
|
/**
|
|
@@ -1152,6 +1157,16 @@ window.__ModuleLoader__.load({
|
|
|
1152
1157
|
getSnapshot() {
|
|
1153
1158
|
return this.snapshot;
|
|
1154
1159
|
}
|
|
1160
|
+
/** Latest host tunnel list mirrored by the Tunnels tab (kept outside PanelControllerSnapshot). */
|
|
1161
|
+
getActiveTunnels() {
|
|
1162
|
+
return this.activeTunnels;
|
|
1163
|
+
}
|
|
1164
|
+
/** Mirror the latest host tunnel list so subscribers such as sessionActivities stay current. */
|
|
1165
|
+
setActiveTunnels(tunnels) {
|
|
1166
|
+
if (this.activeTunnels.length === tunnels.length && this.activeTunnels.every((item, index) => item.id === tunnels[index]?.id && item.state === tunnels[index]?.state)) return;
|
|
1167
|
+
this.activeTunnels = [...tunnels];
|
|
1168
|
+
for (const fn of [...this.listeners]) fn();
|
|
1169
|
+
}
|
|
1155
1170
|
subscribe(fn) {
|
|
1156
1171
|
this.listeners.add(fn);
|
|
1157
1172
|
return () => {
|
|
@@ -16678,6 +16693,69 @@ window.__ModuleLoader__.load({
|
|
|
16678
16693
|
});
|
|
16679
16694
|
}
|
|
16680
16695
|
//#endregion
|
|
16696
|
+
//#region src/client/panel/directory-dialog.ts
|
|
16697
|
+
/** Slot factory name owned by `@deepseek-ai/dsh-client-ui-directory-picker-browse`. */
|
|
16698
|
+
const DIRECTORY_BROWSER_DIALOG_FACTORY = "directory.browser.dialog";
|
|
16699
|
+
/** Check whether the slot registry currently carries the `directory.browser.dialog` factory. */
|
|
16700
|
+
function hasDirectoryBrowserFactory(slots) {
|
|
16701
|
+
if (typeof slots !== "object" || slots === null) return false;
|
|
16702
|
+
const snapshot = slots.snapshot;
|
|
16703
|
+
if (typeof snapshot !== "function") return false;
|
|
16704
|
+
try {
|
|
16705
|
+
const nodes = snapshot.call(slots, `factory:${DIRECTORY_BROWSER_DIALOG_FACTORY}`);
|
|
16706
|
+
return Array.isArray(nodes) && nodes.length > 0;
|
|
16707
|
+
} catch {
|
|
16708
|
+
return false;
|
|
16709
|
+
}
|
|
16710
|
+
}
|
|
16711
|
+
/** Normalize a POSIX remote path for directory listing (`''` / `'/'` -> `'/'`, no trailing slash otherwise). */
|
|
16712
|
+
function normalizeRemoteDirPath(raw) {
|
|
16713
|
+
const trimmed = raw?.trim() ?? "";
|
|
16714
|
+
if (trimmed === "" || trimmed === "/") return "/";
|
|
16715
|
+
const collapsed = (trimmed.startsWith("/") ? trimmed : `/${trimmed}`).replace(/\/+/g, "/").replace(/\/+$/, "");
|
|
16716
|
+
return collapsed === "" ? "/" : collapsed;
|
|
16717
|
+
}
|
|
16718
|
+
/** Format a confirmed remote directory path for the transfer path input (always ends with `/`). */
|
|
16719
|
+
function formatRemoteDirectoryPath(raw) {
|
|
16720
|
+
const norm = normalizeRemoteDirPath(raw);
|
|
16721
|
+
return norm === "/" ? "/" : `${norm}/`;
|
|
16722
|
+
}
|
|
16723
|
+
/** Build breadcrumb ancestry from `/` through `normalizedDir` inclusive. */
|
|
16724
|
+
function buildPosixCrumbs(normalizedDir) {
|
|
16725
|
+
const crumbs = [{
|
|
16726
|
+
name: "/",
|
|
16727
|
+
path: "/",
|
|
16728
|
+
hidden: false
|
|
16729
|
+
}];
|
|
16730
|
+
if (normalizedDir === "/") return crumbs;
|
|
16731
|
+
let current = "";
|
|
16732
|
+
for (const segment of normalizedDir.slice(1).split("/")) {
|
|
16733
|
+
if (segment === "") continue;
|
|
16734
|
+
current += `/${segment}`;
|
|
16735
|
+
crumbs.push({
|
|
16736
|
+
name: segment,
|
|
16737
|
+
path: current,
|
|
16738
|
+
hidden: segment.startsWith(".")
|
|
16739
|
+
});
|
|
16740
|
+
}
|
|
16741
|
+
return crumbs;
|
|
16742
|
+
}
|
|
16743
|
+
/** Convert `api.ls` entries into a `DirectoryBrowserListing` (directories only, sorted by name). */
|
|
16744
|
+
function remoteEntriesToDirectoryListing(dir, entries) {
|
|
16745
|
+
const path = normalizeRemoteDirPath(dir);
|
|
16746
|
+
const dirs = entries.filter((entry) => entry.type === "dir" && entry.name !== "." && entry.name !== "..").sort((a, b) => a.name.localeCompare(b.name)).map((entry) => ({
|
|
16747
|
+
name: entry.name,
|
|
16748
|
+
path: path === "/" ? `/${entry.name}` : `${path}/${entry.name}`,
|
|
16749
|
+
hidden: entry.name.startsWith(".")
|
|
16750
|
+
}));
|
|
16751
|
+
return {
|
|
16752
|
+
path,
|
|
16753
|
+
crumbs: buildPosixCrumbs(path),
|
|
16754
|
+
entries: dirs,
|
|
16755
|
+
truncated: false
|
|
16756
|
+
};
|
|
16757
|
+
}
|
|
16758
|
+
//#endregion
|
|
16681
16759
|
//#region src/client/panel/TransferTab.tsx
|
|
16682
16760
|
/**
|
|
16683
16761
|
* Transfer tab: upload/download one file with progress, plus a toggleable
|
|
@@ -16703,12 +16781,13 @@ window.__ModuleLoader__.load({
|
|
|
16703
16781
|
return tt("transfer.gib", { value: (bytes / (1024 * 1024 * 1024)).toFixed(1) });
|
|
16704
16782
|
}
|
|
16705
16783
|
/** The upload/download tab. */
|
|
16706
|
-
function TransferTab({ api }) {
|
|
16784
|
+
function TransferTab({ api, renderDirectoryDialog }) {
|
|
16707
16785
|
const [hosts, setHosts] = (0, react.useState)([]);
|
|
16708
16786
|
const [listError, setListError] = (0, react.useState)(null);
|
|
16709
16787
|
const [alias, setAlias] = (0, react.useState)("");
|
|
16710
16788
|
const [remotePath, setRemotePath] = (0, react.useState)("");
|
|
16711
16789
|
const [browseOpen, setBrowseOpen] = (0, react.useState)(false);
|
|
16790
|
+
const [dialogOpen, setDialogOpen] = (0, react.useState)(false);
|
|
16712
16791
|
const [browseDir, setBrowseDir] = (0, react.useState)("/");
|
|
16713
16792
|
const [entries, setEntries] = (0, react.useState)([]);
|
|
16714
16793
|
const [browsing, setBrowsing] = (0, react.useState)(false);
|
|
@@ -16875,6 +16954,15 @@ window.__ModuleLoader__.load({
|
|
|
16875
16954
|
onClick: openBrowse,
|
|
16876
16955
|
children: tt("transfer.browseRemote")
|
|
16877
16956
|
}),
|
|
16957
|
+
renderDirectoryDialog !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
16958
|
+
type: "button",
|
|
16959
|
+
className: panel_module_css_default.ghostButton,
|
|
16960
|
+
disabled: alias === "",
|
|
16961
|
+
onClick: () => {
|
|
16962
|
+
setDialogOpen(true);
|
|
16963
|
+
},
|
|
16964
|
+
children: tt("transfer.pickDirectory")
|
|
16965
|
+
}),
|
|
16878
16966
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { className: panel_module_css_default.toolbarSpacer }),
|
|
16879
16967
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
16880
16968
|
type: "button",
|
|
@@ -16984,6 +17072,21 @@ window.__ModuleLoader__.load({
|
|
|
16984
17072
|
})
|
|
16985
17073
|
})]
|
|
16986
17074
|
}),
|
|
17075
|
+
dialogOpen && alias !== "" && renderDirectoryDialog !== void 0 && renderDirectoryDialog({
|
|
17076
|
+
open: true,
|
|
17077
|
+
busy: transfer !== null,
|
|
17078
|
+
listDirectory: async (path) => {
|
|
17079
|
+
const target = path === void 0 ? normalizeRemoteDirPath(remotePath) : normalizeRemoteDirPath(path);
|
|
17080
|
+
return remoteEntriesToDirectoryListing(target, await api.ls(alias, target));
|
|
17081
|
+
},
|
|
17082
|
+
onOpen: (picked) => {
|
|
17083
|
+
setRemotePath(formatRemoteDirectoryPath(picked));
|
|
17084
|
+
setDialogOpen(false);
|
|
17085
|
+
},
|
|
17086
|
+
onClose: () => {
|
|
17087
|
+
setDialogOpen(false);
|
|
17088
|
+
}
|
|
17089
|
+
}),
|
|
16987
17090
|
status !== null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
16988
17091
|
className: panel_module_css_default.banner,
|
|
16989
17092
|
"data-kind": status.kind,
|
|
@@ -17018,7 +17121,7 @@ window.__ModuleLoader__.load({
|
|
|
17018
17121
|
return null;
|
|
17019
17122
|
}
|
|
17020
17123
|
/** The tunnels tab. */
|
|
17021
|
-
function TunnelsTab({ api, active = true }) {
|
|
17124
|
+
function TunnelsTab({ api, active = true, onTunnelsChange }) {
|
|
17022
17125
|
const [hosts, setHosts] = (0, react.useState)([]);
|
|
17023
17126
|
const [tunnels, setTunnels] = (0, react.useState)(null);
|
|
17024
17127
|
const [error, setError] = (0, react.useState)(null);
|
|
@@ -17042,6 +17145,8 @@ window.__ModuleLoader__.load({
|
|
|
17042
17145
|
}, [api]);
|
|
17043
17146
|
const seqRef = (0, react.useRef)(0);
|
|
17044
17147
|
const mountedRef = (0, react.useRef)(true);
|
|
17148
|
+
const onTunnelsChangeRef = (0, react.useRef)(onTunnelsChange);
|
|
17149
|
+
onTunnelsChangeRef.current = onTunnelsChange;
|
|
17045
17150
|
(0, react.useEffect)(() => {
|
|
17046
17151
|
mountedRef.current = true;
|
|
17047
17152
|
return () => {
|
|
@@ -17062,6 +17167,7 @@ window.__ModuleLoader__.load({
|
|
|
17062
17167
|
const list = await api.listTunnels();
|
|
17063
17168
|
if (disposed || seq !== seqRef.current) return;
|
|
17064
17169
|
setTunnels((prev) => diffTunnels(prev, list) ?? prev);
|
|
17170
|
+
onTunnelsChangeRef.current?.(list);
|
|
17065
17171
|
setError(null);
|
|
17066
17172
|
} catch (cause) {
|
|
17067
17173
|
if (disposed || seq !== seqRef.current) return;
|
|
@@ -17109,6 +17215,7 @@ window.__ModuleLoader__.load({
|
|
|
17109
17215
|
const list = await api.listTunnels();
|
|
17110
17216
|
if (!mountedRef.current || seq !== seqRef.current) return;
|
|
17111
17217
|
setTunnels(list);
|
|
17218
|
+
onTunnelsChangeRef.current?.(list);
|
|
17112
17219
|
if (!preserveError) setError(null);
|
|
17113
17220
|
} catch (cause) {
|
|
17114
17221
|
if (!mountedRef.current || seq !== seqRef.current) return;
|
|
@@ -17364,7 +17471,7 @@ window.__ModuleLoader__.load({
|
|
|
17364
17471
|
}
|
|
17365
17472
|
];
|
|
17366
17473
|
/** The tabbed SSH panel. */
|
|
17367
|
-
function SshPanel({ controller, api, terminalFont }) {
|
|
17474
|
+
function SshPanel({ controller, api, terminalFont, renderDirectoryDialog }) {
|
|
17368
17475
|
const { panelOpen, activeTab } = (0, react.useSyncExternalStore)((0, react.useCallback)((listener) => controller.subscribe(listener), [controller]), (0, react.useCallback)(() => controller.getSnapshot(), [controller]));
|
|
17369
17476
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
17370
17477
|
className: panel_module_css_default.panel,
|
|
@@ -17421,10 +17528,16 @@ window.__ModuleLoader__.load({
|
|
|
17421
17528
|
controller,
|
|
17422
17529
|
terminalFont
|
|
17423
17530
|
}),
|
|
17424
|
-
activeTab === "transfer" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TransferTab, {
|
|
17531
|
+
activeTab === "transfer" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TransferTab, {
|
|
17532
|
+
api,
|
|
17533
|
+
renderDirectoryDialog
|
|
17534
|
+
}),
|
|
17425
17535
|
activeTab === "tunnels" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TunnelsTab, {
|
|
17426
17536
|
api,
|
|
17427
|
-
active: panelOpen
|
|
17537
|
+
active: panelOpen,
|
|
17538
|
+
onTunnelsChange: (list) => {
|
|
17539
|
+
controller.setActiveTunnels(list);
|
|
17540
|
+
}
|
|
17428
17541
|
}),
|
|
17429
17542
|
activeTab === "cluster" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ClusterTab, { api })
|
|
17430
17543
|
]
|
|
@@ -17480,7 +17593,14 @@ window.__ModuleLoader__.load({
|
|
|
17480
17593
|
* @param props - the framework main-slot share plus this entry's injected face.
|
|
17481
17594
|
* @returns the SSH panel page.
|
|
17482
17595
|
*/
|
|
17483
|
-
function SshPanelPage({ controller, api, terminalFont }) {
|
|
17596
|
+
function SshPanelPage({ controller, api, terminalFont, renderFactorySlot, hasDirectoryDialog }) {
|
|
17597
|
+
const renderDirectoryDialog = renderFactorySlot !== void 0 && (hasDirectoryDialog === void 0 || hasDirectoryDialog()) ? (dialogProps) => renderFactorySlot(DIRECTORY_BROWSER_DIALOG_FACTORY, {
|
|
17598
|
+
open: dialogProps.open,
|
|
17599
|
+
busy: dialogProps.busy,
|
|
17600
|
+
listDirectory: dialogProps.listDirectory,
|
|
17601
|
+
onOpen: dialogProps.onOpen,
|
|
17602
|
+
onClose: dialogProps.onClose
|
|
17603
|
+
}, { fallback: null }) : void 0;
|
|
17484
17604
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
17485
17605
|
className: panel_module_css_default.view,
|
|
17486
17606
|
"data-dsh-ssh-view": "",
|
|
@@ -17488,7 +17608,8 @@ window.__ModuleLoader__.load({
|
|
|
17488
17608
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SshPanel, {
|
|
17489
17609
|
controller,
|
|
17490
17610
|
api,
|
|
17491
|
-
terminalFont
|
|
17611
|
+
terminalFont,
|
|
17612
|
+
renderDirectoryDialog
|
|
17492
17613
|
})
|
|
17493
17614
|
});
|
|
17494
17615
|
}
|
|
@@ -17520,7 +17641,8 @@ window.__ModuleLoader__.load({
|
|
|
17520
17641
|
inject: () => ({
|
|
17521
17642
|
controller,
|
|
17522
17643
|
api,
|
|
17523
|
-
terminalFont
|
|
17644
|
+
terminalFont,
|
|
17645
|
+
hasDirectoryDialog: () => hasDirectoryBrowserFactory(slots)
|
|
17524
17646
|
})
|
|
17525
17647
|
}, SshPanelPage)));
|
|
17526
17648
|
return () => {
|
|
@@ -17528,6 +17650,118 @@ window.__ModuleLoader__.load({
|
|
|
17528
17650
|
};
|
|
17529
17651
|
}
|
|
17530
17652
|
//#endregion
|
|
17653
|
+
//#region src/client/session-activity.tsx
|
|
17654
|
+
/**
|
|
17655
|
+
* Session island activity source for `dsh-ssh`.
|
|
17656
|
+
*
|
|
17657
|
+
* Reports live SSH terminal connections (`connecting` / `connected`) and active
|
|
17658
|
+
* local port-forward tunnels (`connecting` / `forwarding`) held by
|
|
17659
|
+
* {@link PanelController} to the official `sessionActivities` service, with a
|
|
17660
|
+
* matching 16px glyph registered into `conversation.session.panel.activity.icon`.
|
|
17661
|
+
* Reads solely from the controller store so observing a Session triggers zero
|
|
17662
|
+
* background polling.
|
|
17663
|
+
*/
|
|
17664
|
+
/** Stable source id shared with `conversation.session.panel.activity.icon`. */
|
|
17665
|
+
const SSH_ACTIVITY_ID = "dsh-ssh";
|
|
17666
|
+
const EMPTY_ACTIVITIES = [];
|
|
17667
|
+
function sameActivities(left, right) {
|
|
17668
|
+
return left.length === right.length && left.every((item, index) => item.id === right[index]?.id && item.status === right[index]?.status);
|
|
17669
|
+
}
|
|
17670
|
+
/**
|
|
17671
|
+
* Derive active SSH connection activities from live terminal tabs and tunnels.
|
|
17672
|
+
*/
|
|
17673
|
+
function sshActivitiesFrom(tabs, tunnels) {
|
|
17674
|
+
const activities = [];
|
|
17675
|
+
for (const tab of tabs) if (tab.status === "connecting" || tab.status === "connected") activities.push({
|
|
17676
|
+
id: `terminal:${tab.id}`,
|
|
17677
|
+
status: "running"
|
|
17678
|
+
});
|
|
17679
|
+
for (const tunnel of tunnels) if (tunnel.state === "connecting" || tunnel.state === "forwarding") activities.push({
|
|
17680
|
+
id: `tunnel:${tunnel.id}`,
|
|
17681
|
+
status: "running"
|
|
17682
|
+
});
|
|
17683
|
+
return activities.length === 0 ? EMPTY_ACTIVITIES : activities;
|
|
17684
|
+
}
|
|
17685
|
+
/** 16px SSH terminal glyph rendered in the Session island header toggle. */
|
|
17686
|
+
function SshActivityIcon() {
|
|
17687
|
+
return (0, react.createElement)("svg", {
|
|
17688
|
+
viewBox: "0 0 16 16",
|
|
17689
|
+
width: 16,
|
|
17690
|
+
height: 16,
|
|
17691
|
+
fill: "none",
|
|
17692
|
+
stroke: "currentColor",
|
|
17693
|
+
strokeWidth: "1.5",
|
|
17694
|
+
strokeLinecap: "round",
|
|
17695
|
+
strokeLinejoin: "round",
|
|
17696
|
+
"aria-hidden": "true"
|
|
17697
|
+
}, (0, react.createElement)("rect", {
|
|
17698
|
+
x: 1.75,
|
|
17699
|
+
y: 2.25,
|
|
17700
|
+
width: 12.5,
|
|
17701
|
+
height: 11.5,
|
|
17702
|
+
rx: 1.75
|
|
17703
|
+
}), (0, react.createElement)("path", { d: "M4.25 5.25l2.75 2.75-2.75 2.75" }), (0, react.createElement)("path", { d: "M8.5 10.75h3.25" }));
|
|
17704
|
+
}
|
|
17705
|
+
/**
|
|
17706
|
+
* Register the optional `sessionActivities` source and matching island icon.
|
|
17707
|
+
* Returns a disposer releasing both registrations.
|
|
17708
|
+
*/
|
|
17709
|
+
function registerSshSessionActivity(ctx, controller) {
|
|
17710
|
+
const disposers = [];
|
|
17711
|
+
const injectFn = ctx.inject;
|
|
17712
|
+
if (typeof injectFn === "function") {
|
|
17713
|
+
let stopSource;
|
|
17714
|
+
const releaseSource = () => {
|
|
17715
|
+
const stop = stopSource;
|
|
17716
|
+
stopSource = void 0;
|
|
17717
|
+
stop?.();
|
|
17718
|
+
};
|
|
17719
|
+
const fork = injectFn.call(ctx, ["sessionActivities"], (scope) => {
|
|
17720
|
+
const service = scope.get?.("sessionActivities");
|
|
17721
|
+
if (typeof service?.registerSource !== "function") return;
|
|
17722
|
+
scope.effect(() => {
|
|
17723
|
+
releaseSource();
|
|
17724
|
+
stopSource = service.registerSource({
|
|
17725
|
+
id: SSH_ACTIVITY_ID,
|
|
17726
|
+
title: () => tt("activity.title"),
|
|
17727
|
+
observe: () => {
|
|
17728
|
+
let cachedTabs;
|
|
17729
|
+
let cachedTunnels;
|
|
17730
|
+
let cached = EMPTY_ACTIVITIES;
|
|
17731
|
+
return {
|
|
17732
|
+
getSnapshot: () => {
|
|
17733
|
+
const tabs = controller.getSnapshot().terminalTabs;
|
|
17734
|
+
const tunnels = controller.getActiveTunnels();
|
|
17735
|
+
if (tabs !== cachedTabs || tunnels !== cachedTunnels) {
|
|
17736
|
+
cachedTabs = tabs;
|
|
17737
|
+
cachedTunnels = tunnels;
|
|
17738
|
+
const next = sshActivitiesFrom(tabs, tunnels);
|
|
17739
|
+
if (!sameActivities(cached, next)) cached = next;
|
|
17740
|
+
}
|
|
17741
|
+
return cached;
|
|
17742
|
+
},
|
|
17743
|
+
subscribe: (listener) => controller.subscribe(listener)
|
|
17744
|
+
};
|
|
17745
|
+
}
|
|
17746
|
+
});
|
|
17747
|
+
return releaseSource;
|
|
17748
|
+
}, "dsh-ssh: session activity source");
|
|
17749
|
+
});
|
|
17750
|
+
disposers.push(() => {
|
|
17751
|
+
releaseSource();
|
|
17752
|
+
fork?.dispose?.();
|
|
17753
|
+
});
|
|
17754
|
+
}
|
|
17755
|
+
const slots = ctx.slots;
|
|
17756
|
+
if (typeof slots?.inject === "function" && typeof slots?.register === "function") disposers.push(slots.inject("conversation.session.panel.activity.icon", () => slots.register({
|
|
17757
|
+
name: "conversation.session.panel.activity.icon",
|
|
17758
|
+
key: SSH_ACTIVITY_ID
|
|
17759
|
+
}, SshActivityIcon)));
|
|
17760
|
+
return () => {
|
|
17761
|
+
for (const dispose of disposers.splice(0)) dispose();
|
|
17762
|
+
};
|
|
17763
|
+
}
|
|
17764
|
+
//#endregion
|
|
17531
17765
|
//#region src/client/settings-binding.ts
|
|
17532
17766
|
/**
|
|
17533
17767
|
* The snapshot a reader reports before the Host has answered with this
|
|
@@ -17638,7 +17872,7 @@ window.__ModuleLoader__.load({
|
|
|
17638
17872
|
/** The building package's version, when the bundle carries it. */
|
|
17639
17873
|
function bakedVersion() {
|
|
17640
17874
|
try {
|
|
17641
|
-
return "0.4.
|
|
17875
|
+
return "0.4.23";
|
|
17642
17876
|
} catch {
|
|
17643
17877
|
return;
|
|
17644
17878
|
}
|
|
@@ -17776,6 +18010,7 @@ window.__ModuleLoader__.load({
|
|
|
17776
18010
|
const disposers = [];
|
|
17777
18011
|
try {
|
|
17778
18012
|
disposers.push(registerSshPanel(ctx, controller, api, terminalFont));
|
|
18013
|
+
disposers.push(registerSshSessionActivity(ctx, controller));
|
|
17779
18014
|
const layoutFace = ctx.get?.("layout");
|
|
17780
18015
|
if (layoutFace?.panelInfo !== void 0) {
|
|
17781
18016
|
const sync = () => {
|