feat: 深度研究支持独立新报告与原文改写,并完善沙箱、模型管理与全文改写

新报告不再覆盖当前文件卡片,写入时打开沙箱;步骤条仅在改写原文时位于卡片上方。同时补齐改写本地回退、模型管理与会商第三步相关改动。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
董宏凯andCursor committed 2026-08-21 21:46:04 +08:00
1 parent 11f928bc95
commit a5a9c952e8
63 files changed
+4113 -929

No files matched your search

+15 -2
View File
@@ -119,6 +119,8 @@ export interface DocumentRewriteRequest {
instruction: string;
style?: DocumentRewriteStyle;
modelName?: string;
/** Optional Markdown chapter structure selected from the report-structure library. */
reportOutline?: string;
/** Generate locally saved illustration assets after the prose rewrite. */
generateImages?: boolean;
/** Bounded server-side to 1–4. Ignored unless generateImages is true. */
@@ -175,8 +177,15 @@ export type DocumentRewriteStreamEvent =
| { type: "validation_completed"; passed: boolean; warnings: string[] }
| { type: "comparison_ready"; summary: DocumentRewriteSummary }
| { type: "commit_started" }
| { type: "committed"; content: string; committedHash: string; versionId?: string }
| { type: "done"; committedHash: string; versionId?: string }
| {
type: "committed";
content: string;
committedHash: string;
versionId?: string;
/** The rewrite is usable, but its optional undo snapshot was not saved. */
versionSnapshotFailed?: boolean;
}
| { type: "done"; committedHash: string; versionId?: string; versionSnapshotFailed?: boolean }
| { type: "conflict"; message: string }
| { type: "cancelled"; message: string }
| { type: "error"; message: string; stage?: string };
@@ -192,6 +201,7 @@ export interface DurableDocumentRewriteJob {
instruction: string;
style: DocumentRewriteStyle;
modelName: string | null;
reportOutline: string;
generateImages: boolean;
maxGeneratedImages: number;
originalContent: string;
@@ -290,12 +300,14 @@ async function readDocumentRewriteEvent(
content: String(parsed.content ?? ""),
committedHash: String(parsed.committedHash ?? ""),
versionId: typeof parsed.versionId === "string" ? parsed.versionId : undefined,
versionSnapshotFailed: parsed.versionSnapshotFailed === true,
};
case "done":
return {
type: "done",
committedHash: String(parsed.committedHash ?? ""),
versionId: typeof parsed.versionId === "string" ? parsed.versionId : undefined,
versionSnapshotFailed: parsed.versionSnapshotFailed === true,
};
case "conflict":
return { type: "conflict", message: String(parsed.message ?? "文件内容已变化") };
@@ -403,6 +415,7 @@ export async function listDurableDocumentRewrites(
instruction: String(request.instruction ?? ""),
style: (request.style ?? "professional") as DocumentRewriteStyle,
modelName: typeof request.modelName === "string" ? request.modelName : null,
reportOutline: typeof request.reportOutline === "string" ? request.reportOutline : "",
generateImages: request.generateImages === true,
maxGeneratedImages: Number(request.maxGeneratedImages ?? 2),
originalContent: String(request.originalContent ?? ""),