返回 DeepSeek-Reasonix
toolCardDisclosure.ts
根目录 / desktop / frontend / src / lib / toolCardDisclosure.ts
1 import type { ResolvedReasoningDisplayMode } from "./reasoningDisplayPreference";
2 import type { SessionExperience, WorkProcessPresentation } from "./sessionExperience";
3 import type { Item } from "./useController";
4 type ToolItem = Extract<Item, { kind: "tool" }>;
5 export function resolveToolCardDefaultOpen(
6 item: ToolItem,
7 nestedCount: number,
8 reasoningDisplayMode: ResolvedReasoningDisplayMode | SessionExperience | WorkProcessPresentation,
9 ): boolean {
10 const experience = typeof reasoningDisplayMode === "object"
11 ? reasoningDisplayMode.experience
12 : reasoningDisplayMode === "deep" || reasoningDisplayMode === "expanded"
13 ? "deep"
14 : "standard";
15 const subagentReasoningRunning = item.subagentProgress?.phase === "reasoning";
16 const liveFollow = true;
17 // Deep mode exposes the complete tool process by default. Cards without a
18 // body remain visually unchanged, while body-bearing cards/groups can still
19 // be manually collapsed by the user.
20 const keepSubagentReasoningExpanded = experience === "deep";
21 return (nestedCount > 0 && item.status === "running")
22 || (liveFollow && Boolean(item.subagentProgress) && item.status === "running")
23 || (liveFollow && subagentReasoningRunning)
24 || keepSubagentReasoningExpanded;
25 }
26
26 lines TYPESCRIPT