DeepSeek Harness Tauri 桌面版 | Only 8mb installer, zero environment setup, preset plugins, Windows / macOS / Linux.
refactor(ssh): 合并 dsh-tauri-ssh-ui 进 dsh-tauri-ssh 并把 E2E 收敛为单文件
hairyf355018f7e294
diff --git a/archive/docs/plugins/ssh-cordis.patch.example.md b/archive/docs/plugins/ssh-cordis.patch.example.mddeleted file mode 100644index c0c38fa3..00000000--- a/archive/docs/plugins/ssh-cordis.patch.example.md+++ /dev/null@@ -1,116 +0,0 @@-# dsh-remote 插件安装补丁(cordis.patch.yml 示例)--> 本文档自 dsh-tauri-plugins 仓库随插件源码迁入,描述把 `dsh-tauri-ssh`(+`-ui`)-> 手工装进**独立 DSH 检出 / 运行中的 DSH 实例**的补丁写法。在桌面仓库内这两包-> 已是内置插件(`packages/dsh-tauri-ssh`、`packages/dsh-tauri-ssh-ui`),随-> `build:plugins` 打包、由 internal 机制自动装载,无需按下文手工接线;下文仅-> 在脱离桌面仓库单独分发插件时需要。--把下面的 `- insert:` 块追加到 DSH 检出的-`packages/bundle/web-app/cordis.patch.yml`(文件末尾即可,追加多个-`- insert:` 块是合法的)。`ssh-remote` 是宿主内核(设置命名空间 +-同源 `/api-ssh` 连接面,连接与机器发现都读本机 `~/.ssh`),`ui-ssh` 是-设置页(`dsh.client` 行,浏览器半边由 `client-modules` 节点半边扫描进-`window.__DSH_BOOT__` 并按 `/plugins/ui-ssh/client.js` 提供)。--```yaml-# ── dsh-remote:SSH 远程机器 ──────────────────────────────────────────────--- insert:- # 连接内核:settings 命名空间 + 同源 /api-ssh 路由(依赖 base 层的- # settings 与 webServer 服务)。config 全部可省略,省略时使用 schema 默认值。- - id: ssh-remote- name: dsh-tauri-ssh- config:- connectTimeoutMs: 15000- healthCheckTimeoutMs: 3000- healthPollIntervalMs: 1000- healthPollAttempts: 30- # sshDir: '~/.ssh' # 可选:凭据目录覆盖(config 与身份文件所在)- # remotePort: 3080 # 可选:未覆盖机器的默认远端 dsh web 端口- # startCommand: '$HOME/.local/bin/dsh web --host 127.0.0.1 --port {port}'- # # 可选:默认启动命令模板({port} 替换);远端 PATH 无 dsh 时填绝对路径- # installRepo: 'dsh-tauri-desk/deepseek-harness-pkg'- # # 可选:一键安装的发行仓(owner/name 或 GitHub URL):远端安装走- # # 二进制分发——从该仓 releases 下载打包运行时(Node + DSH,- # # SHA-256 校验);默认即官方发行仓,自有镜像/镜像仓填这里- # installRef: '0.1.5-rc.2'- # # 可选:版本钉(semver 或完整 release tag,如- # # 'dsh-0.1.5-rc.2-34495473237';默认取推荐版本,解析失败回退- # # 最新稳定 release)- # installTimeoutMs: 1800000 # 可选:一次远端安装的截止时间(毫秒)-- # 设置页:浏览器插件注册表行(dsh.client 声明在包内 package.json)。- - id: ui-ssh- name: dsh-tauri-ssh-ui-```--注意:`ssh-remote` 行依赖 `settings`/`webServer`,它们由 base 补丁的行提供;-`ui-ssh` 行依赖 `slots`/`locale`,由 web-app 补丁的行提供 ——-两个插件都放在 web-app 补丁里即可(web-app 覆盖 base)。--> **关键**:新插件的行**必须**写在 `- insert:` 块里。只写 `- id: x` 的裸行-> 只对**已存在**的 id 生效(覆盖配置);id 不存在时 loader 会静默丢弃该行-> (实测确认)。--### 方式 B:运行中的 DSH 安装(零源码改动,推荐个人环境)--不需要动 DSH 检出 —— 和已有的 `dsh-better-sidebar` 一样,通过 profile 安装:--1. 把两个包放到任意目录(例如本仓库 `packages/` 下);-2. `~/.dsh/profiles/web/package.json` 的 `dependencies` 增加两条 `link:` 依赖:-```json-{- "dsh-tauri-ssh": "link:<desktop-repo>/packages/dsh-tauri-ssh",- "dsh-tauri-ssh-ui": "link:<desktop-repo>/packages/dsh-tauri-ssh-ui"-}-```-3. `~/.dsh/profiles/web/cordis.patch.yml` 追加:-```yaml-- insert:- - id: ssh-remote- name: dsh-tauri-ssh- - id: ui-ssh- name: dsh-tauri-ssh-ui-```-4. `cd ~/.dsh/profiles/web && pnpm install`;-5. 构建插件产物(`dist/`):在本仓库运行- `pnpm --filter dsh-tauri-ssh --filter dsh-tauri-ssh-ui run build`;-6. `dsh web` → 设置 → SSH 机器。--> 版本要求:`dsh-tauri-ssh-ui` 的 `dsh.client.inject` 面向-> **dsh ≥ 0.1.2-alpha.1**(`slots` 服务由 `dsh-client-ui-renderer` 提供),-> 本仓库当前对齐 **0.1.5-rc.2**(远端 bootstrap 的-> `RECOMMENDED_DSH_VERSION` 与桌面 `version-recommend.json` 同步钉定)。-> 更早版本(≤ 0.1.1-rc.2)需把该行换回 `@deepseek-ai/dsh-client-runtime`。--同时需要:--1. **包位置**:把 `packages/dsh-tauri-ssh` 复制为- `<dsh>/packages/host/dsh-tauri-ssh`,把 `packages/dsh-tauri-ssh-ui` 复制为- `<dsh>/packages/client/dsh-tauri-ssh-ui`。工作区 glob `packages/*/*` 会自动收录。--2. **pnpm-workspace.yaml**:在 DSH 检出的 `pnpm-workspace.yaml` 的- `allowBuilds:` 里追加两行(ssh2 的安装脚本在纯 JS 回退下不需要执行):-- ```yaml- allowBuilds:- ssh2: false- cpu-features: false- ```--3. **类型检查接线**(`tsc -b` 构建顺序):- - `tsconfig.host.json` 的 `references` 数组追加- `{ "path": "./packages/host/dsh-tauri-ssh" }`;- - `tsconfig.client.json` 的 `references` 数组追加- `{ "path": "./packages/client/dsh-tauri-ssh-ui" }`。--4. 构建并启动:-- ```bash- pnpm install- pnpm run build:lib- dsh web # 或 pnpm run dev:web- ```--5. 打开 Web UI → 设置 → SSH 机器,添加机器、测试、连接、打开。diff --git a/eslint.config.mjs b/eslint.config.mjsindex 019dbe2a..a72fd04f 100644--- a/eslint.config.mjs+++ b/eslint.config.mjs@@ -18,7 +18,7 @@ export default antfu({// genapi 产物:格式由生成器(prettier 默认)决定,不由项目 eslint 规约'packages/*/src/client/apis/index.ts','packages/*/src/client/apis/index.type.ts',- // 插件 Tailwind 产物:由 scripts/build-taiwindcss.ts 生成,转义后的选择器与体积+ // 插件 Tailwind 产物:由 packages/dsh-tauri-taiwindcss/scripts/taiwindcss.ts 生成,转义后的选择器与体积// 都不适合本仓 lint 规约'packages/*/src/client/styles/taiwindcss.ts',],diff --git a/package.json b/package.jsonindex 8cc8e52d..388a11a0 100644--- a/package.json+++ b/package.json@@ -12,7 +12,7 @@"prebuild": "pnpm build:plugins","build": "tsc && vite build","build:plugins": "tsx scripts/build-plugins.ts",- "build:taiwindcss": "tsx scripts/build-taiwindcss.ts",+ "build:taiwindcss": "tsx packages/dsh-tauri-taiwindcss/scripts/taiwindcss.ts","build:debug": "tsx scripts/build-debug.ts","genapi": "genapi","preview": "vite preview",@@ -93,6 +93,7 @@"@types/react": "catalog:types","@types/react-dom": "catalog:types","@types/semver": "catalog:types",+ "@types/ssh2": "catalog:types","@vitejs/plugin-react": "catalog:build","@vitest/coverage-v8": "catalog:testing","@wdio/tauri-service": "catalog:testing",@@ -110,6 +111,7 @@"playwright": "catalog:testing","postcss": "catalog:build","publint": "catalog:cli",+ "ssh2": "catalog:utils","tailwindcss": "catalog:build","tinyexec": "catalog:utils","tsx": "catalog:build",diff --git a/packages/dsh-tauri-bundle/package.json b/packages/dsh-tauri-bundle/package.jsonindex 606e357d..393d6a55 100644--- a/packages/dsh-tauri-bundle/package.json+++ b/packages/dsh-tauri-bundle/package.json@@ -11,9 +11,8 @@"dsh-tauri-rightclick": "workspace:*","dsh-tauri-running-changes": "workspace:*","dsh-tauri-session": "workspace:*",- "dsh-tauri-taiwindcss": "workspace:*","dsh-tauri-ssh": "workspace:*",- "dsh-tauri-ssh-ui": "workspace:*",+ "dsh-tauri-taiwindcss": "workspace:*","dsh-tauri-ui": "workspace:*","dsh-tauri-worktree": "workspace:*"}diff --git a/packages/dsh-tauri-ssh-ui/cordis.patch.yml b/packages/dsh-tauri-ssh-ui/cordis.patch.ymldeleted file mode 100644index 2439cd4b..00000000--- a/packages/dsh-tauri-ssh-ui/cordis.patch.yml+++ /dev/null@@ -1,3 +0,0 @@-- insert:- - id: ui-ssh- name: dsh-tauri-ssh-uidiff --git a/packages/dsh-tauri-ssh-ui/package.json b/packages/dsh-tauri-ssh-ui/package.jsondeleted file mode 100644index 91b79366..00000000--- a/packages/dsh-tauri-ssh-ui/package.json+++ /dev/null@@ -1,87 +0,0 @@-{- "name": "dsh-tauri-ssh-ui",- "type": "module",- "version": "0.6.7",- "description": "DSH remote-machine client plugin: the Settings page for SSH machines (CRUD through the settings API, connect/test/disconnect and Open through the plugin's /api-ssh route)",- "author": "Hairyf <[email protected]>",- "license": "MIT",- "homepage": "https://github.com/dsh-tauri-desk/deepseek-harness-desktop/tree/main/packages/dsh-tauri-ssh-ui",- "repository": {- "type": "git",- "url": "git+https://github.com/dsh-tauri-desk/deepseek-harness-desktop.git"- },- "bugs": {- "url": "https://github.com/dsh-tauri-desk/deepseek-harness-desktop/issues"- },- "keywords": [- "dsh",- "plugin",- "dsh-plugin",- "ssh",- "settings",- "tauri",- "deepseek-harness"- ],- "sideEffects": false,- "exports": {- ".": "./dist/index.js",- "./client": "./dist/client.cjs",- "./package.json": "./package.json"- },- "main": "./dist/index.js",- "module": "./dist/index.js",- "types": "./dist/index.d.ts",- "files": [- "cordis.patch.yml",- "dist"- ],- "dsh": {- "client": {- "inject": [- "@deepseek-ai/dsh-client-ui-renderer",- "@deepseek-ai/dsh-client-ui-settings",- "@deepseek-ai/dsh-client-ui-primitives",- "@deepseek-ai/dsh-client-locale",- "dsh-tauri",- "dsh-tauri-ui"- ],- "external": [- "dsh-tauri/client",- "dsh-tauri-ui/client"- ],- "platform": "web"- },- "bundle": {- "patch": "./cordis.patch.yml"- }- },- "scripts": {- "build": "tsdown",- "dev": "tsdown --watch",- "prepublishOnly": "nr build",- "start": "tsx src/index.ts",- "test": "vitest run",- "typecheck": "tsc"- },- "dependencies": {- "dsh-tauri": "workspace:*",- "dsh-tauri-ui": "workspace:*"- },- "devDependencies": {- "@deepseek-ai/dsh-client-ui-primitives": "catalog:dsh",- "@testing-library/dom": "catalog:testing",- "@testing-library/react": "catalog:testing",- "@types/node": "catalog:types",- "@types/react": "catalog:types",- "@types/react-dom": "catalog:types",- "anser": "catalog:",- "dsh-tauri-tsdown": "workspace:*",- "jsdom": "catalog:testing",- "react": "catalog:runtime",- "react-dom": "catalog:runtime",- "shiki": "catalog:",- "tsdown": "catalog:cli",- "typescript": "catalog:cli",- "vitest": "catalog:testing"- }-}diff --git a/packages/dsh-tauri-ssh-ui/src/index.ts b/packages/dsh-tauri-ssh-ui/src/index.tsdeleted file mode 100644index b79c7310..00000000--- a/packages/dsh-tauri-ssh-ui/src/index.ts+++ /dev/null@@ -1,10 +0,0 @@-/**- * The DSH remote-machine client plugin: the SSH-machines settings page. The- * browser half lives in `./client` (locale dictionary + one- * `settings.section` slot); this entry is the host-side loader stub — no- * host-side behavior, the SSH kernel is the `dsh-tauri-ssh` host plugin.- * @module dsh-tauri-ssh-ui- */--/** Host plugin body — no host-side behavior; the SSH kernel is the ssh-remote host plugin. */-export function apply(): void {}diff --git a/packages/dsh-tauri-ssh-ui/tsconfig.json b/packages/dsh-tauri-ssh-ui/tsconfig.jsondeleted file mode 100644index 789c0a3b..00000000--- a/packages/dsh-tauri-ssh-ui/tsconfig.json+++ /dev/null@@ -1,12 +0,0 @@-{- "extends": "../../tsconfig.json",- "compilerOptions": {- "target": "es2024",- "lib": ["ES2024", "DOM", "DOM.Iterable"],- "types": ["node"],- "exactOptionalPropertyTypes": true,- "noImplicitOverride": true,- "noUncheckedIndexedAccess": true- },- "include": ["src/**/*.ts", "src/**/*.tsx", "../../types/**/*.d.ts"]-}diff --git a/packages/dsh-tauri-ssh-ui/tsdown.config.ts b/packages/dsh-tauri-ssh-ui/tsdown.config.tsdeleted file mode 100644index 3280fec7..00000000--- a/packages/dsh-tauri-ssh-ui/tsdown.config.ts+++ /dev/null@@ -1,5 +0,0 @@-import { defineDshConfig } from '../dsh-tauri-tsdown/src/index.ts'--// Host stub (src/index.ts) + browser client bundle (src/client/index.ts)-// wrapped in the dsh-client-modules closure factory.-export default defineDshConfig()diff --git a/packages/dsh-tauri-ssh-ui/vitest.config.ts b/packages/dsh-tauri-ssh-ui/vitest.config.tsdeleted file mode 100644index 1a826970..00000000--- a/packages/dsh-tauri-ssh-ui/vitest.config.ts+++ /dev/null@@ -1,31 +0,0 @@-import { fileURLToPath } from 'node:url'-import { defineConfig } from 'vitest/config'--/**- * The section components render the official UI primitives, whose package- * ships real `.module.css` sidecars and (under pnpm) a nested react@18 —- * while this package develops against the workspace react. In the deployed- * ModuleLoader there is exactly one platform react for both; these test-time- * settings recreate that: the primitives package is inlined so Vite can- * process its CSS imports, and every react specifier is pinned to the- * workspace copy so jsdom mounts one renderer, not two.- */-const reactRoot = fileURLToPath(new URL('../../node_modules/react', import.meta.url))--export default defineConfig({- resolve: {- alias: [- { find: /^react$/, replacement: reactRoot },- { find: /^react\/jsx-runtime$/, replacement: `${reactRoot}/jsx-runtime.js` },- { find: /^react\/jsx-dev-runtime$/, replacement: `${reactRoot}/jsx-dev-runtime.js` },- ],- },- test: {- css: true,- server: {- deps: {- inline: [/@deepseek-ai\/dsh-client-ui-primitives/],- },- },- },-})diff --git a/packages/dsh-tauri-ssh/e2e.vitest.config.ts b/packages/dsh-tauri-ssh/e2e.vitest.config.tsdeleted file mode 100644index 7dfc8466..00000000--- a/packages/dsh-tauri-ssh/e2e.vitest.config.ts+++ /dev/null@@ -1,17 +0,0 @@-import { defineConfig } from 'vitest/config'--/**- * E2E runner: real network round trips (a reachable linux x64 SSH machine,- * local unreachable ports, an in-process ssh2 protocol server). Deliberately- * separate from the unit suite — `pnpm test` never picks these up.- */-export default defineConfig({- test: {- include: ['e2e/**/*.e2e.ts'],- testTimeout: 240_000,- hookTimeout: 240_000,- // One file at a time: the drop test owns the shared dev machine's- // session processes and its remote port.- fileParallelism: false,- },-})diff --git a/packages/dsh-tauri-ssh/e2e/give-up.e2e.ts b/packages/dsh-tauri-ssh/e2e/give-up.e2e.tsdeleted file mode 100644index 0c55d94a..00000000--- a/packages/dsh-tauri-ssh/e2e/give-up.e2e.ts+++ /dev/null@@ -1,71 +0,0 @@-/**- * E2E #2 — backoff rhythm and the give-up terminal state, driven by a- * persistently unreachable local port (nothing listens on 127.0.0.1:1).- * Records every event timestamp so the exponential schedule is readable in- * the evidence log.- * @module dsh-tauri-ssh/e2e/give-up- */--import type { MachineProfile } from '../src/host/types/index'-import { describe, expect, it } from 'vitest'-import { bootHarness, id, waitFor } from './helpers'--const profile: MachineProfile = {- id: id('unreachable'),- name: 'unreachable',- host: '127.0.0.1',- port: 1,- user: 'root',- remotePort: 3080,-}--describe('e2e give-up (local unreachable port)', () => {- it('retries on an exponential schedule, then lands in given-up', async () => {- const harness = bootHarness({- connectTimeoutMs: 2_000,- reconnectInitialDelayMs: 300,- reconnectMaxDelayMs: 1_200,- reconnectMaxAttempts: 4,- })- const { manager } = harness- try {- manager.refreshProfiles(new Map([[profile.id, profile]]))-- // The first failure rejects the caller's connect; the loop continues.- await expect(manager.connect(profile.id)).rejects.toThrow()- await waitFor(() => manager.status(profile.id).state === 'given-up', 'give-up', 30_000)-- const status = manager.status(profile.id)- expect(status.state).toBe('given-up')- expect(status.nextRetryAt).toBeUndefined()- expect(status.lastError).toMatch(/connect failed after 5 attempt\(s\)/u)- expect(status.lastError).toMatch(/host unreachable/u)-- // The retry schedule from the event log: one auth failure per attempt,- // one reconnect line per scheduled retry, gaps growing 300→600→1200→1200.- const retryLines = harness.evidence.filter(line => line.text.includes('event reconnect: retrying'))- const gaps: number[] = []- let previous: number | undefined- for (const line of retryLines) {- if (previous !== undefined)- gaps.push(line.at - previous)- previous = line.at- }- harness.log(`retry gaps: ${gaps.join(', ')} ms`)- expect(gaps.length).toBeGreaterThanOrEqual(3)- for (const gap of gaps)- expect(gap).toBeGreaterThan(0)- // Each gap at least as long as the previous one (the schedule only- // grows, capped at 1.2 s; small scheduling jitter tolerated).- for (let i = 1; i < gaps.length; i++)- expect(gaps[i]!).toBeGreaterThanOrEqual(gaps[i - 1]! - 50)-- // A manual disconnect after give-up is a different, clean terminal.- await manager.disconnect(profile.id)- expect(manager.status(profile.id).state).toBe('disconnected')- }- finally {- await harness.dispose()- }- }, 120_000)-})diff --git a/packages/dsh-tauri-ssh/e2e/helpers.ts b/packages/dsh-tauri-ssh/e2e/helpers.tsdeleted file mode 100644index aa9334f8..00000000--- a/packages/dsh-tauri-ssh/e2e/helpers.ts+++ /dev/null@@ -1,144 +0,0 @@-/**- * Shared scaffolding for the E2E suite: a real SshManager over the real- * ssh2 transport and the host's own `~/.ssh`, with timestamped evidence- * logging of every status/event emission.- * @module dsh-tauri-ssh/e2e/helpers- */--import type { SshMachineStage, SshMachineTerminal } from '../src/host/types/index'-import { generateKeyPairSync } from 'node:crypto'-import { mkdtempSync } from 'node:fs'-import { homedir, tmpdir } from 'node:os'-import { join } from 'pathe'-import { SshMachineEvents } from '../src/host/service/events'-import { KnownHostsStore } from '../src/host/service/host-keys'-import { SshManager } from '../src/host/service/manager'-import { SshConfigResolver } from '../src/host/service/ssh-config'-import { Ssh2Transport } from '../src/host/service/transport'-import { MachineId } from '../src/host/types/index'--/**- * The machine event channel with evidence logging: every appended line is- * echoed into the harness log (`event <stage>[/<terminal>]: <line>`) before- * it lands in the ring buffer, so spec files can grep the emitted stream.- */-class LoggingMachineEvents extends SshMachineEvents {- constructor(private readonly log: (text: string) => void) {- super()- }-- override append(machineId: MachineId, stage: SshMachineStage, line: string, options: { terminal?: SshMachineTerminal, reason?: string } = {}) {- this.log(`event ${stage}${options.terminal === undefined ? '' : `/${options.terminal}`}: ${line}`)- return super.append(machineId, stage, line, options)- }-}--/** One timestamped evidence line. */-export interface EvidenceLine {- at: number- text: string-}--/** The E2E harness: manager plus captured evidence. */-export interface Harness {- manager: SshManager- evidence: EvidenceLine[]- log: (text: string) => void- dispose: () => Promise<void>-}--/** A monotonic-ish wall clock in epoch ms. */-export function now(): number {- return Date.now()-}--/** One freshly generated RSA key in PKCS#1 PEM form (what ssh2 parses natively). */-export function freshRsaPem(): string {- const { privateKey } = generateKeyPairSync('rsa', { modulusLength: 2048 })- return String(privateKey.export({ format: 'pem', type: 'pkcs1' }))-}--/**- * Boot one real-transport manager with scratch TOFU storage and the given- * connect/reconnect timing, logging every status and event emission with a- * timestamp.- */-export function bootHarness(options: {- connectTimeoutMs?: number- keepaliveIntervalMs?: number- keepaliveCountMax?: number- reconnectInitialDelayMs?: number- reconnectMaxDelayMs?: number- reconnectMaxAttempts?: number- healthPollIntervalMs?: number- healthPollAttempts?: number- sshDir?: string-} = {}): Harness {- const evidence: EvidenceLine[] = []- const t0 = now()- const log = (text: string): void => {- const line = { at: now(), text }- evidence.push(line)- // eslint-disable-next-line no-console -- the E2E evidence log is the point- console.log(`[+${(line.at - t0).toString().padStart(6)}ms] ${text}`)- }- const root = mkdtempSync(join(tmpdir(), 'dsh-ssh-e2e-'))- const manager = new SshManager({- transport: new Ssh2Transport(- options.connectTimeoutMs ?? 15_000,- // The host's real ~/.ssh: config aliases and identity files, exactly- // what the plugin in the desktop app would resolve against.- new SshConfigResolver(options.sshDir ?? join(homedir(), '.ssh'), homedir()),- {- keepaliveIntervalMs: options.keepaliveIntervalMs ?? 3_000,- keepaliveCountMax: options.keepaliveCountMax ?? 3,- },- ),- knownHosts: new KnownHostsStore(join(root, 'known-hosts.json')),- config: {- connectTimeoutMs: options.connectTimeoutMs ?? 15_000,- healthCheckTimeoutMs: 3_000,- healthPollIntervalMs: options.healthPollIntervalMs ?? 500,- healthPollAttempts: options.healthPollAttempts ?? 30,- keepaliveIntervalMs: options.keepaliveIntervalMs ?? 3_000,- keepaliveCountMax: options.keepaliveCountMax ?? 3,- reconnectInitialDelayMs: options.reconnectInitialDelayMs ?? 1_000,- reconnectMaxDelayMs: options.reconnectMaxDelayMs ?? 5_000,- reconnectMaxAttempts: options.reconnectMaxAttempts ?? 6,- },- events: new LoggingMachineEvents(log),- emitStatus: (id, status) => {- const hints = [- status.state,- ...status.tunnelBaseUrl === undefined ? [] : [`tunnel=${status.tunnelBaseUrl}`],- ...status.nextRetryAt === undefined ? [] : [`nextRetryAt=+${status.nextRetryAt - now()}ms`],- ...status.authMethod === undefined ? [] : [`auth=${status.authMethod}`],- ...status.lastError === undefined ? [] : [`lastError=${status.lastError}`],- ]- log(`status ${String(id)}: ${hints.join(' ')}`)- },- })- return {- manager,- evidence,- log,- dispose: async () => {- await manager.dispose()- },- }-}--/** Wait until the predicate holds or the deadline passes (step-probe wait). */-export async function waitFor(predicate: () => boolean, label: string, timeoutMs = 30_000): Promise<void> {- const deadline = now() + timeoutMs- while (!predicate()) {- if (now() > deadline)- throw new Error(`timed out waiting for ${label}`)- await new Promise(resolve => setTimeout(resolve, 100))- }-}--/** Brand a machine id. */-export function id(name: string): ReturnType<typeof MachineId> {- return MachineId(name)-}diff --git a/packages/dsh-tauri-ssh/e2e/password-chain.e2e.ts b/packages/dsh-tauri-ssh/e2e/password-chain.e2e.tsdeleted file mode 100644index 3dbb2239..00000000--- a/packages/dsh-tauri-ssh/e2e/password-chain.e2e.ts+++ /dev/null@@ -1,155 +0,0 @@-/**- * E2E #3 — password authentication over a real SSH protocol round trip.- *- * Environment note: no OS sshd with password login is reachable from this- * host (local port 22 closed, no docker, and the shared root dev machine's- * sshd config must not be touched). The stand-in is a loopback ssh2 protocol- * server that rejects every publickey attempt and accepts exactly one- * password — the full agent→key→password chain, the order evidence- * (server-recorded method sequence), and the three failure classes are all- * exercised over the wire by the real transport.- *- * Downgrade label: OS-sshd password E2E 未验证(环境不可得);本文件为本地- * ssh2 协议服务器替代证据。- * @module dsh-tauri-ssh/e2e/password-chain- */--import type { Connection, Server as SshServer } from 'ssh2'-import type { MachineProfile } from '../src/host/types/index'-import { generateKeyPairSync } from 'node:crypto'-import { mkdtempSync, rmSync, writeFileSync } from 'node:fs'-import { tmpdir } from 'node:os'-import { join } from 'pathe'-import { Server } from 'ssh2'-import { afterAll, beforeAll, describe, expect, it } from 'vitest'-import { bootHarness, id } from './helpers'--const PASSWORD = 'e2e-trustno1'--/** One server-side authentication attempt record. */-interface AuthAttempt {- method: string- accepted: boolean-}--/** The recorded auth attempts and the accepted method, per connection. */-const attempts: AuthAttempt[] = []-let server: SshServer-let serverPort = 0-let scratchSshDir: string--/** One freshly generated RSA key in PKCS#1 PEM form (what ssh2 parses natively). */-function freshPem(): string {- const { privateKey } = generateKeyPairSync('rsa', { modulusLength: 2048 })- return String(privateKey.export({ format: 'pem', type: 'pkcs1' }))-}--beforeAll(async () => {- // A fresh host key pair for the server and one for the client's (rejected)- // identity file.- const hostKey = freshPem()- const clientKey = freshPem()- scratchSshDir = mkdtempSync(join(tmpdir(), 'dsh-ssh-e2e-sshdir-'))- writeFileSync(join(scratchSshDir, 'id_rsa'), clientKey)-- server = new Server({ hostKeys: [hostKey] }, (client: Connection) => {- client.on('authentication', (ctx) => {- if (ctx.method === 'password' && ctx.password === PASSWORD) {- attempts.push({ method: ctx.method, accepted: true })- ctx.accept()- return- }- attempts.push({ method: ctx.method, accepted: false })- ctx.reject(['publickey', 'password'])- })- client.on('session', (accept) => {- const session = accept()- session.on('exec', (acceptExec) => {- const stream = acceptExec()- stream.write('Linux x86_64\n')- stream.exit(0)- stream.end()- })- })- client.on('error', () => {- // Client-side hangups during failure cases surface here; expected.- })- })- await new Promise<void>((resolve) => {- server.listen(0, '127.0.0.1', () => resolve())- })- serverPort = (server.address() as { port: number }).port-})--afterAll(() => {- server.close()- rmSync(scratchSshDir, { recursive: true, force: true })-})--function profileWith(password?: string): MachineProfile {- return {- id: id('password-e2e'),- name: 'password-e2e',- host: '127.0.0.1',- port: serverPort,- user: 'root',- ...password === undefined ? {} : { password },- remotePort: 3080,- }-}--describe('e2e password chain (loopback ssh2 protocol server)', () => {- it('authenticates with the stored password after agent and keys are refused', async () => {- attempts.length = 0- const harness = bootHarness({ sshDir: scratchSshDir, connectTimeoutMs: 5_000 })- try {- const profile = profileWith(PASSWORD)- harness.manager.refreshProfiles(new Map([[profile.id, profile]]))- const result = await harness.manager.test(profile.id)- expect(result).toEqual({ ok: true, banner: 'Linux x86_64' })-- // Order evidence: every publickey attempt (agent-sourced and the- // identity file) precedes the accepted password attempt.- const methods = attempts.map(attempt => attempt.method)- harness.log(`server saw auth methods: ${methods.join(' -> ')}`)- expect(methods[methods.length - 1]).toBe('password')- expect(attempts.at(-1)?.accepted).toBe(true)- const passwordIndex = methods.indexOf('password')- expect(methods.slice(0, passwordIndex).every(method => method === 'publickey')).toBe(true)- expect(passwordIndex).toBeGreaterThan(0)- }- finally {- await harness.dispose()- }- })-- it('classifies a wrong stored password as password-rejected', async () => {- attempts.length = 0- const harness = bootHarness({ sshDir: scratchSshDir, connectTimeoutMs: 5_000 })- try {- const profile = profileWith('wrong-password')- harness.manager.refreshProfiles(new Map([[profile.id, profile]]))- const result = await harness.manager.test(profile.id)- expect(result.ok).toBe(false)- expect(result.ok === false && result.message).toMatch(/stored password was rejected/u)- }- finally {- await harness.dispose()- }- })-- it('classifies exhausted keys without a password as key-rejected', async () => {- attempts.length = 0- const harness = bootHarness({ sshDir: scratchSshDir, connectTimeoutMs: 5_000 })- try {- const profile = profileWith()- harness.manager.refreshProfiles(new Map([[profile.id, profile]]))- const result = await harness.manager.test(profile.id)- expect(result.ok).toBe(false)- expect(result.ok === false && result.message).toMatch(/no key or ssh-agent was accepted/u)- }- finally {- await harness.dispose()- }- })-})diff --git a/packages/dsh-tauri-ssh/e2e/reconnect-drop.e2e.ts b/packages/dsh-tauri-ssh/e2e/reconnect-drop.e2e.tsdeleted file mode 100644index c389e33c..00000000--- a/packages/dsh-tauri-ssh/e2e/reconnect-drop.e2e.ts+++ /dev/null@@ -1,132 +0,0 @@-/**- * E2E #1 — drop-driven auto-reconnect on a real linux x64 machine.- *- * Flow: connect to `ssh dev` (a python3 HTTP server stands in for the remote- * `dsh web` instance — the dev host has no Node/dsh and the clone-path- * install cannot run there; the connection/tunnel/poll surface under test is- * identical), verify the tunnel serves HTTP, kill exactly the sshd session- * process serving OUR connection (identified as the one new session worker- * that appeared while connecting; never the listener, never a global- * restart), and watch the manager walk connected → reconnecting → connected- * with the SAME tunnel URL serving HTTP again.- * @module dsh-tauri-ssh/e2e/reconnect-drop- */--import type { MachineProfile } from '../src/host/types/index'-import { execSync } from 'node:child_process'-import { describe, expect, it } from 'vitest'-import { bootHarness, id, waitFor } from './helpers'--const REMOTE_PORT = 3100--const profile: MachineProfile = {- id: id('dev-drop'),- name: 'dev-drop',- host: 'dev',- port: 22,- user: '',- // The remote instance stand-in: any loopback HTTP listener exercises the- // same probe → start → healthy → tunnel path.- startCommand: `python3 -m http.server ${REMOTE_PORT} --bind 127.0.0.1`,- remotePort: REMOTE_PORT,-}--/**- * The dev host's container hides /proc/net from `ss`, so peer-port matching- * is unavailable. Instead: snapshot the sshd session workers (the- * `sshd-session: …@notty` processes, excluding the probe's own session via- * `$PPID` and the privileged parents), and diff around our connect.- */-function sshdSessionWorkers(): Set<number> {- const out = execSync(- `ssh dev 'echo OWN=$PPID; ps -eo pid=,cmd= | grep "[s]shd-session"'`,- { encoding: 'utf8' },- )- const own = Number(out.match(/OWN=(\d+)/u)?.[1] ?? NaN)- const workers = new Set<number>()- for (const line of out.split('\n')) {- const pid = Number(line.trim().match(/^(\d+)\s/u)?.[1] ?? NaN)- if (!Number.isFinite(pid) || pid === own)- continue- if (line.includes('[priv]'))- continue- if (line.includes('@'))- workers.add(pid)- }- return workers-}--describe('e2e reconnect (linux x64 dev machine)', () => {- it('recovers a server-side session kill with the same tunnel URL', async () => {- const harness = bootHarness({ keepaliveIntervalMs: 3_000, reconnectInitialDelayMs: 1_000, reconnectMaxDelayMs: 5_000, reconnectMaxAttempts: 6 })- const { manager, log } = harness- try {- manager.refreshProfiles(new Map([[profile.id, profile]]))-- // 1. Connect and verify the tunnel serves HTTP (the "polling" probe).- const beforeSessions = sshdSessionWorkers()- const link = await manager.connect(profile.id)- expect(manager.status(profile.id).state).toBe('connected')- const afterSessions = sshdSessionWorkers()- const fresh = [...afterSessions].filter(pid => !beforeSessions.has(pid))- const before = await fetch(link.tunnelBaseUrl)- expect(before.status).toBe(200)- log(`tunnel serves HTTP ${before.status} at ${link.tunnelBaseUrl}`)- // A second URL through the same tunnel proves a real HTTP round trip.- const deep = await fetch(`${link.tunnelBaseUrl}/definitely-missing`)- expect(deep.status).toBe(404)-- // 2. Our session worker is exactly the one that appeared during the- // connect; verify what we are about to kill before killing it.- expect(fresh.length).toBe(1)- const pid = fresh[0]!- const cmdOfPid = execSync(`ssh dev "ps -p ${pid} -o cmd="`, { encoding: 'utf8' }).trim()- expect(cmdOfPid, `refusing to kill non-sshd process: ${cmdOfPid}`).toMatch(/sshd-session/iu)- log(`identified session sshd pid=${pid} (${cmdOfPid}) as the connect-window diff`)-- // 3. Kill exactly that process (targeted single PID, no restarts).- execSync(`ssh dev "kill ${pid}"`)- log(`killed session sshd pid=${pid}`)-- // 4. The manager must walk reconnecting → connected on its own.- await waitFor(() => manager.status(profile.id).state === 'reconnecting', 'reconnecting state')- log('observed reconnecting state')- await waitFor(() => manager.status(profile.id).state === 'connected', 'auto-reconnect', 60_000)- const status = manager.status(profile.id)- expect(status.state).toBe('connected')- expect(['agent', 'key']).toContain(status.authMethod)- log(`auto-reconnected (auth=${status.authMethod})`)-- // 5. Same URL, serving again: tunnel rebuilt on the preferred port.- expect(manager.link(profile.id)?.tunnelBaseUrl).toBe(link.tunnelBaseUrl)- const after = await fetch(link.tunnelBaseUrl)- expect(after.status).toBe(200)- log(`tunnel serves HTTP ${after.status} again at the SAME ${link.tunnelBaseUrl}`)-- // 6. Clean teardown; a manual disconnect is `disconnected`, not given-up.- await manager.disconnect(profile.id)- expect(manager.status(profile.id).state).toBe('disconnected')-- // 7. Leave the dev machine as we found it: stop the stand-in listener- // (verify it is our python3 http.server before killing the PID).- const listenerLine = execSync(- `ssh dev "ss -tlnp '( sport = :${REMOTE_PORT} )' | grep ':${REMOTE_PORT} '"`,- { encoding: 'utf8' },- ).trim()- const listenerPid = listenerLine.match(/pid=(\d+)/u)?.[1]- if (listenerPid !== undefined) {- const listenerCmd = execSync(`ssh dev "ps -p ${listenerPid} -o cmd="`, { encoding: 'utf8' }).trim()- if (/http\.server/iu.test(listenerCmd)) {- execSync(`ssh dev "kill ${listenerPid}"`)- log(`stopped stand-in listener pid=${listenerPid} on remote port ${REMOTE_PORT}`)- }- else {- log(`left remote listener pid=${listenerPid} alone (not our http.server: ${listenerCmd})`)- }- }- }- finally {- await harness.dispose()- }- }, 240_000)-})diff --git a/packages/dsh-tauri-ssh/e2e/watchdog.e2e.ts b/packages/dsh-tauri-ssh/e2e/watchdog.e2e.tsdeleted file mode 100644index 445bafb0..00000000--- a/packages/dsh-tauri-ssh/e2e/watchdog.e2e.ts+++ /dev/null@@ -1,149 +0,0 @@-/**- * E2E #4 — the keepalive watchdog on a hung (silent) connection. A local- * proxy stops forwarding bytes in both directions (no FIN, no RST — exactly- * what a NAT/firewall drop looks like); ssh2's keepalive misses its- * heartbeat budget and must declare the session closed, surfacing through- * the session's onClosed callback (the manager's reconnect trigger).- * @module dsh-tauri-ssh/e2e/watchdog- */--import type { Connection, Server as SshServer } from 'ssh2'-import type { MachineProfile } from '../src/host/types/index'-import { mkdtempSync, rmSync, writeFileSync } from 'node:fs'-import { createServer, connect as tcpConnect } from 'node:net'-import { homedir, tmpdir } from 'node:os'-import { join } from 'pathe'-import { Server } from 'ssh2'-import { afterAll, beforeAll, describe, expect, it } from 'vitest'-import { SshConfigResolver } from '../src/host/service/ssh-config'-import { Ssh2Transport } from '../src/host/service/transport'-import { MachineId } from '../src/host/types/index'-import { freshRsaPem } from './helpers'--const PASSWORD = 'e2e-watchdog'-const KEEPALIVE_INTERVAL_MS = 1_000-const KEEPALIVE_COUNT_MAX = 3--let server: SshServer-let serverPort = 0-let scratchSshDir: string--/** The stalling proxy: pipes traffic until `freeze()` silently drops it. */-function startStallingProxy(): Promise<{ port: number, freeze: () => void, close: () => void }> {- const sockets = new Set<{ a: import('node:net').Socket, b: import('node:net').Socket }>()- const proxy = createServer((downstream) => {- const upstream = tcpConnect(serverPort, '127.0.0.1')- const pair = { a: downstream, b: upstream }- sockets.add(pair)- downstream.on('close', () => sockets.delete(pair))- upstream.on('close', () => sockets.delete(pair))- downstream.pipe(upstream)- upstream.pipe(downstream)- downstream.on('error', () => downstream.destroy())- upstream.on('error', () => upstream.destroy())- })- return new Promise((resolve) => {- proxy.listen(0, '127.0.0.1', () => {- resolve({- port: (proxy.address() as { port: number }).port,- freeze: (): void => {- // Stop forwarding in both directions without closing anything: the- // client sees a silent, still-open TCP connection.- for (const { a, b } of sockets) {- a.unpipe(b)- b.unpipe(a)- a.pause()- b.pause()- }- },- close: (): void => {- for (const { a, b } of sockets) {- a.destroy()- b.destroy()- }- proxy.close()- },- })- })- })-}--beforeAll(async () => {- server = new Server({ hostKeys: [freshRsaPem()] }, (client: Connection) => {- client.on('authentication', (ctx) => {- if (ctx.method === 'password' && ctx.password === PASSWORD)- ctx.accept()- else- ctx.reject(['password'])- })- client.on('session', (accept) => {- const session = accept()- session.on('exec', (acceptExec) => {- const stream = acceptExec()- stream.write('Linux x86_64\n')- stream.exit(0)- stream.end()- })- })- client.on('error', () => {- // Watchdog teardowns land here on the server side; expected.- })- })- await new Promise<void>((resolve) => {- server.listen(0, '127.0.0.1', () => resolve())- })- serverPort = (server.address() as { port: number }).port- scratchSshDir = mkdtempSync(join(tmpdir(), 'dsh-ssh-e2e-watchdog-'))- writeFileSync(join(scratchSshDir, 'config'), '')-})--afterAll(() => {- server.close()- rmSync(scratchSshDir, { recursive: true, force: true })-})--describe('e2e keepalive watchdog (silent connection freeze)', () => {- it('declares a hung session closed after the heartbeat budget', async () => {- const proxy = await startStallingProxy()- const transport = new Ssh2Transport(- 5_000,- new SshConfigResolver(scratchSshDir, homedir()),- { keepaliveIntervalMs: KEEPALIVE_INTERVAL_MS, keepaliveCountMax: KEEPALIVE_COUNT_MAX },- )- const profile: MachineProfile = {- id: MachineId('watchdog'),- name: 'watchdog',- host: '127.0.0.1',- port: proxy.port,- user: 'root',- password: PASSWORD,- remotePort: 3080,- }- try {- const session = await transport.connect(profile, () => true)- expect(session.authMethod).toBe('password')-- const closedAt = new Promise<number>((resolve) => {- session.onClosed(() => resolve(Date.now()))- })- const frozeAt = Date.now()- proxy.freeze()-- // ssh2 must give up after ~interval*(countMax) of unanswered- // heartbeats and surface the close — not hang forever on the silent- // socket. Assert a generous upper bound so the test stays robust.- const timeout = new Promise<never>((_, reject) => {- setTimeout(() => reject(new Error('watchdog never declared the session closed')), 30_000)- })- const closed = await Promise.race([closedAt, timeout])- const elapsed = closed - frozeAt- // eslint-disable-next-line no-console -- evidence log- console.log(`[watchdog] silent freeze → close after ${elapsed} ms (interval ${KEEPALIVE_INTERVAL_MS} ms × ${KEEPALIVE_COUNT_MAX} missed)`)- expect(elapsed).toBeGreaterThan(KEEPALIVE_INTERVAL_MS * KEEPALIVE_COUNT_MAX - 500)- expect(elapsed).toBeLessThan(20_000)- }- finally {- proxy.close()- }- }, 60_000)-})diff --git a/packages/dsh-tauri-ssh/package.json b/packages/dsh-tauri-ssh/package.jsonindex 26151e4f..54e40bb7 100644--- a/packages/dsh-tauri-ssh/package.json+++ b/packages/dsh-tauri-ssh/package.json@@ -25,6 +25,7 @@"sideEffects": false,"exports": {".": "./dist/index.js",+ "./client": "./dist/client.cjs","./package.json": "./package.json"},"main": "./dist/index.js",@@ -35,6 +36,21 @@"dist"],"dsh": {+ "client": {+ "inject": [+ "@deepseek-ai/dsh-client-ui-renderer",+ "@deepseek-ai/dsh-client-ui-settings",+ "@deepseek-ai/dsh-client-ui-primitives",+ "@deepseek-ai/dsh-client-locale",+ "dsh-tauri",+ "dsh-tauri-ui"+ ],+ "external": [+ "dsh-tauri/client",+ "dsh-tauri-ui/client"+ ],+ "platform": "web"+ },"bundle": {"patch": "./cordis.patch.yml"}@@ -45,19 +61,28 @@"prepublishOnly": "nr build","start": "tsx src/index.ts","test": "vitest run",- "typecheck": "tsc",- "test:e2e": "vitest run --config e2e.vitest.config.ts"+ "typecheck": "tsc"},"dependencies": {+ "dsh-tauri": "workspace:*",+ "dsh-tauri-ui": "workspace:*","pathe": "catalog:utils","schemastery": "catalog:utils","ssh2": "catalog:utils","yaml": "catalog:testing"},"devDependencies": {+ "@deepseek-ai/dsh-client-ui-primitives": "catalog:dsh",+ "@testing-library/dom": "catalog:testing",+ "@testing-library/react": "catalog:testing","@types/node": "catalog:types",+ "@types/react": "catalog:types",+ "@types/react-dom": "catalog:types","@types/ssh2": "catalog:types","dsh-tauri-tsdown": "workspace:*",+ "jsdom": "catalog:testing",+ "react": "catalog:runtime",+ "react-dom": "catalog:runtime","tsdown": "catalog:cli","typescript": "catalog:cli","vitest": "catalog:testing"diff --git a/packages/dsh-tauri-ssh-ui/src/client/components/machines-section.test.tsx b/packages/dsh-tauri-ssh/src/client/components/machines-section.test.tsxsimilarity index 100%rename from packages/dsh-tauri-ssh-ui/src/client/components/machines-section.test.tsxrename to packages/dsh-tauri-ssh/src/client/components/machines-section.test.tsxdiff --git a/packages/dsh-tauri-ssh-ui/src/client/components/machines-section.tsx b/packages/dsh-tauri-ssh/src/client/components/machines-section.tsxsimilarity index 99%rename from packages/dsh-tauri-ssh-ui/src/client/components/machines-section.tsxrename to packages/dsh-tauri-ssh/src/client/components/machines-section.tsxindex a55e7198..62dd515c 100644--- a/packages/dsh-tauri-ssh-ui/src/client/components/machines-section.tsx+++ b/packages/dsh-tauri-ssh/src/client/components/machines-section.tsx@@ -43,7 +43,7 @@ export type SecretFieldName = 'password' | 'passphrase'export interface MachinesSectionInjected {store: MachinesStore/** Desktop bridge; absent (or unanswered probe) means pure web. */- bridge?: RemoteBridge+ bridge?: RemoteBridge | undefined}export interface MachinesSectionProps extends MachinesSectionInjected {diff --git a/packages/dsh-tauri-ssh-ui/src/client/components/ssh-section.test.tsx b/packages/dsh-tauri-ssh/src/client/components/ssh-section.test.tsxsimilarity index 100%rename from packages/dsh-tauri-ssh-ui/src/client/components/ssh-section.test.tsxrename to packages/dsh-tauri-ssh/src/client/components/ssh-section.test.tsxdiff --git a/packages/dsh-tauri-ssh-ui/src/client/components/ssh-section.tsx b/packages/dsh-tauri-ssh/src/client/components/ssh-section.tsxsimilarity index 100%rename from packages/dsh-tauri-ssh-ui/src/client/components/ssh-section.tsxrename to packages/dsh-tauri-ssh/src/client/components/ssh-section.tsxdiff --git a/packages/dsh-tauri-ssh-ui/src/client/components/sync-panel.test.tsx b/packages/dsh-tauri-ssh/src/client/components/sync-panel.test.tsxsimilarity index 100%rename from packages/dsh-tauri-ssh-ui/src/client/components/sync-panel.test.tsxrename to packages/dsh-tauri-ssh/src/client/components/sync-panel.test.tsxdiff --git a/packages/dsh-tauri-ssh-ui/src/client/components/sync-panel.tsx b/packages/dsh-tauri-ssh/src/client/components/sync-panel.tsxsimilarity index 100%rename from packages/dsh-tauri-ssh-ui/src/client/components/sync-panel.tsxrename to packages/dsh-tauri-ssh/src/client/components/sync-panel.tsxdiff --git a/packages/dsh-tauri-ssh-ui/src/client/constants/index.ts b/packages/dsh-tauri-ssh/src/client/constants/index.tssimilarity index 100%rename from packages/dsh-tauri-ssh-ui/src/client/constants/index.tsrename to packages/dsh-tauri-ssh/src/client/constants/index.tsdiff --git a/packages/dsh-tauri-ssh-ui/src/client/index.test.ts b/packages/dsh-tauri-ssh/src/client/index.test.tssimilarity index 96%rename from packages/dsh-tauri-ssh-ui/src/client/index.test.tsrename to packages/dsh-tauri-ssh/src/client/index.test.tsindex 454cb328..2766ee6c 100644--- a/packages/dsh-tauri-ssh-ui/src/client/index.test.ts+++ b/packages/dsh-tauri-ssh/src/client/index.test.ts@@ -1,6 +1,5 @@import type { UiContext } from './types/index'import { afterEach, describe, expect, it, vi } from 'vitest'-import { apply as hostApply } from '../index'import { SshSection } from './components/ssh-section.tsx'import { apply, inject } from './index'import { en, zh } from './locales/index'@@ -48,10 +47,6 @@ function scriptedCtx(): {}describe('ui-ssh client plugin', () => {- it('host half apply is a no-op', () => {- expect(hostApply()).toBeUndefined()- })-it('declares its inject topology', () => {expect(inject).toEqual(['slots', 'locale'])})diff --git a/packages/dsh-tauri-ssh-ui/src/client/index.ts b/packages/dsh-tauri-ssh/src/client/index.tssimilarity index 97%rename from packages/dsh-tauri-ssh-ui/src/client/index.tsrename to packages/dsh-tauri-ssh/src/client/index.tsindex 712ef485..30492b7f 100644--- a/packages/dsh-tauri-ssh-ui/src/client/index.ts+++ b/packages/dsh-tauri-ssh/src/client/index.ts@@ -33,8 +33,8 @@ export const inject = ['slots', 'locale']* @param ctx - client root context.*/export function apply(ctx: UiContext): void {- ctx.effect(() => ctx.locale.register(SSH_LOCALE_NS, { zh, en }), 'dsh-tauri-ssh-ui: dictionaries')- ctx.effect(() => mountStyle(sshStyle, SSH_STYLE_ID), 'dsh-tauri-ssh-ui: styles')+ ctx.effect(() => ctx.locale.register(SSH_LOCALE_NS, { zh, en }), 'dsh-tauri-ssh: dictionaries')+ ctx.effect(() => mountStyle(sshStyle, SSH_STYLE_ID), 'dsh-tauri-ssh: styles')const t = ctx.locale.bind(SSH_LOCALE_NS)const store = new MachinesStore((url, init) => fetch(url, init))ctx.slots.inject(SETTINGS_SECTION_SLOT, () => ctx.slots.register({diff --git a/packages/dsh-tauri-ssh-ui/src/client/locales/index.test.ts b/packages/dsh-tauri-ssh/src/client/locales/index.test.tssimilarity index 100%rename from packages/dsh-tauri-ssh-ui/src/client/locales/index.test.tsrename to packages/dsh-tauri-ssh/src/client/locales/index.test.tsdiff --git a/packages/dsh-tauri-ssh-ui/src/client/locales/index.ts b/packages/dsh-tauri-ssh/src/client/locales/index.tssimilarity index 100%rename from packages/dsh-tauri-ssh-ui/src/client/locales/index.tsrename to packages/dsh-tauri-ssh/src/client/locales/index.tsdiff --git a/packages/dsh-tauri-ssh-ui/src/client/service/bridge.ts b/packages/dsh-tauri-ssh/src/client/service/bridge.tssimilarity index 100%rename from packages/dsh-tauri-ssh-ui/src/client/service/bridge.tsrename to packages/dsh-tauri-ssh/src/client/service/bridge.tsdiff --git a/packages/dsh-tauri-ssh-ui/src/client/store/index.test.ts b/packages/dsh-tauri-ssh/src/client/store/index.test.tssimilarity index 100%rename from packages/dsh-tauri-ssh-ui/src/client/store/index.test.tsrename to packages/dsh-tauri-ssh/src/client/store/index.test.tsdiff --git a/packages/dsh-tauri-ssh-ui/src/client/store/index.ts b/packages/dsh-tauri-ssh/src/client/store/index.tssimilarity index 100%rename from packages/dsh-tauri-ssh-ui/src/client/store/index.tsrename to packages/dsh-tauri-ssh/src/client/store/index.tsdiff --git a/packages/dsh-tauri-ssh-ui/src/client/styles/index.cssr.ts b/packages/dsh-tauri-ssh/src/client/styles/index.cssr.tssimilarity index 100%rename from packages/dsh-tauri-ssh-ui/src/client/styles/index.cssr.tsrename to packages/dsh-tauri-ssh/src/client/styles/index.cssr.tsdiff --git a/packages/dsh-tauri-ssh-ui/src/client/styles/index.ts b/packages/dsh-tauri-ssh/src/client/styles/index.tssimilarity index 98%rename from packages/dsh-tauri-ssh-ui/src/client/styles/index.tsrename to packages/dsh-tauri-ssh/src/client/styles/index.tsindex 6a4d803a..6e5bd307 100644--- a/packages/dsh-tauri-ssh-ui/src/client/styles/index.ts+++ b/packages/dsh-tauri-ssh/src/client/styles/index.ts@@ -9,7 +9,7 @@import sshStyle from './index.cssr'/** The mounted stylesheet id (style tag identity, plugin-prefixed). */-export const SSH_STYLE_ID = 'dsh-tauri-ssh-ui-styles'+export const SSH_STYLE_ID = 'dsh-tauri-ssh-styles'/** The css-render tree, mounted once by the client apply via ctx.effect. */export { sshStyle }diff --git a/packages/dsh-tauri-ssh-ui/src/client/types/index.ts b/packages/dsh-tauri-ssh/src/client/types/index.tssimilarity index 100%rename from packages/dsh-tauri-ssh-ui/src/client/types/index.tsrename to packages/dsh-tauri-ssh/src/client/types/index.tsdiff --git a/packages/dsh-tauri-ssh-ui/src/client/types/sync.ts b/packages/dsh-tauri-ssh/src/client/types/sync.tssimilarity index 100%rename from packages/dsh-tauri-ssh-ui/src/client/types/sync.tsrename to packages/dsh-tauri-ssh/src/client/types/sync.tsdiff --git a/packages/dsh-tauri-ssh-ui/src/client/utils/error.ts b/packages/dsh-tauri-ssh/src/client/utils/error.tssimilarity index 100%rename from packages/dsh-tauri-ssh-ui/src/client/utils/error.tsrename to packages/dsh-tauri-ssh/src/client/utils/error.tsdiff --git a/packages/dsh-tauri-ssh-ui/src/client/utils/retry.test.ts b/packages/dsh-tauri-ssh/src/client/utils/retry.test.tssimilarity index 100%rename from packages/dsh-tauri-ssh-ui/src/client/utils/retry.test.tsrename to packages/dsh-tauri-ssh/src/client/utils/retry.test.tsdiff --git a/packages/dsh-tauri-ssh-ui/src/client/utils/retry.ts b/packages/dsh-tauri-ssh/src/client/utils/retry.tssimilarity index 100%rename from packages/dsh-tauri-ssh-ui/src/client/utils/retry.tsrename to packages/dsh-tauri-ssh/src/client/utils/retry.tsdiff --git a/packages/dsh-tauri-ssh/src/host/service/plugins-sync.ts b/packages/dsh-tauri-ssh/src/host/service/plugins-sync.tsindex 44efea6d..d5cf10b5 100644--- a/packages/dsh-tauri-ssh/src/host/service/plugins-sync.ts+++ b/packages/dsh-tauri-ssh/src/host/service/plugins-sync.ts@@ -112,7 +112,7 @@ export function findBundledPluginsTree(): BundledPluginsTree | undefined {resolve(ownPkgDir, '../../src-tauri/resources/node_modules'),]for (const root of candidates) {- if (!existsSync(join(root, 'dsh-tauri-ssh-ui', 'package.json'))+ if (!existsSync(join(root, 'dsh-tauri-ssh', 'package.json'))|| !existsSync(join(root, 'ssh2', 'package.json'))) {continue}diff --git a/packages/dsh-tauri-ssh/src/host/storage/index.ts b/packages/dsh-tauri-ssh/src/host/storage/index.tsindex e3ed5a80..d517f244 100644--- a/packages/dsh-tauri-ssh/src/host/storage/index.ts+++ b/packages/dsh-tauri-ssh/src/host/storage/index.ts@@ -111,7 +111,7 @@ export const ConfigSchema: z<Config> = z.object({reconnectInitialDelayMs: z.number().default(1_000),reconnectMaxDelayMs: z.number().default(20_000),reconnectMaxAttempts: z.number().default(6),-})+}) as z<Config>/** Project one stored record; malformed rows are dropped, never fatal. */export function machineProfileOf(raw: unknown): MachineProfile | undefined {diff --git a/packages/dsh-tauri-ssh/src/shared/constants.ts b/packages/dsh-tauri-ssh/src/shared/constants.tsindex eacb90b5..962eba94 100644--- a/packages/dsh-tauri-ssh/src/shared/constants.ts+++ b/packages/dsh-tauri-ssh/src/shared/constants.ts@@ -1,7 +1,8 @@/**- * Cross-half protocol constants of the SSH remote-machine plugin pair- * (`dsh-tauri-ssh` host / `dsh-tauri-ssh-ui` client). Both halves and the- * docs reference these identifiers; centralizing them prevents drift.+ * Cross-half protocol constants of the SSH remote-machine plugin+ * (`dsh-tauri-ssh` host half + `dsh-tauri-ssh/client` browser half). Both+ * halves and the docs reference these identifiers; centralizing them prevents+ * drift.* @module dsh-tauri-ssh/shared/constants*/diff --git a/packages/dsh-tauri-ssh/tsconfig.json b/packages/dsh-tauri-ssh/tsconfig.jsonindex 077eaec0..a11be020 100644--- a/packages/dsh-tauri-ssh/tsconfig.json+++ b/packages/dsh-tauri-ssh/tsconfig.json@@ -2,11 +2,11 @@"extends": "../../tsconfig.json","compilerOptions": {"target": "es2024",- "lib": ["ES2024"],+ "lib": ["ES2024", "DOM", "DOM.Iterable"],"types": ["node"],"exactOptionalPropertyTypes": true,"noImplicitOverride": true,"noUncheckedIndexedAccess": true},- "include": ["src/**/*.ts", "e2e/**/*.ts", "e2e.vitest.config.ts", "../../types/**/*.d.ts"]+ "include": ["src/**/*.ts", "../../types/**/*.d.ts"]}diff --git a/packages/dsh-tauri-ssh/tsdown.config.ts b/packages/dsh-tauri-ssh/tsdown.config.tsindex 636ec92c..8161184d 100644--- a/packages/dsh-tauri-ssh/tsdown.config.ts+++ b/packages/dsh-tauri-ssh/tsdown.config.ts@@ -1,15 +1,5 @@-import { defineConfig, dshExternal } from '../dsh-tauri-tsdown/src/index.ts'+import { defineDshConfig } from '../dsh-tauri-tsdown/src/index.ts'-// Host-only plugin (no client half — the settings page is dsh-tauri-ssh-ui):-// one ESM entry with dts, mirroring defineDshConfig's server half.-export default defineConfig({- outDir: 'dist',- format: 'esm',- outExtensions: () => ({ js: '.js' }),- publint: true,- external: dshExternal,- entry: { index: 'src/index.ts' },- dts: true,- sourcemap: false,- clean: true,-})+// Host half (src/index.ts) + browser client bundle (src/client/index.ts)+// wrapped in the dsh-client-modules closure factory.+export default defineDshConfig()diff --git a/packages/dsh-tauri-ssh/vitest.config.ts b/packages/dsh-tauri-ssh/vitest.config.tsindex da59da7d..4d51076a 100644--- a/packages/dsh-tauri-ssh/vitest.config.ts+++ b/packages/dsh-tauri-ssh/vitest.config.ts@@ -1,13 +1,35 @@+import { fileURLToPath } from 'node:url'import { defineConfig } from 'vitest/config'/*** 包内套件入口:根 vitest.config.ts 已改为 project 清单(unit/plugin/desktop- * 三 lane),从包目录裸跑 `vitest run` 会在错误的 CWD 下解析那份清单。本包- * 用例全部是 node 环境的纯单测,显式声明自身配置即可独立运行- * (`pnpm --filter dsh-tauri-ssh test`),也避免依赖根 lane 的装配前提。+ * 三 lane),从包目录裸跑 `vitest run` 会在错误的 CWD 下解析那份清单。本包用例+ * 显式声明自身配置即可独立运行(`pnpm --filter dsh-tauri-ssh test`),也避免+ * 依赖根 lane 的装配前提。+ *+ * 组件用例渲染官方 UI primitives,其包带真实 `.module.css` 边车文件、且在 pnpm 下+ * 嵌套了另一份 react@18——而本包面向 workspace 的 react 开发。部署时的 ModuleLoader+ * 里两者共用同一个平台 react,这里用测试期设置复原该环境:primitives 包内联让 Vite+ * 处理它的 CSS import,所有 react specifier 钉到 workspace 那份,使 jsdom 只挂一个+ * 渲染器而不是两个。(组件用例自带 `@vitest-environment jsdom` 文档块。)*/+const reactRoot = fileURLToPath(new URL('../../node_modules/react', import.meta.url))+export default defineConfig({+ resolve: {+ alias: [+ { find: /^react$/, replacement: reactRoot },+ { find: /^react\/jsx-runtime$/, replacement: `${reactRoot}/jsx-runtime.js` },+ { find: /^react\/jsx-dev-runtime$/, replacement: `${reactRoot}/jsx-dev-runtime.js` },+ ],+ },test: {environment: 'node',+ css: true,+ server: {+ deps: {+ inline: [/@deepseek-ai\/dsh-client-ui-primitives/],+ },+ },},})diff --git a/packages/dsh-tauri-taiwindcss/package.json b/packages/dsh-tauri-taiwindcss/package.jsonindex 39e038c2..573b2738 100644--- a/packages/dsh-tauri-taiwindcss/package.json+++ b/packages/dsh-tauri-taiwindcss/package.json@@ -50,9 +50,9 @@}},"scripts": {- "build": "tsx ../../scripts/build-taiwindcss.ts && tsdown",- "dev": "tsx ../../scripts/build-taiwindcss.ts --watch & tsdown --watch",- "generate": "tsx ../../scripts/build-taiwindcss.ts",+ "build": "tsx scripts/taiwindcss.ts && tsdown",+ "dev": "tsx scripts/taiwindcss.ts --watch & tsdown --watch",+ "generate": "tsx scripts/taiwindcss.ts","prepublishOnly": "nr build","typecheck": "tsc"},@@ -60,8 +60,10 @@"dsh-tauri": "workspace:*"},"devDependencies": {+ "@tailwindcss/postcss": "catalog:build","dsh-tauri-tsdown": "workspace:*","dsh-tauri-ui": "workspace:*",+ "postcss": "catalog:build","tsdown": "catalog:cli"}}diff --git a/scripts/build-taiwindcss.ts b/packages/dsh-tauri-taiwindcss/scripts/taiwindcss.tssimilarity index 96%rename from scripts/build-taiwindcss.tsrename to packages/dsh-tauri-taiwindcss/scripts/taiwindcss.tsindex 53a007c1..abf00adc 100644--- a/scripts/build-taiwindcss.ts+++ b/packages/dsh-tauri-taiwindcss/scripts/taiwindcss.ts@@ -5,10 +5,10 @@ import process from 'node:process'import tailwindcss from '@tailwindcss/postcss'import postcss from 'postcss'-const PLUGIN_ID = 'dsh-tauri-taiwindcss'-const REPO_ROOT = resolve(import.meta.dirname, '..')+const PACKAGE_ROOT = resolve(import.meta.dirname, '..')+const REPO_ROOT = resolve(PACKAGE_ROOT, '../..')const PACKAGES_ROOT = join(REPO_ROOT, 'packages')-const STYLES_DIR = join(PACKAGES_ROOT, PLUGIN_ID, 'src', 'client', 'styles')+const STYLES_DIR = join(PACKAGE_ROOT, 'src', 'client', 'styles')const INPUT_FILE = join(STYLES_DIR, 'index.css')const OUTPUT_FILE = join(STYLES_DIR, 'taiwindcss.ts')/** 决定产物的配置:plugins 配置是入口,主题与色板继承 tailwind.config.js。 */diff --git a/packages/dsh-tauri-taiwindcss/src/client/styles/index.css b/packages/dsh-tauri-taiwindcss/src/client/styles/index.cssindex 2412ad39..20b78088 100644--- a/packages/dsh-tauri-taiwindcss/src/client/styles/index.css+++ b/packages/dsh-tauri-taiwindcss/src/client/styles/index.css@@ -1,5 +1,5 @@/*- * 插件包(packages/*)的 Tailwind 构建入口,只被 scripts/build-taiwindcss.ts 消费。+ * 插件包(packages/*)的 Tailwind 构建入口,只被 scripts/taiwindcss.ts 消费。** - 不引入 preflight:产物会挂进 DSH 控制台所在文档,基础层重置会改掉宿主 UI 的默认样式。* - source(none) 关掉自动内容探测:探测会从本文件一路扫到仓库根,桌面壳 src/** 的类会被diff --git a/packages/dsh-tauri-taiwindcss/src/client/styles/taiwindcss.ts b/packages/dsh-tauri-taiwindcss/src/client/styles/taiwindcss.tsindex cda37319..d2848d94 100644--- a/packages/dsh-tauri-taiwindcss/src/client/styles/taiwindcss.ts+++ b/packages/dsh-tauri-taiwindcss/src/client/styles/taiwindcss.ts@@ -71,6 +71,9 @@ const TAIWINDCSS_GENERATED = `.hidden {display: none;}+ .inline {+ display: inline;+ }.inline-block {display: inline-block;}@@ -89,6 +92,11 @@ const TAIWINDCSS_GENERATED = `.flex-wrap {flex-wrap: wrap;}+ .truncate {+ overflow: hidden;+ text-overflow: ellipsis;+ white-space: nowrap;+ }.rounded {border-radius: 0.25rem;}@@ -109,6 +117,14 @@ const TAIWINDCSS_GENERATED = `.underline {text-decoration-line: underline;}+ .shadow {+ --tw-shadow: 0 1px 3px 0 var(--tw-shadow-color, rgb(0 0 0 / 0.1)), 0 1px 2px -1px var(--tw-shadow-color, rgb(0 0 0 / 0.1));+ box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);+ }+ .ring {+ --tw-ring-shadow: var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color, currentcolor);+ box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);+ }.outline {outline-style: var(--tw-outline-style);outline-width: 1px;@@ -171,6 +187,71 @@ const TAIWINDCSS_GENERATED = `syntax: "*";inherits: false;}+@property --tw-shadow {+ syntax: "*";+ inherits: false;+ initial-value: 0 0 #0000;+}+@property --tw-shadow-color {+ syntax: "*";+ inherits: false;+}+@property --tw-shadow-alpha {+ syntax: "<percentage>";+ inherits: false;+ initial-value: 100%;+}+@property --tw-inset-shadow {+ syntax: "*";+ inherits: false;+ initial-value: 0 0 #0000;+}+@property --tw-inset-shadow-color {+ syntax: "*";+ inherits: false;+}+@property --tw-inset-shadow-alpha {+ syntax: "<percentage>";+ inherits: false;+ initial-value: 100%;+}+@property --tw-ring-color {+ syntax: "*";+ inherits: false;+}+@property --tw-ring-shadow {+ syntax: "*";+ inherits: false;+ initial-value: 0 0 #0000;+}+@property --tw-inset-ring-color {+ syntax: "*";+ inherits: false;+}+@property --tw-inset-ring-shadow {+ syntax: "*";+ inherits: false;+ initial-value: 0 0 #0000;+}+@property --tw-ring-inset {+ syntax: "*";+ inherits: false;+}+@property --tw-ring-offset-width {+ syntax: "<length>";+ inherits: false;+ initial-value: 0px;+}+@property --tw-ring-offset-color {+ syntax: "*";+ inherits: false;+ initial-value: #fff;+}+@property --tw-ring-offset-shadow {+ syntax: "*";+ inherits: false;+ initial-value: 0 0 #0000;+}@property --tw-outline-style {syntax: "*";inherits: false;@@ -279,6 +360,20 @@ const TAIWINDCSS_GENERATED = `--tw-numeric-figure: initial;--tw-numeric-spacing: initial;--tw-numeric-fraction: initial;+ --tw-shadow: 0 0 #0000;+ --tw-shadow-color: initial;+ --tw-shadow-alpha: 100%;+ --tw-inset-shadow: 0 0 #0000;+ --tw-inset-shadow-color: initial;+ --tw-inset-shadow-alpha: 100%;+ --tw-ring-color: initial;+ --tw-ring-shadow: 0 0 #0000;+ --tw-inset-ring-color: initial;+ --tw-inset-ring-shadow: 0 0 #0000;+ --tw-ring-inset: initial;+ --tw-ring-offset-width: 0px;+ --tw-ring-offset-color: #fff;+ --tw-ring-offset-shadow: 0 0 #0000;--tw-outline-style: solid;--tw-blur: initial;--tw-brightness: initial;diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex 15bf37f5..29d3dacf 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -62,15 +62,9 @@ catalogs:'@tauri-apps/plugin-store':specifier: ^2.4.4version: 2.4.4- anser:- specifier: ^2.3.5- version: 2.3.5h3:specifier: 2.0.1-rc.31version: 2.0.1-rc.31- shiki:- specifier: ^1.29.2- version: 1.29.2valtio:specifier: ^2.3.2version: 2.3.2@@ -537,6 +531,9 @@ importers:'@types/semver':specifier: catalog:typesversion: 7.8.0+ '@types/ssh2':+ specifier: catalog:types+ version: 1.15.6'@vitejs/plugin-react':specifier: catalog:buildversion: 4.7.0([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected]))@@ -588,6 +585,9 @@ importers:publint:specifier: catalog:cliversion: 0.3.24+ ssh2:+ specifier: catalog:utils+ version: 1.17.0tailwindcss:specifier: catalog:buildversion: 4.1.11@@ -694,9 +694,6 @@ importers:dsh-tauri-ssh:specifier: workspace:*version: link:../dsh-tauri-ssh- dsh-tauri-ssh-ui:- specifier: workspace:*- version: link:../dsh-tauri-ssh-uidsh-tauri-taiwindcss:specifier: workspace:*version: link:../dsh-tauri-taiwindcss@@ -974,6 +971,12 @@ importers:packages/dsh-tauri-ssh:dependencies:+ dsh-tauri:+ specifier: workspace:*+ version: link:../dsh-tauri+ dsh-tauri-ui:+ specifier: workspace:*+ version: link:../dsh-tauri-uipathe:specifier: catalog:utilsversion: 2.0.3@@ -986,34 +989,6 @@ importers:yaml:specifier: catalog:testingversion: 2.9.0- devDependencies:- '@types/node':- specifier: catalog:types- version: 22.20.1- '@types/ssh2':- specifier: catalog:types- version: 1.15.6- dsh-tauri-tsdown:- specifier: workspace:*- version: link:../dsh-tauri-tsdown- tsdown:- specifier: catalog:cli- version: 0.17.4(@emnapi/[email protected])(@emnapi/[email protected])([email protected])([email protected])([email protected])([email protected])- typescript:- specifier: catalog:cli- version: 5.8.3- vitest:- specifier: catalog:testing- version: 4.1.11(@opentelemetry/[email protected])(@types/[email protected])(@vitest/[email protected])([email protected])([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected]))-- packages/dsh-tauri-ssh-ui:- dependencies:- dsh-tauri:- specifier: workspace:*- version: link:../dsh-tauri- dsh-tauri-ui:- specifier: workspace:*- version: link:../dsh-tauri-uidevDependencies:'@deepseek-ai/dsh-client-ui-primitives':specifier: catalog:dsh@@ -1033,9 +1008,9 @@ importers:'@types/react-dom':specifier: catalog:typesversion: 19.2.4(@types/[email protected])- anser:- specifier: 'catalog:'- version: 2.3.5+ '@types/ssh2':+ specifier: catalog:types+ version: 1.15.6dsh-tauri-tsdown:specifier: workspace:*version: link:../dsh-tauri-tsdown@@ -1048,9 +1023,6 @@ importers:react-dom:specifier: catalog:runtimeversion: 19.2.8([email protected])- shiki:- specifier: 'catalog:'- version: 1.29.2tsdown:specifier: catalog:cliversion: 0.17.4(@emnapi/[email protected])(@emnapi/[email protected])([email protected])([email protected])([email protected])([email protected])@@ -1067,12 +1039,18 @@ importers:specifier: workspace:*version: link:../dsh-tauridevDependencies:+ '@tailwindcss/postcss':+ specifier: catalog:build+ version: 4.1.11dsh-tauri-tsdown:specifier: workspace:*version: link:../dsh-tauri-tsdowndsh-tauri-ui:specifier: workspace:*version: link:../dsh-tauri-ui+ postcss:+ specifier: catalog:build+ version: 8.5.26tsdown:specifier: catalog:cliversion: 0.17.4(@emnapi/[email protected])(@emnapi/[email protected])([email protected])([email protected])([email protected])([email protected])@@ -3327,27 +3305,6 @@ packages:cpu: [x64]os: [win32]- '@shikijs/[email protected]':- resolution: {integrity: sha512-vju0lY9r27jJfOY4Z7+Rt/nIOjzJpZ3y+nYpqtUZInVoXQ/TJZcfGnNOGnKjFdVZb8qexiCuSlZRKcGfhhTTZQ==}-- '@shikijs/[email protected]':- resolution: {integrity: sha512-iNEZv4IrLYPv64Q6k7EPpOCE/nuvGiKl7zxdq0WFuRPF5PAE9PRo2JGq/d8crLusM59BRemJ4eOqrFrC4wiQ+A==}-- '@shikijs/[email protected]':- resolution: {integrity: sha512-7iiOx3SG8+g1MnlzZVDYiaeHe7Ez2Kf2HrJzdmGwkRisT7r4rak0e655AcM/tF9JG/kg5fMNYlLLKglbN7gBqA==}-- '@shikijs/[email protected]':- resolution: {integrity: sha512-FIBA7N3LZ+223U7cJDUYd5shmciFQlYkFXlkKVaHsCPgfVLiO+e12FmQE6Tf9vuyEsFe3dIl8qGWKXgEHL9wmQ==}-- '@shikijs/[email protected]':- resolution: {integrity: sha512-i9TNZlsq4uoyqSbluIcZkmPL9Bfi3djVxRnofUHwvx/h6SRW3cwgBC5SML7vsDcWyukY0eCzVN980rqP6qNl9g==}-- '@shikijs/[email protected]':- resolution: {integrity: sha512-VJjK0eIijTZf0QSTODEXCqinjBn0joAHQ+aPSBzrv4O2d/QSbsMw+ZeSRx03kV34Hy7NzUvV/7NqfYGRLrASmw==}-- '@shikijs/[email protected]':- resolution: {integrity: sha512-83yeghZ2xxin3Nj8z1NMd/NCuca+gsYXswywDy5bHvwlWL8tpTQmzGeUuHd9FC3E/SBEMvzJRwWEOz5gGes9Qg==}-'@simple-git/[email protected]':resolution: {integrity: sha512-ngJMaHlsWDTfjyq9F3VIQ8b7NXbBLq5j9i5bJ6XLYtD6qlDXT7fdKY2KscWWUF8t18xx052Y/PUO1K1TRc9yKA==}@@ -3774,9 +3731,6 @@ packages:resolution: {integrity: sha512-fkv8dHRDqfGtTHuJeebdrQ7cX6Ad4WAS00rgHh9UGvMycF1mjBfsxry1XsLIFhWZ6Judlh6UdzK+TYlbpCXgnA==}engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}- '@ungap/[email protected]':- resolution: {integrity: sha512-1mEZtMKPM09vDmQt5y7YvmN2+DFTP7Tg0EWXdic8/C6VRnpb33e4ghisCIE3WZjsE2N8mf+QV1Zqh7ZFYLWInQ==}-'@vitejs/[email protected]':resolution: {integrity: sha512-gUu9hwfWvvEDBBmgtAowQCojwZmJ5mcLn3aufeCsitijs3+f2NsrPtlAWIR6OPiqljl96GVCUbLe0HyqIpVaoA==}engines: {node: ^14.18.0 || >=16.0.0}@@ -3949,9 +3903,6 @@ packages:resolution: {integrity: sha512-Thbli+OlOj+iMPYFBVBfJ3OmCAnaSyNn4M1vz9T6Gka5Jt9ba/HIR56joy65tY6kx/FCF5VXNB819Y7/GUrBGA==}- resolution: {integrity: sha512-vcZjxvvVoxTeR5XBNJB38oTu/7eDCZlwdz32N1eNgpyPF7j/Z7Idf+CUwQOkKKpJ7RJyjxgLHCM7vdIK0iCNMQ==}-resolution: {integrity: sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==}engines: {node: '>=8'}@@ -4213,12 +4164,6 @@ packages:engines: {node: ^22.19.0 || ^24.11.0 || >=26.0.0}hasBin: true- resolution: {integrity: sha512-1v7fgQRj6hnSwFpq1Eu0ynr/CDEw0rXo2B61qXrLNdHZmPKgb7fqS1a2JwF0rISo9q77jDI8VMEHoApn8qDoZA==}-- resolution: {integrity: sha512-RpPp0asT/6ufRm//AJVwpViZbGM/MkjQFxJccQRHmISF/22NBtsHqAWmL+/pmkPWoIUJdWyeVleTl1wydHATVQ==}-resolution: {integrity: sha512-shx7oQ0Awen/BRIdkjkvz54PnEEI/EjwXDSIZp86/KKdbafHh1Df/RYGBhn4hbe2+uKC9FnT5UCEdyPz3ai9hQ==}@@ -4280,9 +4225,6 @@ packages:resolution: {integrity: sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w==}- resolution: {integrity: sha512-Fu4hJdvzeylCfQPp9SGWidpzrMs7tTrlu6Vb8XGaRGck8QSNZJJp538Wrb60Lax4fPwR64ViY468OIUTbRlGZg==}-resolution: {integrity: sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww==}engines: {node: '>= 12'}@@ -4550,9 +4492,6 @@ packages:resolution: {integrity: sha512-bNglH7lPH5l+yHOes7Zr4VqxhOy4BQ9ZBUX4VdoFgxMpzJk7W1ZoO3Vgd9Pxa9PyjQ76sfm2aKH/nzEcCNRlew==}- resolution: {integrity: sha512-LRlerrMYoIDrT6jgpeZ2YYl/L8EulRTt5hQcYjy5AInh7HWXKimpqx68aknBFpGL2+/IcogTcaydJEgaTmOpDg==}-resolution: {integrity: sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==}@@ -5095,12 +5034,6 @@ packages:resolution: {integrity: sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==}engines: {node: '>=8'}- resolution: {integrity: sha512-OguPdidb+fbHQSU4Q4ZiLKnzWo8Wwsf5bZfbvu7//a9oTYoqD/fWpe96NuHkoS9h0ccGOTe0C4NGXdtS0iObOw==}-- resolution: {integrity: sha512-88JUN06ipLwsnv+dVn+OIYOvAuvBMy/Qoi6O7mQHxdPXpjy+Cd6xRkWwux7DKO+4sYILtLBRIKgsdpS2gQc7qw==}-resolution: {integrity: sha512-Yc+BQe8SvoXH1643Qez1zqLRmbA5rCL+sSmk6TVos0LWVfNIB7PGncdlId77WzLGSIB5KaWgTaNTs2lNVEI6VQ==}@@ -5120,9 +5053,6 @@ packages:resolution: {integrity: sha512-0zHsZJrK7S3K2aucXWL6ycoYJ/iNtIcFHC/nYQgFklPtrv5LpJctIiSCroWZWeuoXvuyFdzp6KzjJQ+OT5MfFw==}- resolution: {integrity: sha512-bEqo66MRXsUGxWHV5IP0PUiAWwoEjba4VCzg0LjFJBpchPaTfyfCKTG6bc5F8ucKec3q5y6qOdGyYTSBEvhCrg==}-resolution: {integrity: sha512-xWROBw9+MEGwxpotll0h672KCaLrKKiCYzsyN8ZgL9cQbVumFnyvsk2JqiB9ELAV1GLj1GG/jxZUjV9OZZi/yQ==}@@ -5587,9 +5517,6 @@ packages:resolution: {integrity: sha512-TqICwyvJJpBwvGAMZjj4J2n0X8QWp21b9l0o7eXyVJ25YNWYbJDVIyD1bZXE6WtV6RmKJVYmQAKWa0zWOABz2w==}- resolution: {integrity: sha512-cctsq2wp5vTsLIcaymblUriiTcZd0CwWtCbLvrOzYCDZoWyMNV8sZ7krj09FSnsiJi3WVsHLM4k6Dq/yaPyCXA==}-resolution: {integrity: sha512-xj68wMTvGXVOKonmog6LwyJKrYXZPvlwabaryTjLh9LuvovB/KAH+kvi8Gjj+7rJjsFi23nkUxRQv1KqSroMqA==}@@ -5885,9 +5812,6 @@ packages:resolution: {integrity: sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==}- resolution: {integrity: sha512-bwALDxriqfKGfUufKGGepCzu9x7nJQuoRoAFp4AnwehhC2crqrDIAP/uN2qdlsAvSMpeRC3+Yzhqc7hLmle5+g==}-resolution: {integrity: sha512-YgBpdJHPyQ2UE5x+hlSXcnejzAvD0b22U2OuAP+8OnlJT+PjWPxtgmGqKKc+RgTM63U9gN0YzrYc71R2WT/hTA==}engines: {node: '>=18'}@@ -6073,9 +5997,6 @@ packages:resolution: {integrity: sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg==}- resolution: {integrity: sha512-IAtzIB6sUiWaJYrX9smp3V46pBGbBeLFRGdh25kg1334VcBlD8HzhPeNIWQH9zhGmo2itIe25EHt9dQP7G5hmg==}-resolution: {integrity: sha512-TmatMXdr2KlRiA2CyDu8GqR8EjahTG3aY3nXjdzFyoZbmB8hrBsTyMezhULIXKnC0jpfjlmiZ3+EaCzoInSu/A==}engines: {node: '>= 14'}@@ -6211,15 +6132,6 @@ packages:resolution: {integrity: sha512-J8rn6v4DBb2nnFqkqwy6/NnTYMcgLA+sLr0iIO41qpv0n+ngb7ksag2tMRl0inb1bbO/esUwzW1vbJi7K0sI0g==}engines: {node: ^12.0.0 || ^14.0.0 || >=16.0.0}- resolution: {integrity: sha512-ae7SBCbzVNrIjgSbh7wMznPcQel1DNlDtzensnFxpiNpXt1U2ju/bHugH422r+4LAVS1FpW1YCwilmnNsjum9w==}-- resolution: {integrity: sha512-8VhliFJAWRaUiVvREIiW2NXXTmHs4vMNnSzuJVhscgmGav3g9VDxLrQndI3dZZVVdp0ZO/5v0xmX516/7M9cng==}-- resolution: {integrity: sha512-dN5I359AVGPnwzJm2jN1k0W9LPZ+ePvoOeVMMfqIMFz53sSwXkxaJoxr50ptnsC771lK95BnTrVSZxq0b9yCGw==}-resolution: {integrity: sha512-sZuz1dYW/ZsfG17WSAG7eS85r5a0dDsvg+7BiiYR5o6lKCAtUrEwdmRmaGF6rwVj3LcmAeYkOWKEPlbPzN3Y3A==}engines: {node: ^12.0.0 || ^14.0.0 || >=16.0.0}@@ -6363,9 +6275,6 @@ packages:resolution: {integrity: sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==}engines: {node: '>=8'}- resolution: {integrity: sha512-njXuliz/cP+67jU2hukkxCNuH1yUi4QfdZZY+sMr5PPrIyXSu5iTb/qYC4BiWWB0vZ+7TbdvYUCeL23zpwCfbg==}-resolution: {integrity: sha512-ybx0WO1/8bSBLEWXZvEd7gMW3Sn3JFlW3TvX1nREbDLRNQNaeNN8WK0meBwPdAaOI7TtRRRJn/Es1zhrrCHu7g==}@@ -6407,9 +6316,6 @@ packages:resolution: {integrity: sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==}engines: {node: '>=0.10.0'}- resolution: {integrity: sha512-PEGlAwrG8yXGXRjW32fGbg66JAlOAwbObuqVoJpv/mRgoWDQfgH1wDPvtzWyUSNAXBGSk8h755YDbbcEy3SH2Q==}-resolution: {integrity: sha512-lLYsktklSRKprreOm7NXReW8YiX2VBjbgmXYEziOoGf/qsJqAEACaDvoTtUOycwjpaSh+bT8eu0KrJn7UNxiCg==}@@ -6468,9 +6374,6 @@ packages:resolution: {integrity: sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==}- resolution: {integrity: sha512-IwfBptatlO+QCJUo19AqvrPNqlVMpW9YEL2LIVY+Rpv2qsjCGxaDLNRgeGsQWJhfItebuJhsGSLjaBbNSQ+ieg==}-resolution: {integrity: sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==}engines: {node: '>=8'}@@ -6606,9 +6509,6 @@ packages:resolution: {integrity: sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A==}hasBin: true- resolution: {integrity: sha512-kRj8B+YHZCc9kQYdWfJB2/oUl9rA99qbowYYBtr4ui4mZyAQ2JpvVBd/6U2YloATfqBhBTSMhTpgBHtU0Mf3Rg==}-resolution: {integrity: sha512-OJ/ibxhPlqrMM0UiNHJ/0CKQkoKF243/AEmplt3qpRgkW8VG7IfOS41h7V8TjITqdByHzrjcS/2si+y4lIh8NA==}engines: {node: '>=18.12'}@@ -6712,9 +6612,6 @@ packages:resolution: {integrity: sha512-LsiILbtBETkDz8I9p1dQ0uyRUWuaQzd/cuEeS1hoRSyW5E5XGmTzlwY1OrNzzakGowI9Dr/I8HVaw4hTtnxy8g==}- resolution: {integrity: sha512-fucsC7HjXvkB5R3kTCO7kUjRdrS0BJt3M/FPxmHMBOm8JQi2BsHAHFsy27E0EolP8rp0NzXsJ+jNPyDWvOJZPA==}-resolution: {integrity: sha512-Hp5Kh3wLxv0PHj9m2yZhhLt58KzPtEYKQQ4yxfYFEO7EvHwzyDYnduhHnY1mDxoqr7VUwVuHXk9RXKIiYS1N8Q==}@@ -6863,12 +6760,6 @@ packages:resolution: {integrity: sha512-sXMwN6DMHeouPfCxkxWkKAmxphWKEenHYY5H1nIBzU3PmDsmJp6kBXJdshjVdpMZuWCmL9SH7KFRx29AylpP6g==}engines: {node: '>=18.12.0'}- resolution: {integrity: sha512-QTHzsGd1EhbZs4AsQ20JX1rC3cOlt/IWJruk893DfLRr57lcnOeMaWG4K0JrRta4mIJZKth2Au3mM3u03/JWKw==}-- resolution: {integrity: sha512-KzIbH/9tXat2u30jf+smMwFCsno4wHVdNmzFyL+T/L3UGqqk6JKfVqOFOZEpZSHADH1k40ab6NUIXZq422ov3Q==}-resolution: {integrity: sha512-4XP60spRGjSZFf1qYH+dJIkK2znL3zQfl9KkOV9MkkRR/3Dls0dxaBsQPTloEc5BLXWPL9vsOxopxyKoMmDueg==}engines: {node: ^20.19.0 || >=22.12.0}@@ -9075,41 +8966,6 @@ snapshots:'@rollup/[email protected]':optional: true- '@shikijs/[email protected]':- dependencies:- '@shikijs/engine-javascript': 1.29.2- '@shikijs/engine-oniguruma': 1.29.2- '@shikijs/types': 1.29.2- '@shikijs/vscode-textmate': 10.0.2- '@types/hast': 3.0.5- hast-util-to-html: 9.0.5-- '@shikijs/[email protected]':- dependencies:- '@shikijs/types': 1.29.2- '@shikijs/vscode-textmate': 10.0.2- oniguruma-to-es: 2.3.0-- '@shikijs/[email protected]':- dependencies:- '@shikijs/types': 1.29.2- '@shikijs/vscode-textmate': 10.0.2-- '@shikijs/[email protected]':- dependencies:- '@shikijs/types': 1.29.2-- '@shikijs/[email protected]':- dependencies:- '@shikijs/types': 1.29.2-- '@shikijs/[email protected]':- dependencies:- '@shikijs/vscode-textmate': 10.0.2- '@types/hast': 3.0.5-- '@shikijs/[email protected]': {}-'@simple-git/[email protected]': {}'@simple-git/[email protected]':@@ -9539,8 +9395,6 @@ snapshots:'@typescript-eslint/types': 8.67.0eslint-visitor-keys: 5.0.1- '@ungap/[email protected]': {}-'@vitejs/[email protected]([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected]))':dependencies:'@babel/core': 7.29.7@@ -9809,8 +9663,6 @@ snapshots:json-schema-traverse: 1.0.0require-from-string: 2.0.2- [email protected]: {}-@@ -10084,10 +9936,6 @@ snapshots:transitivePeerDependencies:- magicast- [email protected]: {}-- [email protected]: {}-@@ -10162,8 +10010,6 @@ snapshots:- [email protected]: {}-@@ -10413,8 +10259,6 @@ snapshots:- [email protected]: {}-@@ -11098,24 +10942,6 @@ snapshots:- dependencies:- '@types/hast': 3.0.5- '@types/unist': 3.0.3- ccount: 2.0.1- comma-separated-tokens: 2.0.3- hast-util-whitespace: 3.0.0- html-void-elements: 3.0.0- mdast-util-to-hast: 13.2.1- property-information: 7.2.0- space-separated-tokens: 2.0.2- stringify-entities: 4.0.4- zwitch: 2.0.4-- dependencies:- '@types/hast': 3.0.5-@@ -11130,8 +10956,6 @@ snapshots:- [email protected]: {}-@@ -11661,18 +11485,6 @@ snapshots:'@types/mdast': 4.0.4unist-util-is: 6.0.1- dependencies:- '@types/hast': 3.0.5- '@types/mdast': 4.0.4- '@ungap/structured-clone': 1.4.0- devlop: 1.1.0- micromark-util-sanitize-uri: 2.0.1- trim-lines: 3.0.1- unist-util-position: 5.0.0- unist-util-visit: 5.1.0- vfile: 6.0.3-dependencies:'@types/mdast': 4.0.4@@ -12069,12 +11881,6 @@ snapshots:dependencies:wrappy: 1.0.2- dependencies:- emoji-regex-xs: 1.0.0- regex: 5.1.1- regex-recursion: 5.1.1-dependencies:default-browser: 5.5.1@@ -12300,8 +12106,6 @@ snapshots:object-assign: 4.1.1react-is: 16.13.1- [email protected]: {}-dependencies:agent-base: 7.1.4@@ -12462,17 +12266,6 @@ snapshots:dependencies:'@eslint-community/regexpp': 4.12.2- dependencies:- regex: 5.1.1- regex-utilities: 2.3.0-- [email protected]: {}-- dependencies:- regex-utilities: 2.3.0-dependencies:'@eslint-community/regexpp': 4.12.2@@ -12649,17 +12442,6 @@ snapshots:- dependencies:- '@shikijs/core': 1.29.2- '@shikijs/engine-javascript': 1.29.2- '@shikijs/engine-oniguruma': 1.29.2- '@shikijs/langs': 1.29.2- '@shikijs/themes': 1.29.2- '@shikijs/types': 1.29.2- '@shikijs/vscode-textmate': 10.0.2- '@types/hast': 3.0.5-@@ -12700,8 +12482,6 @@ snapshots:optional: true- [email protected]: {}-@@ -12766,11 +12546,6 @@ snapshots:dependencies:safe-buffer: 5.2.1- dependencies:- character-entities-html4: 2.1.0- character-entities-legacy: 3.0.0-dependencies:ansi-regex: 5.0.1@@ -12913,8 +12688,6 @@ snapshots:- [email protected]: {}-dependencies:typescript: 5.8.3@@ -13005,10 +12778,6 @@ snapshots:dependencies:'@types/unist': 3.0.3- dependencies:- '@types/unist': 3.0.3-dependencies:'@types/unist': 3.0.3@@ -13103,16 +12872,6 @@ snapshots:- dependencies:- '@types/unist': 3.0.3- unist-util-stringify-position: 4.0.0-- dependencies:- '@types/unist': 3.0.3- vfile-message: 4.0.3-[email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected]):dependencies:esbuild: 0.28.2diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yamlindex f096ad4f..bfdfe035 100644--- a/pnpm-workspace.yaml+++ b/pnpm-workspace.yaml@@ -112,9 +112,7 @@ catalog:'@genapi/shared': ^4.1.4'@tauri-apps/plugin-os': ^2.3.2'@tauri-apps/plugin-store': ^2.4.4- anser: ^2.3.5h3: 2.0.1-rc.31- shiki: ^1.29.2valtio: ^2.3.2catalogs:diff --git a/src-tauri/resources/manifest.jsonc b/src-tauri/resources/manifest.jsoncindex f064fe5e..cbd66842 100644--- a/src-tauri/resources/manifest.jsonc+++ b/src-tauri/resources/manifest.jsonc@@ -64,7 +64,7 @@"depercated": ["dsh-win-terminal-inspector","dsh-session-context-menu",- "dsh-notification",+ "dsh-tauri-ssh","dsh-tauri-panel","dsh-tauri-turnrewind","dsh-tauri-connection"@@ -151,15 +151,8 @@"id": "dsh-tauri-ssh","spec": "dsh-tauri-ssh","name": "DSH Tauri SSH",- "description": "Remote-machine host kernel for the desktop: SSH connection management with TOFU host keys, ~/.ssh/config discovery, remote dsh web auto-start, loopback tunnels, and the same-origin /api-ssh route.",+ "description": "Remote-machine plugin for the desktop: SSH connection management with TOFU host keys, ~/.ssh/config discovery, remote dsh web auto-start, loopback tunnels, the same-origin /api-ssh route, and the settings page for machine CRUD, connect/test/disconnect and one-click remote install.","repo": "https://github.com/dsh-tauri-desk/deepseek-harness-desktop/tree/main/packages/dsh-tauri-ssh"- },- {- "id": "dsh-tauri-ssh-ui",- "spec": "dsh-tauri-ssh-ui",- "name": "DSH Tauri SSH UI",- "description": "Settings page for SSH remote machines: machine CRUD with per-machine identity colors, connect/test/disconnect through the plugin's /api-ssh route, one-click remote dsh install, and the tunnel popup opener.",- "repo": "https://github.com/dsh-tauri-desk/deepseek-harness-desktop/tree/main/packages/dsh-tauri-ssh-ui"}],"preset": [diff --git a/test/e2e/plugins/dsh-tauri-ssh.e2e.ts b/test/e2e/plugins/dsh-tauri-ssh.e2e.tsnew file mode 100644index 00000000..8e52de66--- /dev/null+++ b/test/e2e/plugins/dsh-tauri-ssh.e2e.ts@@ -0,0 +1,626 @@+/**+ * dsh-tauri-ssh 远程机插件 E2E:真实 ssh2 传输层与真实 SSH 协议往返。+ *+ * 四条契约各占一个 describe,共用同一套 `bootHarness` 脚手架——真实的+ * `Ssh2Transport`、宿主自身 `~/.ssh` 的别名与身份文件解析、带时间戳的+ * status/event 证据日志。断言对象是外部世界(HTTP 字节、服务端记录的认证方法+ * 序列、被杀的 sshd 会话进程),不采信插件自报:+ * - reconnect:真实 linux x64 机器上杀掉服务端会话 → 自动重连 → 同一隧道 URL 继续服务;+ * - give-up:持续不可达的本机端口上的指数退避节奏与 given-up 终态;+ * - password-chain:回环 ssh2 协议服务器上的 agent→key→password 认证链与三类失败分类;+ * - watchdog:静默冻结(无 FIN/RST)连接上的 keepalive 看门狗。+ *+ * 环境降级标注(不得以 skip 掩盖):+ * - password-chain:本机 22 端口关闭、无 docker、共享 dev 机 sshd 配置不可动,+ * 故无 OS sshd 可测——「OS-sshd password E2E 未验证(环境不可得)」,以本地+ * ssh2 协议服务器替代证据;+ * - reconnect:需要可达的 `ssh dev` 别名机器。+ */++import type { Connection, Server as SshServer } from 'ssh2'+import type { MachineProfile, SshMachineStage, SshMachineTerminal } from '../../../packages/dsh-tauri-ssh/src/host/types/index'+import { execSync } from 'node:child_process'+import { generateKeyPairSync } from 'node:crypto'+import { mkdtempSync, rmSync, writeFileSync } from 'node:fs'+import { createServer, connect as tcpConnect } from 'node:net'+import { homedir, tmpdir } from 'node:os'+import { join } from 'pathe'+import { Server } from 'ssh2'+import { afterAll, beforeAll, describe, expect, it } from 'vitest'+import { SshMachineEvents } from '../../../packages/dsh-tauri-ssh/src/host/service/events'+import { KnownHostsStore } from '../../../packages/dsh-tauri-ssh/src/host/service/host-keys'+import { SshManager } from '../../../packages/dsh-tauri-ssh/src/host/service/manager'+import { SshConfigResolver } from '../../../packages/dsh-tauri-ssh/src/host/service/ssh-config'+import { Ssh2Transport } from '../../../packages/dsh-tauri-ssh/src/host/service/transport'+import { MachineId } from '../../../packages/dsh-tauri-ssh/src/host/types/index'++/**+ * The machine event channel with evidence logging: every appended line is+ * echoed into the harness log (`event <stage>[/<terminal>]: <line>`) before+ * it lands in the ring buffer, so the specs can grep the emitted stream.+ */+class LoggingMachineEvents extends SshMachineEvents {+ constructor(private readonly log: (text: string) => void) {+ super()+ }++ override append(machineId: MachineId, stage: SshMachineStage, line: string, options: { terminal?: SshMachineTerminal, reason?: string } = {}) {+ this.log(`event ${stage}${options.terminal === undefined ? '' : `/${options.terminal}`}: ${line}`)+ return super.append(machineId, stage, line, options)+ }+}++/** One timestamped evidence line. */+interface EvidenceLine {+ at: number+ text: string+}++/** The E2E harness: manager plus captured evidence. */+interface Harness {+ manager: SshManager+ evidence: EvidenceLine[]+ log: (text: string) => void+ dispose: () => Promise<void>+}++/** A monotonic-ish wall clock in epoch ms. */+function now(): number {+ return Date.now()+}++/** One freshly generated RSA key in PKCS#1 PEM form (what ssh2 parses natively). */+function freshRsaPem(): string {+ const { privateKey } = generateKeyPairSync('rsa', { modulusLength: 2048 })+ return String(privateKey.export({ format: 'pem', type: 'pkcs1' }))+}++/**+ * Boot one real-transport manager with scratch TOFU storage and the given+ * connect/reconnect timing, logging every status and event emission with a+ * timestamp.+ */+function bootHarness(options: {+ connectTimeoutMs?: number+ keepaliveIntervalMs?: number+ keepaliveCountMax?: number+ reconnectInitialDelayMs?: number+ reconnectMaxDelayMs?: number+ reconnectMaxAttempts?: number+ healthPollIntervalMs?: number+ healthPollAttempts?: number+ sshDir?: string+} = {}): Harness {+ const evidence: EvidenceLine[] = []+ const t0 = now()+ const log = (text: string): void => {+ const line = { at: now(), text }+ evidence.push(line)+ // eslint-disable-next-line no-console -- the E2E evidence log is the point+ console.log(`[+${(line.at - t0).toString().padStart(6)}ms] ${text}`)+ }+ const root = mkdtempSync(join(tmpdir(), 'dsh-ssh-e2e-'))+ const manager = new SshManager({+ transport: new Ssh2Transport(+ options.connectTimeoutMs ?? 15_000,+ // The host's real ~/.ssh: config aliases and identity files, exactly+ // what the plugin in the desktop app would resolve against.+ new SshConfigResolver(options.sshDir ?? join(homedir(), '.ssh'), homedir()),+ {+ keepaliveIntervalMs: options.keepaliveIntervalMs ?? 3_000,+ keepaliveCountMax: options.keepaliveCountMax ?? 3,+ },+ ),+ knownHosts: new KnownHostsStore(join(root, 'known-hosts.json')),+ config: {+ connectTimeoutMs: options.connectTimeoutMs ?? 15_000,+ healthCheckTimeoutMs: 3_000,+ healthPollIntervalMs: options.healthPollIntervalMs ?? 500,+ healthPollAttempts: options.healthPollAttempts ?? 30,+ keepaliveIntervalMs: options.keepaliveIntervalMs ?? 3_000,+ keepaliveCountMax: options.keepaliveCountMax ?? 3,+ reconnectInitialDelayMs: options.reconnectInitialDelayMs ?? 1_000,+ reconnectMaxDelayMs: options.reconnectMaxDelayMs ?? 5_000,+ reconnectMaxAttempts: options.reconnectMaxAttempts ?? 6,+ },+ events: new LoggingMachineEvents(log),+ emitStatus: (statusId, status) => {+ const hints = [+ status.state,+ ...status.tunnelBaseUrl === undefined ? [] : [`tunnel=${status.tunnelBaseUrl}`],+ ...status.nextRetryAt === undefined ? [] : [`nextRetryAt=+${status.nextRetryAt - now()}ms`],+ ...status.authMethod === undefined ? [] : [`auth=${status.authMethod}`],+ ...status.lastError === undefined ? [] : [`lastError=${status.lastError}`],+ ]+ log(`status ${String(statusId)}: ${hints.join(' ')}`)+ },+ })+ return {+ manager,+ evidence,+ log,+ dispose: async () => {+ await manager.dispose()+ },+ }+}++/** Wait until the predicate holds or the deadline passes (step-probe wait). */+async function waitFor(predicate: () => boolean, label: string, timeoutMs = 30_000): Promise<void> {+ const deadline = now() + timeoutMs+ while (!predicate()) {+ if (now() > deadline)+ throw new Error(`timed out waiting for ${label}`)+ await new Promise(resolve => setTimeout(resolve, 100))+ }+}++/** Brand a machine id. */+function id(name: string): ReturnType<typeof MachineId> {+ return MachineId(name)+}++/**+ * E2E #1 — drop-driven auto-reconnect on a real linux x64 machine.+ *+ * Flow: connect to `ssh dev` (a python3 HTTP server stands in for the remote+ * `dsh web` instance — the dev host has no Node/dsh and the clone-path+ * install cannot run there; the connection/tunnel/poll surface under test is+ * identical), verify the tunnel serves HTTP, kill exactly the sshd session+ * process serving OUR connection (identified as the one new session worker+ * that appeared while connecting; never the listener, never a global+ * restart), and watch the manager walk connected → reconnecting → connected+ * with the SAME tunnel URL serving HTTP again.+ */+describe('e2e reconnect (linux x64 dev machine)', () => {+ const REMOTE_PORT = 3100++ const profile: MachineProfile = {+ id: id('dev-drop'),+ name: 'dev-drop',+ host: 'dev',+ port: 22,+ user: '',+ // The remote instance stand-in: any loopback HTTP listener exercises the+ // same probe → start → healthy → tunnel path.+ startCommand: `python3 -m http.server ${REMOTE_PORT} --bind 127.0.0.1`,+ remotePort: REMOTE_PORT,+ }++ /**+ * The dev host's container hides /proc/net from `ss`, so peer-port matching+ * is unavailable. Instead: snapshot the sshd session workers (the+ * `sshd-session: …@notty` processes, excluding the probe's own session via+ * `$PPID` and the privileged parents), and diff around our connect.+ */+ function sshdSessionWorkers(): Set<number> {+ const out = execSync(+ `ssh dev 'echo OWN=$PPID; ps -eo pid=,cmd= | grep "[s]shd-session"'`,+ { encoding: 'utf8' },+ )+ const own = Number(out.match(/OWN=(\d+)/u)?.[1] ?? NaN)+ const workers = new Set<number>()+ for (const line of out.split('\n')) {+ const pid = Number(line.trim().match(/^(\d+)\s/u)?.[1] ?? NaN)+ if (!Number.isFinite(pid) || pid === own)+ continue+ if (line.includes('[priv]'))+ continue+ if (line.includes('@'))+ workers.add(pid)+ }+ return workers+ }++ it('recovers a server-side session kill with the same tunnel URL', async () => {+ const harness = bootHarness({ keepaliveIntervalMs: 3_000, reconnectInitialDelayMs: 1_000, reconnectMaxDelayMs: 5_000, reconnectMaxAttempts: 6 })+ const { manager, log } = harness+ try {+ manager.refreshProfiles(new Map([[profile.id, profile]]))++ // 1. Connect and verify the tunnel serves HTTP (the "polling" probe).+ const beforeSessions = sshdSessionWorkers()+ const link = await manager.connect(profile.id)+ expect(manager.status(profile.id).state).toBe('connected')+ const afterSessions = sshdSessionWorkers()+ const fresh = [...afterSessions].filter(pid => !beforeSessions.has(pid))+ const before = await fetch(link.tunnelBaseUrl)+ expect(before.status).toBe(200)+ log(`tunnel serves HTTP ${before.status} at ${link.tunnelBaseUrl}`)+ // A second URL through the same tunnel proves a real HTTP round trip.+ const deep = await fetch(`${link.tunnelBaseUrl}/definitely-missing`)+ expect(deep.status).toBe(404)++ // 2. Our session worker is exactly the one that appeared during the+ // connect; verify what we are about to kill before killing it.+ expect(fresh.length).toBe(1)+ const pid = fresh[0]!+ const cmdOfPid = execSync(`ssh dev "ps -p ${pid} -o cmd="`, { encoding: 'utf8' }).trim()+ expect(cmdOfPid, `refusing to kill non-sshd process: ${cmdOfPid}`).toMatch(/sshd-session/iu)+ log(`identified session sshd pid=${pid} (${cmdOfPid}) as the connect-window diff`)++ // 3. Kill exactly that process (targeted single PID, no restarts).+ execSync(`ssh dev "kill ${pid}"`)+ log(`killed session sshd pid=${pid}`)++ // 4. The manager must walk reconnecting → connected on its own.+ await waitFor(() => manager.status(profile.id).state === 'reconnecting', 'reconnecting state')+ log('observed reconnecting state')+ await waitFor(() => manager.status(profile.id).state === 'connected', 'auto-reconnect', 60_000)+ const status = manager.status(profile.id)+ expect(status.state).toBe('connected')+ expect(['agent', 'key']).toContain(status.authMethod)+ log(`auto-reconnected (auth=${status.authMethod})`)++ // 5. Same URL, serving again: tunnel rebuilt on the preferred port.+ expect(manager.link(profile.id)?.tunnelBaseUrl).toBe(link.tunnelBaseUrl)+ const after = await fetch(link.tunnelBaseUrl)+ expect(after.status).toBe(200)+ log(`tunnel serves HTTP ${after.status} again at the SAME ${link.tunnelBaseUrl}`)++ // 6. Clean teardown; a manual disconnect is `disconnected`, not given-up.+ await manager.disconnect(profile.id)+ expect(manager.status(profile.id).state).toBe('disconnected')++ // 7. Leave the dev machine as we found it: stop the stand-in listener+ // (verify it is our python3 http.server before killing the PID).+ const listenerLine = execSync(+ `ssh dev "ss -tlnp '( sport = :${REMOTE_PORT} )' | grep ':${REMOTE_PORT} '"`,+ { encoding: 'utf8' },+ ).trim()+ const listenerPid = listenerLine.match(/pid=(\d+)/u)?.[1]+ if (listenerPid !== undefined) {+ const listenerCmd = execSync(`ssh dev "ps -p ${listenerPid} -o cmd="`, { encoding: 'utf8' }).trim()+ if (/http\.server/iu.test(listenerCmd)) {+ execSync(`ssh dev "kill ${listenerPid}"`)+ log(`stopped stand-in listener pid=${listenerPid} on remote port ${REMOTE_PORT}`)+ }+ else {+ log(`left remote listener pid=${listenerPid} alone (not our http.server: ${listenerCmd})`)+ }+ }+ }+ finally {+ await harness.dispose()+ }+ }, 240_000)+})++/**+ * E2E #2 — backoff rhythm and the give-up terminal state, driven by a+ * persistently unreachable local port (nothing listens on 127.0.0.1:1).+ * Records every event timestamp so the exponential schedule is readable in+ * the evidence log.+ */+describe('e2e give-up (local unreachable port)', () => {+ const profile: MachineProfile = {+ id: id('unreachable'),+ name: 'unreachable',+ host: '127.0.0.1',+ port: 1,+ user: 'root',+ remotePort: 3080,+ }++ it('retries on an exponential schedule, then lands in given-up', async () => {+ const harness = bootHarness({+ connectTimeoutMs: 2_000,+ reconnectInitialDelayMs: 300,+ reconnectMaxDelayMs: 1_200,+ reconnectMaxAttempts: 4,+ })+ const { manager } = harness+ try {+ manager.refreshProfiles(new Map([[profile.id, profile]]))++ // The first failure rejects the caller's connect; the loop continues.+ await expect(manager.connect(profile.id)).rejects.toThrow()+ await waitFor(() => manager.status(profile.id).state === 'given-up', 'give-up', 30_000)++ const status = manager.status(profile.id)+ expect(status.state).toBe('given-up')+ expect(status.nextRetryAt).toBeUndefined()+ expect(status.lastError).toMatch(/connect failed after 5 attempt\(s\)/u)+ expect(status.lastError).toMatch(/host unreachable/u)++ // The retry schedule from the event log: one auth failure per attempt,+ // one reconnect line per scheduled retry, gaps growing 300→600→1200→1200.+ const retryLines = harness.evidence.filter(line => line.text.includes('event reconnect: retrying'))+ const gaps: number[] = []+ let previous: number | undefined+ for (const line of retryLines) {+ if (previous !== undefined)+ gaps.push(line.at - previous)+ previous = line.at+ }+ harness.log(`retry gaps: ${gaps.join(', ')} ms`)+ expect(gaps.length).toBeGreaterThanOrEqual(3)+ for (const gap of gaps)+ expect(gap).toBeGreaterThan(0)+ // Each gap at least as long as the previous one (the schedule only+ // grows, capped at 1.2 s; small scheduling jitter tolerated).+ for (let i = 1; i < gaps.length; i++)+ expect(gaps[i]!).toBeGreaterThanOrEqual(gaps[i - 1]! - 50)++ // A manual disconnect after give-up is a different, clean terminal.+ await manager.disconnect(profile.id)+ expect(manager.status(profile.id).state).toBe('disconnected')+ }+ finally {+ await harness.dispose()+ }+ }, 120_000)+})++/**+ * E2E #3 — password authentication over a real SSH protocol round trip.+ *+ * Environment note: no OS sshd with password login is reachable from this+ * host (local port 22 closed, no docker, and the shared root dev machine's+ * sshd config must not be touched). The stand-in is a loopback ssh2 protocol+ * server that rejects every publickey attempt and accepts exactly one+ * password — the full agent→key→password chain, the order evidence+ * (server-recorded method sequence), and the three failure classes are all+ * exercised over the wire by the real transport.+ *+ * Downgrade label: OS-sshd password E2E 未验证(环境不可得);本套为本地+ * ssh2 协议服务器替代证据。+ */+describe('e2e password chain (loopback ssh2 protocol server)', () => {+ const PASSWORD = 'e2e-trustno1'++ /** One server-side authentication attempt record. */+ interface AuthAttempt {+ method: string+ accepted: boolean+ }++ /** The recorded auth attempts and the accepted method, per connection. */+ const attempts: AuthAttempt[] = []+ let server: SshServer+ let serverPort = 0+ let scratchSshDir: string++ beforeAll(async () => {+ // A fresh host key pair for the server and one for the client's (rejected)+ // identity file.+ const hostKey = freshRsaPem()+ const clientKey = freshRsaPem()+ scratchSshDir = mkdtempSync(join(tmpdir(), 'dsh-ssh-e2e-sshdir-'))+ writeFileSync(join(scratchSshDir, 'id_rsa'), clientKey)++ server = new Server({ hostKeys: [hostKey] }, (client: Connection) => {+ client.on('authentication', (ctx) => {+ if (ctx.method === 'password' && ctx.password === PASSWORD) {+ attempts.push({ method: ctx.method, accepted: true })+ ctx.accept()+ return+ }+ attempts.push({ method: ctx.method, accepted: false })+ ctx.reject(['publickey', 'password'])+ })+ client.on('session', (accept) => {+ const session = accept()+ session.on('exec', (acceptExec) => {+ const stream = acceptExec()+ stream.write('Linux x86_64\n')+ stream.exit(0)+ stream.end()+ })+ })+ client.on('error', () => {+ // Client-side hangups during failure cases surface here; expected.+ })+ })+ await new Promise<void>((resolve) => {+ server.listen(0, '127.0.0.1', () => resolve())+ })+ serverPort = (server.address() as { port: number }).port+ })++ afterAll(() => {+ server.close()+ rmSync(scratchSshDir, { recursive: true, force: true })+ })++ function profileWith(password?: string): MachineProfile {+ return {+ id: id('password-e2e'),+ name: 'password-e2e',+ host: '127.0.0.1',+ port: serverPort,+ user: 'root',+ ...password === undefined ? {} : { password },+ remotePort: 3080,+ }+ }++ it('authenticates with the stored password after agent and keys are refused', async () => {+ attempts.length = 0+ const harness = bootHarness({ sshDir: scratchSshDir, connectTimeoutMs: 5_000 })+ try {+ const profile = profileWith(PASSWORD)+ harness.manager.refreshProfiles(new Map([[profile.id, profile]]))+ const result = await harness.manager.test(profile.id)+ expect(result).toEqual({ ok: true, banner: 'Linux x86_64' })++ // Order evidence: every publickey attempt (agent-sourced and the+ // identity file) precedes the accepted password attempt.+ const methods = attempts.map(attempt => attempt.method)+ harness.log(`server saw auth methods: ${methods.join(' -> ')}`)+ expect(methods[methods.length - 1]).toBe('password')+ expect(attempts.at(-1)?.accepted).toBe(true)+ const passwordIndex = methods.indexOf('password')+ expect(methods.slice(0, passwordIndex).every(method => method === 'publickey')).toBe(true)+ expect(passwordIndex).toBeGreaterThan(0)+ }+ finally {+ await harness.dispose()+ }+ })++ it('classifies a wrong stored password as password-rejected', async () => {+ attempts.length = 0+ const harness = bootHarness({ sshDir: scratchSshDir, connectTimeoutMs: 5_000 })+ try {+ const profile = profileWith('wrong-password')+ harness.manager.refreshProfiles(new Map([[profile.id, profile]]))+ const result = await harness.manager.test(profile.id)+ expect(result.ok).toBe(false)+ expect(result.ok === false && result.message).toMatch(/stored password was rejected/u)+ }+ finally {+ await harness.dispose()+ }+ })++ it('classifies exhausted keys without a password as key-rejected', async () => {+ attempts.length = 0+ const harness = bootHarness({ sshDir: scratchSshDir, connectTimeoutMs: 5_000 })+ try {+ const profile = profileWith()+ harness.manager.refreshProfiles(new Map([[profile.id, profile]]))+ const result = await harness.manager.test(profile.id)+ expect(result.ok).toBe(false)+ expect(result.ok === false && result.message).toMatch(/no key or ssh-agent was accepted/u)+ }+ finally {+ await harness.dispose()+ }+ })+})++/**+ * E2E #4 — the keepalive watchdog on a hung (silent) connection. A local+ * proxy stops forwarding bytes in both directions (no FIN, no RST — exactly+ * what a NAT/firewall drop looks like); ssh2's keepalive misses its+ * heartbeat budget and must declare the session closed, surfacing through+ * the session's onClosed callback (the manager's reconnect trigger).+ */+describe('e2e keepalive watchdog (silent connection freeze)', () => {+ const PASSWORD = 'e2e-watchdog'+ const KEEPALIVE_INTERVAL_MS = 1_000+ const KEEPALIVE_COUNT_MAX = 3++ let server: SshServer+ let serverPort = 0+ let scratchSshDir: string++ /** The stalling proxy: pipes traffic until `freeze()` silently drops it. */+ function startStallingProxy(): Promise<{ port: number, freeze: () => void, close: () => void }> {+ const sockets = new Set<{ a: import('node:net').Socket, b: import('node:net').Socket }>()+ const proxy = createServer((downstream) => {+ const upstream = tcpConnect(serverPort, '127.0.0.1')+ const pair = { a: downstream, b: upstream }+ sockets.add(pair)+ downstream.on('close', () => sockets.delete(pair))+ upstream.on('close', () => sockets.delete(pair))+ downstream.pipe(upstream)+ upstream.pipe(downstream)+ downstream.on('error', () => downstream.destroy())+ upstream.on('error', () => upstream.destroy())+ })+ return new Promise((resolve) => {+ proxy.listen(0, '127.0.0.1', () => {+ resolve({+ port: (proxy.address() as { port: number }).port,+ freeze: (): void => {+ // Stop forwarding in both directions without closing anything: the+ // client sees a silent, still-open TCP connection.+ for (const { a, b } of sockets) {+ a.unpipe(b)+ b.unpipe(a)+ a.pause()+ b.pause()+ }+ },+ close: (): void => {+ for (const { a, b } of sockets) {+ a.destroy()+ b.destroy()+ }+ proxy.close()+ },+ })+ })+ })+ }++ beforeAll(async () => {+ server = new Server({ hostKeys: [freshRsaPem()] }, (client: Connection) => {+ client.on('authentication', (ctx) => {+ if (ctx.method === 'password' && ctx.password === PASSWORD)+ ctx.accept()+ else+ ctx.reject(['password'])+ })+ client.on('session', (accept) => {+ const session = accept()+ session.on('exec', (acceptExec) => {+ const stream = acceptExec()+ stream.write('Linux x86_64\n')+ stream.exit(0)+ stream.end()+ })+ })+ client.on('error', () => {+ // Watchdog teardowns land here on the server side; expected.+ })+ })+ await new Promise<void>((resolve) => {+ server.listen(0, '127.0.0.1', () => resolve())+ })+ serverPort = (server.address() as { port: number }).port+ scratchSshDir = mkdtempSync(join(tmpdir(), 'dsh-ssh-e2e-watchdog-'))+ writeFileSync(join(scratchSshDir, 'config'), '')+ })++ afterAll(() => {+ server.close()+ rmSync(scratchSshDir, { recursive: true, force: true })+ })++ it('declares a hung session closed after the heartbeat budget', async () => {+ const proxy = await startStallingProxy()+ const transport = new Ssh2Transport(+ 5_000,+ new SshConfigResolver(scratchSshDir, homedir()),+ { keepaliveIntervalMs: KEEPALIVE_INTERVAL_MS, keepaliveCountMax: KEEPALIVE_COUNT_MAX },+ )+ const profile: MachineProfile = {+ id: MachineId('watchdog'),+ name: 'watchdog',+ host: '127.0.0.1',+ port: proxy.port,+ user: 'root',+ password: PASSWORD,+ remotePort: 3080,+ }+ try {+ const session = await transport.connect(profile, () => true)+ expect(session.authMethod).toBe('password')++ const closedAt = new Promise<number>((resolve) => {+ session.onClosed(() => resolve(Date.now()))+ })+ const frozeAt = Date.now()+ proxy.freeze()++ // ssh2 must give up after ~interval*(countMax) of unanswered+ // heartbeats and surface the close — not hang forever on the silent+ // socket. Assert a generous upper bound so the test stays robust.+ const timeout = new Promise<never>((_, reject) => {+ setTimeout(() => reject(new Error('watchdog never declared the session closed')), 30_000)+ })+ const closed = await Promise.race([closedAt, timeout])+ const elapsed = closed - frozeAt+ // eslint-disable-next-line no-console -- evidence log+ console.log(`[watchdog] silent freeze → close after ${elapsed} ms (interval ${KEEPALIVE_INTERVAL_MS} ms × ${KEEPALIVE_COUNT_MAX} missed)`)+ expect(elapsed).toBeGreaterThan(KEEPALIVE_INTERVAL_MS * KEEPALIVE_COUNT_MAX - 500)+ expect(elapsed).toBeLessThan(20_000)+ }+ finally {+ proxy.close()+ }+ }, 60_000)+})diff --git a/tsconfig.json b/tsconfig.jsonindex 53bb720e..64052e1a 100644--- a/tsconfig.json+++ b/tsconfig.json@@ -27,9 +27,9 @@"src","test","packages/*/src",+ "packages/*/scripts","types","packages/.test/test-utils.ts",- "scripts/build-plugins.ts",- "scripts/build-taiwindcss.ts"+ "scripts/build-plugins.ts"]}diff --git a/tsconfig.node.json b/tsconfig.node.jsonindex c22155d7..98f0facb 100644--- a/tsconfig.node.json+++ b/tsconfig.node.json@@ -7,5 +7,5 @@"skipLibCheck": true},"include": ["vite.config.ts", "scripts/**/*"],- "exclude": ["scripts/build-plugins.ts", "scripts/build-taiwindcss.ts"]+ "exclude": ["scripts/build-plugins.ts"]}diff --git a/vitest.unit.config.ts b/vitest.unit.config.tsindex 8b37780a..178862ca 100644--- a/vitest.unit.config.ts+++ b/vitest.unit.config.ts@@ -41,12 +41,12 @@ export default defineProject({'**/node_modules/**','test/archive/**','archive/**',- // 渲染官方 UI primitives 的 ssh-ui 组件套件需要包内 vitest.config 的+ // 渲染官方 UI primitives 的 ssh 组件套件需要包内 vitest.config 的// CSS 内联与 react 单副本别名(pnpm 下 primitives 嵌套 react@18),// 本 project 无此处理会挂载失败;这些套件由- // `pnpm --filter dsh-tauri-ssh-ui test` 全量执行。- 'packages/dsh-tauri-ssh-ui/src/client/components/**',- 'packages/dsh-tauri-ssh-ui/src/client/index.test.ts',+ // `pnpm --filter dsh-tauri-ssh test` 全量执行。+ 'packages/dsh-tauri-ssh/src/client/components/**',+ 'packages/dsh-tauri-ssh/src/client/index.test.ts',],// 壳层模块在导入期就访问 Tauri API,node 下需要最小运行时垫片,见该文件说明。setupFiles: ['./test/setup/tauri-runtime.ts'],