DeepSeek Harness Tauri 桌面版 | Only 8mb installer, zero environment setup, preset plugins, Windows / macOS / Linux.
feat: reuse compatible local Node.js runtime; bump to v0.1.3
hairyf588d3795866b
diff --git a/README.md b/README.mdindex 08c16e4c..246118f8 100644--- a/README.md+++ b/README.md@@ -31,7 +31,7 @@| | || --- | --- |-| **One-click install** | On first launch, the app downloads the Node.js runtime and a prebuilt Harness bundle for you — no manual Node.js, pnpm, or Docker setup. |+| **One-click install** | On first launch the app installs the prebuilt Harness bundle and reuses a compatible local Node.js (v22.15.0+ / v23.8.0+) when present, otherwise downloads the bundled Node.js runtime — no manual setup. || **Runs 100% locally** | The `dsh web` service runs at `http://127.0.0.1:3080`. Profiles, sessions, and settings all live on your machine. || **Privacy by default** | Isolated `$DSH_HOME` and telemetry disabled out of the box (`DSH_TELEMETRY_DISABLED=1`). || **Cross-platform** | Installers for Windows (NSIS/MSI), macOS (DMG), and Linux (AppImage). |@@ -43,7 +43,7 @@1. Download the installer for your platform from the [Releases](https://github.com/hairyf/deepseek-harness-desktop/releases) page.2. Install and launch the app.-3. On the first run it downloads the Node.js runtime and the prebuilt Harness bundle (a few hundred MB in total). When setup finishes, the embedded Harness UI opens at `http://127.0.0.1:3080`.+3. On the first run the app installs its dependencies: if a compatible Node.js (v22.15.0+ / v23.8.0+) is already on your machine it is reused as-is; otherwise the Node.js runtime and the prebuilt Harness bundle are downloaded (a few hundred MB in total). When setup finishes, the embedded Harness UI opens at `http://127.0.0.1:3080`.> First run requires a network connection. Everything after that runs locally.@@ -54,7 +54,7 @@- Linux (mainstream distributions that support AppImage)- Network on first launch-The app bundles Node.js **v22.22.0 LTS**, which satisfies the Harness requirement of **v22.15.0+ or v23.8.0+**.+The app bundles Node.js **v22.22.0 LTS**, which satisfies the Harness requirement of **v22.15.0+ or v23.8.0+**. On first launch it first checks for a local Node.js installation: any compatible version is reused directly and the bundled runtime download is skipped.## Developmentdiff --git a/README.zh.md b/README.zh.mdindex e5e46a6a..bcc044aa 100644--- a/README.zh.md+++ b/README.zh.md@@ -35,7 +35,7 @@| | || --- | --- |-| **一键安装** | 首次启动自动下载 Node.js 运行时与打包好的 Harness 发行版,无需手动配置任何环境 |+| **一键安装** | 首次启动自动安装打包好的 Harness 发行版;若本机已存在版本兼容的 Node.js(v22.15.0+ / v23.8.0+)则直接复用,否则自动下载 Node.js 运行时,无需手动配置任何环境 || **纯本地运行** | `dsh web` 服务运行在 `http://127.0.0.1:3080`,profile、会话与设置全部保存在本机 || **隐私默认** | 隔离的 `$DSH_HOME`,默认关闭遥测(`DSH_TELEMETRY_DISABLED=1`) || **跨平台** | Windows(NSIS/MSI)、macOS(DMG)、Linux(AppImage)安装包 |@@ -47,7 +47,7 @@1. 在 [Releases](https://github.com/hairyf/deepseek-harness-desktop/releases) 页面下载对应平台的安装包;2. 安装并启动应用;-3. 首次运行会自动下载 Node.js 运行时与 Harness 发行包(合计约几百 MB);就绪后内嵌的 Harness 界面会打开在 `http://127.0.0.1:3080`。+3. 首次运行会自动安装依赖:若检测到本机已安装版本兼容的 Node.js(v22.15.0+ / v23.8.0+)则直接复用,否则自动下载 Node.js 运行时与 Harness 发行包(合计约几百 MB);就绪后内嵌的 Harness 界面会打开在 `http://127.0.0.1:3080`。> 首次运行需要联网;之后一切都在本地完成。@@ -58,7 +58,7 @@- Linux(支持 AppImage 的主流发行版)- 首次运行需要网络-应用默认捆绑 Node.js **v22.22.0 LTS**,满足 Harness 的 **v22.15.0+ 或 v23.8.0+** 要求。+应用默认捆绑 Node.js **v22.22.0 LTS**(满足 Harness 的 **v22.15.0+ 或 v23.8.0+** 要求)。首次启动时会优先检测本机的 Node.js 环境:只要版本兼容就直接复用本地 Node,跳过运行时的下载与安装。## 开发与构建diff --git a/package.json b/package.jsonindex 21e5414e..885a985f 100644--- a/package.json+++ b/package.json@@ -1,7 +1,7 @@{"name": "deepseek-harness-desktop","private": true,- "version": "0.1.2",+ "version": "0.1.3","type": "module","description": "Desktop application for DeepSeek Harness (dsh) — one-click local install and launch, no Node.js setup required.","scripts": {diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lockindex 6a85d706..ec160d4b 100644--- a/src-tauri/Cargo.lock+++ b/src-tauri/Cargo.lock@@ -770,7 +770,7 @@ dependencies = [[[package]]name = "deepseek-harness-desktop"-version = "0.1.2"+version = "0.1.3"dependencies = ["async-trait","flate2",diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.tomlindex 521fcb0c..562b1ecd 100644--- a/src-tauri/Cargo.toml+++ b/src-tauri/Cargo.toml@@ -1,6 +1,6 @@[package]name = "deepseek-harness-desktop"-version = "0.1.2"+version = "0.1.3"description = "Desktop application for DeepSeek Harness (dsh)"authors = ["deepseek-harness-desktop contributors"]edition = "2021"diff --git a/src-tauri/src/config/runtime.rs b/src-tauri/src/config/runtime.rsindex e1187ecd..ebd941a2 100644--- a/src-tauri/src/config/runtime.rs+++ b/src-tauri/src/config/runtime.rs@@ -1,7 +1,7 @@use serde::Serialize;use std::env;use std::fs;-use std::path::PathBuf;+use std::path::{Path, PathBuf};use tauri::{AppHandle, Manager, Runtime};use super::constants::*;@@ -49,8 +49,82 @@ pub fn get_dsh_download_url() -> Result<String, String> {Ok(format!("{}{}", DSH_CORE_URL, filename))}-/// Node.js 二进制路径(安装后)+/// 在 PATH 及常见安装目录中查找 node 可执行文件(不校验版本)+fn find_local_node_binary() -> Option<PathBuf> {+ let bin_name = if cfg!(windows) { "node.exe" } else { "node" };++ let path_dirs: Vec<PathBuf> =+ std::env::split_paths(&std::env::var_os("PATH").unwrap_or_default())+ .filter(|dir| !dir.as_os_str().is_empty())+ .collect();++ // macOS 上从 Finder/launchd 启动时 PATH 可能不完整,补充常见安装目录+ #[cfg(target_os = "macos")]+ let dirs: Vec<PathBuf> = {+ let mut dirs = path_dirs;+ dirs.extend([+ PathBuf::from("/opt/homebrew/bin"),+ PathBuf::from("/usr/local/bin"),+ ]);+ dirs+ };++ #[cfg(not(target_os = "macos"))]+ let dirs = path_dirs;++ for dir in dirs {+ let candidate = dir.join(bin_name);+ if candidate.is_file() && is_executable(&candidate) {+ return Some(candidate);+ }+ }+ None+}++#[cfg(unix)]+fn is_executable(path: &Path) -> bool {+ use std::os::unix::fs::PermissionsExt;+ path.metadata()+ .map(|meta| meta.permissions().mode() & 0o111 != 0)+ .unwrap_or(false)+}++#[cfg(not(unix))]+fn is_executable(_path: &Path) -> bool {+ true+}++/// 获取指定 Node.js 二进制的版本号(例如 "22.22.0")+fn get_node_version_of(node: &Path) -> Option<String> {+ let output = std::process::Command::new(node).arg("--version").output().ok()?;+ if !output.status.success() {+ return None;+ }+ let stdout = String::from_utf8_lossy(&output.stdout);+ let version = stdout.trim().trim_start_matches('v');+ if version.is_empty() {+ None+ } else {+ Some(version.to_string())+ }+}++/// 检测本地是否存在版本兼容的 Node.js 环境,返回其二进制路径+pub fn get_local_node_path() -> Option<PathBuf> {+ let node = find_local_node_binary()?;+ let version = get_node_version_of(&node)?;+ is_supported_node_version(&version).then_some(node)+}++/// Node.js 二进制路径+///+/// 优先级:本地版本兼容的 Node.js 环境 > 已安装的捆绑运行时pub fn get_node_binary_path(app_handle: &tauri::AppHandle) -> PathBuf {+ if let Some(local_node) = get_local_node_path() {+ log::debug!("Using local Node.js: {}", local_node.display());+ return local_node;+ }+let runtime_dir = get_node_install_path(app_handle);// 使用 cfg 宏在编译时确定文件名let (rel_path, bin_name) = if cfg!(windows) {@@ -101,6 +175,16 @@ pub fn get_bundled_node_version() -> String {NODE_VERSION.trim_start_matches('v').to_string()}+/// 当前实际使用的 Node.js 版本号(本地 Node 优先,其次捆绑运行时)+pub fn get_active_node_version() -> String {+ if let Some(local_node) = get_local_node_path() {+ if let Some(version) = get_node_version_of(&local_node) {+ return version;+ }+ }+ get_bundled_node_version()+}+fn parse_node_version(output: &str) -> Option<(u64, u64, u64)> {let version = output.trim().trim_start_matches('v');let mut parts = version.split('.');@@ -175,7 +259,7 @@ pub fn runtime_info<R: Runtime>(app: &AppHandle<R>, port: u16) -> RuntimeInfo {RuntimeInfo {app_version: app.package_info().version.to_string(),dsh_version: get_dsh_version(app),- node_version: get_bundled_node_version(),+ node_version: get_active_node_version(),service_url: get_dsh_service_url(port),data_dir: app_data_dir.clone(),log_path: PathBuf::from(&app_data_dir)diff --git a/src-tauri/src/service/download/installable.rs b/src-tauri/src/service/download/installable.rsindex 9dad42be..b95c2bfd 100644--- a/src-tauri/src/service/download/installable.rs+++ b/src-tauri/src/service/download/installable.rs@@ -26,6 +26,13 @@ impl Installable for Nodejs {config::get_node_install_path(app)}fn check_installed(&self, app: &AppHandle) -> bool {+ if let Some(local_node) = config::get_local_node_path() {+ log::info!(+ "Detected compatible local Node.js ({}), skipping bundled runtime",+ local_node.display()+ );+ return true;+ }config::get_node_binary_path(app).exists() && config::is_runtime_compatible(app)}}diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.jsonindex 3f4eb10c..8c23b720 100644--- a/src-tauri/tauri.conf.json+++ b/src-tauri/tauri.conf.json@@ -1,7 +1,7 @@{"$schema": "https://schema.tauri.app/config/2","productName": "Deepseek Harness Desktop",- "version": "0.1.2",+ "version": "0.1.3","identifier": "io.github.hairyf.deepseek-harness-desktop","build": {"beforeDevCommand": "pnpm dev",