import * as dom from "@codingame/monaco-vscode-api/vscode/vs/base/browser/dom"; import { Event } from "@codingame/monaco-vscode-api/vscode/vs/base/common/event"; import { Disposable, DisposableStore, type IReference } from "@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle"; import { OperatingSystem } from "@codingame/monaco-vscode-api/vscode/vs/base/common/platform"; import { URI } from "@codingame/monaco-vscode-api/vscode/vs/base/common/uri"; import { IAccessibilityService } from "@codingame/monaco-vscode-api/vscode/vs/platform/accessibility/common/accessibility.service"; import { IAccessibilitySignalService } from "@codingame/monaco-vscode-api/vscode/vs/platform/accessibilitySignal/browser/accessibilitySignalService.service"; import { ICommandService } from "@codingame/monaco-vscode-api/vscode/vs/platform/commands/common/commands.service"; import { IConfigurationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service"; import { IContextKey } from "@codingame/monaco-vscode-api/vscode/vs/platform/contextkey/common/contextkey"; import { IContextKeyService } from "@codingame/monaco-vscode-api/vscode/vs/platform/contextkey/common/contextkey.service"; import { IFileService } from "@codingame/monaco-vscode-api/vscode/vs/platform/files/common/files.service"; import { IInstantiationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation"; import { IKeybindingService } from "@codingame/monaco-vscode-api/vscode/vs/platform/keybinding/common/keybinding.service"; import { INotificationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/notification/common/notification.service"; import { IOpenerService } from "@codingame/monaco-vscode-api/vscode/vs/platform/opener/common/opener.service"; import { IProductService } from "@codingame/monaco-vscode-api/vscode/vs/platform/product/common/productService.service"; import { IQuickInputService } from "@codingame/monaco-vscode-api/vscode/vs/platform/quickinput/common/quickInput.service"; import { IStorageService } from "@codingame/monaco-vscode-api/vscode/vs/platform/storage/common/storage.service"; import { ITelemetryService } from "@codingame/monaco-vscode-api/vscode/vs/platform/telemetry/common/telemetry.service"; import { IMarkProperties } from "@codingame/monaco-vscode-api/vscode/vs/platform/terminal/common/capabilities/capabilities"; import { TerminalCapabilityStoreMultiplexer } from "@codingame/monaco-vscode-api/vscode/vs/platform/terminal/common/capabilities/terminalCapabilityStore"; import { IMergedEnvironmentVariableCollection } from "../../../../platform/terminal/common/environmentVariable.js"; import { GeneralShellType, IReconnectionProperties, IShellLaunchConfig, ITerminalDimensionsOverride, ITerminalLaunchError, TerminalExitReason, TerminalIcon, TerminalLocation, TerminalShellType, TitleEventSource, type ShellIntegrationInjectionFailureReason } from "@codingame/monaco-vscode-api/vscode/vs/platform/terminal/common/terminal"; import { ITerminalLogService } from "@codingame/monaco-vscode-api/vscode/vs/platform/terminal/common/terminal.service"; import { IColorTheme } from "@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/themeService"; import { IThemeService } from "@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/themeService.service"; import { IWorkspaceFolder } from "@codingame/monaco-vscode-api/vscode/vs/platform/workspace/common/workspace"; import { IWorkspaceContextService } from "@codingame/monaco-vscode-api/vscode/vs/platform/workspace/common/workspace.service"; import { IWorkspaceTrustRequestService } from "@codingame/monaco-vscode-api/vscode/vs/platform/workspace/common/workspaceTrust.service"; import { IViewDescriptorService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/common/views.service"; import { IViewsService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/views/common/viewsService.service"; import { IRequestAddInstanceToGroupEvent, ITerminalContribution, ITerminalInstance, IXtermColorProvider } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/terminal/browser/terminal"; import { ITerminalConfigurationService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/terminal/browser/terminal.service"; import { TerminalProcessManager } from "./terminalProcessManager.js"; import { ITerminalStatusList } from "./terminalStatusList.js"; import { XtermTerminal } from "@codingame/monaco-vscode-xterm-addons-common/vscode/vs/workbench/contrib/terminal/browser/xterm/xtermTerminal"; import { ProcessState } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/terminal/common/terminal"; import { ITerminalProfileResolverService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/terminal/common/terminal.service"; import { IEditorService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorService.service"; import { IWorkbenchEnvironmentService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/environment/common/environmentService.service"; import { IHistoryService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/history/common/history.service"; import { IPathService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/path/common/pathService.service"; import { IPreferencesService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/preferences/common/preferences.service"; import type { IMarker, Terminal as XTermTerminal } from "@xterm/xterm"; import type { IMenu } from "@codingame/monaco-vscode-api/vscode/vs/platform/actions/common/actions"; import { IContextMenuService } from "@codingame/monaco-vscode-api/vscode/vs/platform/contextview/browser/contextView.service"; import type { IProgressState } from "@xterm/addon-progress"; export declare class TerminalInstance extends Disposable implements ITerminalInstance { private readonly _terminalShellTypeContextKey; private _shellLaunchConfig; private readonly _contextKeyService; private readonly _contextMenuService; private readonly _terminalConfigurationService; private readonly _terminalProfileResolverService; private readonly _pathService; private readonly _fileService; private readonly _keybindingService; private readonly _notificationService; private readonly _viewsService; private readonly _themeService; private readonly _configurationService; private readonly _logService; private readonly _accessibilityService; private readonly _quickInputService; private readonly _workbenchEnvironmentService; private readonly _workspaceContextService; private readonly _editorService; private readonly _workspaceTrustRequestService; private readonly _historyService; private readonly _telemetryService; private readonly _openerService; private readonly _commandService; private readonly _accessibilitySignalService; private readonly _viewDescriptorService; private static _lastKnownCanvasDimensions; private static _lastKnownGridDimensions; private static _instanceIdCounter; private readonly _scopedInstantiationService; private readonly _processManager; private readonly _contributions; private readonly _resource; /** * Resolves when xterm.js is ready, this will be undefined if the terminal instance is disposed * before xterm.js could be created. */ private _xtermReadyPromise; get xtermReadyPromise(): Promise; private _pressAnyKeyToCloseListener; private _instanceId; private _latestXtermWriteData; private _latestXtermParseData; private _isExiting; private _hadFocusOnExit; private _exitCode; private _exitReason; private _shellType; private _agentShellTypeFromSequence; private _title; private _titleSource; private _container; private _wrapperElement; get domElement(): HTMLElement; private _horizontalScrollbar; private _terminalFocusContextKey; private _terminalHasFixedWidth; private _terminalHasTextContextKey; private _terminalAltBufferActiveContextKey; private _terminalShellIntegrationEnabledContextKey; private _cols; private _rows; private _fixedCols; private _fixedRows; private _cwd; private _initialCwd; private _injectedArgs; private _layoutSettingsChanged; private _dimensionsOverride; private _areLinksReady; private readonly _initialDataEventsListener; private _initialDataEvents; private _containerReadyBarrier; private _attachBarrier; private _icon; private readonly _messageTitleDisposable; private _widgetManager; private readonly _dndObserver; private _lastLayoutDimensions; private _description?; private _processName; private _sequence?; private _staticTitle?; private _workspaceFolder?; private _labelComputer?; private _userHome?; private _hasScrollBar?; private _usedShellIntegrationInjection; get usedShellIntegrationInjection(): boolean; private _shellIntegrationInjectionInfo; get shellIntegrationInjectionFailureReason(): ShellIntegrationInjectionFailureReason | undefined; private _lineDataEventAddon; private readonly _scopedContextKeyService; private _resizeDebouncer?; readonly capabilities: TerminalCapabilityStoreMultiplexer; readonly statusList: ITerminalStatusList; get store(): DisposableStore; get extEnvironmentVariableCollection(): IMergedEnvironmentVariableCollection | undefined; xterm?: XtermTerminal; disableLayout: boolean; get waitOnExit(): ITerminalInstance["waitOnExit"]; set waitOnExit(value: ITerminalInstance["waitOnExit"]); private _isVisible; get isVisible(): boolean; private _targetRef; get targetRef(): IReference; get target(): TerminalLocation | undefined; set target(value: TerminalLocation | undefined); get instanceId(): number; get resource(): URI; get cols(): number; get rows(): number; get isDisposed(): boolean; get fixedCols(): number | undefined; get fixedRows(): number | undefined; get maxCols(): number; get maxRows(): number; get processId(): number | undefined; get processReady(): Promise; get hasChildProcesses(): boolean; get reconnectionProperties(): IReconnectionProperties | undefined; get areLinksReady(): boolean; get initialDataEvents(): string[] | undefined; get exitCode(): number | undefined; get exitReason(): TerminalExitReason | undefined; get hadFocusOnExit(): boolean; get isTitleSetByProcess(): boolean; get shellLaunchConfig(): IShellLaunchConfig; get shellType(): TerminalShellType | undefined; get os(): OperatingSystem | undefined; get hasRemoteAuthority(): boolean; get remoteAuthority(): string | undefined; get hasFocus(): boolean; get title(): string; get titleSource(): TitleEventSource; get icon(): TerminalIcon | undefined; get color(): string | undefined; get processName(): string; get sequence(): string | undefined; get staticTitle(): string | undefined; get progressState(): IProgressState | undefined; get workspaceFolder(): IWorkspaceFolder | undefined; get cwd(): string | undefined; get initialCwd(): string | undefined; get description(): string | undefined; get userHome(): string | undefined; get shellIntegrationNonce(): string; get injectedArgs(): string[] | undefined; private readonly _onExit; readonly onExit: Event; private readonly _onDisposed; readonly onDisposed: Event; private readonly _onProcessIdReady; readonly onProcessIdReady: Event; private readonly _onProcessReplayComplete; readonly onProcessReplayComplete: Event; private readonly _onTitleChanged; readonly onTitleChanged: Event; private readonly _onIconChanged; readonly onIconChanged: Event<{ instance: ITerminalInstance; userInitiated: boolean; }>; private readonly _onWillData; readonly onWillData: Event; private readonly _onData; readonly onData: Event; private readonly _onBinary; readonly onBinary: Event; private readonly _onRequestExtHostProcess; readonly onRequestExtHostProcess: Event; private readonly _onDimensionsChanged; readonly onDimensionsChanged: Event; private readonly _onMaximumDimensionsChanged; readonly onMaximumDimensionsChanged: Event; private readonly _onDidFocus; readonly onDidFocus: Event; private readonly _onDidRequestFocus; readonly onDidRequestFocus: Event; private readonly _onDidBlur; readonly onDidBlur: Event; private readonly _onDidInputData; readonly onDidInputData: Event; private readonly _onDidChangeSelection; readonly onDidChangeSelection: Event; private readonly _onRequestAddInstanceToGroup; readonly onRequestAddInstanceToGroup: Event; private readonly _onDidChangeHasChildProcesses; readonly onDidChangeHasChildProcesses: Event; private readonly _onDidExecuteText; readonly onDidExecuteText: Event; private readonly _onDidChangeTarget; readonly onDidChangeTarget: Event; private readonly _onDidSendText; readonly onDidSendText: Event; private readonly _onDidChangeShellType; readonly onDidChangeShellType: Event; private readonly _onDidChangeVisibility; readonly onDidChangeVisibility: Event; private readonly _onLineData; readonly onLineData: Event; readonly sessionId: string; constructor(_terminalShellTypeContextKey: IContextKey, _shellLaunchConfig: IShellLaunchConfig, _contextKeyService: IContextKeyService, _contextMenuService: IContextMenuService, instantiationService: IInstantiationService, _terminalConfigurationService: ITerminalConfigurationService, _terminalProfileResolverService: ITerminalProfileResolverService, _pathService: IPathService, _fileService: IFileService, _keybindingService: IKeybindingService, _notificationService: INotificationService, _preferencesService: IPreferencesService, _viewsService: IViewsService, _themeService: IThemeService, _configurationService: IConfigurationService, _logService: ITerminalLogService, _storageService: IStorageService, _accessibilityService: IAccessibilityService, _productService: IProductService, _quickInputService: IQuickInputService, _workbenchEnvironmentService: IWorkbenchEnvironmentService, _workspaceContextService: IWorkspaceContextService, _editorService: IEditorService, _workspaceTrustRequestService: IWorkspaceTrustRequestService, _historyService: IHistoryService, _telemetryService: ITelemetryService, _openerService: IOpenerService, _commandService: ICommandService, _accessibilitySignalService: IAccessibilitySignalService, _viewDescriptorService: IViewDescriptorService); getContribution(id: string): T | null; private _handleOnData; private _getIcon; private _getColor; private _initDimensions; /** * Evaluates and sets the cols and rows of the terminal if possible. * @param width The width of the container. * @param height The height of the container. * @return The terminal's width if it requires a layout. */ private _evaluateColsAndRows; private _setLastKnownColsAndRows; private _fireMaximumDimensionsChanged; private _getDimension; get persistentProcessId(): number | undefined; get shouldPersist(): boolean; static getXtermConstructor(keybindingService: IKeybindingService, contextKeyService: IContextKeyService): Promise; /** * Create xterm.js instance and attach data listeners. */ protected _createXterm(): Promise; private _refreshShellIntegrationInfoStatus; runCommand(commandLine: string, shouldExecute: boolean, commandId?: string, forceBracketedPasteMode?: boolean, commandLineForMetadata?: string): Promise; detachFromElement(): void; attachToElement(container: HTMLElement): void; /** * Opens the terminal instance inside the parent DOM element previously set with * `attachToElement`, you must ensure the parent DOM element is explicitly visible before * invoking this function as it performs some DOM calculations internally */ private _open; private _setFocus; private _setShellIntegrationContextKey; resetFocusContextKey(): void; private _initDragAndDrop; hasSelection(): boolean; get selection(): string | undefined; clearSelection(): void; private _refreshAltBufferContextKey; dispose(reason?: TerminalExitReason): void; detachProcessAndDispose(reason: TerminalExitReason): Promise; focus(force?: boolean): void; focusWhenReady(force?: boolean): Promise; sendText(text: string, shouldExecute: boolean, forceBracketedPasteMode?: boolean): Promise; sendSignal(signal: string): Promise; sendPath(originalPath: string | URI, shouldExecute: boolean): Promise; preparePathForShell(originalPath: string | URI): Promise; getUriLabelForShell(uri: URI): Promise; setVisible(visible: boolean): void; scrollDownLine(): void; scrollDownPage(): void; scrollToBottom(): void; scrollUpLine(): void; scrollUpPage(): void; scrollToTop(): void; clearBuffer(): void; private _refreshSelectionContextKey; protected _createProcessManager(): TerminalProcessManager; private _createProcess; registerMarker(offset?: number): IMarker | undefined; addBufferMarker(properties: IMarkProperties): void; scrollToMark(startMarkId: string, endMarkId?: string, highlight?: boolean): void; freePortKillProcess(port: string, command: string): Promise; private _onProcessData; private _writeProcessData; /** * Called when either a process tied to a terminal has exited or when a terminal renderer * simulates a process exiting (e.g. custom execution task). * @param exitCode The exit code of the process, this is undefined when the terminal was exited * through user action. */ private _onProcessExit; private _relaunchWithShellIntegrationDisabled; /** * Ensure write calls to xterm.js have finished before resolving. */ private _flushXtermData; private _attachPressAnyKeyToCloseListener; private _writeInitialText; reuseTerminal(shell: IShellLaunchConfig, reset?: boolean): Promise; relaunch(): void; private _onTitleChange; private _handleShellTypeChange; private _trust; private _updateProcessCwd; updateConfig(): void; private _updateUnicodeVersion; updateAccessibilitySupport(): void; layout(dimension: dom.Dimension): void; private _resize; private _updatePtyDimensions; setShellType(shellType: TerminalShellType | undefined): void; private _setAriaLabel; private _updateTitleProperties; setOverrideDimensions(dimensions: ITerminalDimensionsOverride | undefined, immediate?: boolean): void; setFixedDimensions(): Promise; private _parseFixedDimension; toggleSizeToContentWidth(): Promise; private _refreshScrollbar; private _addScrollbar; private _removeScrollbar; private _setResolvedShellLaunchConfig; private _onEnvironmentVariableInfoChanged; private _refreshEnvironmentVariableInfoWidgetState; getInitialCwd(): Promise; getSpeculativeCwd(): Promise; getCwdResource(): Promise; private _refreshProperty; private _updateProperty; rename(title?: string, source?: TitleEventSource): Promise; private _setTitle; changeIcon(icon?: TerminalIcon): Promise; changeColor(color?: string, skipQuickPick?: boolean): Promise; forceScrollbarVisibility(): void; resetScrollbarVisibility(): void; setParentContextKeyService(parentContextKeyService: IContextKeyService): void; handleMouseEvent(event: MouseEvent, contextMenu: IMenu): Promise<{ cancelContextMenu: boolean; } | void>; } declare enum TerminalLabelType { Title = "title", Description = "description" } export declare class TerminalLabelComputer extends Disposable { private readonly _fileService; private readonly _terminalConfigurationService; private readonly _workspaceContextService; private _title; private _description; get title(): string | undefined; get description(): string; private readonly _onDidChangeLabel; readonly onDidChangeLabel: Event<{ title: string; description: string; }>; /** * Agent CLIs whose tab title should come from their own escape sequences rather * than the configured template or a static profile name. */ static readonly agentCliShellTypes: ReadonlySet; constructor(_fileService: IFileService, _terminalConfigurationService: ITerminalConfigurationService, _workspaceContextService: IWorkspaceContextService); refreshLabel(instance: Pick, reset?: boolean): void; computeLabel(instance: Pick, labelTemplate: string, labelType: TerminalLabelType, reset?: boolean): string; private _getProgressStateString; } export declare function parseExitResult(exitCodeOrError: ITerminalLaunchError | number | undefined, shellLaunchConfig: IShellLaunchConfig, processState: ProcessState, initialCwd: string | undefined): { code: number | undefined; message: string | undefined; } | undefined; export declare class TerminalInstanceColorProvider implements IXtermColorProvider { private readonly _target; private readonly _viewDescriptorService; constructor(_target: IReference, _viewDescriptorService: IViewDescriptorService); getBackgroundColor(theme: IColorTheme): import("@codingame/monaco-vscode-api/vscode/vs/base/common/color").Color | undefined; } export {};