src/vs/workbench/contrib/terminal/browser/baseTerminalBackend.ts/BaseTerminalBackend/constructor
class BaseTerminalBackend:	constructor(
		eventSource: IPtyHostController,
		protected readonly _logService: ILogService,
		notificationService: INotificationService,
		historyService: IHistoryService,
		configurationResolverService: IConfigurationResolverService,
		protected readonly _workspaceContextService: IWorkspaceContextService
	) {
		super();

		// Attach pty host listeners
		if (eventSource.onPtyHostExit) {
			this._register(eventSource.onPtyHostExit(() => {
				this._logService.error(`The terminal's pty host process exited, the connection to all terminal processes was lost`);
			}));
		}
		let unresponsiveNotification: INotificationHandle | undefined;
		if (eventSource.onPtyHostStart) {
			this._register(eventSource.onPtyHostStart(() => {
				this._logService.info(`ptyHost restarted`);
				this._onPtyHostRestart.fire();
				unresponsiveNotification?.close();
				unresponsiveNotification = undefined;
				this._isPtyHostUnresponsive = false;
			}));
		}
		if (eventSource.onPtyHostUnresponsive) {
			this._register(eventSource.onPtyHostUnresponsive(() => {
				const choices: IPromptChoice[] = [{
					label: localize('restartPtyHost', "Restart pty host"),
					run: () => eventSource.restartPtyHost!()
				}];
				unresponsiveNotification = notificationService.prompt(Severity.Error, localize('nonResponsivePtyHost', "The connection to the terminal's pty host process is unresponsive, the terminals may stop working."), choices);
				this._isPtyHostUnresponsive = true;
				this._onPtyHostUnresponsive.fire();
			}));
		}
		if (eventSource.onPtyHostResponsive) {
			this._register(eventSource.onPtyHostResponsive(() => {
				if (!this._isPtyHostUnresponsive) {
					return;
				}
				this._logService.info('The pty host became responsive again');
				unresponsiveNotification?.close();
				unresponsiveNotification = undefined;
				this._isPtyHostUnresponsive = false;
				this._onPtyHostResponsive.fire();
			}));
		}
		if (eventSource.onPtyHostRequestResolveVariables) {
			this._register(eventSource.onPtyHostRequestResolveVariables(async e => {
				// Only answer requests for this workspace
				if (e.workspaceId !== this._workspaceContextService.getWorkspace().id) {
					return;
				}
				const activeWorkspaceRootUri = historyService.getLastActiveWorkspaceRoot(Schemas.file);
				const lastActiveWorkspaceRoot = activeWorkspaceRootUri ? withNullAsUndefined(this._workspaceContextService.getWorkspaceFolder(activeWorkspaceRootUri)) : undefined;
				const resolveCalls: Promise<string>[] = e.originalText.map(t => {
					return configurationResolverService.resolveAsync(lastActiveWorkspaceRoot, t);
				});
				const result = await Promise.all(resolveCalls);
				eventSource.acceptPtyHostResolvedVariables?.(e.requestId, result);
			}));
		}
	}