fix: 发布 1.1.31,演练台进入正式版,回退不再在侧边栏堆分支

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
叫我小杨同学andCursor committed 2026-09-28 17:35:43 +08:00
1 parent 181fe141e3
commit f988474f2f
57 files changed
+24155 -26

No files matched your search

+24
View File
@@ -405,18 +405,42 @@ async function rewindOneSession(ctx, controller, sessionId) {
if (!childId) return { ok: false, error: "回退会话创建失败" };
await disarmRewoundSession(ctx, childId);
// 宿主只能 fork / create,不能在原会话里截断。不收起旧会话的话,每退一次侧边栏就多一条。
const archived = await hideRewoundSource(ctx, sessionId);
const rec = rememberDraft(childId, plan.text, sessionId);
return {
ok: true,
sessionId: childId,
parentId: sessionId,
archived,
text: rec.text,
cut: plan.mode,
at: rec.at,
};
}
async function hideRewoundSource(ctx, sessionId) {
if (!sessionId) return false;
const registry = service(ctx, "workspaceRegistry");
const workspaces = service(ctx, "workspaces");
const target = typeof registry?.archiveSession === "function"
? registry
: (typeof workspaces?.archiveSession === "function" ? workspaces : null);
let hidden = false;
if (target) {
await target.archiveSession(sessionId, { stopActivity: true });
hidden = true;
}
const listed = findWorkspace(ctx, sessionId);
const entity = listed?.id && typeof registry?.get === "function" ? registry.get(listed.id) : null;
if (entity && typeof entity.detachSession === "function") {
await entity.detachSession(sessionId);
hidden = true;
}
return hidden;
}
export async function analyzeRewind(ctx, sessionId) {
if (!sessionId) return { ok: false, error: "没有当前会话" };
try {