feat(history): add unified MCP execution history

This commit is contained in:
二丫讲梵 authored and GitHub committed 2026-09-26 22:18:38 +08:00
1 parent dd82d948a9
commit 5c0ce7e4dc
39 files changed
+1261 -87

No files matched your search

+4
View File
@@ -380,6 +380,8 @@ export const saveSqlFileUploadMaxMb = forward("saveSqlFileUploadMaxMb");
export const saveMaxAgentTurns = forward("saveMaxAgentTurns");
export const loadHistoryRetentionLimit = forward("loadHistoryRetentionLimit");
export const saveHistoryRetentionLimit = forward("saveHistoryRetentionLimit");
export const loadMcpHistoryRetentionLimit = forward("loadMcpHistoryRetentionLimit");
export const saveMcpHistoryRetentionLimit = forward("saveMcpHistoryRetentionLimit");
export const loadMaxRetries = forward("loadMaxRetries");
export const saveMaxRetries = forward("saveMaxRetries");
export const completeAppClose = forward("completeAppClose");
@@ -916,6 +918,8 @@ export const searchHistory = forward("searchHistory");
export const loadHistoryConnectionOptions = forward("loadHistoryConnectionOptions");
export const loadRedisHistory = forward("loadRedisHistory");
export const clearHistory = forward("clearHistory");
export const clearHistoryBySource = forward("clearHistoryBySource");
export const cleanupMcpHistoryRetention = forward("cleanupMcpHistoryRetention");
export const clearRedisHistory = forward("clearRedisHistory");
export const deleteHistoryEntry = forward("deleteHistoryEntry");
+21
View File
@@ -2277,6 +2277,19 @@ export async function saveHistoryRetentionLimit(limit: number): Promise<void> {
if (!res.ok) throw await backendResponseError(res);
}
export async function loadMcpHistoryRetentionLimit(): Promise<number> {
return get("/api/app-settings/mcp-history-retention-limit");
}
export async function saveMcpHistoryRetentionLimit(limit: number): Promise<void> {
const res = await fetch(apiUrl("/api/app-settings/mcp-history-retention-limit"), {
method: "PUT",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ limit }),
});
if (!res.ok) throw await backendResponseError(res);
}
export async function loadMaxRetries(): Promise<number> {
return get("/api/app-settings/max-retries");
}
@@ -5197,6 +5210,14 @@ export async function clearHistory(): Promise<void> {
return del("/api/history");
}
export async function clearHistoryBySource(source: string): Promise<void> {
return del(`/api/history?source=${encodeURIComponent(source)}`);
}
export async function cleanupMcpHistoryRetention(): Promise<number> {
return post("/api/app-settings/mcp-history-retention-cleanup", {});
}
export async function clearRedisHistory(): Promise<void> {
const entries = await loadRedisHistory(1000, 0);
await Promise.all(entries.map((e) => deleteHistoryEntry(e.id)));
+23
View File
@@ -882,6 +882,14 @@ export async function saveHistoryRetentionLimit(limit: number): Promise<void> {
return invoke("save_history_retention_limit", { limit });
}
export async function loadMcpHistoryRetentionLimit(): Promise<number> {
return invoke("load_mcp_history_retention_limit");
}
export async function saveMcpHistoryRetentionLimit(limit: number): Promise<void> {
return invoke("save_mcp_history_retention_limit", { limit });
}
export async function loadMaxRetries(): Promise<number> {
return invoke("load_max_retries");
}
@@ -5086,6 +5094,11 @@ export interface HistoryEntry {
affected_rows?: number | null;
rollback_sql?: string | null;
details_json?: string | null;
source?: "sql" | "mcp" | "other";
mcp_tool_name?: string | null;
mcp_request_json?: string | null;
mcp_response_json?: string | null;
mcp_session_id?: string | null;
}
export interface HistoryConnectionFilter {
@@ -5112,6 +5125,8 @@ export interface HistorySearchRequest {
ended_at?: string;
cursor?: HistoryCursor;
limit: number;
source?: "sql" | "mcp" | "other";
mcp_tool_name?: string;
}
export interface HistorySearchResult {
@@ -5152,6 +5167,14 @@ export async function clearHistory(): Promise<void> {
return invoke("clear_history");
}
export async function clearHistoryBySource(source: string): Promise<void> {
return invoke("clear_history_by_source", { source });
}
export async function cleanupMcpHistoryRetention(): Promise<number> {
return invoke("cleanup_mcp_history_retention");
}
export async function clearRedisHistory(): Promise<void> {
const entries = await loadRedisHistory(1000, 0);
await Promise.all(entries.map((e) => deleteHistoryEntry(e.id)));