feat(studio): 回退/重roll 与 R5 用户确认下一步

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-05-31 22:27:25 +08:00
parent f3792915a3
commit 63a32bfa7c
8 changed files with 613 additions and 82 deletions

View File

@@ -26,3 +26,18 @@ export function findLastUserMessageIndex(stepMessages = []) {
}
return -1;
}
/** Whether undo is available for the active node state. */
export function canUndoRun(activeNodeState) {
return (activeNodeState?.turnHistory?.length ?? 0) > 0;
}
/** Whether reroll is available (at least one user message in current step). */
export function canRerollRun(activeNodeState) {
return findLastUserMessageIndex(activeNodeState?.stepMessages) >= 0;
}
/** Whether the user may advance to the next pipeline node (R5). */
export function canAdvanceNextStep(activeNodeState) {
return Boolean(activeNodeState?.lastDraft);
}