返回 DeepSeek-Reasonix
draftPresentation.ts
根目录 / desktop / frontend / src / app-shell / draftPresentation.ts
1 import type { SessionDraftSurface } from "../app-runtime/useSessionDraftSurface";
2
3 const DRAFT_ATTENTION_PHASES = new Set([
4 "accepted",
5 "dispatch_unknown",
6 "dispatching_shell",
7 "resume_required",
8 "runtime_failed",
9 "terminal_failed",
10 ]);
11
12 /** Healthy drafts use the new-session landing; recovery controls need room. */
13 export function draftSurfaceNeedsAttention(draft: SessionDraftSurface): boolean {
14 return draft.saveState === "conflict" || draft.saveState === "error" || Boolean(draft.taskError)
15 || Boolean(draft.operation && DRAFT_ATTENTION_PHASES.has(draft.operation.phase));
16 }
17
18 export function creationHeroVisible(draft: SessionDraftSurface | null | undefined, emptyHero: boolean): boolean {
19 // A hidden formal tab must not collapse the active draft's recovery surface.
20 return draft ? !draftSurfaceNeedsAttention(draft) : emptyHero;
21 }
22
22 lines TYPESCRIPT