返回 DeepSeek-Reasonix
AppRuntimeView.tsx
根目录 / desktop / frontend / src / app-shell / AppRuntimeView.tsx
1 import { lazy, Suspense, useMemo, useState, useLayoutEffect, type CSSProperties } from "react";
2 import { DockNavigation } from "./dockNavigation";
3 import { useFileNavigationRuntime } from "../app-runtime/useFileNavigationRuntime";
4 import { useActiveRemoteRef } from "../app-runtime/useActiveRemoteRef";
5 import { fileNavigationKey } from "../lib/fileNavigationOwner";
6 import { useActivityBarStore } from "../store/activityBar";
7 import { ShellExpandProvider } from "../lib/shellExpand";
8 import { RemoteNavigationContext } from "../lib/remoteNavigationCommands";
9 import { UpdaterProvider } from "../lib/useUpdater";
10 import type { State } from "../lib/useController";
11 import type { TabMeta } from "../lib/types";
12 import type { RemoteSessionApi } from "../lib/useRemoteSession";
13 import type { Translator } from "../lib/i18n";
14 import type { useAppRuntimeAdapter } from "../app-runtime/useAppRuntimeAdapter";
15 import type { useNavigationSurface } from "../lib/useNavigationSurface";
16 import type { useAppShellStores } from "../app-runtime/useAppShellStores";
17 import type { useAppSessionComposition } from "../app-runtime/useAppSessionComposition";
18 import type { useAppNavigationComposition } from "../app-runtime/useAppNavigationComposition";
19 import type { HistoryViewState } from "../app-runtime/historyViewProjection";
20 import { ShellHotkeys, TextSizeHotkeys } from "./HotkeyRegistrations";
21 import { WindowChromeLifecycle } from "../app-runtime/WindowChromeLifecycle";
22 import { StartupGateLifecycle } from "../app-runtime/StartupGateLifecycle";
23 import { AppRuntimeEffects } from "../app-runtime/AppRuntimeEffects";
24 import { ThemeBackground } from "../components/ThemeBackground";
25 import { useTopicbarHeightVar } from "../lib/useTopicbarHeightVar";
26 import { SidebarRegion } from "./SidebarRegion";
27 import { TopicbarRegion } from "./TopicbarRegion";
28 import { buildTopicbarView, TopicbarActionsStack } from "./TopicbarActionsStack";
29 import { DockToggleButton } from "./DockToggleButton";
30 import { LauncherToggleButton } from "./LauncherToggleButton";
31 import { SessionStatusBanners } from "./SessionStatusBanners";
32 import { ChatPaneRegion } from "./ChatPaneRegion";
33 import { DecisionFooterRegion } from "./DecisionFooterRegion";
34 import { WorkspaceDockRegion } from "./WorkspaceDockRegion";
35 import { AppBottomRegions } from "./AppBottomRegions";
36 import { AppOverlayHost } from "./AppOverlayHost";
37 import { buildAppShellClassNames, buildSessionStatusBannerProps, buildSidebarRegionProps } from "./chromeRegionBuilders";
38 import { buildBottomRegionsProps, buildWorkspaceDockProps } from "./dockRegionBuilders";
39 import { buildOverlayHostProps } from "./overlayBuilders";
40 import { buildComposerSurface, buildDecisionFooterSurface, buildFooterTodo, buildFooterUndo } from "./decisionFooterBuilders";
41 import { submitBlockReason } from "../lib/sessionAvailability";
42
43 const WindowsWindowControls = lazy(() => import("./WindowsWindowControls").then((module) => ({ default: module.WindowsWindowControls })));
44 const DockLauncher = lazy(() => import("../components/DockLauncher").then((module) => ({ default: module.DockLauncher })));
45 const StudioDiscoveryLifecycle = lazy(() => import("../app-runtime/StudioDiscoveryLifecycle").then((module) => ({ default: module.StudioDiscoveryLifecycle })));
46
47 const WORKSPACE_RESIZER_WIDTH = 8;
48 const SHOW_CONTEXT_DOCK = true;
49
50 const ManualSessionRecovery = lazy(() => import("../components/ManualSessionRecovery").then(module => ({ default: module.ManualSessionRecovery })));
51 type Runtime = ReturnType<typeof useAppRuntimeAdapter>;
52 type Shell = ReturnType<typeof useAppShellStores>;
53 type SessionComposition = ReturnType<typeof useAppSessionComposition>;
54 type NavigationComposition = ReturnType<typeof useAppNavigationComposition>;
55 type LiveStore = Runtime["snapshot"]["liveStore"];
56
57 export type AppRuntimeViewProps = {
58 core: {
59 state: State;
60 activeTab: TabMeta | undefined;
61 activeTabId: string | undefined;
62 liveStore: LiveStore;
63 remoteSurfaceActive: boolean;
64 remoteSession: RemoteSessionApi;
65 remoteComposerReady: boolean;
66 remoteCancel: (queuedItemIDs?: string[]) => Promise<import("../lib/inboxCancel").CancelOutcome>;
67 surface: ReturnType<typeof useNavigationSurface>;
68 t: Translator;
69 locale: string;
70 onOpenLink: (url: string) => void;
71 };
72 shell: Shell;
73 session: SessionComposition;
74 navigation: NavigationComposition;
75 runtime: Runtime;
76 local: {
77 tasksOpen: false | "session" | "all";
78 setTasksOpen: React.Dispatch<React.SetStateAction<false | "session" | "all">>;
79 sidebarImDetailConnectionId: string;
80 setSidebarImDetailConnectionId: React.Dispatch<React.SetStateAction<string>>;
81 tabRevealSignal: number;
82 histView: HistoryViewState | null;
83 projectRevision: number;
84 dockRefreshKey: number;
85 composerFileRefRefreshKey: string;
86 refreshComposerFileRefs: () => void;
87 terminalContentVisible: boolean;
88 terminalFitEnabled: boolean;
89 prefetchTerminalPanel: () => void;
90 };
91 };
92
93 /**
94 * Pure assembly of the App shell tree: every region receives its props from
95 * the session/navigation composition bags and the caller's stores. No hooks
96 * beyond value memoization live here; ownership stays in the compositions.
97 */
98 export function AppRuntimeView(props: AppRuntimeViewProps) {
99 const [dockNavigation] = useState(() => new DockNavigation());
100 const fileNavigation = useFileNavigationRuntime();
101 useLayoutEffect(() => dockNavigation.attach(), [dockNavigation]);
102 useLayoutEffect(() => useActivityBarStore.subscribe(state => dockNavigation.reconcile(state.tabs.map(tab => tab.id))), [dockNavigation]);
103 // The open dock tabs are the set of live records: closing a tab, or switching
104 // to a project whose tab list has none of them, ends those records. A session
105 // change inside one project keeps the dock and only rebinds its credentials.
106 useLayoutEffect(() => {
107 const retain = () => fileNavigation.retain(
108 useActivityBarStore.getState().tabs.map(tab => fileNavigationKey({ sessionTabId: "", dockTabId: tab.id })),
109 );
110 retain();
111 return useActivityBarStore.subscribe(retain);
112 }, [fileNavigation]);
113 useTopicbarHeightVar();
114 const { core, shell, session, navigation, runtime, local } = props;
115 const { state, activeTab, activeTabId, t, locale } = core;
116 const { windowsFramelessChrome, mainWindowMaximised } = shell;
117 const activeRemoteRef = useActiveRemoteRef(activeTab);
118 const {
119 conversationView, visibleRuntimeState, sidebarImDetailConnection,
120 surfaceWorkspacePanelRenderable, surfaceWorkspacePanelGridOpen, surfaceWorkspacePanelOverlay, terminalSurfaceOpen,
121 controllerReady, decisionSurface, visibleDecisionSurface, composerSurfaceHidden,
122 shellGeometry, appRef, layoutRef, footerHeight, footerRef,
123 } = session;
124 const { chromeCommands, navigationCommands } = navigation;
125 const runtimeTransitioning = core.surface.transitioning;
126 const presentationTransitioning = runtimeTransitioning && core.remoteSurfaceActive;
127 const browserPreviewChrome = navigation.browserPreviewChrome;
128 const workspaceContextProject = Boolean(
129 activeTab?.remote || (activeTab?.scope === "project" && activeTab.workspaceRoot),
130 );
131 const workspaceContextRoot = workspaceContextProject
132 ? (activeTab?.workspaceRoot ?? state.meta?.workspaceRoot ?? state.meta?.cwd ?? "")
133 : "";
134
135 const workbenchChromeHidden = true;
136 const sidebarClassName = [
137 "sidebar",
138 shell.sidebarCollapsed ? "sidebar--collapsed" : "",
139 "sidebar--workbench",
140 ].filter(Boolean).join(" ");
141 const startupSplashHold = !activeTabId && state.meta?.ready !== true && !state.meta?.startupErr;
142
143 const layoutStyle = useMemo(
144 () =>
145 ({
146 "--sidebar-expanded-width": `${shellGeometry.sidebarRenderWidth}px`,
147 "--chat-min-width": `${shellGeometry.chatReservedWidth}px`,
148 "--workspace-width": `${shellGeometry.workspacePanelRenderWidth}px`,
149 "--workspace-resizer-width": `${WORKSPACE_RESIZER_WIDTH}px`,
150 "--terminal-height": `${terminalSurfaceOpen ? shell.liveTerminalHeight ?? shellGeometry.terminalRenderHeight : 0}px`,
151 }) as CSSProperties,
152 [shellGeometry.chatReservedWidth, shell.liveTerminalHeight, shellGeometry.sidebarRenderWidth, shellGeometry.terminalRenderHeight, terminalSurfaceOpen, shellGeometry.workspacePanelRenderWidth],
153 );
154
155 const shellClassNames = buildAppShellClassNames({
156 platform: shell.desktopPlatform,
157 windowsFrameless: windowsFramelessChrome,
158 browserPreview: browserPreviewChrome,
159 imDetailActive: Boolean(sidebarImDetailConnection),
160 sidebarCollapsed: shell.sidebarCollapsed,
161 sidebarResizing: shell.sidebarResizing,
162 dockGridOpen: surfaceWorkspacePanelGridOpen,
163 dockOverlay: surfaceWorkspacePanelOverlay,
164 terminalOpen: terminalSurfaceOpen,
165 terminalResizing: shell.terminalResizing,
166 dockOpen: shell.workspacePanelOpen,
167 dockMaximized: shell.workspacePanelMaximized,
168 dockResizing: shell.workspacePanelResizing,
169 });
170 const footerTodo = buildFooterTodo({
171 show: session.todoPanel.showTodos,
172 identity: session.todoPanel.scopedTodoBatch,
173 todos: session.todoPanel.todos,
174 running: visibleRuntimeState.running,
175 pendingPrompt: visibleRuntimeState.pendingPrompt,
176 continueReady: Boolean(activeTabId && !activeTab?.readOnly && (core.remoteSurfaceActive ? core.remoteComposerReady : controllerReady)),
177 onContinue: session.todoPanel.handleTodoContinue,
178 onDismiss: session.todoPanel.dismissTodos,
179 });
180 const footerUndo = buildFooterUndo({ rewindState: session.sessionUndo.rewindState, activeTabId, onUndo: session.sessionUndo.handleUndoRewind });
181 const decisionFooterSurface = buildDecisionFooterSurface({
182 view: {
183 surface: visibleDecisionSurface,
184 activeTabId,
185 cwd: state.meta?.cwd,
186 workspaceScopeKey: session.workspaceScopeKey,
187 approval: state.approval,
188 ask: state.ask,
189 mcpInteraction: state.mcpInteraction,
190 extensionForm: state.extensionForm,
191 workspaceConflict: session.workspaceConflict,
192 toolApprovalMode: session.profileProjection.toolApprovalMode,
193 insertRequest: session.insertCommands.activePlanRevisionInsertRequest,
194 },
195 prompts: session.promptCommands,
196 extension: session.extensionSurface,
197 tabs: session.tabBarCommands,
198 clear: session.clearCommands,
199 onStop: session.controlCommands.handleStopActive,
200 cancelWorkspaceConflict: session.controlCommands.cancelWorkspaceConflict,
201 onOpenLink: core.onOpenLink,
202 onRevisionActiveChange: session.insertCommands.handleRevisionActiveChange,
203 t,
204 });
205
206 return (
207 <ShellExpandProvider>
208 <RemoteNavigationContext.Provider value={session.desktopNavigation.openRemoteProject}>
209 <UpdaterProvider>
210 <ShellHotkeys />
211 <TextSizeHotkeys />
212 <WindowChromeLifecycle />
213 <StartupGateLifecycle />
214 <Suspense fallback={null}><StudioDiscoveryLifecycle
215 stableRelease={shell.preferences.stableRelease}
216 safeToShow={!startupSplashHold && !shell.startupSplashVisible && !shell.managementActive
217 && (activeTabId ? controllerReady : state.meta?.ready === true) && !core.remoteSurfaceActive
218 && !shell.providerSetupNeeded && !shell.paletteOpen && !shell.shortcutsOpen
219 && !shell.sidebarSearchOpen && !shell.takeoverDialogTab && !shell.reclaimBusyTab
220 && !runtimeTransitioning && !visibleDecisionSurface && !state.running
221 && !local.tasksOpen && !local.histView
222 && !session.visibleTabs.some(tab => tab.running || tab.pendingPrompt || (tab.backgroundJobs ?? 0) > 0)}
223 /></Suspense>
224 <AppRuntimeEffects
225 running={state.running && !state.runtimeStateSnapshot?.maintenance}
226 onEvent={session.runtimeEventCommands.handleRuntimeEvent}
227 onReady={session.runtimeEventCommands.handleRuntimeReady}
228 onRebuilt={session.runtimeEventCommands.handleRuntimeRebuilt}
229 onRemoteStatus={session.runtimeEventCommands.handleRemoteStatus}
230 onRemoteForwards={session.runtimeEventCommands.handleRemoteForwards}
231 onRemoteServer={session.runtimeEventCommands.handleRemoteServer}
232 onInitialRemoteHosts={session.runtimeEventCommands.handleInitialRemoteHosts}
233 onInitialRemoteStatuses={session.runtimeEventCommands.handleInitialRemoteStatuses}
234 />
235 <div
236 ref={appRef}
237 onDoubleClickCapture={chromeCommands.handleChromeTitlebarDoubleClick}
238 className={shellClassNames.app}
239 >
240 <ThemeBackground />
241 <div
242 ref={layoutRef}
243 className={shellClassNames.layout}
244 style={layoutStyle}
245 >
246 <a className="skip-to-composer" href="#composer-input">
247 {t("shortcuts.skipToComposer")}
248 </a>
249
250 <SidebarRegion {...buildSidebarRegionProps({
251 className: sidebarClassName,
252 shell,
253 t,
254 geometry: shellGeometry,
255 projectTree: {
256 activeTab: activeTab,
257 activeRemote: activeRemoteRef,
258 imTopicSources: shell.preferences.imTopicSources, refreshSignal: local.projectRevision,
259 searchExpanded: true, searchFocusSignal: shell.sidebarSearchFocusSignal,
260 showShortcutBadges: navigation.topicShortcuts.showTopicBadges, shortcutPlatform: shell.desktopPlatform,
261 onVisibleTopicsChange: navigation.topicShortcuts.handleVisibleTopicsChange,
262 },
263 topics: navigation.projectTopicCommands,
264 paletteShortcut: navigation.commandPaletteShortcut,
265 commands: {
266 onNewSession: () => void navigationCommands.handleNewTab(),
267 onOpenPalette: () => void navigation.paletteCommands.openPalette(),
268 onOpenTrash: () => void navigation.historyCommands.openTrash(),
269 onOpenAutomation: () => shell.openPage({ kind: "automation" }),
270 onOpenSettings: chromeCommands.openSidebarSettings,
271 onOpenTopic: navigationCommands.handleOpenTopic,
272 },
273 })} />
274
275 <TopicbarRegion view={buildTopicbarView({
276 t, locale, activeTab: activeTab, cwd: state.meta?.cwd,
277 imDetail: sidebarImDetailConnection, imTopicSources: shell.preferences.imTopicSources,
278 chromeHidden: workbenchChromeHidden, windowsBrand: windowsFramelessChrome,
279 automationReturn: shell.automationReturn,
280 sidebar: { title: navigation.sidebarToggleTitle, blocked: navigation.sidebarExpandBlocked, pressed: shell.sidebarTogglePressed, collapsed: shell.sidebarCollapsed },
281 rename: { editing: navigation.projectTopicCommands.topicbarEditing, draft: navigation.projectTopicCommands.topicTitleDraft },
282 })} commands={{
283 openAutomation: () => shell.openPage({ kind: "automation" }), toggleSidebar: shellGeometry.toggleSidebar,
284 setTitleDraft: navigation.projectTopicCommands.setTopicTitleDraft, commitRename: navigation.projectTopicCommands.commitActiveTopicRename, cancelRename: navigation.projectTopicCommands.cancelActiveTopicRename,
285 startRename: navigation.projectTopicCommands.startActiveTopicRename, openWorktree: navigation.worktreeMergeCommands.openWorktreeMerge,
286 }}>
287 <TopicbarActionsStack
288 t={t}
289 activeTab={activeTab}
290 activeTabId={activeTabId}
291 imDetailActive={Boolean(sidebarImDetailConnection)}
292 dismissSignal={shell.transientOverlayDismissSignal}
293 sessionHasContent={session.sessionHasContent}
294 exportCommands={session.sessionExportCommands}
295 terminal={{ toggle: session.terminalPanelCommands.toggleTerminalPanel, enabled: !core.remoteSurfaceActive, open: shell.terminalPanelOpen && !core.remoteSurfaceActive, prefetch: local.prefetchTerminalPanel }}
296 tasksOpen={local.tasksOpen}
297 setTasksOpen={local.setTasksOpen}
298 onCloseTasks={() => local.setTasksOpen(false)}
299 onOpenTaskSession={navigationCommands.openTaskMonitorSession}
300 dockToggle={<DockToggleButton renderable={surfaceWorkspacePanelRenderable} t={t} onToggle={session.workspacePanelCommands.toggleWorkspacePanel} />}
301 launcherToggle={<LauncherToggleButton
302 visible={session.workspacePanelCommands.launcherCard.visible}
303 t={t}
304 onToggle={session.workspacePanelCommands.toggleLauncherCard}
305 />}
306 />
307 </TopicbarRegion>
308
309 <section className={`chat-pane${session.transcript.emptyHero ? " chat-pane--creation-empty" : ""}`}>
310 <SessionStatusBanners {...buildSessionStatusBannerProps({
311 t,
312 activeTab,
313 leaseBlocked: session.leaseBlockedTab ? { tabId: session.leaseBlockedTab.id, message: session.leaseBlockedTab.runtime!.issue!.message } : null,
314 meta: state.meta,
315 configWarnings: shell.preferences.configLoadWarnings,
316 dismissConfigWarnings: shell.preferences.dismissConfigWarnings,
317 updateChecksEnabled: shell.preferences.startupUpdateChecksEnabled === true,
318 shell,
319 banners: session.bannerCommands,
320 onboarding: navigation.onboardingCommands,
321 })} startupError={navigationCommands.manualCreation && navigationCommands.manualCreation.operation?.phase !== "ready" ? undefined : state.meta?.startupErr}
322 historical={core.remoteSurfaceActive ? undefined : { tab: activeTab, navigate: session.desktopNavigation.enqueueNavigation,
323 captureNavigation: () => { const intent = runtime.navigation.currentNavigationIntent(); return () => runtime.navigation.isNavigationIntentCurrent(intent); },
324 openRecoveryDetails: () => chromeCommands.openSidebarSettings("storage"),
325 }} />
326
327 <ChatPaneRegion
328 // Local navigation is now history-first: keep the transcript
329 // mounted while the controller is rebuilt in the background. The
330 // transcript's own hydrating/readiness state still reports progress
331 // and the controllerReady fence keeps writes disabled. Remote
332 // surfaces retain their existing transition gate because they do
333 // not share the local runtime/cache ownership model.
334 transitioning={presentationTransitioning}
335 t={t}
336 imDetail={sidebarImDetailConnection ? {
337 connection: sidebarImDetailConnection,
338 onClose: () => local.setSidebarImDetailConnectionId(""),
339 onOpenSettings: chromeCommands.openBotSettings,
340 onManageAllowlist: chromeCommands.openBotAllowlistSettings,
341 onOpenSession: (connection) => void navigationCommands.openSidebarImConnectionSession(connection),
342 } : null}
343 remote={activeTab?.remote ? { tab: activeTab, session: core.remoteSession } : undefined}
344 launcher={session.workspacePanelCommands.launcherCardMounted && !core.remoteSurfaceActive ? (
345 <Suspense fallback={null}>
346 <DockLauncher
347 tabId={activeTabId ?? ""}
348 scopeKey={session.workspaceScopeKey}
349 workspaceRoot={activeTab?.workspaceRoot ?? state.meta?.cwd ?? ""}
350 visible={!shell.managementActive && !sidebarImDetailConnection}
351 onSelect={session.workspacePanelCommands.openDockEntry}
352 gitBranch={state.meta?.gitBranch}
353 onSpaceModeChange={session.workspacePanelCommands.setLauncherSpaceMode}
354 overlay={session.workspacePanelCommands.launcherCardOverlay}
355 />
356 </Suspense>
357 ) : null}
358 transcript={{
359 state,
360 items: session.transcript.visibleTranscriptItems,
361 tabId: session.transcript.visibleTranscriptTabId,
362 geometrySessionKey: session.transcript.visibleTranscriptGeometryKey,
363 footerHeight,
364 invocationMetadata: session.transcript.visibleTranscriptTabId ? session.invocation.invocationMetadataByTab[session.transcript.visibleTranscriptTabId] : undefined,
365 surfaceCommitToken: core.surface.surfaceCommitToken,
366 liveStore: core.liveStore,
367 transcriptHydrating: session.transcript.transcriptHydrating,
368 navigationDataReady: core.surface.dataReady,
369 readOnly: Boolean(activeTab?.readOnly),
370 controllerReady,
371 hydratePlaceholderActive: session.hydratePlaceholderActive,
372 clearContextPending: session.clearCommands.clearContextPending,
373 emptyHero: session.transcript.emptyHero,
374 availability: session.transcript.availability,
375 rewind: { stateActive: session.sessionUndo.rewindState != null, committing: session.sessionUndo.rewindCommitting },
376 }}
377 onRetryHistory={() => runtime.sessionActions.retrySessionHistory(activeTabId)}
378 commands={{
379 onPrompt: session.transcript.handleTranscriptPrompt,
380 onFork: (turnId) => session.sessionUndo.handleForkTurn(turnId),
381 onOpenTurnChanges: session.turnVerificationCommands.openTurnChanges,
382 onLoadOlderHistory: session.transcript.handleLoadOlderHistory,
383 onLoadNewerHistory: session.transcript.handleLoadNewerHistory,
384 onNavigateToTurn: session.transcript.handleNavigateToTurn,
385 onSurfacePaintReady: session.transcript.handleSurfacePaintReady,
386 }}
387 />
388 <DecisionFooterRegion
389 hidden={Boolean(sidebarImDetailConnection)}
390 creationNotice={!core.remoteSurfaceActive && !sidebarImDetailConnection ? <Suspense fallback={null}>
391 <ManualSessionRecovery
392 key={`${runtime.navigation.currentNavigationIntent()}:${activeTab?.session?.sessionId ?? ""}`}
393 sessionId={core.surface.surface?.phase === "source-retained" ? undefined : activeTab?.session?.sessionId}
394 attempt={navigationCommands.manualCreation}
395 onRetry={navigationCommands.retryCreation}
396 onNew={navigationCommands.handleNewTab}
397 onChooseProject={navigation.projectTopicCommands.onAddProject}
398 />
399 </Suspense> : null}
400 className={["footer", terminalSurfaceOpen ? "footer--compact" : "", visibleDecisionSurface ? "footer--decision" : "", presentationTransitioning ? "footer--navigation-hidden" : ""].filter(Boolean).join(" ")}
401 footerRef={footerRef}
402 style={core.surface.surface?.phase === "source-retained" && footerHeight > 0 ? { height: footerHeight, minHeight: footerHeight, boxSizing: "border-box" } : undefined}
403 todo={footerTodo}
404 undo={footerUndo}
405 decision={decisionFooterSurface}
406 composer={buildComposerSurface({
407 empty: { onCreate: () => void navigationCommands.handleNewTab(), onChooseProject: () => void navigation.projectTopicCommands.onAddProject() },
408 view: {
409 hidden: composerSurfaceHidden,
410 inert: runtimeTransitioning,
411 targetInputReady: Boolean(activeTab?.session) && core.surface.surface?.phase === "target-masked"
412 && !state.backendActivationPending,
413 hero: session.transcript.emptyHero,
414 headline: t("welcome.creation.title"),
415 remote: core.remoteSurfaceActive,
416 rewindCommitting: session.sessionUndo.rewindCommitting,
417 messageActionPending: state.messageAction != null,
418 decisionActive: Boolean(decisionSurface),
419 runtimeTransitioning: presentationTransitioning,
420 controllerReady: controllerReady && session.transcript.availability.kind === "ready",
421 submitDisabledReason: submitBlockReason(session.transcript.availability, t),
422 showContextWindowRing: false,
423 },
424 base: conversationView.composer,
425 tab: activeTab,
426 tabId: activeTabId,
427 profile: session.profileProjection,
428 router: session.routerCommands,
429 modes: session.modeActions,
430 goals: session.goalCommands,
431 remoteGoal: session.remoteGoalActions,
432 modelSwitch: session.controllerProfileCommands,
433 inserts: session.insertCommands,
434 control: session.controlCommands,
435 remoteComposer: {
436 send: session.remoteComposerSend,
437 cancel: core.remoteCancel,
438 ready: core.remoteComposerReady,
439 profileReady: session.profileProjection.remoteComposerProfileReady,
440 liveStore: core.remoteSession.liveStore,
441 },
442 localLiveStore: core.liveStore,
443 onInvocationMetadataChange: session.invocation.handleInvocationMetadataChange,
444 onCycleMode: session.cycleMode,
445 transientDismissSignal: shell.transientOverlayDismissSignal,
446 sessionKey: session.composerSessionKey,
447 workspaceScopeKey: session.workspaceScopeKey,
448 workspaceContext: {
449 scope: workspaceContextProject ? "project" : "global",
450 workspaceRoot: workspaceContextRoot,
451 workspaceName: workspaceContextProject
452 ? activeTab?.workspaceName ?? state.meta?.workspaceName
453 : undefined,
454 defaultWorkspaceName: activeTab?.scope === "global" && !activeTab.remote ? activeTab.workspaceName : undefined,
455 gitBranch: workspaceContextProject && !activeTab?.remote ? state.meta?.gitBranch : undefined,
456 tabId: activeTabId,
457 scopeKey: session.workspaceScopeKey,
458 remote: Boolean(activeTab?.remote),
459 onSwitchWorkspace: navigation.projectTopicCommands.onAddProject,
460 onWorkWithoutProject: () => navigationCommands.openBlankSession("global", ""),
461 onRefreshProjects: navigation.projectTopicCommands.refreshProjectsAndTabs,
462 },
463 fileRefRefreshKey: local.composerFileRefRefreshKey,
464 guidance: session.transcript.latestGuidanceConsumed,
465 guidanceQueuePreviewItems: navigation.guidanceQueueMockItems,
466 })}
467 />
468 </section>
469
470 <WorkspaceDockRegion navigation={dockNavigation} fileNavigation={fileNavigation} workspaceRoot={activeTab?.workspaceRoot ?? state.meta?.cwd ?? ""} {...buildWorkspaceDockProps({
471 surface: { renderable: surfaceWorkspacePanelRenderable, overlay: surfaceWorkspacePanelOverlay, gridOpen: surfaceWorkspacePanelGridOpen },
472 showContext: SHOW_CONTEXT_DOCK,
473 remote: core.remoteSurfaceActive,
474 t,
475 context: conversationView.context,
476 sessionTurns: session.sessionTurns,
477 contextRefreshKey: local.dockRefreshKey + visibleRuntimeState.contextPanelSeq,
478 workspaceKey: session.workspaceTreeMemoryKey,
479 workspaceScopeKey: session.workspaceScopeKey,
480 mode: shell.rightDockMode,
481 meta: state.meta,
482 tabId: activeTabId,
483 completionSummary: state.completionSummary,
484 turnStartAt: state.turnStartAt,
485 layout: { treeWidth: shell.rightDockTreeWidth, previewWidth: shell.rightDockPreviewWidth, maximized: shell.workspacePanelMaximized },
486 geometry: shellGeometry,
487 panels: session.workspacePanelCommands,
488 inserts: session.insertCommands,
489 verification: session.turnVerificationCommands,
490 onFileTreeRefresh: local.refreshComposerFileRefs,
491 onSessionRevertCommitted: session.sessionUndo.handleSessionRevertCommitted,
492 onOpenInTerminal: core.remoteSurfaceActive ? undefined : session.terminalPanelCommands.openTerminalForPath,
493 })} />
494 <AppBottomRegions {...buildBottomRegionsProps({
495 t,
496 chatSurfaceVisible: session.chatSurfaceVisible,
497 surfaceOpen: terminalSurfaceOpen,
498 contentVisible: local.terminalContentVisible,
499 remote: core.remoteSurfaceActive,
500 readOnly: Boolean(activeTab?.readOnly && !activeTab.takenOver),
501 tabId: activeTabId,
502 meta: state.meta,
503 fitEnabled: local.terminalFitEnabled,
504 liveTerminalHeight: shell.liveTerminalHeight,
505 geometry: shellGeometry,
506 terminal: {
507 onClose: session.terminalPanelCommands.closeTerminalPanel,
508 onAddOutput: (sessionId) => void session.insertCommands.addTerminalOutputToComposer(sessionId),
509 onAddToChat: session.insertCommands.addTerminalSelectionToComposer,
510 },
511 status: !session.statusBarVisible ? undefined : {
512 base: conversationView.status,
513 rewindCommitting: session.sessionUndo.rewindCommitting,
514 sessionTurns: session.sessionTurns,
515 labelStyle: shell.preferences.statusBarStyle,
516 items: shell.preferences.statusBarItems,
517 extensionStatuses: session.extensionStatusList,
518 remoteHosts: shell.remoteHosts,
519 remoteStatuses: shell.remoteStatuses,
520 onCancelJob: core.remoteSurfaceActive ? core.remoteSession.cancelJob : runtime.composer.cancelJob,
521 onCancelRuntimeJob: session.controlCommands.cancelRuntimeJob,
522 onRevealRuntime: session.tabBarCommands.revealBackgroundRuntime,
523 onConnectRemote: session.remoteWorkspaceCommands.connectAndOpenRemoteWorkspace,
524 onDisconnectRemote: session.controlCommands.handleDisconnectRemote,
525 onManageRemote: () => shell.setSettingsTarget("remote"),
526 onOpenRemote: shell.requestRemoteExplorer,
527 onOpenRemoteWorkspace: session.remoteWorkspaceCommands.openRemoteWorkspaceFromStatus,
528 },
529 })} />
530 </div>
531
532 <AppOverlayHost {...buildOverlayHostProps({
533 t,
534 running: state.running,
535 histView: local.histView,
536 pageKind: shell.page.kind,
537 activeTab,
538 activeTabId,
539 cwd: state.meta?.cwd,
540 paletteItems: navigation.paletteCommands.paletteItems,
541 startupSplashHold,
542 automationTopic: session.automation.openAutomationTopic,
543 shell,
544 history: navigation.historyCommands,
545 navigation: navigationCommands,
546 chrome: chromeCommands,
547 onboarding: navigation.onboardingCommands,
548 worktree: navigation.worktreeMergeCommands,
549 prefillSubagentCommand: session.insertCommands.prefillSubagentCommand,
550 sessionActions: {
551 previewSession: runtime.sessionActions.previewSession,
552 listTrashedSessions: runtime.sessionActions.listTrashedSessions,
553 restoreSession: runtime.sessionActions.restoreSession,
554 purgeTrashedSession: runtime.sessionActions.purgeTrashedSession,
555 },
556 setSettingsTarget: shell.setSettingsTarget,
557 })} />
558 {windowsFramelessChrome && (
559 <WindowsWindowControls
560 maximised={mainWindowMaximised}
561 onMinimize={chromeCommands.minimizeMainWindow}
562 onToggleMaximize={chromeCommands.toggleMainWindowMaximized}
563 onClose={chromeCommands.closeMainWindow}
564 />
565 )}
566 </div>
567 </UpdaterProvider>
568 </RemoteNavigationContext.Provider>
569 </ShellExpandProvider>
570 );
571 }
572
572 lines Plain Text