fix: restart backend under systemd and use .sproutclaw agent dir

Restart via systemctl when running as a service, set SPROUTCLAW_CODING_AGENT_DIR
for the RPC subprocess, and add a frontend poll timeout for failed restarts.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-06-24 10:29:28 +08:00
parent 767a776a3e
commit bd2251e89a
7 changed files with 123 additions and 32 deletions

View File

@@ -100,7 +100,7 @@ function extensionCategory(extension: ExtensionInfo): "local" | "npm" {
}
if (extension.source?.startsWith("npm:")) return "npm";
const pathHint = `${extension.path || ""} ${extension.location || ""}`.replace(/\\/g, "/");
if (pathHint.includes("/.pi/agent/npm/node_modules/")) return "npm";
if (pathHint.includes("/.sproutclaw/agent/npm/node_modules/")) return "npm";
return "local";
}
@@ -701,8 +701,13 @@ export function SettingsPage() {
} catch {
// 后端重启时连接断开属正常现象,忽略错误
}
// 轮询直到后端恢复
const deadline = Date.now() + 60_000;
const poll = async () => {
if (Date.now() > deadline) {
setRestarting(false);
setStatus("后端重启超时,请检查 sproutclaw-web 服务状态", "error");
return;
}
try {
await settingsApi.fetchSettings();
setStatus("后端已重启,正在刷新...", "ok");