feat: 新增报告协作页,并强化 Deep Research 运行诊断与报告兜底

支持浏览器侧素材快照撰写、拒绝报告读时修复、Mermaid PNG 导出与 Word 导出加固。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
董宏凯andCursor committed 2026-09-03 11:16:50 +08:00
1 parent 65d6b61d5d
commit f109a95535
65 files changed
+10342 -245

No files matched your search

@@ -66,6 +66,8 @@ export interface DeepResearchSession {
usage?: Record<string, unknown>;
activeJobId?: string;
error?: string;
/** Durable backend execution trace for production incident diagnosis. */
runtimeDiagnostics?: Record<string, unknown>;
/** The real LangGraph thread the collector agent chats on (chat collection). */
runtimeThreadId?: string;
createdAt?: string;
@@ -219,6 +221,11 @@ function normalizeSession(row: WireRecord): DeepResearchSession {
usage: (pick(row, "usage", "usage_snapshot") ?? undefined) as Record<string, unknown> | undefined,
activeJobId: pick<string>(row, "activeJobId", "active_job_id"),
error: typeof row.error === "string" ? row.error : undefined,
runtimeDiagnostics: pick<Record<string, unknown>>(
row,
"runtimeDiagnostics",
"runtime_diagnostics",
),
runtimeThreadId: pick<string>(row, "runtimeThreadId", "runtime_thread_id"),
createdAt: pick<string>(row, "createdAt", "created_at"),
updatedAt: pick<string>(row, "updatedAt", "updated_at"),
@@ -345,6 +352,8 @@ export interface StartJobOptions {
entry?: "chat" | "legacy" | "regenerate";
/** Report-config card choices merged over the frozen session snapshot. */
config?: Record<string, unknown>;
/** Compact collector evidence frozen before the report job starts. */
collectorMaterials?: Record<string, unknown>[];
}
export async function startJob(
@@ -360,6 +369,7 @@ export async function startJob(
request_id: opts.requestId ?? createClientId(),
entry: opts.entry ?? "legacy",
config: opts.config ?? null,
collector_materials: opts.collectorMaterials ?? null,
}),
});
return readJson(res, "startJob");
@@ -1000,11 +1010,13 @@ export function useResearchActions() {
sessionId,
entry,
config,
collectorMaterials,
}: {
sessionId: string;
entry?: "chat" | "legacy" | "regenerate";
config?: Record<string, unknown>;
}) => startJob(sessionId, { entry, config }),
collectorMaterials?: Record<string, unknown>[];
}) => startJob(sessionId, { entry, config, collectorMaterials }),
onSuccess: (_result, { sessionId }) => {
queryClient.invalidateQueries({ queryKey: [DEEP_RESEARCH_SESSIONS_KEY] });
queryClient.invalidateQueries({ queryKey: [DEEP_RESEARCH_SESSION_KEY, sessionId] });