Skip to content

DeepSeek Harness Tauri 桌面版 | Only 8mb installer, zero environment setup, preset plugins, Windows / macOS / Linux.

fix(ssh): 新档案冷启动三连修——模板初始化/旗标形状/裸清单兜底

Menghuan19188eec0255f4e6
diff --git a/packages/dsh-tauri-ssh/src/host/service/bootstrap.test.ts b/packages/dsh-tauri-ssh/src/host/service/bootstrap.test.ts
index 019f357e..73f3a5b2 100644
--- a/packages/dsh-tauri-ssh/src/host/service/bootstrap.test.ts
+++ b/packages/dsh-tauri-ssh/src/host/service/bootstrap.test.ts
@@ -559,7 +559,7 @@ describe('component probe and launch commands', () => {
it('launches with the machine profile flag and falls back to remote', async () => {
const plan = await planRemoteInstall('Linux 6.8 x86_64', {}, healthyFetchers())
const named = startCommandFor({ ...profile, profileName: 'work' }, plan)
- expect(named).toContain(`--profile "$5"`)
+ expect(named).toContain(`--profile "$5" --host`)
expect(named).toContain('work')
expect(named).toContain('档案: work')
expect(startCommandFor(profile, plan)).toContain('档案: remote')
diff --git a/packages/dsh-tauri-ssh/src/host/service/bootstrap.ts b/packages/dsh-tauri-ssh/src/host/service/bootstrap.ts
index 03aca232..2d33fefc 100644
--- a/packages/dsh-tauri-ssh/src/host/service/bootstrap.ts
+++ b/packages/dsh-tauri-ssh/src/host/service/bootstrap.ts
@@ -567,7 +567,7 @@ export function startCommandFor(profile: MachineProfile, plan?: RemoteInstallPla
`export PATH="$ROOT/runtime/bin:$PATH"`,
`export DSH_TELEMETRY_DISABLED=1 NO_COLOR=1 DSH_WEB_PORT=${profile.remotePort}`,
`export DSH_REMOTE_SESSION_ORIGIN=${shQuote(profile.name)}`,
- `( sh -c 'echo $$ > "$1/.dsh-remote.pid"; exec "$2" "$3" --profile "$5" web --host 127.0.0.1 --port "$4" --no-open' dsh-remote "$LOG_DIR" "$NODE" "$DSH_BIN" ${profile.remotePort} ${profileName} </dev/null >>"$LOG" 2>&1 & )`,
+ `( sh -c 'echo $$ > "$1/.dsh-remote.pid"; exec "$2" "$3" --profile "$5" --host 127.0.0.1 --port "$4" --no-open' dsh-remote "$LOG_DIR" "$NODE" "$DSH_BIN" ${profile.remotePort} ${profileName} </dev/null >>"$LOG" 2>&1 & )`,
`echo "远端实例已拉起(档案: ${profileName}, 日志: $LOG)"`,
].join('\n')
}
diff --git a/packages/dsh-tauri-ssh/src/host/service/plugins-sync.ts b/packages/dsh-tauri-ssh/src/host/service/plugins-sync.ts
index dce6bcd0..950d998b 100644
--- a/packages/dsh-tauri-ssh/src/host/service/plugins-sync.ts
+++ b/packages/dsh-tauri-ssh/src/host/service/plugins-sync.ts
@@ -46,7 +46,9 @@ const REMOTE_PIDFILE = '.dsh/dsh-remote.pid'
export const WIRE_SCRIPT = `const fs = require('fs')
const path = require('path')
const [profilePkg, base, ...names] = process.argv.slice(2)
-const doc = JSON.parse(fs.readFileSync(profilePkg, 'utf8'))
+const doc = fs.existsSync(profilePkg)
+ ? JSON.parse(fs.readFileSync(profilePkg, 'utf8'))
+ : { name: 'dsh-remote', version: '0.0.0', dependencies: {} }
doc.dependencies = doc.dependencies || {}
doc.dsh = doc.dsh || {}
doc.dsh.profile = doc.dsh.profile || {}
@@ -188,7 +190,7 @@ export function pluginSyncApplyCommand(tree: BundledPluginsTree, hash: string, p
`mv "$BASE.new" "$BASE"`,
`rm -rf "$BASE.old"`,
`echo "${hash}" > "$HOME/${SYNC_MARKER}"`,
- `mkdir -p "$HOME/${profile}"`,
+ `[ -f "$HOME/${profile}/package.json" ] || "$HOME/${REMOTE_ROOT}/runtime/bin/node" "$HOME/${REMOTE_ROOT}/dependencies/dsh/node_modules/@deepseek-ai/dsh/lib/bin.js" --profile ${profileName} --from-default-profile web --help >/dev/null 2>&1`,
`"$HOME/${REMOTE_ROOT}/runtime/bin/node" "$BASE/node_modules/_wire.js" "$HOME/${profile}/package.json" "$BASE/node_modules" ${names}`,
// 实例在跑则重启:pidfile 之外还按安装路径精确清场(pidfile 可能因上次崩溃
// 指向已死进程),并等 3080 释放后再交还 ensure 拉起,避免新实例 EADDRINUSE