@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/lib/index.js CHANGED
@@ -4,7 +4,7 @@ import { StringDecoder } from "node:string_decoder";
4
4
  import { Client } from "ssh2";
5
5
  import { randomBytes, randomUUID } from "node:crypto";
6
6
  import { homedir, tmpdir } from "node:os";
7
- import { basename, dirname, isAbsolute, join, posix, relative, resolve } from "node:path";
7
+ import { dirname, isAbsolute, join, posix, relative, resolve } from "node:path";
8
8
  import { isAbsolute as isAbsolute$1, join as join$1 } from "node:path/posix";
9
9
  import { spawn } from "node:child_process";
10
10
  import { Duplex } from "node:stream";
@@ -14,9 +14,9 @@ import { WebSocket, WebSocketServer } from "ws";
14
14
  import { defineTool } from "@deepseek-ai/dsh-tools";
15
15
  //#region src/dsh-home.ts
16
16
  /**
17
- * DSH_HOME resolution shared by the plugin family's Host halves: the
18
- * environment override wins, the platform home fallback follows. Mirrors
19
- * what dsh-pet and dsh-liangshen each used to implement locally.
17
+ * DSH_HOME and DSH_AGENTS_HOME resolution shared by the plugin family's Host
18
+ * halves: environment overrides win (blank values treated as unset), then the
19
+ * platform home fallbacks follow — mirroring `@deepseek-ai/dsh-home-paths`.
20
20
  */
21
21
  /** Expand a leading ~ (or ~user) in a path, platform-style. */
22
22
  function expandHome$1(path, home = homedir()) {
@@ -25,6 +25,16 @@ function expandHome$1(path, home = homedir()) {
25
25
  if (path.startsWith("~/") || path.startsWith("~\\")) return j(home, path.slice(2));
26
26
  return path;
27
27
  }
28
+ function resolveUserRoot(envValue, defaultDirName, home) {
29
+ const isPosix = home.startsWith("/");
30
+ const j = isPosix ? join$1 : join;
31
+ const isAbs = isPosix ? isAbsolute$1 : isAbsolute;
32
+ if (envValue !== void 0 && envValue.trim() !== "") {
33
+ const expanded = expandHome$1(envValue.trim(), home);
34
+ return isAbs(expanded) ? expanded : j(process.cwd(), expanded);
35
+ }
36
+ return j(home, defaultDirName);
37
+ }
28
38
  /**
29
39
  * Resolve the DSH home directory.
30
40
  * @param env - process environment to read DSH_HOME from.
@@ -32,15 +42,7 @@ function expandHome$1(path, home = homedir()) {
32
42
  * @returns the absolute DSH home path.
33
43
  */
34
44
  function resolveDshHome(env = process.env, home = homedir()) {
35
- const isPosix = home.startsWith("/");
36
- const j = isPosix ? join$1 : join;
37
- const isAbs = isPosix ? isAbsolute$1 : isAbsolute;
38
- const raw = env.DSH_HOME;
39
- if (raw !== void 0 && raw.trim() !== "") {
40
- const expanded = expandHome$1(raw.trim(), home);
41
- return isAbs(expanded) ? expanded : j(process.cwd(), expanded);
42
- }
43
- return j(home, ".dsh");
45
+ return resolveUserRoot(env.DSH_HOME, ".dsh", home);
44
46
  }
45
47
  /** Resolve the DSH home directory from the live environment. */
46
48
  function dshHome() {
@@ -1970,6 +1972,9 @@ async function startTunnel(engine, alias, options) {
1970
1972
  client.off("close", onLinkClosed);
1971
1973
  };
1972
1974
  const server = createServer((socket) => {
1975
+ socket.on("error", () => {
1976
+ destroyQuietly(socket);
1977
+ });
1973
1978
  sockets.add(socket);
1974
1979
  socket.on("close", () => {
1975
1980
  sockets.delete(socket);
@@ -1999,7 +2004,6 @@ async function startTunnel(engine, alias, options) {
1999
2004
  } catch {}
2000
2005
  };
2001
2006
  stream.on("error", destroy);
2002
- socket.on("error", destroy);
2003
2007
  stream.on("close", destroy);
2004
2008
  socket.on("close", destroy);
2005
2009
  stream.pipe(socket).pipe(stream);
@@ -2710,21 +2714,17 @@ function isLoopbackRequest(request) {
2710
2714
  function resolveConnection(ctx) {
2711
2715
  try {
2712
2716
  const candidate = typeof ctx.get === "function" ? ctx.get("connection", false) ?? ctx.get("connection") : ctx.connection;
2713
- return candidate !== void 0 && candidate !== null && (typeof candidate.admit === "function" || typeof candidate.requestRejection === "function") ? candidate : void 0;
2717
+ return candidate !== void 0 && candidate !== null && typeof candidate.admit === "function" ? candidate : void 0;
2714
2718
  } catch {
2715
2719
  return;
2716
2720
  }
2717
2721
  }
2718
2722
  /** Whether the Host's own authenticated/trusted-host decision admits a request. */
2719
2723
  function connectionAdmits(connection, request) {
2720
- if (connection === void 0) return false;
2724
+ if (connection === void 0 || typeof connection.admit !== "function") return false;
2721
2725
  try {
2722
- if (typeof connection.admit === "function") {
2723
- const admission = connection.admit(request);
2724
- return admission.rejection === void 0 && "peer" in admission && admission.peer !== void 0;
2725
- }
2726
- if (typeof connection.requestRejection === "function") return connection.requestRejection(request) === void 0;
2727
- return false;
2726
+ const admission = connection.admit(request);
2727
+ return admission.rejection === void 0 && "peer" in admission && admission.peer !== void 0;
2728
2728
  } catch {
2729
2729
  return false;
2730
2730
  }
@@ -3255,7 +3255,7 @@ function makeRoutes(deps) {
3255
3255
  res.writeHead(200, {
3256
3256
  "content-type": "application/octet-stream",
3257
3257
  "content-length": String(outcome.bytes),
3258
- "content-disposition": `attachment; filename="${safeAttachmentFilename(basename(remotePath))}"`,
3258
+ "content-disposition": `attachment; filename="${safeAttachmentFilename(posix.basename(remotePath))}"`,
3259
3259
  "referrer-policy": "no-referrer"
3260
3260
  });
3261
3261
  await new Promise((resolve, reject) => {
@@ -3454,6 +3454,7 @@ function renderTunnel(tunnel) {
3454
3454
  function sshListTool(engine) {
3455
3455
  return defineTool({
3456
3456
  name: "ssh_list",
3457
+ environment: "independent",
3457
3458
  description: "List configured SSH hosts (alias, host, user, auth, agent forwarding, environment, tags, description). Use ssh_exec etc. with the alias.",
3458
3459
  parameters: { query: {
3459
3460
  type: "string",
@@ -3544,6 +3545,7 @@ function sshListTool(engine) {
3544
3545
  function sshExecTool(engine) {
3545
3546
  return defineTool({
3546
3547
  name: "ssh_exec",
3548
+ environment: "explicit",
3547
3549
  description: "Execute a shell command on a REMOTE SSH host by alias; the command runs on the remote host, never on this machine. For commands on this machine, use the local bash tool. Prefer combining independent read-only queries into one command.",
3548
3550
  parameters: {
3549
3551
  alias: {
@@ -3919,6 +3921,7 @@ function sshTunnelTool(engine) {
3919
3921
  function sshClusterTool(engine) {
3920
3922
  return defineTool({
3921
3923
  name: "ssh_cluster",
3924
+ environment: "explicit",
3922
3925
  description: "Run one command concurrently across selected SSH hosts; at least one aliases, environment, or tags filter is required.",
3923
3926
  parameters: {
3924
3927
  command: {
@@ -4140,11 +4143,15 @@ const PLUGIN_TOOL_SECTION_ORDERS = {
4140
4143
  agents: 220
4141
4144
  };
4142
4145
  /**
4143
- * Build a section provider that renders \`text\` only while at least one of
4144
- * \`toolNames\` is visible to the rendering scope.
4146
+ * Build a section provider that renders `text` only while at least one of
4147
+ * `toolNames` is visible to the rendering scope.
4145
4148
  *
4146
4149
  * The native convention: a tool that a restriction, a preset, or a missing
4147
4150
  * registry removed must not leave guidance behind telling the model to call it.
4151
+ * Under a 0.2.3-alpha.3+ PTC root registry (`PtcToolRegistry`), `tools.get(name,
4152
+ * scope)` exposes only the `run_code` transport while binding registered tools
4153
+ * inside programs; when `run_code` is active in the rendering scope, fall back
4154
+ * to checking the unscoped registry so guidance does not vanish under PTC.
4148
4155
  * An unreadable registry renders the text unchanged — guidance that outlives a
4149
4156
  * momentary read failure is recoverable; guidance for a tool that is gone is
4150
4157
  * not.
@@ -4161,6 +4168,13 @@ function visibleToolText(tools, toolNames, text) {
4161
4168
  } catch {
4162
4169
  return text;
4163
4170
  }
4171
+ if (context.scope !== void 0 && toolNames.length > 0) try {
4172
+ if (tools.get("run_code", context.scope) !== void 0) {
4173
+ for (const name of toolNames) if (tools.get(name) !== void 0) return text;
4174
+ }
4175
+ } catch {
4176
+ return text;
4177
+ }
4164
4178
  return "";
4165
4179
  };
4166
4180
  }
@@ -12,7 +12,7 @@
12
12
  */
13
13
  import type { Context as ClientContext } from '@deepseek-ai/cordis';
14
14
  import { type SshKey } from './locales.ts';
15
- declare module '@deepseek-ai/dsh-client-ui-slots' {
15
+ declare module '@deepseek-ai/dsh-client-ui-slots/client' {
16
16
  interface LocaleNamespaceMap {
17
17
  /** dsh-ssh surface copy. */
18
18
  'dsh-ssh': SshKey;
@@ -3,6 +3,7 @@
3
3
  */
4
4
  export declare const zh: {
5
5
  readonly 'entry.label': "SSH";
6
+ readonly 'activity.title': "SSH 连接";
6
7
  readonly 'entry.tooltip': "远程 SSH 运维面板";
7
8
  readonly 'panel.title': "远程 SSH";
8
9
  readonly 'panel.backToConversation': "返回会话";
@@ -142,6 +143,7 @@ export declare const zh: {
142
143
  readonly 'transfer.done': "完成:{bytes} 字节";
143
144
  readonly 'transfer.failed': "传输失败:{error}";
144
145
  readonly 'transfer.browseRemote': "浏览远程目录";
146
+ readonly 'transfer.pickDirectory': "选择目录…";
145
147
  readonly 'transfer.refresh': "刷新";
146
148
  readonly 'transfer.name': "名称";
147
149
  readonly 'transfer.upLevel': "上级目录";
@@ -24,6 +24,7 @@ import type { Context as ClientContext } from '@deepseek-ai/cordis';
24
24
  import type { SshApi } from './api.ts';
25
25
  import { SSH_PANEL_ID, type PanelController } from './panel/controller.ts';
26
26
  import { type TerminalFontSource } from './panel/helpers.ts';
27
+ import { type RenderFactorySlotFn } from './panel/directory-dialog.ts';
27
28
  /** The panel id shared by the sidebar row and the main-slot occupant. */
28
29
  export { SSH_PANEL_ID };
29
30
  /**
@@ -49,10 +50,12 @@ export declare function SshPanelIcon({ size }: {
49
50
  * @param props - the framework main-slot share plus this entry's injected face.
50
51
  * @returns the SSH panel page.
51
52
  */
52
- export declare function SshPanelPage({ controller, api, terminalFont }: {
53
+ export declare function SshPanelPage({ controller, api, terminalFont, renderFactorySlot, hasDirectoryDialog }: {
53
54
  controller: PanelController;
54
55
  api: SshApi;
55
56
  terminalFont?: TerminalFontSource;
57
+ renderFactorySlot?: RenderFactorySlotFn;
58
+ hasDirectoryDialog?: () => boolean;
56
59
  }): React.ReactElement;
57
60
  /**
58
61
  * Register the SSH panel's sidebar row and center-column page.
@@ -1,6 +1,7 @@
1
1
  import type { SshApi } from '../api.ts';
2
2
  import type { PanelController } from './controller.ts';
3
3
  import { type TerminalFontSource } from './helpers.ts';
4
+ import type { RenderDirectoryDialog } from './directory-dialog.ts';
4
5
  /** Panel shell props. */
5
6
  export interface SshPanelProps {
6
7
  /** The panel state owner (open/close/toggle, active tab, terminal session). */
@@ -9,6 +10,8 @@ export interface SshPanelProps {
9
10
  api: SshApi;
10
11
  /** Live terminal-font setting source handed to the terminal tab (issue #577). */
11
12
  terminalFont?: TerminalFontSource;
13
+ /** Optional shell `directory.browser.dialog` factory renderer for remote folder picks. */
14
+ renderDirectoryDialog?: RenderDirectoryDialog;
12
15
  }
13
16
  /** The tabbed SSH panel. */
14
- export declare function SshPanel({ controller, api, terminalFont }: SshPanelProps): import("react").JSX.Element;
17
+ export declare function SshPanel({ controller, api, terminalFont, renderDirectoryDialog }: SshPanelProps): import("react").JSX.Element;
@@ -1,7 +1,10 @@
1
1
  import type { SshApi } from '../api.ts';
2
+ import { type RenderDirectoryDialog } from './directory-dialog.ts';
2
3
  /** Transfer tab props. */
3
4
  export interface TransferTabProps {
4
5
  api: SshApi;
6
+ /** Optional shell `directory.browser.dialog` factory renderer for remote folder picks. */
7
+ renderDirectoryDialog?: RenderDirectoryDialog;
5
8
  }
6
9
  /** The upload/download tab. */
7
- export declare function TransferTab({ api }: TransferTabProps): import("react").JSX.Element;
10
+ export declare function TransferTab({ api, renderDirectoryDialog }: TransferTabProps): import("react").JSX.Element;
@@ -14,6 +14,8 @@ export interface TunnelsTabProps {
14
14
  api: SshApi;
15
15
  /** Pause automatic reads while the owning panel is closed, preserving form state. */
16
16
  active?: boolean;
17
+ /** Optional listener mirroring refreshed tunnel state back to PanelController. */
18
+ onTunnelsChange?: (tunnels: readonly TunnelInfo[]) => void;
17
19
  }
18
20
  /** The tunnels tab. */
19
- export declare function TunnelsTab({ api, active }: TunnelsTabProps): import("react").JSX.Element;
21
+ export declare function TunnelsTab({ api, active, onTunnelsChange }: TunnelsTabProps): import("react").JSX.Element;
@@ -20,6 +20,7 @@
20
20
  * PTY with no owner (the orphan the reference implementation produced).
21
21
  */
22
22
  import type { TerminalConnection } from '../api.ts';
23
+ import type { TunnelInfo } from '../../protocol.ts';
23
24
  /** The panel's tab identifiers. */
24
25
  export type SshTab = 'hosts' | 'keys' | 'terminal' | 'transfer' | 'tunnels' | 'cluster';
25
26
  /** Stable id shared by the sidebar panel row and the main-slot page. */
@@ -105,6 +106,7 @@ export declare class PanelController {
105
106
  private terminalTabs;
106
107
  private activeTerminalTabId;
107
108
  private draftAlias;
109
+ private activeTunnels;
108
110
  private nextTerminalTabSeq;
109
111
  private listeners;
110
112
  /**
@@ -123,6 +125,10 @@ export declare class PanelController {
123
125
  private snapshot;
124
126
  constructor(deps?: PanelControllerDeps);
125
127
  getSnapshot(): PanelControllerSnapshot;
128
+ /** Latest host tunnel list mirrored by the Tunnels tab (kept outside PanelControllerSnapshot). */
129
+ getActiveTunnels(): readonly TunnelInfo[];
130
+ /** Mirror the latest host tunnel list so subscribers such as sessionActivities stay current. */
131
+ setActiveTunnels(tunnels: readonly TunnelInfo[]): void;
126
132
  subscribe(fn: () => void): () => void;
127
133
  /**
128
134
  * Show the panel. The layout owns which panel the column renders, so the
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Adapter bridging `dsh-ssh` remote SFTP directory listings (`api.ls`) onto the
3
+ * official reusable `directory.browser.dialog` Component Factory (DSH 0.2.3-alpha.4+).
4
+ */
5
+ import type { ReactNode } from 'react';
6
+ import type { RemoteDirEntry } from '../../protocol.ts';
7
+ /** Slot factory name owned by `@deepseek-ai/dsh-client-ui-directory-picker-browse`. */
8
+ export declare const DIRECTORY_BROWSER_DIALOG_FACTORY = "directory.browser.dialog";
9
+ /** One directory row matching `DirectoryBrowserEntry`. */
10
+ export interface DirectoryDialogEntry {
11
+ readonly name: string;
12
+ readonly path: string;
13
+ readonly hidden: boolean;
14
+ }
15
+ /** One listed level matching `DirectoryBrowserListing`. */
16
+ export interface DirectoryDialogListing {
17
+ readonly path: string;
18
+ readonly home?: string;
19
+ readonly crumbs: readonly DirectoryDialogEntry[];
20
+ readonly entries: readonly DirectoryDialogEntry[];
21
+ readonly truncated: boolean;
22
+ }
23
+ /** Input props passed to `renderFactorySlot('directory.browser.dialog', ...)`. */
24
+ export interface DirectoryDialogRenderProps {
25
+ readonly open: boolean;
26
+ readonly busy: boolean;
27
+ readonly listDirectory: (path?: string, signal?: AbortSignal) => Promise<DirectoryDialogListing>;
28
+ readonly onOpen: (path: string) => void;
29
+ readonly onClose: () => void;
30
+ }
31
+ /** Bound renderer for the optional `directory.browser.dialog` factory. */
32
+ export type RenderDirectoryDialog = (props: DirectoryDialogRenderProps) => ReactNode;
33
+ /** Structural slice of the slot renderer's `renderFactorySlot` helper. */
34
+ export type RenderFactorySlotFn = (name: string, props: Record<string, unknown>, options?: {
35
+ readonly fallback?: ReactNode;
36
+ }) => ReactNode;
37
+ /** Check whether the slot registry currently carries the `directory.browser.dialog` factory. */
38
+ export declare function hasDirectoryBrowserFactory(slots: unknown): boolean;
39
+ /** Normalize a POSIX remote path for directory listing (`''` / `'/'` -> `'/'`, no trailing slash otherwise). */
40
+ export declare function normalizeRemoteDirPath(raw: string | undefined): string;
41
+ /** Format a confirmed remote directory path for the transfer path input (always ends with `/`). */
42
+ export declare function formatRemoteDirectoryPath(raw: string): string;
43
+ /** Convert `api.ls` entries into a `DirectoryBrowserListing` (directories only, sorted by name). */
44
+ export declare function remoteEntriesToDirectoryListing(dir: string | undefined, entries: readonly RemoteDirEntry[]): DirectoryDialogListing;
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Session island activity source for `dsh-ssh`.
3
+ *
4
+ * Reports live SSH terminal connections (`connecting` / `connected`) and active
5
+ * local port-forward tunnels (`connecting` / `forwarding`) held by
6
+ * {@link PanelController} to the official `sessionActivities` service, with a
7
+ * matching 16px glyph registered into `conversation.session.panel.activity.icon`.
8
+ * Reads solely from the controller store so observing a Session triggers zero
9
+ * background polling.
10
+ */
11
+ import { type ReactNode } from 'react';
12
+ import type { Context as ClientContext } from '@deepseek-ai/cordis';
13
+ import type { TunnelInfo } from '../protocol.ts';
14
+ import type { PanelController, TerminalTabRecord } from './panel/controller.ts';
15
+ /** Stable source id shared with `conversation.session.panel.activity.icon`. */
16
+ export declare const SSH_ACTIVITY_ID = "dsh-ssh";
17
+ /** Official `SessionActivityStatus` subset reported to `sessionActivities`. */
18
+ export type SshActivityStatus = 'queued' | 'running' | 'stopping' | 'done' | 'failed' | 'inactive';
19
+ /** One reported activity unit matching `@deepseek-ai/dsh-client-ui-session-panel`. */
20
+ export interface SshSessionActivity {
21
+ readonly id: string;
22
+ readonly status: SshActivityStatus;
23
+ }
24
+ /**
25
+ * Derive active SSH connection activities from live terminal tabs and tunnels.
26
+ */
27
+ export declare function sshActivitiesFrom(tabs: readonly TerminalTabRecord[], tunnels: readonly TunnelInfo[]): readonly SshSessionActivity[];
28
+ /** 16px SSH terminal glyph rendered in the Session island header toggle. */
29
+ export declare function SshActivityIcon(): ReactNode;
30
+ /**
31
+ * Register the optional `sessionActivities` source and matching island icon.
32
+ * Returns a disposer releasing both registrations.
33
+ */
34
+ export declare function registerSshSessionActivity(ctx: ClientContext, controller: Pick<PanelController, 'getSnapshot' | 'getActiveTunnels' | 'subscribe'>): () => void;
@@ -1,14 +1,12 @@
1
1
  /**
2
- * Optional bridge to the Host connection trust decision. Newer hosts expose
3
- * admit(request); the rc.3 SDK cohort exposes requestRejection(request). A
2
+ * Optional bridge to the Host connection trust decision (`admit(request)`). A
4
3
  * missing or throwing bridge is not an admission: callers must retain their
5
4
  * existing loopback or pairing fence.
6
5
  */
7
6
  import type { IncomingMessage } from 'node:http';
8
7
  import type { Context } from '@deepseek-ai/cordis';
9
- /** Structural host connection face across supported SDK cohorts. */
8
+ /** Structural host connection face (`admit(request)` on DSH 0.2.3-alpha.2+). */
10
9
  export interface HostConnectionService {
11
- requestRejection?: (request: IncomingMessage) => unknown;
12
10
  admit?: (request: IncomingMessage) => {
13
11
  readonly peer?: unknown;
14
12
  readonly rejection?: unknown;
@@ -1,7 +1,7 @@
1
1
  /**
2
- * DSH_HOME resolution shared by the plugin family's Host halves: the
3
- * environment override wins, the platform home fallback follows. Mirrors
4
- * what dsh-pet and dsh-liangshen each used to implement locally.
2
+ * DSH_HOME and DSH_AGENTS_HOME resolution shared by the plugin family's Host
3
+ * halves: environment overrides win (blank values treated as unset), then the
4
+ * platform home fallbacks follow — mirroring `@deepseek-ai/dsh-home-paths`.
5
5
  */
6
6
  /** Expand a leading ~ (or ~user) in a path, platform-style. */
7
7
  export declare function expandHome(path: string, home?: string): string;
@@ -14,3 +14,13 @@ export declare function expandHome(path: string, home?: string): string;
14
14
  export declare function resolveDshHome(env?: NodeJS.ProcessEnv, home?: string): string;
15
15
  /** Resolve the DSH home directory from the live environment. */
16
16
  export declare function dshHome(): string;
17
+ /**
18
+ * Resolve the shared agent configuration root (`$DSH_AGENTS_HOME`, defaulting
19
+ * to `<home>/.agents`), matching `@deepseek-ai/dsh-home-paths`'s `resolveAgentsHome`.
20
+ * @param env - process environment to read DSH_AGENTS_HOME from.
21
+ * @param home - platform home directory fallback (test seam).
22
+ * @returns the absolute shared agents home path.
23
+ */
24
+ export declare function resolveAgentsHome(env?: NodeJS.ProcessEnv, home?: string): string;
25
+ /** Resolve the shared agent configuration root from the live environment. */
26
+ export declare function agentsHome(): string;
@@ -56,11 +56,15 @@ export interface SectionScopeContext {
56
56
  scope?: unknown;
57
57
  }
58
58
  /**
59
- * Build a section provider that renders \`text\` only while at least one of
60
- * \`toolNames\` is visible to the rendering scope.
59
+ * Build a section provider that renders `text` only while at least one of
60
+ * `toolNames` is visible to the rendering scope.
61
61
  *
62
62
  * The native convention: a tool that a restriction, a preset, or a missing
63
63
  * registry removed must not leave guidance behind telling the model to call it.
64
+ * Under a 0.2.3-alpha.3+ PTC root registry (`PtcToolRegistry`), `tools.get(name,
65
+ * scope)` exposes only the `run_code` transport while binding registered tools
66
+ * inside programs; when `run_code` is active in the rendering scope, fall back
67
+ * to checking the unscoped registry so guidance does not vanish under PTC.
64
68
  * An unreadable registry renders the text unchanged — guidance that outlives a
65
69
  * momentary read failure is recoverable; guidance for a tool that is gone is
66
70
  * not.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@linxin666/dsh-ssh",
3
3
  "description": "Remote SSH operations for the dsh web GUI: host config store (~/.dsh/dsh-ssh.json, import from ~/.ssh/config), a persistent ssh2 connection pool with jump-host support, exec / PTY web terminal / SFTP transfer / local port-forward tunnels / cluster execution, plus agent tools (ssh_list, ssh_exec, ssh_upload, ssh_download, ssh_tunnel, ssh_cluster). Hot-pluggable — mounted via ~/.dsh/cordis.patch.yml + a profile node_modules symlink, no dsh source changes.",
4
- "version": "0.4.22",
4
+ "version": "0.4.23",
5
5
  "icon": "icon.svg",
6
6
  "type": "module",
7
7
  "engines": {
@@ -25,7 +25,7 @@
25
25
  },
26
26
  "dsh": {
27
27
  "engines": {
28
- "dsh": ">=0.2.3-alpha.2"
28
+ "dsh": ">=0.2.3-alpha.4"
29
29
  },
30
30
  "bundle": {
31
31
  "patch": "./cordis.patch.yml"
@@ -41,42 +41,42 @@
41
41
  }
42
42
  },
43
43
  "dependencies": {
44
- "@deepseek-ai/schemastery": "~3.20.0-alpha.1",
44
+ "@deepseek-ai/schemastery": "~3.20.0-alpha.3",
45
45
  "@xterm/addon-fit": "^0.11.0",
46
46
  "@xterm/xterm": "^6.0.0",
47
47
  "ssh2": "^1.17.0",
48
48
  "ws": "^8.18.0"
49
49
  },
50
50
  "peerDependencies": {
51
- "@deepseek-ai/dsh": ">=0.2.3-alpha.2",
52
- "react": "^18.2.0",
53
- "react-dom": "^18.2.0"
51
+ "@deepseek-ai/dsh": ">=0.2.3-alpha.4",
52
+ "react": "^19.3.1",
53
+ "react-dom": "^19.3.1"
54
54
  },
55
55
  "devDependencies": {
56
- "@deepseek-ai/cordis": "~4.2.0-alpha.1",
57
- "@deepseek-ai/dsh-client-connection": "^0.2.3-alpha.2",
58
- "@deepseek-ai/dsh-client-locale": "^0.2.3-alpha.2",
59
- "@deepseek-ai/dsh-client-ui-layout": "^0.2.3-alpha.2",
60
- "@deepseek-ai/dsh-client-ui-renderer": "^0.2.3-alpha.2",
61
- "@deepseek-ai/dsh-client-ui-settings": "^0.2.3-alpha.2",
62
- "@deepseek-ai/dsh-client-ui-sidebar": "^0.2.3-alpha.2",
63
- "@deepseek-ai/dsh-client-ui-slots": "^0.2.3-alpha.2",
64
- "@deepseek-ai/dsh-host-webserver": "^0.2.3-alpha.2",
65
- "@deepseek-ai/dsh-llm": "^0.2.3-alpha.2",
66
- "@deepseek-ai/dsh-scope": "^0.2.3-alpha.2",
67
- "@deepseek-ai/dsh-settings": "^0.2.3-alpha.2",
68
- "@deepseek-ai/dsh-system-prompt": "^0.2.3-alpha.2",
69
- "@deepseek-ai/dsh-timeout": "^0.2.3-alpha.2",
70
- "@deepseek-ai/dsh-tools": "^0.2.3-alpha.2",
56
+ "@deepseek-ai/cordis": "~4.2.0-alpha.3",
57
+ "@deepseek-ai/dsh-client-connection": "^0.2.3-alpha.4",
58
+ "@deepseek-ai/dsh-client-locale": "^0.2.3-alpha.4",
59
+ "@deepseek-ai/dsh-client-ui-layout": "^0.2.3-alpha.4",
60
+ "@deepseek-ai/dsh-client-ui-renderer": "^0.2.3-alpha.4",
61
+ "@deepseek-ai/dsh-client-ui-settings": "^0.2.3-alpha.4",
62
+ "@deepseek-ai/dsh-client-ui-sidebar": "^0.2.3-alpha.4",
63
+ "@deepseek-ai/dsh-client-ui-slots": "^0.2.3-alpha.4",
64
+ "@deepseek-ai/dsh-host-webserver": "^0.2.3-alpha.4",
65
+ "@deepseek-ai/dsh-llm": "^0.2.3-alpha.4",
66
+ "@deepseek-ai/dsh-scope": "^0.2.3-alpha.4",
67
+ "@deepseek-ai/dsh-settings": "^0.2.3-alpha.4",
68
+ "@deepseek-ai/dsh-system-prompt": "^0.2.3-alpha.4",
69
+ "@deepseek-ai/dsh-timeout": "^0.2.3-alpha.4",
70
+ "@deepseek-ai/dsh-tools": "^0.2.3-alpha.4",
71
71
  "@types/node": "^22.20.0",
72
- "@types/react": "~18.3.1",
73
- "@types/react-dom": "^18.3.5",
72
+ "@types/react": "~19.3.2",
73
+ "@types/react-dom": "~19.3.0",
74
74
  "@types/ssh2": "^1.15.5",
75
75
  "@types/ws": "^8.5.13",
76
76
  "@vitest/coverage-v8": "^4.1.11",
77
77
  "jsdom": "^25.0.0",
78
- "react": "^18.3.1",
79
- "react-dom": "^18.3.1",
78
+ "react": "^19.3.1",
79
+ "react-dom": "^19.3.1",
80
80
  "tsdown": "0.22.2",
81
81
  "typescript": "~5.7.2",
82
82
  "vitest": "^4.1.11"
@@ -18,10 +18,11 @@ import type {} from '@deepseek-ai/dsh-client-ui-settings/client'
18
18
  // Type-only: pulls the ctx.slots merge (the renderer owns the slot registry since 0.1.2).
19
19
  import type {} from '@deepseek-ai/dsh-client-ui-renderer/client'
20
20
  // Type-only: pulls the LocaleNamespaceMap merge table.
21
- import type {} from '@deepseek-ai/dsh-client-ui-slots'
21
+ import type {} from '@deepseek-ai/dsh-client-ui-slots/client'
22
22
  import { SshApi } from './api.ts'
23
23
  import { en, zh, type SshKey } from './locales.ts'
24
24
  import { registerSshPanel } from './native-panel.tsx'
25
+ import { registerSshSessionActivity } from './session-activity.tsx'
25
26
  import { PanelController, SSH_PANEL_ID } from './panel/controller.ts'
26
27
  import type { TerminalFontSource } from './panel/helpers.ts'
27
28
  import { setRuntimeTranslate } from './panel/helpers.ts'
@@ -46,7 +47,7 @@ interface SshClientSettings {
46
47
  /** The one field this plugin's own Config schema declares (its entry identity on the shared settings surface). */
47
48
  const TERMINAL_FONT_FIELD = 'terminalFontFamily' satisfies keyof SshClientSettings
48
49
 
49
- declare module '@deepseek-ai/dsh-client-ui-slots' {
50
+ declare module '@deepseek-ai/dsh-client-ui-slots/client' {
50
51
  interface LocaleNamespaceMap {
51
52
  /** dsh-ssh surface copy. */
52
53
  'dsh-ssh': SshKey
@@ -120,6 +121,7 @@ export function apply(ctx: ClientContext): void {
120
121
  const disposers: Array<() => void> = []
121
122
  try {
122
123
  disposers.push(registerSshPanel(ctx, controller, api, terminalFont))
124
+ disposers.push(registerSshSessionActivity(ctx, controller))
123
125
  // The layout's panel selection is reconciled back into the controller, so
124
126
  // the panel follows the user clicking another panel row.
125
127
  const layoutFace = (ctx as unknown as { get?(name: string): unknown }).get?.('layout') as { panelInfo?: { subscribe(listener: () => void): () => void; getSnapshot(): { activePanelId: unknown } } } | undefined
@@ -4,6 +4,7 @@
4
4
 
5
5
  export const zh = {
6
6
  'entry.label': 'SSH',
7
+ 'activity.title': 'SSH 连接',
7
8
  'entry.tooltip': '远程 SSH 运维面板',
8
9
  'panel.title': '远程 SSH',
9
10
  'panel.backToConversation': '返回会话',
@@ -148,6 +149,7 @@ export const zh = {
148
149
  'transfer.done': '完成:{bytes} 字节',
149
150
  'transfer.failed': '传输失败:{error}',
150
151
  'transfer.browseRemote': '浏览远程目录',
152
+ 'transfer.pickDirectory': '选择目录…',
151
153
  'transfer.refresh': '刷新',
152
154
  'transfer.name': '名称',
153
155
  'transfer.upLevel': '上级目录',
@@ -206,6 +208,7 @@ export const zh = {
206
208
 
207
209
  export const en: Record<keyof typeof zh, string> = {
208
210
  'entry.label': 'SSH',
211
+ 'activity.title': 'SSH',
209
212
  'entry.tooltip': 'Remote SSH operations panel',
210
213
  'panel.title': 'Remote SSH',
211
214
  'panel.backToConversation': 'Back to chat',
@@ -345,6 +348,7 @@ export const en: Record<keyof typeof zh, string> = {
345
348
  'transfer.done': 'Done: {bytes} bytes',
346
349
  'transfer.failed': 'Transfer failed: {error}',
347
350
  'transfer.browseRemote': 'Browse remote',
351
+ 'transfer.pickDirectory': 'Pick folder…',
348
352
  'transfer.refresh': 'Refresh',
349
353
  'transfer.name': 'Name',
350
354
  'transfer.upLevel': 'Parent directory',