Skip to content

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

feat(plugin): surface preinstall restart in log panel

hairyfb501d5db341e
diff --git a/src-tauri/src/service/plugin/install.rs b/src-tauri/src/service/plugin/install.rs
index b728e4e5..0531525a 100644
--- a/src-tauri/src/service/plugin/install.rs
+++ b/src-tauri/src/service/plugin/install.rs
@@ -83,6 +83,13 @@ pub async fn install(app_handle: &AppHandle, ids: &[String]) -> Result<(), Strin
// 安装前停止运行中的服务,避免资源冲突
if workflow::has_owned_process() {
+ // 停服务会让用户感到"重启",先在日志面板讲清缘由(issue #48)
+ let _ = window.emit(
+ PREINSTALL_LOG_EVENT,
+ PreinstallLogPayload {
+ line: "[harness] 正在停止运行中的服务(安装插件需要短暂重启)…".to_string(),
+ },
+ );
log::info!("Stopping running harness service before installing preinstall plugins");
if let Err(e) = workflow::stop(app_handle.clone()).await {
log::warn!("failed to stop harness before preinstall: {e}");
@@ -199,6 +206,14 @@ pub async fn install(app_handle: &AppHandle, ids: &[String]) -> Result<(), Strin
}
}
+ // 告知用户安装阶段结束;随后的服务重启由前端 continueAfterPreinstall 负责
+ let _ = window.emit(
+ PREINSTALL_LOG_EVENT,
+ PreinstallLogPayload {
+ line: format!("[harness] 已安装 {} 个插件", ids.len()),
+ },
+ );
+
log::info!("Preinstall plugins installed successfully: {ids:?}");
Ok(())
}
diff --git a/src/store/modules/harness/store.ts b/src/store/modules/harness/store.ts
index 1b4dbc75..481b06f5 100644
--- a/src/store/modules/harness/store.ts
+++ b/src/store/modules/harness/store.ts
@@ -452,6 +452,9 @@ export const harness = defineStore({
try {
unlisten = await this.listenPreinstallLog()
await invoke('install_preinstall_plugins', { ids })
+ // 后端装完已把服务停掉,这里在日志面板讲清接下来的重启(issue #48),
+ // 避免用户把"插件安装后的自动重启"误认为崩溃/故障。
+ this.preinstall.logs = [...this.preinstall.logs, '[harness] 正在重启服务,请稍候…'].slice(-200)
await this.continueAfterPreinstall()
}
catch (err) {