11import { html , nothing } from "lit" ;
2- import { isDesktopPanelAvailable } from "../../app/app-shell-chrome.ts" ;
32import { findInlineApproval } from "../../app/approval-presentation.ts" ;
43import { hasOperatorAdminAccess , hasOperatorWriteAccess } from "../../app/operator-access.ts" ;
54import { cancelQuestionPrompt , submitQuestionPrompt } from "../../app/question-prompt.ts" ;
@@ -23,6 +22,7 @@ import { clearChatHistory } from "./chat-history.ts";
2322import { resolveChatMessageAccess } from "./chat-message-access.ts" ;
2423import { requiresChatModelSetup } from "./chat-model-setup.ts" ;
2524import { ChatPaneLayoutRender } from "./chat-pane-layout-render.ts" ;
25+ import { createChatPaneRails } from "./chat-pane-rails.ts" ;
2626import {
2727 createChatPaneSessionActionCallbacks ,
2828 readChatPaneMutationAccess ,
@@ -44,24 +44,14 @@ import {
4444 selectedChatSessionRow ,
4545} from "./chat-state-route.ts" ;
4646import type { ChatProps } from "./chat-view.ts" ;
47- import { createBackgroundTasksProps } from "./components/chat-background-tasks.ts" ;
48- import { openTaskDetailId } from "./components/chat-detail-slot.ts" ;
4947import { chatPullRequestId , createPullRequestBranch } from "./components/chat-pull-requests.ts" ;
5048import {
51- createSessionWorkspaceProps ,
5249 openSessionWorkspaceFile ,
5350 revealSessionWorkspaceFile ,
5451} from "./components/chat-session-workspace.ts" ;
5552import { activeQueuedMessageEdit } from "./queued-message-edit.ts" ;
5653import { hasAbortableSessionRun } from "./run-lifecycle.ts" ;
5754import { scheduleChatScroll } from "./scroll.ts" ;
58- import {
59- SIDEBAR_NARROW_BREAKPOINT_PX ,
60- closeSlot ,
61- isSidebarSlotVisible ,
62- openSlot ,
63- type SidebarSlotId ,
64- } from "./sidebar-layout.ts" ;
6555import { resolveActiveRunOutputTokens , resolveChatProjectionRunId } from "./tool-stream.ts" ;
6656import { configureToolTitleFetcher } from "./tool-titles.ts" ;
6757import { workspaceResultConflictFromPlacement } from "./workspace-conflict.ts" ;
@@ -111,25 +101,6 @@ export class ChatPane extends ChatPaneLayoutRender {
111101 layout : state . sidebarLayout ,
112102 paneWidth : this . paneWidth ,
113103 } ) ;
114- const hasPanelSlot = ( slot : SidebarSlotId ) =>
115- sidebarLayout . columns [ 0 ] ?. panels . some ( ( panel ) => panel . slot === slot ) === true ;
116- const progressCardInRail =
117- this . paneWidth >= SIDEBAR_NARROW_BREAKPOINT_PX &&
118- isSidebarSlotVisible ( sidebarLayout , "companion" ) ;
119- const openPanelSlot = ( slot : SidebarSlotId ) => {
120- state . updateSidebarLayout ( openSlot ( state . sidebarLayout , slot ) ) ;
121- if ( slot === "companion" ) {
122- this . setSessionObserverVisibility ( true ) ;
123- }
124- } ;
125- const closePanelSlot = ( slot : SidebarSlotId ) => {
126- if ( slot === "companion" ) {
127- this . setSessionObserverVisibility ( false ) ;
128- }
129- state . updateSidebarLayout ( closeSlot ( state . sidebarLayout , slot ) ) ;
130- } ;
131- const togglePanelSlot = ( slot : SidebarSlotId ) =>
132- hasPanelSlot ( slot ) ? closePanelSlot ( slot ) : openPanelSlot ( slot ) ;
133104 state . chatFollowUpMode = resolveControlUiFollowUpMode (
134105 state . settings . chatFollowUpMode ,
135106 resolveControlUiServerQueueMode (
@@ -223,33 +194,15 @@ export class ChatPane extends ChatPaneLayoutRender {
223194 ? t ( "chat.catalog.remoteViewOnly" )
224195 : t ( "chat.catalog.unsupportedViewOnly" )
225196 : null ;
226- const sessionWorkspaceBase = createSessionWorkspaceProps ( state , {
227- draftScope : this . presentationId ,
228- expanded : hasPanelSlot ( "workspace" ) ,
229- narrowLayout : false ,
230- } ) ;
231- const sessionWorkspace = {
232- ...sessionWorkspaceBase ,
233- collapsed : ! hasPanelSlot ( "workspace" ) ,
234- narrowLayout : false ,
235- onToggleCollapsed : ( ) => togglePanelSlot ( "workspace" ) ,
236- onToggleTerminal : state . terminalAvailable ? ( ) => togglePanelSlot ( "terminal" ) : undefined ,
237- onToggleBrowser : state . browserPanelAvailable ? ( ) => togglePanelSlot ( "browser" ) : undefined ,
238- onToggleDesktop : isDesktopPanelAvailable ( gatewaySnapshot )
239- ? ( ) => togglePanelSlot ( "desktop" )
240- : undefined ,
241- } ;
242- const backgroundTasksBase = createBackgroundTasksProps ( state , {
243- narrowLayout : false ,
244- openTaskId : openTaskDetailId ( state . sidebarContent , sidebarLayout ) ,
245- onOpenTaskDetail : ( task ) => state . handleOpenSidebar ( { kind : "task" , taskId : task . id } ) ,
246- } ) ;
247- const backgroundTasks = {
248- ...backgroundTasksBase ,
249- collapsed : ! hasPanelSlot ( "tasks" ) ,
250- narrowLayout : false ,
251- onToggleCollapsed : ( ) => togglePanelSlot ( "tasks" ) ,
252- } ;
197+ const { backgroundTasks, closePanelSlot, openPanelSlot, progressCardInRail, sessionWorkspace } =
198+ createChatPaneRails ( {
199+ state,
200+ sidebarLayout,
201+ paneWidth : this . paneWidth ,
202+ presentationId : this . presentationId ,
203+ gatewaySnapshot,
204+ setObserverVisibility : this . setSessionObserverVisibility ,
205+ } ) ;
253206 const selfUser = resolveCurrentSelfUser ( {
254207 snapshotUser : gatewaySnapshot . selfUser ,
255208 presenceEntries : readPresenceEntries ( gatewaySnapshot . hello ?. snapshot ) ,
0 commit comments