feat: 增加父进程看护机制与操作来源标识

- 新增 startParentWatchdog 方法,监控宿主进程状态,确保后端在宿主崩溃时自动退出,避免端口占用。
- 在 API 请求中引入 X-MacTFS-Source 请求头,区分来自 MCP(AI)与手动操作的请求,增强操作日志的可追溯性。
- 更新操作日志结构,记录操作来源,支持在前端进行来源过滤展示。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
fenghp
2026-06-26 14:15:08 +08:00
co-authored by Cursor
parent 3cf42cdbaf
commit 24de23ee61
7 changed files with 210 additions and 15 deletions
+5 -1
View File
@@ -26,7 +26,11 @@ async function request<T>(
}
}
const headers: Record<string, string> = { Accept: "application/json" }
const headers: Record<string, string> = {
Accept: "application/json",
// 标记本次请求来自 MCP(AI),供后端操作日志区分「AI 操作 / 手动操作」。
"X-MacTFS-Source": "mcp",
}
if (token) {
headers.Authorization = `Bearer ${token}`
}