import { Disposable, DisposableStore, IDisposable } from "../../base/common/lifecycle.js"; import { Event } from "../../base/common/event.js"; import { IDimension } from "../../base/browser/dom.js"; import { Parts, Position, PanelAlignment, SINGLE_WINDOW_PARTS, MULTI_WINDOW_PARTS, IPartVisibilityChangeEvent } from "../../workbench/services/layout/browser/layoutService.js"; import { ILayoutOffsetInfo } from "../../platform/layout/browser/layoutService.js"; import { Part } from "../../workbench/browser/part.js"; import { Direction, ISerializableView, ISerializedNode, IViewSize, SerializableGrid } from "../../base/browser/ui/grid/grid.js"; import { IEditorGroupsService } from "../../workbench/services/editor/common/editorGroupsService.service.js"; import { ILogService } from "../../platform/log/common/log.service.js"; import { IInstantiationService, ServicesAccessor } from "../../platform/instantiation/common/instantiation.js"; import { CodeWindow } from "../../base/browser/window.js"; import { ServiceCollection } from "../../platform/instantiation/common/serviceCollection.js"; import { WillShutdownEvent } from "../../workbench/services/lifecycle/common/lifecycle.js"; import { ILifecycleService } from "../../workbench/services/lifecycle/common/lifecycle.service.js"; import { NotificationService } from "@codingame/monaco-vscode-notifications-service-override/vscode/vs/workbench/services/notification/common/notificationService"; import { IEditorWillOpenEvent } from "../../workbench/common/editor.js"; import { SessionsLayoutPolicy } from "./layoutPolicy.js"; import { ChatLayoutPresentation } from "../common/chatLayout.js"; import { ISessionsService } from "../services/sessions/browser/sessionsService.service.js"; import { IAgentWorkbenchLayoutService } from "./workbench.service.js"; export interface IWorkbenchOptions { /** * Extra classes to be added to the workbench container. */ extraClasses?: string[]; } /** Visibility of each workbench part in the Agents window layout. */ export interface IPartVisibilityState { sidebar: boolean; auxiliaryBar: boolean; editor: boolean; panel: boolean; sessions: boolean; customViewGrid: boolean; } interface IPartSizesState { sidebar?: number; auxiliaryBar?: number; sessions?: number; editor?: number; panel?: number; } /** Opaque per-transition capture returned by `Workbench._prepareSideBarResize`. */ export interface ISideBarResizeContext { } /** Current visibility state of the side pane and its constituent parts. */ export interface ISidePaneState { readonly editor: boolean; readonly auxiliaryBar: boolean; } /** Side-pane visibility before and after a completed toggle. */ export interface ISidePaneToggleEvent { readonly before: ISidePaneState; readonly after: ISidePaneState; } export declare enum AgentWorkbenchLayout { Mobile = "mobile", Desktop = "desktop" } /** * Docked-editor (desktop detail panel) concerns of the layout service, kept * separate from the general contract so features that do not care about the * docked layout are not coupled to it. */ export interface IDockedEditorLayout { handleDockedEditorPartLayout(nodeWidth: number): void; /** * Fired when the side pane (the docked editor part and/or the auxiliary-bar * detail panel) transitions from *fully hidden* to visible — i.e. the user * opens the side pane. It fires regardless of how the pane is opened (the * toggle action, revealing an editor, or revealing the detail). Consumers * decide what to do from the current editor group state (e.g. populate the * default managed tabs only when no real editor is open). */ readonly onDidRevealSidePane: Event; /** * Whether the editor's current visible state was produced by an explicit user * reveal (opening an editor, or toggling the detail panel off). */ isEditorRevealedExplicitly(): boolean; /** * Reveals the (possibly hidden) editor part as an explicit user action. Use for * deliberate opens like the session-header Changes pill or opening a file diff. */ revealEditorPartExplicitly(): void; /** * The docked auxiliary bar (detail panel) width, owned by the workbench's * desktop layout state and read/written by the docked controller that the * editor part owns. Trivial in the mobile layout. */ getDockedAuxiliaryBarWidth(): number; setDockedAuxiliaryBarWidth(width: number): void; /** Returns the preferred editor-part width for an outer sash reset. */ getPreferredEditorPartWidth(): number | undefined; } export declare const CLOSE_MOBILE_SIDEBAR_DRAWER_COMMAND_ID = "sessions.closeMobileSidebarDrawer"; export declare abstract class Workbench extends Disposable implements IAgentWorkbenchLayoutService { protected readonly parent: HTMLElement; private readonly options; private readonly serviceCollection; protected readonly logService: ILogService; readonly _serviceBrand: undefined; abstract readonly agentWorkbenchLayout: AgentWorkbenchLayout; private readonly _onWillShutdown; readonly onWillShutdown: Event; private readonly _onDidShutdown; readonly onDidShutdown: Event; private readonly _onDidChangeZenMode; readonly onDidChangeZenMode: Event; private readonly _onDidChangeMainEditorCenteredLayout; readonly onDidChangeMainEditorCenteredLayout: Event; private readonly _onDidChangePanelAlignment; readonly onDidChangePanelAlignment: Event; private readonly _onDidChangeWindowMaximized; readonly onDidChangeWindowMaximized: Event<{ windowId: number; maximized: boolean; }>; private readonly _onDidChangePanelPosition; readonly onDidChangePanelPosition: Event; private readonly _onDidChangePartVisibility; readonly onDidChangePartVisibility: Event; private readonly _onWillToggleSidePane; readonly onWillToggleSidePane: Event; private readonly _onDidToggleSidePane; readonly onDidToggleSidePane: Event; private readonly _onDidRevealSidePane; readonly onDidRevealSidePane: Event; private readonly _onDidChangeNotificationsVisibility; readonly onDidChangeNotificationsVisibility: Event; private readonly _onDidChangeAuxiliaryBarMaximized; readonly onDidChangeAuxiliaryBarMaximized: Event; private readonly _onDidChangeEditorMaximized; readonly onDidChangeEditorMaximized: Event; private readonly _onDidLayoutMainContainer; readonly onDidLayoutMainContainer: Event; private readonly _onDidLayoutActiveContainer; readonly onDidLayoutActiveContainer: Event; private readonly _onDidLayoutContainer; readonly onDidLayoutContainer: Event<{ container: HTMLElement; dimension: IDimension; }>; private readonly _onDidAddContainer; readonly onDidAddContainer: Event<{ container: HTMLElement; disposables: DisposableStore; }>; private readonly _onDidChangeActiveContainer; readonly onDidChangeActiveContainer: Event; readonly mainContainer: HTMLDivElement; get activeContainer(): HTMLElement; get containers(): Iterable; private getContainerFromDocument; private _mainContainerDimension; get mainContainerDimension(): IDimension; get activeContainerDimension(): IDimension; private getContainerDimension; get mainContainerOffset(): ILayoutOffsetInfo; get activeContainerOffset(): ILayoutOffsetInfo; private computeContainerOffset; private readonly parts; private layoutDensity; protected workbenchGrid: SerializableGrid; private titleBarPartView; protected sideBarPartView: ISerializableView; private panelPartView; protected auxiliaryBarPartView: ISerializableView; protected editorPartView: ISerializableView; protected sessionsPartView: ISerializableView; protected customViewGridPartView: ISerializableView; private _sessionsSidePaneDivider; /** The editor part container; the auxiliary bar is docked inside it. */ protected _editorPartContainer: HTMLElement | undefined; /** `true` while the editor's current visible state was produced by an explicit user reveal. */ protected _editorRevealedExplicitly: boolean; protected readonly partVisibility: IPartVisibilityState; private mainWindowFullscreen; private readonly maximized; protected readonly layoutPolicy: SessionsLayoutPolicy; chatLayoutPresentation: ChatLayoutPresentation; private readonly mobileNavStack; private mobileTopBarElement; private focusMobileTopBar; private readonly mobileTopBarDisposables; private _editorMaximized; private _panelAlignment; private _panelMaximizedEditorState; private _maximumEditorDimensionsOverride; private _customViewVisibleKey; /** Guards the grid updates that show/hide the custom view from feeding back into the desired part visibility. */ private _applyingCustomViewGridVisibility; private _customViewCoveredPartWidths; private _editorLastNonMaximizedVisibility; private _editorLastNonMaximizedSize; private _restoreAttachedEditorMaximizedOnShow; protected _editorPartAutoVisibilitySuppressionCount: number; protected _hasAppliedInitialEditorSplit: boolean; private _sidePaneStateBeforeHide; private _restoreSidePaneEditorMaximizedOnShow; protected readonly _defaultSidePaneState: ISidePaneState; private readonly restoredPromise; readonly whenRestored: Promise; private restored; readonly openedDefaultEditors = false; protected _savedPartSizes: IPartSizesState; private static readonly _PART_VISIBILITY_KEY; private static readonly _PART_SIZES_KEY; private static readonly _PANEL_ALIGNMENT_KEY; protected editorGroupService: IEditorGroupsService; private editorService; private paneCompositeService; private viewDescriptorService; protected sessionsService: ISessionsService; private sessionsPartService; private customViewService; private customViewGridPartService; private instantiationService; private storageService; constructor(parent: HTMLElement, options: IWorkbenchOptions | undefined, serviceCollection: ServiceCollection, logService: ILogService); protected registerErrorHandler(logService: ILogService): void; startup(): IInstantiationService; private logWindowLayout; protected initServices(serviceCollection: ServiceCollection): IInstantiationService; private registerListeners; private fontAliasing; private updateFontAliasing; private restoreFontInfo; private storeFontInfo; private _loadPartVisibility; private _loadPanelAlignment; /** * Overlays the persisted part visibility on top of the current * (layout-policy default) `partVisibility` state. Must run before the * `WorkbenchContextKeysHandler` reads the initial visibility so that * context keys like `auxiliaryBarVisible` reflect the restored state on * reload rather than the hardcoded defaults. */ private _applyPersistedPartVisibility; protected _savePartVisibility(): void; private _loadPartSizes; private _savePartSizes; private renderWorkbench; private createMobileTitlebar; private toggleMobileSidebarDrawer; private openMobileSidebarDrawer; private closeMobileSidebarDrawer; protected createNotificationsHandlers(instantiationService: IInstantiationService, notificationService: NotificationService): void; protected registerNotificationRowHeight(): void; private createPartContainer; private createEditorPart; private createSessionsPart; private _restoreSessionsPartOnActivation; private _restoreEditorPartOnActivation; private _restoreMinimizedPartOnActivation; protected _minimumPartWidthForActivation(view: ISerializableView): number; private createCustomViewGridPart; protected restore(lifecycleService: ILifecycleService): void; protected restoreParts(): void; private registerEditorTabHeightClass; private registerEditorPartFocus; initLayout(accessor: ServicesAccessor): void; private areAllGroupsInMainPartEmpty; protected revealEditorOnOpen(e: IEditorWillOpenEvent): void; private handleDidCloseEditor; suppressEditorPartAutoVisibility(): IDisposable; protected rememberAttachedEditorMaximizedState(): void; private restoreAttachedEditorMaximizedState; protected _fireDidChangePartVisibility(partId: Parts, visible: boolean, source?: "resize"): void; protected _notifyContainerDidLayout(): void; protected _setMainEditorAreaHidden(hidden: boolean): void; /** * Handles a change in the editor-part grid view's visibility. In the mobile * layout the editor part is a standalone grid view, so its view visibility *is* * the editor visibility — map it to `setEditorHidden` and raise the part event. * Desktop overrides this: its editor-part grid view also hosts the docked * auxiliary bar, so the view can become visible purely to show the detail while * the editor content stays hidden; it fires its own editor-part events instead. */ protected _onEditorPartGridVisibilityChange(visible: boolean): void; isEditorPartAutoVisibilitySuppressed(): boolean; protected get _isEditorPartAutoVisibilitySuppressed(): boolean; /** Toggles the container marker class for the side-pane layout. */ protected _applyLayoutContainerClass(): void; /** Width the auxiliary bar occupies when visible (for max-editor-dimension math). */ protected _auxiliaryBarLayoutWidth(): number; protected _auxiliaryBarViewSize(): IViewSize; protected _setAuxiliaryBarViewSize(size: IViewSize): void; protected _resizeAuxiliaryBarBy(deltaWidth: number, deltaHeight: number): void; protected _restoreAuxiliaryBarWidth(_width: number): void; /** * Reads a part's size from the workbench grid for persistence. For visible * parts, the current view size; for hidden parts, the grid's cached visible * size (the size it had the last time it was shown) so toggling visibility * later restores the same dimensions. Overridden by the desktop layout for * its docked auxiliary bar, which is not a grid view. */ protected _persistedGridViewSize(view: ISerializableView, dimension: "width" | "height", visible: boolean): number | undefined; protected _persistedEditorWidth(editorGridWidth: number | undefined): number | undefined; protected _defaultSideBarSize(policySideBarSize: number): number; protected _editorNodeSize(effectiveEditorWidth: number, _effectiveAuxBarWidth: number): number; protected _editorNodeVisible(editorVisible: boolean, _auxBarVisible: boolean): boolean; protected _topRightSectionChildren(sessionsNode: ISerializedNode, editorNode: ISerializedNode, auxiliaryBarNode: ISerializedNode, customViewGridNode: ISerializedNode): ISerializedNode[]; /** Attach any per-layout controllers once the editor part container exists. */ protected _attachSidePane(): void; /** Lay out any docked overlay. */ protected _layoutSidePane(): void; /** React to a whole-grid change (e.g. a sash drag) after the grid rebuilds. */ protected _onGridDidChange(): void; /** React to the editor grid node being resized to `nodeWidth`. */ protected _onEditorNodeResized(_nodeWidth: number): void; /** Run editor-node work with the reveal-sync suspended (no-op for the grid layout). */ protected _runWithEditorResizeSyncSuspended(fn: () => void): void; protected _applyEditorVisibility(hidden: boolean): void; protected _onWillHideAuxiliaryBar(_hidden: boolean): void; protected _applyAuxiliaryBarVisibility(hidden: boolean, _source?: "resize"): void; protected _shouldOpenAuxiliaryPaneComposite(_containerId: string): boolean; protected _handleAllEditorsClosed(): void; protected _prepareSideBarResize(_hidden: boolean): ISideBarResizeContext; protected _applySideBarResize(_hidden: boolean, _context: ISideBarResizeContext): void; private registerLayoutListeners; private updateFullscreenClass; createWorkbenchLayout(): void; private _registerGridMaximizationListener; private _updateSessionsSidePaneDivider; createWorkbenchManagement(instantiationService: IInstantiationService): void; /** * Creates the grid descriptor for the Agent Sessions layout. * * Structure (horizontal orientation): * - Sidebar (left, spans full height from top to bottom) * - Right section (vertical): * - Titlebar (top of right section) * - Chat Bar | Editor | Auxiliary Bar * - Panel below either the Chat Bar or the entire main region */ private createGridDescriptor; /** * Standard multi-part layout for all viewport classes. * On phone, the titlebar is hidden via CSS and a MobileTitlebarPart * is prepended before the grid. Sidebar/panel/auxbar are hidden * in the grid via partVisibility defaults. */ private createDesktopGridDescriptor; private _previousViewportClass; layout(): void; protected _layoutGrid(): void; handleDockedEditorPartLayout(nodeWidth: number): void; isEditorRevealedExplicitly(): boolean; revealEditorPartExplicitly(): void; getDockedAuxiliaryBarWidth(): number; setDockedAuxiliaryBarWidth(_width: number): void; getPreferredEditorPartWidth(): number | undefined; private layoutMobileSidebar; private handleContainerDidLayout; isFloatingPanelsEnabled(): boolean; private updateLayoutDensity; isModernUICompact(): boolean; getLayoutClasses(): string[]; isEditorPaneVisible(): boolean; private _updateEditorPaneVisibilityClass; registerPart(part: Part): IDisposable; getPart(key: Parts): Part; hasFocus(part: Parts): boolean; focusPart(part: MULTI_WINDOW_PARTS, targetWindow: Window): void; focusPart(part: SINGLE_WINDOW_PARTS): void; focus(): void; getContainer(targetWindow: Window): HTMLElement; getContainer(targetWindow: Window, part: Parts): HTMLElement | undefined; whenContainerStylesLoaded(_window: CodeWindow): Promise | undefined; isActivityBarHidden(): boolean; /** * Parts a visible custom view replaces. While the custom view grid is shown * these keep their desired (per-session) visibility state but are not * rendered, so hiding the custom view restores whatever the layout * controller last asked for — including changes made while it was shown. */ private static readonly _CUSTOM_VIEW_EXCLUSIVE_PARTS; /** The desired visibility of a part, ignoring any custom view showing over it. */ private _desiredVisible; /** Whether a part is actually rendered right now. */ protected _effectiveVisible(part: Parts): boolean; /** * Whether the editor grid node should be shown. In the desktop layout the * node also hosts the docked auxiliary bar, so it follows both parts. */ protected _editorNodeShouldBeVisible(): boolean; isVisible(part: SINGLE_WINDOW_PARTS): boolean; isVisible(part: MULTI_WINDOW_PARTS, targetWindow: Window): boolean; setPartHidden(hidden: boolean, part: Parts): void; toggleSecondarySideBar(): void; isSecondarySideBarVisible(): boolean; isSidePaneVisible(): boolean; toggleSidePane(): boolean; hideSidePane(): void; captureSidePaneComposition(): ISidePaneState; restoreSidePaneComposition(composition: ISidePaneState): void; private _getSidePaneState; private setSideBarHidden; setAuxiliaryBarHidden(hidden: boolean): void; setAuxiliaryBarHiddenForResize(hidden: boolean): void; private _setAuxiliaryBarHidden; /** * Whether the given auxiliary-bar view container currently has content to show * (mirrors `IViewsService.isViewContainerActive`: a `hideIfEmpty` container is * only active once it has at least one active view descriptor). Used to avoid * presenting an empty docked detail panel. */ protected _isAuxViewContainerActive(containerId: string): boolean; setEditorHidden(hidden: boolean, explicit?: boolean, skipSidePaneReveal?: boolean): void; /** * Fires when the side pane (editor part and/or auxiliary bar) transitions from * fully hidden to visible. */ protected _onSidePaneRevealed(): void; /** * Sizes the editor part when it is first revealed from a hidden state, so it * opens as a comfortable split with the sessions part rather than at its * minimum/restored width. The default grid layout splits the main area evenly; * layouts with different sizing (e.g. the desktop side pane) override this. */ protected _applyEditorSplitSize(mainAreaWidth: number): void; private setPanelHidden; private setSessionsHidden; /** * Shows or hides the custom view grid. The custom view grid and the sessions * grid are mutually exclusive and exactly one of them owns the row, so hiding * the custom view always brings the sessions grid back (together with the side * panel and panel state the layout wants for the active session). The parts it * covers keep their desired visibility while it is shown, so the restore * reflects whatever the layout controller last asked for. */ private _applyCustomViewGridVisibility; private _restoreCustomViewCoveredPartWidths; private _applyExclusivePartVisibility; /** Pushes the editor and auxiliary bar node visibility into the grid. */ protected _applyEditorAreaVisibility(): void; private _updateExclusiveLayoutClasses; /** Keeps the Android back button in sync with a shown custom view. */ private _updateMobileCustomViewNavigation; getSideBarPosition(): Position; getPanelPosition(): Position; setPanelPosition(_position: Position): void; getPanelAlignment(): PanelAlignment; setPanelAlignment(alignment: PanelAlignment): void; /** * Whether the side pane showed as the panel started to align, while the grid moves its views. The grid lays out its views * between the steps of a move, and they read from it, such as the Sessions Part whether the side pane shows: the grid * cannot answer for a view it has taken out until the move is done, so they read what was before. */ protected _editorPaneVisibleWhileGridMoves: boolean | undefined; private _viewMoveSizing; getSize(part: Parts): IViewSize; setSize(part: Parts, size: IViewSize): void; resizePart(part: Parts, sizeChangeWidth: number, sizeChangeHeight: number): void; private getPartView; getMaximumEditorDimensions(_container: HTMLElement): IDimension; toggleMaximizedPanel(): void; isPanelMaximized(): boolean; toggleMaximizedAuxiliaryBar(): void; setAuxiliaryBarMaximized(_maximized: boolean): boolean; isAuxiliaryBarMaximized(): boolean; isEditorMaximized(): boolean; setEditorMaximized(maximized: boolean): void; toggleZenMode(): void; toggleMenuBar(): void; isMainEditorLayoutCentered(): boolean; centerMainEditorLayout(_active: boolean): void; hasMainWindowBorder(): boolean; getMainWindowBorderRadius(): string | undefined; isWindowMaximized(targetWindow: Window): boolean; updateWindowMaximizedState(targetWindow: Window, maximized: boolean): void; getVisibleNeighborPart(part: Parts, direction: Direction): Parts | undefined; isRestored(): boolean; setRestored(): void; registerNotifications(delegate: { onDidChangeNotificationsVisibility: Event; }): void; } export {};